drivers/lcd: add stride support for LCD driver

support LCD stride for GET_AREA and PUT_AREA operation

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
This commit is contained in:
rongyichang 2023-09-20 19:35:32 +08:00 committed by Xiang Xiao
parent bb5b5420ae
commit bc43c419f2
2 changed files with 11 additions and 4 deletions

View File

@ -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)
{

View File

@ -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;
};