All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lowry Li <lowry.li@arm.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: David Airlie <airlied@linux.ie>,
	Emil Velikov <emil.l.velikov@gmail.com>,
	Liviu Dudau <liviu.dudau@arm.com>,
	"Linux-Kernel@Vger. Kernel. Org" <linux-kernel@vger.kernel.org>,
	ML dri-devel <dri-devel@lists.freedesktop.org>,
	Mali DP Maintainers <malidp@foss.arm.com>,
	"Vetter, Daniel" <daniel.vetter@intel.com>,
	nd@arm.com
Subject: Re: [PATCH v3 1/2] drm: Add per-plane pixel blend mode property
Date: Tue, 14 Aug 2018 11:11:02 +0800	[thread overview]
Message-ID: <24287.3342395344$1534216161@news.gmane.org> (raw)
In-Reply-To: <325674b0-d100-4e38-3963-0e458e6dec80@linux.intel.com>

On Mon, Aug 13, 2018 at 12:49:13PM +0200, Maarten Lankhorst wrote:
> Op 05-06-18 om 11:07 schreef Lowry Li:
> > On Mon, Jun 04, 2018 at 02:49:26PM +0100, Emil Velikov wrote:
> >> On 1 June 2018 at 13:41, Lowry Li <lowry.li@arm.com> wrote:
> >>> Pixel blend modes represent the alpha blending equation
> >>> selection, describing how the pixels from the current
> >>> plane are composited with the background.
> >>>
> >>> Add 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.
> >>>
> >>> Signed-off-by: Lowry Li <lowry.li@arm.com>
> >>> ---
> >>>  drivers/gpu/drm/drm_atomic.c        |   4 ++
> >>>  drivers/gpu/drm/drm_atomic_helper.c |   1 +
> >>>  drivers/gpu/drm/drm_blend.c         | 126 ++++++++++++++++++++++++++++++++++++
> >>>  include/drm/drm_blend.h             |   6 ++
> >>>  include/drm/drm_plane.h             |   5 ++
> >>>  5 files changed, 142 insertions(+)
> >>>
> >>> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> >>> index 07fef42..1d18389 100644
> >>> --- a/drivers/gpu/drm/drm_atomic.c
> >>> +++ b/drivers/gpu/drm/drm_atomic.c
> >>> @@ -785,6 +785,8 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
> >>>                 state->src_h = val;
> >>>         } else if (property == plane->alpha_property) {
> >>>                 state->alpha = val;
> >>> +       } else if (property == plane->blend_mode_property) {
> >>> +               state->pixel_blend_mode = val;
> >>>         } else if (property == plane->rotation_property) {
> >>>                 if (!is_power_of_2(val & DRM_MODE_ROTATE_MASK))
> >>>                         return -EINVAL;
> >>> @@ -852,6 +854,8 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
> >>>                 *val = state->src_h;
> >>>         } else if (property == plane->alpha_property) {
> >>>                 *val = state->alpha;
> >>> +       } else if (property == plane->blend_mode_property) {
> >>> +               *val = state->pixel_blend_mode;
> >>>         } else if (property == plane->rotation_property) {
> >>>                 *val = state->rotation;
> >>>         } else if (property == plane->zpos_property) {
> >>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> >>> index 130da51..7f5d463 100644
> >>> --- a/drivers/gpu/drm/drm_atomic_helper.c
> >>> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> >>> @@ -3515,6 +3515,7 @@ void drm_atomic_helper_plane_reset(struct drm_plane *plane)
> >>>                 /* Reset the alpha value to fully opaque if it matters */
> >>>                 if (plane->alpha_property)
> >>>                         plane->state->alpha = plane->alpha_property->values[1];
> >>> +               plane->state->pixel_blend_mode = DRM_MODE_BLEND_PREMULTI;
> >>>         }
> >>>  }
> >>>  EXPORT_SYMBOL(drm_atomic_helper_plane_reset);
> >>> diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
> >>> index a16a74d..ac6f19c 100644
> >>> --- a/drivers/gpu/drm/drm_blend.c
> >>> +++ b/drivers/gpu/drm/drm_blend.c
> >>> @@ -107,6 +107,52 @@
> >>>   *     planes. Without this property the primary plane is always below the cursor
> >>>   *     plane, and ordering between all other planes is undefined.
> >>>   *
> >>> + * pixel blend mode:
> >>> + *     Pixel blend mode is set up with drm_plane_create_blend_mode_property().
> >>> + *     It adds a blend mode for alpha blending equation selection, describing
> >>> + *     how the pixels from the current plane are composited with the
> >>> + *     background.
> >>> + *
> >>> + *      Three alpha blending equations are defined:
> >>> + *
> >>> + *      "None":
> >>> + *              Blend formula that ignores the pixel alpha::
> >>> + *
> >>> + *                      out.rgb = plane_alpha * fg.rgb +
> >>> + *                              (1 - plane_alpha) * bg.rgb
> >>> + *
> >>> + *      "Pre-multiplied":
> >>> + *              Blend formula that assumes the pixel color values
> >>> + *              have been already pre-multiplied with the alpha
> >>> + *              channel values::
> >>> + *
> >>> + *                      out.rgb = plane_alpha * fg.rgb +
> >>> + *                              (1 - (plane_alpha * fg.alpha)) * bg.rgb
> >>> + *
> >>> + *      "Coverage":
> >>> + *              Blend formula that assumes the pixel color values have not
> >>> + *              been pre-multiplied and will do so when blending them to the
> >>> + *              background color values::
> >>> + *
> >>> + *                      out.rgb = plane_alpha * fg.alpha * fg.rgb +
> >>> + *                              (1 - (plane_alpha * fg.alpha)) * bg.rgb
> >>> + *
> >>> + *      Using the following symbols:
> >>> + *
> >>> + *      ``fg.rgb``:
> >>> + *              Each of the RGB component values from the plane's pixel
> >>> + *      ``fg.alpha``:
> >>> + *              Alpha component value from the plane's pixel. If the plane's
> >>> + *              pixel format has no alpha component, then this is assumed to be
> >>> + *              1.0. In these cases, this property has no effect, as all three
> >>> + *              equations become equivalent.
> >>> + *      ``bg.rgb``:
> >>> + *              Each of the RGB component values from the background
> >>> + *      ``plane_alpha``:
> >>> + *              Plane alpha value set by the plane "alpha" property. If the
> >>> + *              plane does not expose the "alpha" property, then this is
> >>> + *              assumed to be 1.0
> >>> + *
> >>>   * Note that all the property extensions described here apply either to the
> >>>   * plane or the CRTC (e.g. for the background color, which currently is not
> >>>   * exposed and assumed to be black).
> >>> @@ -448,3 +494,83 @@ int drm_atomic_normalize_zpos(struct drm_device *dev,
> >>>         return 0;
> >>>  }
> >>>  EXPORT_SYMBOL(drm_atomic_normalize_zpos);
> >>> +
> >>> +/**
> >>> + * drm_plane_create_blend_mode_property - create a new blend mode property
> >>> + * @plane: drm plane
> >>> + * @supported_modes: bitmask of supported modes, must include
> >>> + *                  BIT(DRM_MODE_BLEND_PREMULTI). Current DRM assumption is
> >>> + *                  that alpha is premultiplied, and old userspace can break if
> >>> + *                  the property defaults to coverage.
> >>> + *
> >> Thanks for the explanation Lowry.
> >> Sigh, old userspace :-\
> >>
> >> One pedantic suggestion s/defaults to coverage/defaults to anything else/
> >> Since defaulting to "none" or any future blend mode is also a no-go.
> >>
> >> I wouldn't bother resending solely for ^^. Perhaps squash locally
> >> before merging?
> >>
> >> With that, the patch is
> >> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
> >>
> >> -Emil
> > Hi Emil,
> >
> > Thanks a lot for your review and will change that.
> 
> Ping? Any updates?
> 
> ~Maarten
Hi Maarten,

So far the merge request on user space patch has been verified by John
Stultz. The comments from Sean has been fixed and now we are waiting the
reviewed-tag from Sean. Once it merged, we'll send a new kernel patch to
review.

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

  reply	other threads:[~2018-08-14  3:11 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01 12:41 [PATCH v3 0/2] drm/blend: Add per-plane pixel blend mode property Lowry Li
2018-06-01 12:41 ` Lowry Li
2018-06-01 12:41 ` [PATCH v3 1/2] drm: " Lowry Li
2018-06-01 12:41   ` Lowry Li
2018-06-04 13:49   ` Emil Velikov
2018-06-04 13:49     ` Emil Velikov
2018-06-05  9:07     ` Lowry Li
     [not found]     ` <20180605090729.GA2686@lowry.li@arm.com>
2018-08-13 10:49       ` Maarten Lankhorst
2018-08-13 10:49         ` Maarten Lankhorst
2018-08-14  3:11         ` Lowry Li [this message]
     [not found]         ` <20180814031102.GA8541@lowry.li@arm.com>
2018-08-14  9:15           ` Maarten Lankhorst
2018-08-14  9:15             ` Maarten Lankhorst
2018-08-14  9:22             ` Lowry Li
2018-08-14  9:28             ` Daniel Vetter
2018-08-14 11:38     ` Lowry Li
2018-06-04 13:49   ` [PATCH i-g-t 1/2] lib/igt_kms: Add set_prop_enum for mode objects Maarten Lankhorst
2018-06-04 13:49     ` [igt-dev] " Maarten Lankhorst
2018-06-04 13:49     ` [PATCH i-g-t 2/2] tests: Add kms plane alpha blending test Maarten Lankhorst
2018-06-04 13:50   ` [PATCH] drm/i915: Add plane alpha blending support based on RFC Maarten Lankhorst
2018-06-04 14:29     ` [igt-dev] " Ville Syrjälä
2018-06-04 14:29       ` Ville Syrjälä
2018-06-04 16:27       ` Maarten Lankhorst
2018-06-04 16:27         ` Maarten Lankhorst
2018-06-04 16:47         ` Ville Syrjälä
2018-06-04 16:47           ` Ville Syrjälä
2018-06-01 12:41 ` [PATCH v3 2/2] drm/mali-dp: Implement plane alpha and pixel blend on malidp Lowry Li
2018-06-01 12:41   ` Lowry Li

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='24287.3342395344$1534216161@news.gmane.org' \
    --to=lowry.li@arm.com \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=malidp@foss.arm.com \
    --cc=nd@arm.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.