This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new bc43c419f2 drivers/lcd: add stride support for LCD driver
bc43c419f2 is described below

commit bc43c419f2f82497ebd23f51d9408a4899b0e82b
Author: rongyichang <[email protected]>
AuthorDate: Wed Sep 20 19:35:32 2023 +0800

    drivers/lcd: add stride support for LCD driver
    
    support LCD stride for GET_AREA and PUT_AREA operation
    
    Signed-off-by: rongyichang <[email protected]>
---
 drivers/lcd/lcd_dev.c       | 14 ++++++++++----
 include/nuttx/lcd/lcd_dev.h |  1 +
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/lcd/lcd_dev.c b/drivers/lcd/lcd_dev.c
index 93f7d53a1f..93ac9f1cfc 100644
--- a/drivers/lcd/lcd_dev.c
+++ b/drivers/lcd/lcd_dev.c
@@ -118,8 +118,11 @@ static int lcddev_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
         FAR struct lcddev_area_s *lcd_area =
             (FAR struct lcddev_area_s *)arg;
         size_t cols = lcd_area->col_end - lcd_area->col_start + 1;
-        size_t row_size = cols * (priv->planeinfo.bpp > 1 ?
-                                    priv->planeinfo.bpp >> 3 : 1);
+        size_t pixel_size = priv->planeinfo.bpp > 1 ?
+                            priv->planeinfo.bpp >> 3 : 1;
+        size_t row_size = lcd_area->stride > 0 ?
+                          lcd_area->stride * pixel_size :
+                          cols * pixel_size;
 
         if (priv->planeinfo.getarea)
           {
@@ -158,8 +161,11 @@ static int lcddev_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
         FAR const struct lcddev_area_s *lcd_area =
             (FAR const struct lcddev_area_s *)arg;
         size_t cols = lcd_area->col_end - lcd_area->col_start + 1;
-        size_t row_size = cols * (priv->planeinfo.bpp > 1 ?
-                                    priv->planeinfo.bpp >> 3 : 1);
+        size_t pixel_size = priv->planeinfo.bpp > 1 ?
+                            priv->planeinfo.bpp >> 3 : 1;
+        size_t row_size = lcd_area->stride > 0 ?
+                          lcd_area->stride * pixel_size :
+                          cols * pixel_size;
 
         if (priv->planeinfo.putarea)
           {
diff --git a/include/nuttx/lcd/lcd_dev.h b/include/nuttx/lcd/lcd_dev.h
index 9b8a0e0610..b3b2c40f24 100644
--- a/include/nuttx/lcd/lcd_dev.h
+++ b/include/nuttx/lcd/lcd_dev.h
@@ -87,6 +87,7 @@ struct lcddev_area_s
 {
   fb_coord_t row_start, row_end;
   fb_coord_t col_start, col_end;
+  fb_coord_t stride;
   FAR uint8_t *data;
 };
 

Reply via email to