dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Jessica Zhang <quic_jesszhan@quicinc.com>,
	freedreno@lists.freedesktop.org
Cc: linux-arm-msm@vger.kernel.org, quic_abhinavk@quicinc.com,
	dri-devel@lists.freedesktop.org, swboyd@chromium.org,
	daniel.vetter@ffwll.ch, seanpaul@chromium.org,
	laurent.pinchart@ideasonboard.com
Subject: Re: [RFC PATCH 1/3] drm: Introduce color fill properties for drm plane
Date: Sat, 29 Oct 2022 14:23:11 +0300	[thread overview]
Message-ID: <eddf4726-3d7e-601a-51ac-03adb2dd822b@linaro.org> (raw)
In-Reply-To: <20221028225952.160-2-quic_jesszhan@quicinc.com>

On 29/10/2022 01:59, Jessica Zhang wrote:
> Add support for COLOR_FILL and COLOR_FILL_FORMAT properties for
> drm_plane. In addition, add support for setting and getting the values
> of these properties.
> 
> COLOR_FILL represents the color fill of a plane while COLOR_FILL_FORMAT
> represents the format of the color fill. Userspace can set enable solid
> fill on a plane by assigning COLOR_FILL to a uint64_t value, assigning
> the COLOR_FILL_FORMAT property to a uint32_t value, and setting the
> framebuffer to NULL.

I suppose that COLOR_FILL should override framebuffer rather than 
requiring that FB is set to NULL. In other words, if color_filL_format 
is non-zero, it would make sense to ignore the FB. Then one can use the 
color_fill_format property to quickly switch between filled plane and 
FB-backed one.

