You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/07/12 17:03:24 UTC
[nuttx] branch master updated: drivers/lcd: add area alignment ioctl for lcd driver
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 6902ed9516 drivers/lcd: add area alignment ioctl for lcd driver
6902ed9516 is described below
commit 6902ed9516a9e11515782d09c4b340acda6ebe52
Author: rongyichang <ro...@xiaomi.com>
AuthorDate: Tue Apr 18 22:16:47 2023 +0800
drivers/lcd: add area alignment ioctl for lcd driver
Signed-off-by: rongyichang <ro...@xiaomi.com>
---
drivers/lcd/lcd_dev.c | 19 +++++++++++++++++++
include/nuttx/lcd/lcd.h | 18 ++++++++++++++++++
include/nuttx/lcd/lcd_dev.h | 14 ++++++++------
3 files changed, 45 insertions(+), 6 deletions(-)
diff --git a/drivers/lcd/lcd_dev.c b/drivers/lcd/lcd_dev.c
index 4aacc9d042..f00015132d 100644
--- a/drivers/lcd/lcd_dev.c
+++ b/drivers/lcd/lcd_dev.c
@@ -272,6 +272,25 @@ static int lcddev_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
*((FAR int *)arg) = priv->lcd_ptr->getframerate(priv->lcd_ptr);
}
break;
+ case LCDDEVIO_GETAREAALIGN:
+ {
+ FAR struct lcddev_area_align_s *area_align =
+ (FAR struct lcddev_area_align_s *)arg;
+
+ if (priv->lcd_ptr->getareaalign == NULL)
+ {
+ area_align->row_start_align = 1;
+ area_align->height_align = 1;
+ area_align->col_start_align = 1;
+ area_align->width_align = 1;
+ area_align->buf_align = sizeof(uintptr_t);
+ }
+ else
+ {
+ ret = priv->lcd_ptr->getareaalign(priv->lcd_ptr, area_align);
+ }
+ }
+ break;
default:
ret = -EINVAL;
break;
diff --git a/include/nuttx/lcd/lcd.h b/include/nuttx/lcd/lcd.h
index b76d680278..8a72ae3a02 100644
--- a/include/nuttx/lcd/lcd.h
+++ b/include/nuttx/lcd/lcd.h
@@ -47,6 +47,19 @@
struct lcd_dev_s;
+/* Some special LCD drivers require input data to be aligned.
+ * Such as starting row and column, width, height, data address, etc.
+ */
+
+struct lcddev_area_align_s
+{
+ uint16_t row_start_align; /* Start row index alignment */
+ uint16_t height_align; /* Height alignment */
+ uint16_t col_start_align; /* Start column index alignment */
+ uint16_t width_align; /* Width alignment */
+ uint16_t buf_align; /* Buffer addr alignment */
+};
+
/* This structure describes one color plane. Some YUV formats may support
* up to 4 planes (although they probably wouldn't be used on LCD hardware).
* The framebuffer driver provides the video memory address in its
@@ -246,6 +259,11 @@ struct lcd_dev_s
/* Get LCD panel frame rate (0: disable refresh) */
int (*getframerate)(struct lcd_dev_s *dev);
+
+ /* Get LCD panel area alignment */
+
+ int (*getareaalign)(FAR struct lcd_dev_s *dev,
+ FAR struct lcddev_area_align_s *align);
};
/****************************************************************************
diff --git a/include/nuttx/lcd/lcd_dev.h b/include/nuttx/lcd/lcd_dev.h
index 16193e1472..9b8a0e0610 100644
--- a/include/nuttx/lcd/lcd_dev.h
+++ b/include/nuttx/lcd/lcd_dev.h
@@ -50,17 +50,19 @@
#define LCDDEVIO_SETPLANENO _LCDIOC(10) /* Arg: int */
#ifdef CONFIG_FB_CMAP
-#define LCDDEVIO_GETCMAP _LCDIOC(9) /* Arg: struct fb_cmap_s* */
-#define LCDDEVIO_PUTCMAP _LCDIOC(10) /* Arg: const struct fb_cmap_s* */
+#define LCDDEVIO_GETCMAP _LCDIOC(11) /* Arg: struct fb_cmap_s* */
+#define LCDDEVIO_PUTCMAP _LCDIOC(12) /* Arg: const struct fb_cmap_s* */
#endif
#ifdef CONFIG_FB_HWCURSOR
-#define LCDDEVIO_GETCURSOR _LCDIOC(11) /* Arg: struct fb_cursorattrib_s* */
-#define LCDDEVIO_SETCURSOR _LCDIOC(12) /* Arg: struct fb_setcursor_s* */
+#define LCDDEVIO_GETCURSOR _LCDIOC(13) /* Arg: struct fb_cursorattrib_s* */
+#define LCDDEVIO_SETCURSOR _LCDIOC(14) /* Arg: struct fb_setcursor_s* */
#endif
-#define LCDDEVIO_SETFRAMERATE _LCDIOC(13) /* Arg: int */
-#define LCDDEVIO_GETFRAMERATE _LCDIOC(14) /* Arg: int* */
+#define LCDDEVIO_SETFRAMERATE _LCDIOC(15) /* Arg: int */
+#define LCDDEVIO_GETFRAMERATE _LCDIOC(16) /* Arg: int* */
+
+#define LCDDEVIO_GETAREAALIGN _LCDIOC(17) /* Arg: struct lcddev_area_align_s* */
/****************************************************************************
* Public Data