Re: [PATCH 4/9] drm: Add an blend_color property

Matt Roper
2016-01-21T00:29:09Z

On Mon, Jan 18, 2016 at 08:45:38PM +0530, Vandita Kulkarni wrote:
> From: Damien Lespiau <damien.lespiau@intel.com>
>
> Add blend color property and update the
> documentation for the same
>
> V2: Add blend color support in get property.

It would be good to describe in a bit more detail what "blend color"
means. It's unclear whether you're referring to per-pixel color keying,
global plane alpha, etc.

>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> Signed-off-by: vandita kulkarni <vandita.kulkarni@intel.com>
> ---
> Documentation/DocBook/gpu.tmpl | 11 +++++++++--
> drivers/gpu/drm/drm_atomic.c | 4 ++++
> drivers/gpu/drm/drm_crtc.c | 5 +++++
> include/drm/drm_crtc.h | 6 ++++++
> 4 files changed, 24 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/DocBook/gpu.tmpl b/Documentation/DocBook/gpu.tmpl
> index 2017162..4ef3d7f 100644
> --- a/Documentation/DocBook/gpu.tmpl
> +++ b/Documentation/DocBook/gpu.tmpl
> @@ -1816,7 +1816,7 @@ void intel_crt_init(struct drm_device *dev)
> Description/Restrictions
>
>
> - DRM
> + DRM
> Generic
> “rotation”
> BITMASK
> @@ -1868,7 +1868,7 @@ void intel_crt_init(struct drm_device *dev)
> CRTC that connector is attached to (atomic)
>
>
> - Plane
> + Plane
> “type”
> ENUM | IMMUTABLE
> { "Overlay", "Primary", "Cursor" }
> @@ -1953,6 +1953,13 @@ void intel_crt_init(struct drm_device *dev)
> Source and destination blending factors
>
>
> + “blend_color”
> + Color
> + DRM_MODE_COLOR()

As noted on an earlier patch, these two fields are supposed to be the
property type (which is a range property in your patch today) and the
possible values (which are 0-U64_MAX).

Matt

> + Plane
> + Blend constant color
> +
> +
> DVI-I
> “subconnector”
> ENUM
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 0c165c6..13b237c 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -642,6 +642,8 @@ int drm_atomic_plane_set_property(struct drm_plane *plane,
> return -EINVAL;
>
> state->blend_mode.func = val & GENMASK(31, 0);
> + } else if (property == config->prop_blend_color) {
> + state->blend_mode.color = val;
> } else if (plane->funcs->atomic_set_property) {
> return plane->funcs->atomic_set_property(plane, state,
> property, val);
> @@ -700,6 +702,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
> *val = state->rotation;
> } else if (property == config->prop_blend_func) {
> *val = state->blend_mode.func;
> + } else if (property == config->prop_blend_color) {
> + *val = state->blend_mode.color;
> } else if (plane->funcs->atomic_get_property) {
> return plane->funcs->atomic_get_property(plane, state, property, val);
> } else {
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index b8dde06..eb8dc2b 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -1547,6 +1547,11 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)
> return -ENOMEM;
> dev->mode_config.prop_blend_func = prop;
>
> + prop = drm_property_create_range(dev, 0, "blend_color", 0, U64_MAX);
> + if (!prop)
> + return -ENOMEM;
> + dev->mode_config.prop_blend_color = prop;
> +
> return 0;
> }
>
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 9cfe601..9c3563b 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -105,6 +105,10 @@ enum drm_blend_factor {
> DRM_BLEND_FACTOR_ONE,
> DRM_BLEND_FACTOR_SRC_ALPHA,
> DRM_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA,
> + DRM_BLEND_FACTOR_CONSTANT_ALPHA,
> + DRM_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA,
> + DRM_BLEND_FACTOR_CONSTANT_ALPHA_TIMES_SRC_ALPHA,
> + DRM_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA_TIMES_SRC_ALPHA,
> };
>
> #define DRM_BLEND_FUNC(src_factor, dst_factor) \
> @@ -113,6 +117,7 @@ enum drm_blend_factor {
> #define DRM_BLEND_FUNC_DST_FACTOR(val) ((val) & 0xffff)
>
> struct drm_blend_mode {
> + uint64_t color;
> uint64_t func;
> };
>
> @@ -2119,6 +2124,7 @@ struct drm_mode_config {
> struct drm_property *prop_active;
> struct drm_property *prop_mode_id;
> struct drm_property *prop_blend_func;
> + struct drm_property *prop_blend_color;
>
> /* DVI-I properties */
> struct drm_property *dvi_i_subconnector_property;
> --
> 1.9.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Matt Roper
Graphics Software Engineer
IoTG Platform Enabling & Development
Intel Corporation
(916) 356-2795