Skip to content

Commit

Permalink
drivers/lcd: add stride support for LCD driver
Browse files Browse the repository at this point in the history
support LCD stride for GET_AREA and PUT_AREA operation

Signed-off-by: rongyichang <[email protected]>
  • Loading branch information
terry0012 authored and xiaoxiang781216 committed Nov 9, 2023
1 parent bb5b542 commit bc43c41
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
14 changes: 10 additions & 4 deletions drivers/lcd/lcd_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions include/nuttx/lcd/lcd_dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down

0 comments on commit bc43c41

Please sign in to comment.