All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Lespiau <damien.lespiau@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 09/10] drm/i915/skl: Factor skl_plane_get_formats()
Date: Tue, 12 May 2015 16:13:21 +0100	[thread overview]
Message-ID: <1431443602-22886-10-git-send-email-damien.lespiau@intel.com> (raw)
In-Reply-To: <1431443602-22886-1-git-send-email-damien.lespiau@intel.com>

We can have a single function returns the list of formats. It's rather
simple for now but will be augmented with the NV12 work.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 27 ++++++++++++++++++++-------
 drivers/gpu/drm/i915/intel_drv.h     |  2 ++
 drivers/gpu/drm/i915/intel_sprite.c  | 20 +++-----------------
 3 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index c32abe1..980afae 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -74,13 +74,19 @@ static const uint32_t gen4_primary_formats[] = {
 	DRM_FORMAT_VYUY,
 };
 
-
-static const uint32_t skl_primary_formats[] = {
-	COMMON_PRIMARY_FORMATS, \
-	DRM_FORMAT_XBGR8888,
+static uint32_t skl_plane_formats[] = {
+	DRM_FORMAT_C8,
+	DRM_FORMAT_RGB565,
 	DRM_FORMAT_ABGR8888,
-	DRM_FORMAT_XRGB2101010,
+	DRM_FORMAT_ARGB8888,
+	DRM_FORMAT_XBGR8888,
+	DRM_FORMAT_XRGB8888,
 	DRM_FORMAT_XBGR2101010,
+	DRM_FORMAT_XRGB2101010,
+	DRM_FORMAT_YUYV,
+	DRM_FORMAT_YVYU,
+	DRM_FORMAT_UYVY,
+	DRM_FORMAT_VYUY,
 };
 
 /* Cursor formats */
@@ -2503,6 +2509,13 @@ static int i9xx_format_to_fourcc(int format)
 	}
 }
 
+void skl_plane_get_formats(int pipe, int plane,
+			   const uint32_t **formats, int *n_formats)
+{
+	*formats = skl_plane_formats;
+	*n_formats = ARRAY_SIZE(skl_plane_formats);
+}
+
 static int skl_format_to_fourcc(int format, bool rgb_order, bool alpha)
 {
 	switch (format) {
@@ -13301,8 +13314,8 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
 		primary->plane = !pipe;
 
 	if (INTEL_INFO(dev)->gen >= 9) {
-		intel_primary_formats = skl_primary_formats;
-		num_formats = ARRAY_SIZE(skl_primary_formats);
+		skl_plane_get_formats(pipe, 0,
+				      &intel_primary_formats, &num_formats);
 	} else if (INTEL_INFO(dev)->gen >= 4) {
 		intel_primary_formats = gen4_primary_formats;
 		num_formats = ARRAY_SIZE(gen4_primary_formats);
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 47bc729..0277ca6 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1143,6 +1143,8 @@ int skl_max_scale(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state);
 
 unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane,
 				     struct drm_i915_gem_object *obj);
+void skl_plane_get_formats(int pipe, int plane,
+			   const uint32_t **formats, int *n_formats);
 u32 skl_plane_ctl_format(uint32_t pixel_format);
 u32 skl_plane_ctl_tiling(uint64_t fb_modifier);
 u32 skl_plane_ctl_rotation(unsigned int rotation);
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index d510b60..21950f0 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1083,21 +1083,6 @@ static uint32_t vlv_plane_formats[] = {
 	DRM_FORMAT_VYUY,
 };
 
-static uint32_t skl_plane_formats[] = {
-	DRM_FORMAT_C8,
-	DRM_FORMAT_RGB565,
-	DRM_FORMAT_ABGR8888,
-	DRM_FORMAT_ARGB8888,
-	DRM_FORMAT_XBGR8888,
-	DRM_FORMAT_XRGB8888,
-	DRM_FORMAT_XBGR2101010,
-	DRM_FORMAT_XRGB2101010,
-	DRM_FORMAT_YUYV,
-	DRM_FORMAT_YVYU,
-	DRM_FORMAT_UYVY,
-	DRM_FORMAT_VYUY,
-};
-
 int
 intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 {
@@ -1169,8 +1154,9 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 		intel_plane->disable_plane = skl_disable_plane;
 		state->scaler_id = -1;
 
-		plane_formats = skl_plane_formats;
-		num_plane_formats = ARRAY_SIZE(skl_plane_formats);
+		/* plane + 1 because plane is the sprite number here */
+		skl_plane_get_formats(pipe, plane + 1,
+				      &plane_formats, &num_plane_formats);
 		break;
 	default:
 		kfree(intel_plane);
-- 
2.1.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2015-05-12 15:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12 15:13 [PATCH 00/10] Expose the same formats for SKL primary/sprite planes Damien Lespiau
2015-05-12 15:13 ` [PATCH 01/10] drm/i915/skl: Leave a new line between variable declarations and code Damien Lespiau
2015-05-14  5:19   ` Konduru, Chandra
2015-05-12 15:13 ` [PATCH 02/10] drm/i915/skl: Add a new line before return Damien Lespiau
2015-05-14  5:20   ` Konduru, Chandra
2015-05-12 15:13 ` [PATCH 03/10] drm/i915/skl: Rename a local variable to fit in 80 chars Damien Lespiau
2015-05-12 16:20   ` Ville Syrjälä
2015-05-14  5:20   ` Konduru, Chandra
2015-05-12 15:13 ` [PATCH 04/10] drm/i915/skl: Replace BUG() by MISSING_CASE() in skl_plane_ctl_format() Damien Lespiau
2015-05-14  5:24   ` Konduru, Chandra
2015-05-12 15:13 ` [PATCH 05/10] drm/i915/skl: Support the advertized index format Damien Lespiau
2015-05-14  5:24   ` Konduru, Chandra
2015-05-12 15:13 ` [PATCH 06/10] drm/i915: Don't use the intel_ prefix for gen-specific data Damien Lespiau
2015-05-12 16:04   ` Daniel Vetter
2015-05-12 16:09     ` Daniel Vetter
2015-05-12 15:13 ` [PATCH 07/10] drm/i915/skl: Don't advertize ARGB2101010 and ABGR2101010 Damien Lespiau
2015-05-12 16:13   ` Daniel Vetter
2015-05-12 16:18     ` Damien Lespiau
2015-05-12 16:48       ` Daniel Vetter
2015-05-12 16:29   ` Ville Syrjälä
2015-05-12 15:13 ` [PATCH 08/10] drm/i915/skl: Make primary and sprite plane advertize the same formats Damien Lespiau
2015-05-12 16:14   ` Daniel Vetter
2015-05-12 16:33   ` Ville Syrjälä
2015-05-12 15:13 ` Damien Lespiau [this message]
2015-05-12 15:13 ` [PATCH 10/10] drm/i915: Make the sprite formats const Damien Lespiau
2015-05-12 16:14   ` 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=1431443602-22886-10-git-send-email-damien.lespiau@intel.com \
    --to=damien.lespiau@intel.com \
    --cc=intel-gfx@lists.freedesktop.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 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.