dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Anholt <eric@anholt.net>
Cc: airlied@linux.ie, linux-rpi-kernel@lists.infradead.org,
	dri-devel@lists.freedesktop.org,
	Stefan Schake <stschake@gmail.com>
Subject: Re: [PATCH v2] drm/vc4: Add support for plane alpha
Date: Mon, 23 Apr 2018 11:27:57 -0700	[thread overview]
Message-ID: <87sh7lhj6a.fsf@anholt.net> (raw)
In-Reply-To: <20180421000954.18936-1-stschake@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1534 bytes --]

Stefan Schake <stschake@gmail.com> writes:

> The HVS supports mixing fixed alpha with per-pixel alpha or
> setting a fixed plane alpha in case there is no per-pixel information.
> This allows us to support the generic DRM plane alpha property.
>
> Signed-off-by: Stefan Schake <stschake@gmail.com>

Applied to drm-misc-next.  Thanks!

> @@ -565,6 +567,13 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
>  					      SCALER_POS1_SCL_HEIGHT));
>  	}
>  
> +	/* Don't waste cycles mixing with plane alpha if the set alpha
> +	 * is opaque or there is no per-pixel alpha information.
> +	 * In any case we use the alpha property value as the fixed alpha.
> +	 */
> +	mix_plane_alpha = state->alpha != DRM_BLEND_ALPHA_OPAQUE &&
> +			  fb->format->has_alpha;
> +
>  	/* Position Word 2: Source Image Size, Alpha */
>  	vc4_state->pos2_offset = vc4_state->dlist_count;
>  	vc4_dlist_write(vc4_state,
> @@ -572,6 +581,7 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
>  				      SCALER_POS2_ALPHA_MODE_PIPELINE :
>  				      SCALER_POS2_ALPHA_MODE_FIXED,
>  				      SCALER_POS2_ALPHA_MODE) |
> +			(mix_plane_alpha ? SCALER_POS2_ALPHA_MIX : 0) |
>  			(fb->format->has_alpha ? SCALER_POS2_ALPHA_PREMULT : 0) |
>  			VC4_SET_FIELD(vc4_state->src_w[0], SCALER_POS2_WIDTH) |
>  			VC4_SET_FIELD(vc4_state->src_h[0], SCALER_POS2_HEIGHT));

In an interesting note from the docs, if you'd set SCALER_POS2_ALPHA_MIX
with SCALER_POS2_ALPHA_MODE_FIXED, you'd get the fixed alpha squared!

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2018-04-23 18:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-21  0:09 [PATCH v2] drm/vc4: Add support for plane alpha Stefan Schake
2018-04-23 18:27 ` Eric Anholt [this message]

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=87sh7lhj6a.fsf@anholt.net \
    --to=eric@anholt.net \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=stschake@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox