All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Paul <seanpaul@chromium.org>
To: "Kristian H. Kristensen" <hoegsberg@gmail.com>
Cc: "Kristian H. Kristensen" <hoegsberg@chromium.org>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/rockchip: Filter out alpha formats for primary plane
Date: Mon, 16 Apr 2018 16:38:41 -0400	[thread overview]
Message-ID: <20180416203841.GX73214@art_vandelay> (raw)
In-Reply-To: <20180416190103.83171-1-hoegsberg@chromium.org>

On Mon, Apr 16, 2018 at 12:01:03PM -0700, Kristian H. Kristensen wrote:
> Rockchip doesn't support per-pixel alpha blending for the lowest
> window in the stack. While the hw supports restacking the windows, we
> don't expose that in KMS, so just filter out alpha formats for the
> primary plane.
> 
> Change-Id: I7828d5bf0f0b5c6dd23f9e52aa01a5a683131d2f

Can you please strip this from upstream commit msgs?

> Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org>
> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 28 ++++++++++++++++++++++++++--
>  1 file changed, 26 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index fae37b1cd691..2efe78600fd0 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -1547,6 +1547,28 @@ static irqreturn_t vop_isr(int irq, void *data)
>  	return ret;
>  }
>  
> +static uint32_t formats_for_win(const struct vop_win_phy *phy, uint32_t win,
> +				uint32_t *formats, uint32_t max_formats)
> +{
> +	uint32_t i, j;
> +
> +	BUG_ON(max_formats < phy->nformats);
> +
> +	j = 0;
> +	for (i = 0; i < phy->nformats; i++) {
> +		/*
> +		 * win0 doesn't support per-pixel alpha, so don't add any RGBA
> +		 * formats for that plane.
> +		 */
> +		if (win == 0 && is_alpha_support(phy->data_formats[i]))
> +			continue;
> +
> +		formats[j++] = phy->data_formats[i];
> +	}
> +
> +	return j;
> +}
> +
>  static int vop_create_crtc(struct vop *vop)
>  {
>  	const struct vop_data *vop_data = vop->data;
> @@ -1568,15 +1590,17 @@ static int vop_create_crtc(struct vop *vop)
>  	for (i = 0; i < vop_data->win_size; i++) {
>  		struct vop_win *vop_win = &vop->win[i];
>  		const struct vop_win_data *win_data = vop_win->data;
> +		uint32_t nformats, formats[16];

I guess 16 is probably a safe bet, but perhaps either pull it out into a define,
or just devm_kzalloc the format to phy->nformats. If you choose the former, the
loop in formats_for_win should ensure it doesn't overrun formats.

Sean

>  
>  		if (win_data->type != DRM_PLANE_TYPE_PRIMARY &&
>  		    win_data->type != DRM_PLANE_TYPE_CURSOR)
>  			continue;
>  
> +		nformats = formats_for_win(win_data->phy, i,
> +					   formats, ARRAY_SIZE(formats));
>  		ret = drm_universal_plane_init(vop->drm_dev, &vop_win->base,
>  					       0, &vop_plane_funcs,
> -					       win_data->phy->data_formats,
> -					       win_data->phy->nformats,
> +					       formats, nformats,
>  					       win_data->phy->format_modifiers,
>  					       win_data->type, NULL);
>  		if (ret) {
> -- 
> 2.13.5
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-04-16 20:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-16 19:01 [PATCH] drm/rockchip: Filter out alpha formats for primary plane Kristian H. Kristensen
2018-04-16 20:38 ` Sean Paul [this message]
2018-04-16 21:59 ` Eric Anholt
2018-04-16 22:04   ` Kristian Høgsberg

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=20180416203841.GX73214@art_vandelay \
    --to=seanpaul@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hoegsberg@chromium.org \
    --cc=hoegsberg@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.