From: sagar.a.kamble@intel.com
To: intel-gfx@lists.freedesktop.org
Cc: Sagar Kamble <sagar.a.kamble@intel.com>,
airlied@linux.ie, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/4] drm: Added plane alpha and color blending property
Date: Tue, 25 Mar 2014 20:02:25 +0530 [thread overview]
Message-ID: <1395757947-16492-2-git-send-email-sagar.a.kamble@intel.com> (raw)
In-Reply-To: <1395757947-16492-1-git-send-email-sagar.a.kamble@intel.com>
From: Sagar Kamble <sagar.a.kamble@intel.com>
This patch creates a generic blending bitmask property modeled after
glBlendFunc. Drivers may support subset of these values.
v2: Removing blend properties that are not applicable
[Damien's Review Comments].
Adding DRM_MODE_PROP_32BIT_PAIR flag to blend property.
Cc: airlied@linux.ie
Cc: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Sagar Kamble <sagar.a.kamble@intel.com>
---
drivers/gpu/drm/drm_crtc.c | 27 +++++++++++++++++++++++++++
include/drm/drm_crtc.h | 19 +++++++++++++++++++
2 files changed, 46 insertions(+)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index d0d03ec..a1f254e 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -4157,3 +4157,30 @@ void drm_mode_config_cleanup(struct drm_device *dev)
idr_destroy(&dev->mode_config.crtc_idr);
}
EXPORT_SYMBOL(drm_mode_config_cleanup);
+
+struct drm_property *drm_mode_create_blend_property(struct drm_device *dev,
+ unsigned int supported_factors)
+{
+ static const struct drm_prop_enum_list props[] = {
+ { DRM_BLEND_ZERO, "zero" },
+ { DRM_BLEND_ONE, "one" },
+ { DRM_BLEND_SRC_COLOR, "src-color" },
+ { DRM_BLEND_ONE_MINUS_SRC_COLOR, "one-minus-src-color" },
+ { DRM_BLEND_DST_COLOR, "dst-color" },
+ { DRM_BLEND_ONE_MINUS_DST_COLOR, "one-minus-dst-color" },
+ { DRM_BLEND_SRC_ALPHA, "src-alpha" },
+ { DRM_BLEND_ONE_MINUS_SRC_ALPHA, "one-minus-src-alpha" },
+ { DRM_BLEND_DST_ALPHA, "dst-alpha" },
+ { DRM_BLEND_ONE_MINUS_DST_ALPHA, "one-minus-dst-alpha" },
+ { DRM_BLEND_CONSTANT_COLOR, "constant-color" },
+ { DRM_BLEND_ONE_MINUS_CONSTANT_COLOR, "one-minus-constant-color" },
+ { DRM_BLEND_CONSTANT_ALPHA, "constant-alpha" },
+ { DRM_BLEND_ONE_MINUS_CONSTANT_ALPHA, "one-minus-constant-alpha" },
+ { DRM_BLEND_SRC_ALPHA_SATURATE, "alpha-saturate" }
+ };
+
+ return drm_property_create_bitmask(dev, DRM_MODE_PROP_32BIT_PAIR, "blend",
+ props, ARRAY_SIZE(props),
+ supported_factors);
+}
+EXPORT_SYMBOL(drm_mode_create_blend_property);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 784a568..a9fbfec 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -65,6 +65,23 @@ struct drm_object_properties {
uint64_t values[DRM_OBJECT_MAX_PROPERTY];
};
+/* Blending property bits */
+#define DRM_BLEND_ZERO 0
+#define DRM_BLEND_ONE 1
+#define DRM_BLEND_SRC_COLOR 2
+#define DRM_BLEND_ONE_MINUS_SRC_COLOR 3
+#define DRM_BLEND_DST_COLOR 4
+#define DRM_BLEND_ONE_MINUS_DST_COLOR 5
+#define DRM_BLEND_SRC_ALPHA 6
+#define DRM_BLEND_ONE_MINUS_SRC_ALPHA 7
+#define DRM_BLEND_DST_ALPHA 8
+#define DRM_BLEND_ONE_MINUS_DST_ALPHA 9
+#define DRM_BLEND_CONSTANT_COLOR 10
+#define DRM_BLEND_ONE_MINUS_CONSTANT_COLOR 11
+#define DRM_BLEND_CONSTANT_ALPHA 12
+#define DRM_BLEND_ONE_MINUS_CONSTANT_ALPHA 13
+#define DRM_BLEND_SRC_ALPHA_SATURATE 14
+
/*
* Note on terminology: here, for brevity and convenience, we refer to connector
* control chips as 'CRTCs'. They can control any type of connector, VGA, LVDS,
@@ -1179,6 +1196,8 @@ extern int drm_format_plane_cpp(uint32_t format, int plane);
extern int drm_format_horz_chroma_subsampling(uint32_t format);
extern int drm_format_vert_chroma_subsampling(uint32_t format);
extern const char *drm_get_format_name(uint32_t format);
+extern struct drm_property *drm_mode_create_blend_property(struct drm_device *dev,
+ unsigned int supported_factors);
/* Helpers */
static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
--
1.8.5
next prev parent reply other threads:[~2014-03-25 14:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20140320135151.GO6912@strange.amr.corp.intel.com>
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 ` sagar.a.kamble [this message]
2014-04-10 10:39 ` Sagar Arun Kamble
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=1395757947-16492-2-git-send-email-sagar.a.kamble@intel.com \
--to=sagar.a.kamble@intel.com \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®