summaryrefslogtreecommitdiff
path: root/include/video
diff options
context:
space:
mode:
authorAndy Ritger <aritger@nvidia.com>2013-08-23 16:24:48 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-26 19:46:17 -0700
commit8170e0f94e70a7cd8ae93d9661d08837c802208e (patch)
treeaa6cb8b4056c209a4664f8ce2f4dc74c006e05c7 /include/video
parent170d2441ee71391a969e8aab7a1ffa7323e7c0e7 (diff)
video: tegra: dc: add API for selecting PREMULT_ALPHA cursor blending
Add TEGRA_DC_EXT_CURSOR_FORMAT_FLAGS_RGBA_PREMULT_ALPHA flag for tegra_dc_ext_cursor_image::flags to select premultiplied alpha. For consistency, rename TEGRA_DC_EXT_CURSOR_FLAGS_2BIT_LEGACY TEGRA_DC_EXT_CURSOR_FLAGS_RGBA_NORMAL to TEGRA_DC_EXT_CURSOR_FORMAT_FLAGS_2BIT_LEGACY TEGRA_DC_EXT_CURSOR_FORMAT_FLAGS_RGBA_NON_PREMULT_ALPHA (but retain the old names as aliases, for source-level backwards compatibility). Add new caps bits to be reported in tegra_dc_ext_control_capabilities::caps TEGRA_DC_EXT_CAPABILITIES_CURSOR_TWO_COLOR TEGRA_DC_EXT_CAPABILITIES_CURSOR_RGBA_NON_PREMULT_ALPHA TEGRA_DC_EXT_CAPABILITIES_CURSOR_RGBA_PREMULT_ALPHA Note that before this change the default RGBA cursor behavior on T114 was non-premultipled alpha, while on T124 it was premultipled alpha. Now, the default RGBA cursor behavior is consistently non-premultipled alpha. Existing T124 RGBA cursor users will need to use the new PREMULT_ALPHA flag. Update the cursor image format documentation in tegra_dc_ext.h Bug 1354320 Change-Id: I82b04c97dea1830ce2659c966ae2a1b59fa06028 Signed-off-by: Andy Ritger <aritger@nvidia.com> Reviewed-on: http://git-master/r/271749 GVS: Gerrit_Virtual_Submit Reviewed-by: Jon Mayo <jmayo@nvidia.com>
Diffstat (limited to 'include/video')
-rw-r--r--include/video/tegra_dc_ext.h70
1 files changed, 60 insertions, 10 deletions
diff --git a/include/video/tegra_dc_ext.h b/include/video/tegra_dc_ext.h
index d2a79a1aaa9c..828791314b0e 100644
--- a/include/video/tegra_dc_ext.h
+++ b/include/video/tegra_dc_ext.h
@@ -155,18 +155,46 @@ struct tegra_dc_ext_flip_2 {
/*
* Cursor image format:
- * - Tegra hardware supports two colors: foreground and background, specified
- * by the client in RGB8.
- * - The image should be specified as two 1bpp bitmaps immediately following
- * each other in memory. Each pixel in the final cursor will be constructed
- * from the bitmaps with the following logic:
+ *
+ * Tegra hardware supports two different cursor formats:
+ *
+ * (1) Two color cursor: foreground and background colors are
+ * specified by the client in RGB8.
+ *
+ * The two-color image should be specified as two 1bpp bitmaps
+ * immediately following each other in memory. Each pixel in the
+ * final cursor will be constructed from the bitmaps with the
+ * following logic:
+ *
* bitmap1 bitmap0
* (mask) (color)
* 1 0 transparent
* 1 1 inverted
* 0 0 background color
* 0 1 foreground color
- * - Exactly one of the SIZE flags must be specified.
+ *
+ * This format is supported when TEGRA_DC_EXT_CONTROL_GET_CAPABILITIES
+ * reports the TEGRA_DC_EXT_CAPABILITIES_CURSOR_TWO_COLOR bit.
+ *
+ * (2) RGBA cursor: in this case the image is four bytes per pixel,
+ * with alpha in the low eight bits.
+ *
+ * The RGB components of the cursor image can be either
+ * premultipled by alpha:
+ *
+ * cursor[r,g,b] + desktop[r,g,b] * (1 - cursor[a])
+ *
+ * or not:
+ *
+ * cursor[r,g,b] * cursor[a] + desktop[r,g,b] * (1 - cursor[a])
+ *
+ * TEGRA_DC_EXT_CONTROL_GET_CAPABILITIES will report one or more of
+ * TEGRA_DC_EXT_CURSOR_FLAGS_RGBA{,_NON}_PREMULT_ALPHA to indicate
+ * which are supported on the current hardware.
+ *
+ * Specify one of TEGRA_DC_EXT_CURSOR_FLAGS to indicate the format.
+ *
+ * Exactly one of the SIZE flags must be specified.
*/
@@ -175,8 +203,25 @@ struct tegra_dc_ext_flip_2 {
#define TEGRA_DC_EXT_CURSOR_IMAGE_FLAGS_SIZE_128x128 ((3 & 0x7) << 0)
#define TEGRA_DC_EXT_CURSOR_IMAGE_FLAGS_SIZE_256x256 ((4 & 0x7) << 0)
#define TEGRA_DC_EXT_CURSOR_IMAGE_FLAGS_SIZE(x) (((x) & 0x7) >> 0)
-#define TEGRA_DC_EXT_CURSOR_FLAGS_2BIT_LEGACY (0 << 16)
-#define TEGRA_DC_EXT_CURSOR_FLAGS_RGBA_NORMAL (1 << 16)
+
+#define TEGRA_DC_EXT_CURSOR_FORMAT_2BIT_LEGACY (0)
+#define TEGRA_DC_EXT_CURSOR_FORMAT_RGBA_NON_PREMULT_ALPHA (1)
+#define TEGRA_DC_EXT_CURSOR_FORMAT_RGBA_PREMULT_ALPHA (3)
+
+#define TEGRA_DC_EXT_CURSOR_FORMAT_FLAGS_2BIT_LEGACY \
+ (TEGRA_DC_EXT_CURSOR_FORMAT_2BIT_LEGACY << 16)
+#define TEGRA_DC_EXT_CURSOR_FORMAT_FLAGS_RGBA_NON_PREMULT_ALPHA \
+ (TEGRA_DC_EXT_CURSOR_FORMAT_RGBA_NON_PREMULT_ALPHA << 16)
+#define TEGRA_DC_EXT_CURSOR_FORMAT_FLAGS_RGBA_PREMULT_ALPHA \
+ (TEGRA_DC_EXT_CURSOR_FORMAT_RGBA_PREMULT_ALPHA << 16)
+
+#define TEGRA_DC_EXT_CURSOR_FORMAT_FLAGS(x) (((x) >> 16) & 0x7)
+
+/* aliases for source-level backwards compatibility */
+#define TEGRA_DC_EXT_CURSOR_FLAGS_RGBA_NORMAL \
+ TEGRA_DC_EXT_CURSOR_FORMAT_FLAGS_RGBA_NON_PREMULT_ALPHA
+#define TEGRA_DC_EXT_CURSOR_FLAGS_2BIT_LEGACY \
+ TEGRA_DC_EXT_CURSOR_FORMAT_FLAGS_2BIT_LEGACY
enum CR_MODE {
legacy,
@@ -407,8 +452,13 @@ struct tegra_dc_ext_control_event_bandwidth {
__u32 handle;
};
-#define TEGRA_DC_EXT_CAPABILITIES_CURSOR_MODE (1 << 0)
-#define TEGRA_DC_EXT_CAPABILITIES_BLOCKLINEAR (1 << 1)
+#define TEGRA_DC_EXT_CAPABILITIES_CURSOR_MODE (1 << 0)
+#define TEGRA_DC_EXT_CAPABILITIES_BLOCKLINEAR (1 << 1)
+
+#define TEGRA_DC_EXT_CAPABILITIES_CURSOR_TWO_COLOR (1 << 2)
+#define TEGRA_DC_EXT_CAPABILITIES_CURSOR_RGBA_NON_PREMULT_ALPHA (1 << 3)
+#define TEGRA_DC_EXT_CAPABILITIES_CURSOR_RGBA_PREMULT_ALPHA (1 << 4)
+
struct tegra_dc_ext_control_capabilities {
__u32 caps;
/* Leave some wiggle room for future expansion */