summaryrefslogtreecommitdiff
path: root/include/drm
diff options
context:
space:
mode:
authorLowry Li <lowry.li@arm.com>2018-08-23 16:30:19 +0800
committerLiu Ying <victor.liu@nxp.com>2019-09-17 10:29:13 +0800
commitaf8f7a25b2aad64a4a93b2256ba93bfc9e873c1e (patch)
treef49c312f7723dd61b942801a0f2c659a36ab021b /include/drm
parent80d9c52eab5455f8f395cd0a86383f9eb873bacc (diff)
drm: Add per-plane pixel blend mode property
Pixel blend modes represent the alpha blending equation selection, describing how the pixels from the current plane are composited with the background. Adds a pixel_blend_mode to drm_plane_state and a blend_mode_property to drm_plane, and related support functions. Defines three blend modes in drm_blend.h. Changes since v1: - Moves the blending equation into the DOC comment - Refines the comments of drm_plane_create_blend_mode_property to not enumerate the #defines, but instead the string values - Uses fg.* instead of pixel.* and plane_alpha instead of plane.alpha Changes since v2: - Refines the comments of drm_plane_create_blend_mode_property: 1) Puts the descriptions (after the ":") on a new line 2) Adds explaining why @supported_modes need PREMUL as default Changes since v3: - Refines drm_plane_create_blend_mode_property(). drm_property_add_enum() can calculate the index itself just fine, so no point in having the caller pass it in. - Since the current DRM assumption is that alpha is premultiplied as default, define DRM_MODE_BLEND_PREMULTI as 0 will be better. - Refines some comments. Changes since v4: - Adds comments in drm_blend.h. - Removes setting default value in drm_plane_create_blend_mode_property() as it is already in __drm_atomic_helper_plane_reset(). - Fixes to use state->pixel_blend_mode instead of using plane->state->pixel_blend_mode in reset function. - Rebases on drm-misc-next. Reviewed-by: Liviu Dudau <liviu.dudau@arm.com> Signed-off-by: Lowry Li <lowry.li@arm.com> Signed-off-by: Ayan Kumar Halder <ayan.halder@arm.com> Reviewed-by: Sean Paul <seanpaul@chromium.org> Link: https://patchwork.freedesktop.org/patch/245734/ (cherry picked from commit a5ec8332d4280500544e316f76c04a7adc02ce03)
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drm_blend.h6
-rw-r--r--include/drm/drm_plane.h9
2 files changed, 15 insertions, 0 deletions
diff --git a/include/drm/drm_blend.h b/include/drm/drm_blend.h
index 330c561c4c11..88bdfec3bd88 100644
--- a/include/drm/drm_blend.h
+++ b/include/drm/drm_blend.h
@@ -27,6 +27,10 @@
#include <linux/ctype.h>
#include <drm/drm_mode.h>
+#define DRM_MODE_BLEND_PREMULTI 0
+#define DRM_MODE_BLEND_COVERAGE 1
+#define DRM_MODE_BLEND_PIXEL_NONE 2
+
struct drm_device;
struct drm_atomic_state;
struct drm_plane;
@@ -52,4 +56,6 @@ int drm_plane_create_zpos_immutable_property(struct drm_plane *plane,
unsigned int zpos);
int drm_atomic_normalize_zpos(struct drm_device *dev,
struct drm_atomic_state *state);
+int drm_plane_create_blend_mode_property(struct drm_plane *plane,
+ unsigned int supported_modes);
#endif
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 04990c59408f..878ae9996510 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -109,6 +109,7 @@ struct drm_plane_state {
/* Plane opacity */
u16 alpha;
+ uint16_t pixel_blend_mode;
/* Plane rotation */
unsigned int rotation;
@@ -564,6 +565,14 @@ struct drm_plane {
struct drm_property *alpha_property;
struct drm_property *zpos_property;
struct drm_property *rotation_property;
+ /**
+ * @blend_mode_property:
+ * Optional "pixel blend mode" enum property for this plane.
+ * Blend mode property represents the alpha blending equation selection,
+ * describing how the pixels from the current plane are composited with
+ * the background.
+ */
+ struct drm_property *blend_mode_property;
/**
* @color_encoding_property: