[06/11] drm/i915: Add NV12 as supported format for primary plane
diff mbox

Message ID 1430451795-9657-7-git-send-email-chandra.konduru@intel.com
State New
Headers show

Commit Message

Chandra Konduru May 1, 2015, 3:43 a.m. UTC
This patch adds NV12 to list of supported formats for
primary plane.

Signed-off-by: Chandra Konduru <chandra.konduru@intel.com>
Testcase: igt/kms_nv12
---
 drivers/gpu/drm/i915/intel_display.c |   32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

Comments

Daniel Vetter May 7, 2015, 6:56 a.m. UTC | #1
On Thu, Apr 30, 2015 at 08:43:10PM -0700, Chandra Konduru wrote:
> This patch adds NV12 to list of supported formats for
> primary plane.
> 
> Signed-off-by: Chandra Konduru <chandra.konduru@intel.com>
> Testcase: igt/kms_nv12
> ---
>  drivers/gpu/drm/i915/intel_display.c |   32 +++++++++++++++++++++++++++++++-
>  1 file changed, 31 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index c235a66..d3773d2 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -59,7 +59,7 @@ static const uint32_t intel_primary_formats_gen2[] = {
>  	DRM_FORMAT_ARGB1555,
>  };
>  
> -/* Primary plane formats for gen >= 4 */
> +/* Primary plane formats for gen 4 to 8 */
>  static const uint32_t intel_primary_formats_gen4[] = {
>  	COMMON_PRIMARY_FORMATS, \
>  	DRM_FORMAT_XBGR8888,
> @@ -70,6 +70,28 @@ static const uint32_t intel_primary_formats_gen4[] = {
>  	DRM_FORMAT_ABGR2101010,
>  };
>  
> +/* Primary plane formats for gen >= 9 */
> +static const uint32_t intel_primary_formats_gen9[] = {
> +	COMMON_PRIMARY_FORMATS, \
> +	DRM_FORMAT_XBGR8888,
> +	DRM_FORMAT_ABGR8888,
> +	DRM_FORMAT_XRGB2101010,
> +	DRM_FORMAT_ARGB2101010,
> +	DRM_FORMAT_XBGR2101010,
> +	DRM_FORMAT_ABGR2101010,
> +};
> +
> +static const uint32_t intel_primary_formats_with_nv12_gen9[] = {
> +	COMMON_PRIMARY_FORMATS, \
> +	DRM_FORMAT_XBGR8888,
> +	DRM_FORMAT_ABGR8888,
> +	DRM_FORMAT_XRGB2101010,
> +	DRM_FORMAT_ARGB2101010,
> +	DRM_FORMAT_XBGR2101010,
> +	DRM_FORMAT_ABGR2101010,
> +	DRM_FORMAT_NV12,
> +};

This duplication is a bit unpretty, and we already started to share code
with skl sprites to prep for the great unification of plane code for
gen9+. Can you please do the same with these tables? I also like the names
in intel_sprite.c more. Follow-up patch or squashed in both ok.
-Daniel

> +
>  /* Cursor formats */
>  static const uint32_t intel_cursor_formats[] = {
>  	DRM_FORMAT_ARGB8888,
> @@ -13204,6 +13226,14 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
>  	if (INTEL_INFO(dev)->gen <= 3) {
>  		intel_primary_formats = intel_primary_formats_gen2;
>  		num_formats = ARRAY_SIZE(intel_primary_formats_gen2);
> +	} else if (INTEL_INFO(dev)->gen >= 9) {
> +		if (pipe == PIPE_A || pipe == PIPE_B) {
> +			intel_primary_formats = intel_primary_formats_with_nv12_gen9;
> +			num_formats = ARRAY_SIZE(intel_primary_formats_with_nv12_gen9);
> +		} else {
> +			intel_primary_formats = intel_primary_formats_gen9;
> +			num_formats = ARRAY_SIZE(intel_primary_formats_gen9);
> +		}
>  	} else {
>  		intel_primary_formats = intel_primary_formats_gen4;
>  		num_formats = ARRAY_SIZE(intel_primary_formats_gen4);
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Chandra Konduru May 8, 2015, 2:29 a.m. UTC | #2
> > +/* Primary plane formats for gen >= 9 */
> > +static const uint32_t intel_primary_formats_gen9[] = {
> > +	COMMON_PRIMARY_FORMATS, \
> > +	DRM_FORMAT_XBGR8888,
> > +	DRM_FORMAT_ABGR8888,
> > +	DRM_FORMAT_XRGB2101010,
> > +	DRM_FORMAT_ARGB2101010,
> > +	DRM_FORMAT_XBGR2101010,
> > +	DRM_FORMAT_ABGR2101010,
> > +};
> > +
> > +static const uint32_t intel_primary_formats_with_nv12_gen9[] = {
> > +	COMMON_PRIMARY_FORMATS, \
> > +	DRM_FORMAT_XBGR8888,
> > +	DRM_FORMAT_ABGR8888,
> > +	DRM_FORMAT_XRGB2101010,
> > +	DRM_FORMAT_ARGB2101010,
> > +	DRM_FORMAT_XBGR2101010,
> > +	DRM_FORMAT_ABGR2101010,
> > +	DRM_FORMAT_NV12,
> > +};
> 
> This duplication is a bit unpretty, and we already started to share code
> with skl sprites to prep for the great unification of plane code for
> gen9+. Can you please do the same with these tables? I also like the names
> in intel_sprite.c more. Follow-up patch or squashed in both ok.
> -Daniel
Hi Daniel,
I planned to have single list with nv12 at the end of the list.
And in plane_init report the list as is for nv12 capable planes and
index-1 for non-nv12 planes.
But the earlier (a while ago) feedback from you is, duplication is
cheaper so duplicated them instead of playing trick with array index.
 
Regarding unification, currently skl_plane_formats[] has different formats 
than intel_primary_formats_gen9[]. To have a unified table for both primary
and sprite planes requires testing delta formats on both primary and sprite
planes respectively with respective i-g-t tests. This is not being planned as 
part of nv12 feature.

>
Daniel Vetter May 8, 2015, 7:13 a.m. UTC | #3
On Fri, May 08, 2015 at 02:29:30AM +0000, Konduru, Chandra wrote:
> > > +/* Primary plane formats for gen >= 9 */
> > > +static const uint32_t intel_primary_formats_gen9[] = {
> > > +	COMMON_PRIMARY_FORMATS, \
> > > +	DRM_FORMAT_XBGR8888,
> > > +	DRM_FORMAT_ABGR8888,
> > > +	DRM_FORMAT_XRGB2101010,
> > > +	DRM_FORMAT_ARGB2101010,
> > > +	DRM_FORMAT_XBGR2101010,
> > > +	DRM_FORMAT_ABGR2101010,
> > > +};
> > > +
> > > +static const uint32_t intel_primary_formats_with_nv12_gen9[] = {
> > > +	COMMON_PRIMARY_FORMATS, \
> > > +	DRM_FORMAT_XBGR8888,
> > > +	DRM_FORMAT_ABGR8888,
> > > +	DRM_FORMAT_XRGB2101010,
> > > +	DRM_FORMAT_ARGB2101010,
> > > +	DRM_FORMAT_XBGR2101010,
> > > +	DRM_FORMAT_ABGR2101010,
> > > +	DRM_FORMAT_NV12,
> > > +};
> > 
> > This duplication is a bit unpretty, and we already started to share code
> > with skl sprites to prep for the great unification of plane code for
> > gen9+. Can you please do the same with these tables? I also like the names
> > in intel_sprite.c more. Follow-up patch or squashed in both ok.
> > -Daniel
> Hi Daniel,
> I planned to have single list with nv12 at the end of the list.
> And in plane_init report the list as is for nv12 capable planes and
> index-1 for non-nv12 planes.
> But the earlier (a while ago) feedback from you is, duplication is
> cheaper so duplicated them instead of playing trick with array index.
>  
> Regarding unification, currently skl_plane_formats[] has different formats 
> than intel_primary_formats_gen9[]. To have a unified table for both primary
> and sprite planes requires testing delta formats on both primary and sprite
> planes respectively with respective i-g-t tests. This is not being planned as 
> part of nv12 feature.

Well someone eventually needs to do it, I hoped I could sign you up for
that ;-)
-Daniel

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index c235a66..d3773d2 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -59,7 +59,7 @@  static const uint32_t intel_primary_formats_gen2[] = {
 	DRM_FORMAT_ARGB1555,
 };
 
-/* Primary plane formats for gen >= 4 */
+/* Primary plane formats for gen 4 to 8 */
 static const uint32_t intel_primary_formats_gen4[] = {
 	COMMON_PRIMARY_FORMATS, \
 	DRM_FORMAT_XBGR8888,
@@ -70,6 +70,28 @@  static const uint32_t intel_primary_formats_gen4[] = {
 	DRM_FORMAT_ABGR2101010,
 };
 
+/* Primary plane formats for gen >= 9 */
+static const uint32_t intel_primary_formats_gen9[] = {
+	COMMON_PRIMARY_FORMATS, \
+	DRM_FORMAT_XBGR8888,
+	DRM_FORMAT_ABGR8888,
+	DRM_FORMAT_XRGB2101010,
+	DRM_FORMAT_ARGB2101010,
+	DRM_FORMAT_XBGR2101010,
+	DRM_FORMAT_ABGR2101010,
+};
+
+static const uint32_t intel_primary_formats_with_nv12_gen9[] = {
+	COMMON_PRIMARY_FORMATS, \
+	DRM_FORMAT_XBGR8888,
+	DRM_FORMAT_ABGR8888,
+	DRM_FORMAT_XRGB2101010,
+	DRM_FORMAT_ARGB2101010,
+	DRM_FORMAT_XBGR2101010,
+	DRM_FORMAT_ABGR2101010,
+	DRM_FORMAT_NV12,
+};
+
 /* Cursor formats */
 static const uint32_t intel_cursor_formats[] = {
 	DRM_FORMAT_ARGB8888,
@@ -13204,6 +13226,14 @@  static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
 	if (INTEL_INFO(dev)->gen <= 3) {
 		intel_primary_formats = intel_primary_formats_gen2;
 		num_formats = ARRAY_SIZE(intel_primary_formats_gen2);
+	} else if (INTEL_INFO(dev)->gen >= 9) {
+		if (pipe == PIPE_A || pipe == PIPE_B) {
+			intel_primary_formats = intel_primary_formats_with_nv12_gen9;
+			num_formats = ARRAY_SIZE(intel_primary_formats_with_nv12_gen9);
+		} else {
+			intel_primary_formats = intel_primary_formats_gen9;
+			num_formats = ARRAY_SIZE(intel_primary_formats_gen9);
+		}
 	} else {
 		intel_primary_formats = intel_primary_formats_gen4;
 		num_formats = ARRAY_SIZE(intel_primary_formats_gen4);