xiaoxiang781216 commented on code in PR #14701:
URL: https://github.com/apache/nuttx/pull/14701#discussion_r1845931261


##########
arch/xtensa/src/esp32s3/esp32s3_lcd.c:
##########
@@ -545,10 +569,66 @@ 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. "
+           "x: %" PRIu16 ", y: %" PRIu16 ", w: %" PRIu16 ", h: %" PRIu16 ", "
+           "virtual hres: %d, virtual vres: %d\n",
+           area->x, area->y, area->w, area->h,
+           ESP32S3_LCD_HRES_VIRTUAL, ESP32S3_LCD_VRES_VIRTUAL);
+      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 +

Review Comment:
   size and first_pixel need at the begin of function too to confirm c89 spec



-- 
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

Reply via email to