> 
> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
> ---
>   drivers/gpu/drm/drm_atomic_uapi.c |  8 +++++++
>   drivers/gpu/drm/drm_blend.c       | 38 +++++++++++++++++++++++++++++++
>   include/drm/drm_blend.h           |  2 ++
>   include/drm/drm_plane.h           | 28 +++++++++++++++++++++++
>   4 files changed, 76 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index 79730fa1dd8e..e1664463fca4 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -544,6 +544,10 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
>   		state->src_w = val;
>   	} else if (property == config->prop_src_h) {
>   		state->src_h = val;
> +	} else if (property == plane->color_fill_format_property) {
> +		state->color_fill_format = val;
> +	} else if (property == plane->color_fill_property) {
> +		state->color_fill = val;
>   	} else if (property == plane->alpha_property) {
>   		state->alpha = val;
>   	} else if (property == plane->blend_mode_property) {
> @@ -616,6 +620,10 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
>   		*val = state->src_w;
>   	} else if (property == config->prop_src_h) {
>   		*val = state->src_h;
> +	} else if (property == plane->color_fill_format_property) {
> +		*val = state->color_fill_format;
> +	} else if (property == plane->color_fill_property) {
> +		*val = state->color_fill;
>   	} else if (property == plane->alpha_property) {
>   		*val = state->alpha;
>   	} else if (property == plane->blend_mode_property) {
> diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
> index b4c8cab7158c..b8c2b263fa51 100644
> --- a/drivers/gpu/drm/drm_blend.c
> +++ b/drivers/gpu/drm/drm_blend.c
> @@ -616,3 +616,41 @@ int drm_plane_create_blend_mode_property(struct drm_plane *plane,
>   	return 0;
>   }
>   EXPORT_SYMBOL(drm_plane_create_blend_mode_property);
> +
> +int drm_plane_create_color_fill_property(struct drm_plane *plane)
> +{
> +	struct drm_property *prop;
> +
> +	prop = drm_property_create_range(plane->dev, 0, "color_fill",
> +					 0, 0xffffffff);
> +	if (!prop)
> +		return -ENOMEM;
> +
> +	drm_object_attach_property(&plane->base, prop, 0);
> +	plane->color_fill_property = prop;
> +
> +	if (plane->state)
> +		plane->state->color_fill = 0;
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL(drm_plane_create_color_fill_property);
> +
> +int drm_plane_create_color_fill_format_property(struct drm_plane *plane)
> +{
> +	struct drm_property *prop;
> +
> +	prop = drm_property_create_range(plane->dev, 0, "color_fill_format",
> +					 0, 0xffffffff);
> +	if (!prop)
> +		return -ENOMEM;
> +
> +	drm_object_attach_property(&plane->base, prop, 0);
> +	plane->color_fill_format_property = prop;
> +
> +	if (plane->state)
> +		plane->state->color_fill_format = 0;

Don't you also need to reset these properties in 
__drm_atomic_helper_plane_state_reset() ?

> +
> +	return 0;
> +}
> +EXPORT_SYMBOL(drm_plane_create_color_fill_format_property);
> diff --git a/include/drm/drm_blend.h b/include/drm/drm_blend.h
> index 88bdfec3bd88..3e96f5e83cce 100644
> --- a/include/drm/drm_blend.h
> +++ b/include/drm/drm_blend.h
> @@ -58,4 +58,6 @@ 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);
> +int drm_plane_create_color_fill_property(struct drm_plane *plane);
> +int drm_plane_create_color_fill_format_property(struct drm_plane *plane);
>   #endif
> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> index 89ea54652e87..dcbfdb0e1f71 100644
> --- a/include/drm/drm_plane.h
> +++ b/include/drm/drm_plane.h
> @@ -116,6 +116,20 @@ struct drm_plane_state {
>   	/** @src_h: height of visible portion of plane (in 16.16) */
>   	uint32_t src_h, src_w;
>   
> +	/**
> +	 * @color_fill_format:
> +	 * Format of the color fill value.
> +	 */
> +	uint32_t color_fill_format;
> +
> +	/**
> +	 * @color_fill:
> +	 * Fill color of the plane with 0 as black and 0xffffffff as white.
> +	 * Can be set by user by setting the COLOR_FILL property. See
> +	 * drm_plane_create_color_fill_property() for more details.
> +	 */
> +	uint32_t color_fill;
> +
>   	/**
>   	 * @alpha:
>   	 * Opacity of the plane with 0 as completely transparent and 0xffff as
> @@ -699,6 +713,20 @@ struct drm_plane {
>   	 */
>   	struct drm_plane_state *state;
>   
> +	/*
> +	 * @color_fill_format_property:
> +	 * Optional color fill format property for this plane. See
> +	 * drm_plane_create_color_fill_format_property().
> +	 */
> +	struct drm_property *color_fill_format_property;
> +
> +	/*
> +	 * @color_fill_property:
> +	 * Optional color fill property for this plane. See
> +	 * drm_plane_create_color_fill_property().
> +	 */
> +	struct drm_property *color_fill_property;
> +
>   	/**
>   	 * @alpha_property:
>   	 * Optional alpha property for this plane. See

-- 
With best wishes
Dmitry


  reply	other threads:[~2022-10-29 11:23 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28 22:59 [RFC PATCH 0/3] Support for Solid Fill Planes Jessica Zhang
2022-10-28 22:59 ` [RFC PATCH 1/3] drm: Introduce color fill properties for drm plane Jessica Zhang
2022-10-29 11:23   ` Dmitry Baryshkov [this message]
2022-10-31 21:58     ` Jessica Zhang
2022-11-08 18:25     ` Simon Ser
2022-11-09 13:52       ` Daniel Vetter
2022-11-09 13:53         ` Dmitry Baryshkov
2022-11-09 13:59           ` Daniel Vetter
2022-11-10  1:44             ` Jessica Zhang
2022-11-11  9:45               ` Daniel Vetter
2022-11-18 19:15                 ` Jessica Zhang
2022-10-29 12:08   ` Dmitry Baryshkov
2022-10-31 22:24     ` Jessica Zhang
2022-11-01  0:11       ` Dmitry Baryshkov
2022-11-01 17:35         ` Jessica Zhang
2022-11-08 18:50     ` Simon Ser
2022-11-08 22:01       ` Sebastian Wick
2022-11-09  9:18         ` Pekka Paalanen
2022-11-23 23:27           ` Jessica Zhang
2022-11-24  8:50             ` Pekka Paalanen
2022-11-29 18:53               ` [Freedreno] " Jessica Zhang
2022-10-28 22:59 ` [RFC PATCH 2/3] drm: Adjust atomic checks for solid fill color Jessica Zhang
2022-10-29 11:38   ` Dmitry Baryshkov
2022-10-31 20:41     ` Jessica Zhang
2022-10-28 22:59 ` [RFC PATCH 3/3] drm/msm/dpu: Use color_fill property for DPU planes Jessica Zhang
2022-10-29 11:40   ` Dmitry Baryshkov
2022-10-31 22:14     ` Jessica Zhang
2022-11-07 19:37 ` [RFC PATCH 0/3] Support for Solid Fill Planes Ville Syrjälä
2022-11-07 21:32   ` Jessica Zhang
2022-11-07 22:09     ` [Freedreno] " Rob Clark
2022-11-08  0:22       ` Jessica Zhang
2022-11-08  3:34         ` Rob Clark
2022-11-08  8:52           ` Ville Syrjälä
2022-11-22 23:20             ` Jessica Zhang
2022-11-07 23:06   ` Laurent Pinchart
2023-06-26 23:02   ` Jessica Zhang
2023-06-27  0:06     ` Dmitry Baryshkov
2023-06-27  0:45       ` Jessica Zhang
2023-06-27  1:46         ` Dmitry Baryshkov
2023-06-27  7:58     ` Pekka Paalanen
2023-06-27 21:27       ` Jessica Zhang
2023-06-27 21:59         ` Dmitry Baryshkov
2023-06-27 22:10           ` Abhinav Kumar
2023-06-28  7:34             ` Pekka Paalanen
2023-06-28 16:40               ` Jessica Zhang
2023-06-29  7:29                 ` Pekka Paalanen
2023-06-29 18:53                   ` [Freedreno] " Jessica Zhang
2023-06-29 18:52             ` Jessica Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eddf4726-3d7e-601a-51ac-03adb2dd822b@linaro.org \
    --to=dmitry.baryshkov@linaro.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_jesszhan@quicinc.com \
    --cc=seanpaul@chromium.org \
    --cc=swboyd@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).