FASTSHIFT commented on code in PR #14701: URL: https://github.com/apache/nuttx/pull/14701#discussion_r1845815662
########## arch/xtensa/src/esp32s3/esp32s3_lcd.c: ########## @@ -545,10 +569,59 @@ static int esp32s3_lcd_base_getplaneinfo(struct fb_vtable_s *vtable, static int esp32s3_lcd_base_updatearea(struct fb_vtable_s *vtable, const struct fb_area_s *area) { + if (area->w == 0 || area->h == 0) + { + return 0; + } + + if (area->x + area->w > ESP32S3_LCD_HRES_VIRTUAL || + area->y + area->h > ESP32S3_LCD_VRES_VIRTUAL) + { + gerr("ERROR: updatearea area is out of bounds\n"); + return -EINVAL; + } + struct esp32s3_lcd_s *priv = &g_lcd_priv; - cache_writeback_addr(CURRENT_LAYER(priv)->framebuffer, - ESP32S3_LCD_FB_SIZE); + uint8_t *first_pixel = CURRENT_LAYER(priv)->framebuffer + + (area->y * ESP32S3_LCD_STRIDE + + area->x * ESP32S3_LCD_DATA_WIDTH); + + uint32_t size = (area->h - 1) * ESP32S3_LCD_STRIDE + + area->w * ESP32S3_LCD_DATA_WIDTH; + + cache_writeback_addr(first_pixel, size); + + return 0; +} +#endif + +/**************************************************************************** + * Name: esp32s3_lcd_base_pandisplay + * + * Description: + * Validate the pan info. The pan info is queued by the framebuffer + * subsystem. + * + * Input Parameters: + * vtable - The framebuffer driver object + * pinfo - the planeinfo object + * + * Returned Value: + * Zero is returned on success; a negated errno value is returned on any + * failure. + * + ****************************************************************************/ + +#ifdef CONFIG_ESP32S3_LCD_DOUBLE_BUFFERED +static int esp32s3_lcd_base_pandisplay(FAR struct fb_vtable_s *vtable, + FAR struct fb_planeinfo_s *pinfo) +{ + if (pinfo->yoffset > ESP32S3_LCD_VRES_VIRTUAL - CONFIG_ESP32S3_LCD_VRES) + { + gerr("ERROR: pandisplay yoffset out of bounds\n"); Review Comment: print `pinfo->yoffset` value ########## arch/xtensa/src/esp32s3/esp32s3_lcd.c: ########## @@ -545,10 +569,59 @@ static int esp32s3_lcd_base_getplaneinfo(struct fb_vtable_s *vtable, static int esp32s3_lcd_base_updatearea(struct fb_vtable_s *vtable, const struct fb_area_s *area) { + if (area->w == 0 || area->h == 0) + { + return 0; + } + + if (area->x + area->w > ESP32S3_LCD_HRES_VIRTUAL || + area->y + area->h > ESP32S3_LCD_VRES_VIRTUAL) + { + gerr("ERROR: updatearea area is out of bounds\n"); Review Comment: print area info -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org