From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: Adrian Salido <salidoa@google.com>, Stefan Schake <stschake@gmail.com>
Subject: [PATCH] drm: Document the alpha blending rules
Date: Thu, 22 Mar 2018 11:14:17 +0200 [thread overview]
Message-ID: <20180322091417.18072-1-ville.syrjala@linux.intel.com> (raw)
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Document the fact that the use of a framebuffer with alpha implies
pre-multipled alpha blending, and that the crtc background color
is assumed to be black.
Not sure drm_fourcc.h is the best place for the uapi docs, but
couldn't think of anything better really.
Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Stefan Schake <stschake@gmail.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Adrian Salido <salidoa@google.com>
Cc: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/drm_plane.c | 6 ++++++
include/uapi/drm/drm_fourcc.h | 7 +++++++
2 files changed, 13 insertions(+)
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 143041666096..21e3a560811d 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -48,6 +48,12 @@
*
* The type of a plane is exposed in the immutable "type" enumeration property,
* which has one of the following values: "Overlay", "Primary", "Cursor".
+ *
+ * Use of a framebuffer with alpha implies that the plane will use
+ * pre-multiplied alpha blending: Dc = Sc + (1.0 - Sa) * Dc,
+ * where Sa is source alpha, Sc is source color, and Dc is destination
+ * color. The crtc background color below all the planes is assumed to
+ * be black.
*/
static unsigned int drm_num_planes(struct drm_device *dev)
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index e04613d30a13..8b889a6adcd4 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -35,6 +35,13 @@ extern "C" {
#define DRM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */
+/*
+ * Note that using any format with alpha (A) implies pre-multiplied
+ * alpha blending: Dc = Sc + (1.0 - Sa) * Dc, where Sa is source alpha,
+ * Sc is source color, and Dc is destination color. The crtc background
+ * color below all the planes is assumed to be black.
+ */
+
/* color index */
#define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */
--
2.16.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2018-03-22 9:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-22 9:14 Ville Syrjala [this message]
2018-03-22 9:37 ` [PATCH] drm: Document the alpha blending rules Daniel Vetter
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=20180322091417.18072-1-ville.syrjala@linux.intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=salidoa@google.com \
--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