From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Damien Lespiau <damien.lespiau@intel.com>
Cc: intel-gfx@lists.freedesktop.org,
Akash Goel <akash.goel@intel.com>,
ville.syrjala@intel.comg, Daniel Vetter <daniel@ffwl.ch>
Subject: Re: [PATCH 0/4] Adding support for plane alpha/color blending through drm property
Date: Wed, 2 Apr 2014 22:36:25 +0300 [thread overview]
Message-ID: <20140402193625.GR21652@intel.com> (raw)
In-Reply-To: <20140321192331.GD24812@strange.amr.corp.intel.com>
On Fri, Mar 21, 2014 at 07:23:31PM +0000, Damien Lespiau wrote:
> On Fri, Mar 21, 2014 at 07:06:46PM +0530, Sagar Arun Kamble wrote:
> > Hi Damien,
> >
> > On Thu, 2014-03-20 at 14:45 +0000, Damien Lespiau wrote:
> > > On Thu, Mar 20, 2014 at 02:11:40PM +0000, Damien Lespiau wrote:
> > > > (source is premultiplied)
> > > >
> > > > RGBA = ADD(SRC_COLOR*SRC_ALPHA, DST_COLOR*ONE_MINUS_SRC_ALPHA)
> > >
> > > Grr, copy/paste error. If the source is already premultiplied:
> > >
> > > RGBA = ADD(SRC_COLOR, DST_COLOR*ONE_MINUS_SRC_ALPHA)
> > >
> >
> > 1. Currently there is no interface to advertise the DRM_FORMATS plane
> > supportes to user mode? Should we add new IOCTL for that and include
> > pre-multiplied alpha formats while advertising? Or am I missing any such
> > API already available?
>
> There's a 'formats' array in drmModePlane.
>
> > 2. About constant alpha property - when we program constant alpha
> > register will hardware be able to take care of the blending as per
> > equations you have specified for non-premultiplied-alpha and
> > premultiplied-alpha cases or we have to do any additional setting?
> > Confusion is because of two combinations:
> > a. pre-multiplied alpha+constant alpha
> > b. non-pre-multiplied alpha+constant alpha
>
> The first part of the question should be in the spec. I really do expect
> the hw to work correctly with any combination of (premul, non-premult) x
> (plane alpha, no plane alpha)
>
> To be more clear: I don't think the glBlendFunc constants can represent
> everything we want:
>
> - It'd need to differentiate what we want do to between RGB and A (the
> same reason glBlendFuncSeparate was introduced).
We won't be writing out the alpha anywhere so I'm thinking we don't need
to worry about it.
>
> - We can't represent blending of an unpremultied fb with a plane-global
> alpha with just the GL blending equation as it needs two
> multiplications (so in GL, you would do one of them in the fragment
> shader).
If I'm interpreting the docs correctly these are the kind of blend equations
we will have soonish:
Sc = Sc
Dc = Sc * Ca + (1-Ca) * Dc
Sc = Sc
Dc = Sc * 1 + (1-Sa) * Dc
premultiplied?
0: Sc = Sc * Sa
1: Sc = Sc
Dc = Sc * Sa*Ca + (1-Sa*Ca) * Dc
premultiplied?
0: Sc = Sc * Sa
1: Sc = Sc
Dc = Sc * 1 + (1-Sa) * Dc
For reference OMAP36xx was something like this I think:
premultiplied?
0: Sc = Sc * Sa
1: Sc = Sc
Dc = Sc * Ca + (1-Sa*Ca) * Dc
and OMAP34xx was something like this:
Sc = Sc
Dc = Sc * Sa*Ca + (1-Sa*Ca) * Dc
So we have src factors of:
1, Ca, Sa*Ca
and dst factors of:
0, 1-Ca, 1-Sa, 1-Sa*Ca
If we add the missing Sa src factor we have a fairly sensible looking
set. Obviously the constant alpha related factors aren't part of GL,
but I don't think we need to worry about that, we're not implementing
GL here after all, just something that resembles it a bit to make it
easier for people to grasp it.
So to make stuff easier for userspace to figure out what we actually
support, I'm thinking it could be just an enum property with the values
being something like '(dstf << 32) | (srcf << 0)' with the factors
defined something like so:
enum {
ZERO,
ONE,
SRC_ALPHA,
ONE_MINUS_SRC_ALPHA,
CONST_ALPHA,
ONE_MINUS_CONST_ALPHA,
SRC_CONST_ALPHA,
ONE_MINUS_SRC_CONST_ALPHA,
};
If it's an enum then the user can just pick out one of the
supported blend equations.
> I would just proceed with a premultipled FB format and the alpha plane
> property.
I'm not very enthusiastic about adding the pre-multiplied info to
the FB. That means adding new versions of all the alpha formats we
already have. I almost regret making the A vs. X distinction already.
Might have been neater to leave it entirely up to the blending
properties to figure out whether there's alpha or not.
The one not so annoying option would be to snatch one of the remaining
high bits and use that to indicate premult or not. But we still need to
figure out whether we make the already existing formats be the
premultiplied or non-premultiplied ones. That could have some implication
for user space as we probably can't radically change which formats we
accept to keep existing userspace functional.
So the other option is to not think of it as a property of the
framebuffer, but rather think of it in terms of what operations the
hardware will perform during blending. That way we could just add a flag
which says "yes please, premultiply the data for me".
One thing I didn't much think about is whether we need per-plane blend
functions. That would be the more flexible option, but at least the
current hardware doesn't seem to allow such flexibility. I guess being
future proof shouldn't hurt. We do have the option of per-plane
premultiplication at least. Hmm, actually I have to take that back as
the first two example functions I listed can appear simultaneosly
AFAICS. So this does make things a bit more complicated for userspace
as it can't freely pick blend functions when dealing with multiple
planes. Oh and also for OMAPs the bottom plane wouldn't be blended with
the background AFAICS, so it would always have a blend function of
ONE,ZERO.
OK, so that's my thoughts on the matter. Pardon me if I repeated some
nonsense that has already been shot down. I didn't have time to look at
the actual patches yet.
--
Ville Syrjälä
Intel OTC
next prev parent reply other threads:[~2014-04-02 19:36 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-19 10:08 [RFC 1/1] drm/i915: Added support for setting plane alpha through drm property sagar.a.kamble
2014-02-24 15:44 ` Sagar Arun Kamble
2014-03-06 12:03 ` Damien Lespiau
2014-03-06 12:09 ` Damien Lespiau
2014-02-25 18:18 ` Ville Syrjälä
2014-03-04 9:42 ` [Intel-gfx] " Daniel Vetter
2014-03-04 12:06 ` Ville Syrjälä
2014-03-06 10:28 ` [Intel-gfx] " Sagar Arun Kamble
2014-03-06 11:24 ` Daniel Vetter
2014-03-08 8:21 ` [PATCH 0/4] Adding support for plane alpha/color blending " sagar.a.kamble
2014-03-08 8:21 ` [PATCH 1/4] drm: Added plane alpha and color blending property sagar.a.kamble
2014-03-20 11:58 ` Damien Lespiau
2014-03-20 14:21 ` [Intel-gfx] " Damien Lespiau
2014-03-08 8:21 ` [PATCH 2/4] drm/i915: Enabling constant alpha drm property sagar.a.kamble
2014-03-20 13:51 ` Damien Lespiau
2014-03-25 14:32 ` [PATCH v2 1/4] drm: Adding new flag to restrict bitmask drm properties as 32 bit type and 32 bit value pair sagar.a.kamble
2014-03-25 14:32 ` [PATCH v2 2/4] drm: Added plane alpha and color blending property sagar.a.kamble
2014-03-25 14:32 ` [PATCH v2 3/4] drm/i915: Enabling constant alpha drm property sagar.a.kamble
2014-04-01 4:51 ` Sagar Arun Kamble
2014-04-02 6:12 ` Sagar Arun Kamble
2014-04-03 5:43 ` Sagar Arun Kamble
2014-04-15 9:44 ` Sagar Arun Kamble
2014-04-15 10:35 ` Ville Syrjälä
2014-04-15 11:23 ` Sagar Arun Kamble
2014-04-15 11:44 ` Ville Syrjälä
2014-03-25 14:32 ` [PATCH v2 4/4] Documentation: drm: describing plane alpha and color blending property sagar.a.kamble
2014-03-26 12:30 ` David Herrmann
2014-03-27 9:03 ` [PATCH v3 1/1] " sagar.a.kamble
2014-03-27 9:50 ` sagar.a.kamble
2014-03-27 12:38 ` David Herrmann
2014-03-27 17:31 ` [PATCH v4 " sagar.a.kamble
2014-04-10 10:39 ` [PATCH v2 1/4] drm: Adding new flag to restrict bitmask drm properties as 32 bit type and 32 bit value pair Sagar Arun Kamble
2014-03-08 8:21 ` [PATCH 3/4] drm/i915: Enabling pre-multiplied alpha drm property sagar.a.kamble
2014-03-19 15:10 ` Damien Lespiau
2014-03-20 9:59 ` Sagar Arun Kamble
2014-03-20 11:38 ` Damien Lespiau
2014-03-20 13:51 ` Daniel Vetter
2014-03-20 14:00 ` Damien Lespiau
2014-03-08 8:21 ` [PATCH 4/4] Documentation: drm: describing plane alpha and color blending property sagar.a.kamble
2014-03-10 14:43 ` Laurent Pinchart
2014-03-20 14:11 ` [PATCH 0/4] Adding support for plane alpha/color blending through drm property Damien Lespiau
2014-03-20 14:45 ` Damien Lespiau
2014-03-21 13:36 ` Sagar Arun Kamble
2014-03-21 19:23 ` Damien Lespiau
2014-04-02 19:36 ` Ville Syrjälä [this message]
2014-03-25 10:03 ` Sagar Arun Kamble
2014-03-25 10:51 ` Daniel Vetter
2014-03-25 12:26 ` Damien Lespiau
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=20140402193625.GR21652@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=akash.goel@intel.com \
--cc=damien.lespiau@intel.com \
--cc=daniel@ffwl.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ville.syrjala@intel.comg \
/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