forked from len0rd/rockbox
Fuze PLUS Fix lcd_update_rect()
Lcd_update rect was hanging during horizontal screen update x = 238 and width = 2 which was within the bounds of the screen, this seems to be a weird corner case but more testing needs done. Update_rect now properly bounded between 0 - screen w/h --Cleaned up code Pixels in x are now multiples of 4. Datasheet states: ------------------------------------------------------------------------------------------- WORD_LENGTH=0 implies the input frame buffer is RGB 16 bits per pixel. DATA_FORMAT_16_BIT field indicates if the pixels are in RGB 555 or RGB 565 format. Limitations: — BYTE_PACKING_FORMAT [3:0] should be 0x3 or 0xC if there is only one pixel per word. — If there are two pixels per word, BYTE_PACKING_FORMAT [3:0] should be 0xF and H_COUNT will be restricted to be a multiple of 2 pixels. and WORD_LENGTH=3 indicates that the input frame-buffer is RGB 24 bits per pixel (RGB 888). If BYTE_PACKING_FORMAT [3:0] is 0x7, it indicates that there is only one pixel per 32-bit word and there is no restriction on H_COUNT. Limitations: — If BYTE_PACKING_FORMAT [3:0] is 0xF, it indicates that the pixels are packed, i.e. there are 4 pixels in 3 words or 12 bytes. In that case, H_COUNT must be a multiple of 4 pixels. ------------------------------------------------------------------------------------------- We are using 16 bits per pixel and byte_packing = 0xF but device crashes with multiple of 2 pixels Behaviour can be verified with plugin - oscilloscope, Horizontal mode device hangs as indicator reaches right of screen Change-Id: I1445f5334f4e7fe59304c65c76b47d0daa0614b2
This commit is contained in:
parent
038a10220e
commit
1f63604e2c
1 changed files with 21 additions and 6 deletions
|
@ -566,11 +566,26 @@ void lcd_update_rect(int x, int y, int w, int h)
|
||||||
if(!lcd_on)
|
if(!lcd_on)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
/* make sure the rectangle is included in the screen */
|
/* make sure the rectangle is bounded in the screen */
|
||||||
x = MIN(x, LCD_WIDTH);
|
if (w > LCD_WIDTH - x)/* Clip right */
|
||||||
y = MIN(y, LCD_HEIGHT);
|
w = LCD_WIDTH - x;
|
||||||
w = MIN(w, LCD_WIDTH - x);
|
if (x < 0)/* Clip left */
|
||||||
h = MIN(h, LCD_HEIGHT - y);
|
{
|
||||||
|
w += x;
|
||||||
|
x = 0;
|
||||||
|
}
|
||||||
|
if (w <= 0)
|
||||||
|
return; /* nothing left to do */
|
||||||
|
|
||||||
|
if (h > LCD_HEIGHT - y) /* Clip bottom */
|
||||||
|
h = LCD_HEIGHT - y;
|
||||||
|
if (y < 0) /* Clip top */
|
||||||
|
{
|
||||||
|
h += y;
|
||||||
|
y = 0;
|
||||||
|
}
|
||||||
|
if (h <= 0)
|
||||||
|
return; /* nothing left to do */
|
||||||
|
|
||||||
imx233_lcdif_wait_ready();
|
imx233_lcdif_wait_ready();
|
||||||
lcd_write_reg(0x50, x);
|
lcd_write_reg(0x50, x);
|
||||||
|
@ -612,7 +627,7 @@ void lcd_update_rect(int x, int y, int w, int h)
|
||||||
* of w or h is odd, we will send a copy of the first pixels as dummy writes. We will
|
* of w or h is odd, we will send a copy of the first pixels as dummy writes. We will
|
||||||
* send at most 3 bytes. We then send (w * h + 3) / 4 x 4 bytes.
|
* send at most 3 bytes. We then send (w * h + 3) / 4 x 4 bytes.
|
||||||
*/
|
*/
|
||||||
if(w % 2 == 1 || h % 2 == 1)
|
if(w % 4 || (h & 1) == 1)
|
||||||
{
|
{
|
||||||
/* copy three pixel after the last one */
|
/* copy three pixel after the last one */
|
||||||
for(int i = 0; i < 3; i++)
|
for(int i = 0; i < 3; i++)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue