diff mbox

[13/14] drm/i915: Add NV12 as supported format for sprite plane

Message ID 1507637878-17165-14-git-send-email-vidya.srinivas@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Srinivas, Vidya Oct. 10, 2017, 12:17 p.m. UTC
From: Chandra Konduru <chandra.konduru@intel.com>

This patch adds NV12 to list of supported formats for sprite plane.

v2: Rebased (me)

v3: Review comments by Ville addressed
	- Removed skl_plane_formats_with_nv12 and added
	NV12 case in existing skl_plane_formats
	- Added the 10bpc RGB formats

v4: Addressed review comments from Clinton A Taylor
	"Why are we adding 10 bit RGB formats with the NV12 series patches?
	Trying to set XR30 or AB30 results in error returned even though
	the modes are advertised for the planes"
	- Removed 10bit RGB formats added previously with NV12 series

v5: Missed the Tested-by/Reviewed-by in the previous series
	Adding the same to commit message in this version.
	Addressed review comments from Clinton A Taylor
	"Why are we adding 10 bit RGB formats with the NV12 series patches?
	Trying to set XR30 or AB30 results in error returned even though
	the modes are advertised for the planes"
	- Previous version has 10bit RGB format removed from VLV formats
	by mistake. Fixing that in this version.
	Removed 10bit RGB formats added previously with NV12 series
	for SKL.

v6: Addressed review comments by Ville
	Restricting the NV12 to BXT and PIPE A and B

v7: Rebased (me)

v8: Rebased (me)
	Restricting NV12 changes to BXT and KBL
	Restricting NV12 changes for plane 0 (overlay)

Tested-by: Clinton Taylor <clinton.a.taylor@intel.com>
Reviewed-by: Clinton Taylor <clinton.a.taylor@intel.com>
Signed-off-by: Chandra Konduru <chandra.konduru@intel.com>
Signed-off-by: Nabendu Maiti <nabendu.bikash.maiti@intel.com>
Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com>
---
 drivers/gpu/drm/i915/intel_sprite.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

Comments

Kristian Høgsberg Oct. 16, 2017, 10:35 p.m. UTC | #1
Vidya Srinivas <vidya.srinivas@intel.com> writes:

> From: Chandra Konduru <chandra.konduru@intel.com>
>
> This patch adds NV12 to list of supported formats for sprite plane.
>
> v2: Rebased (me)
>
> v3: Review comments by Ville addressed
> 	- Removed skl_plane_formats_with_nv12 and added
> 	NV12 case in existing skl_plane_formats
> 	- Added the 10bpc RGB formats
>
> v4: Addressed review comments from Clinton A Taylor
> 	"Why are we adding 10 bit RGB formats with the NV12 series patches?
> 	Trying to set XR30 or AB30 results in error returned even though
> 	the modes are advertised for the planes"
> 	- Removed 10bit RGB formats added previously with NV12 series
>
> v5: Missed the Tested-by/Reviewed-by in the previous series
> 	Adding the same to commit message in this version.
> 	Addressed review comments from Clinton A Taylor
> 	"Why are we adding 10 bit RGB formats with the NV12 series patches?
> 	Trying to set XR30 or AB30 results in error returned even though
> 	the modes are advertised for the planes"
> 	- Previous version has 10bit RGB format removed from VLV formats
> 	by mistake. Fixing that in this version.
> 	Removed 10bit RGB formats added previously with NV12 series
> 	for SKL.
>
> v6: Addressed review comments by Ville
> 	Restricting the NV12 to BXT and PIPE A and B
>
> v7: Rebased (me)
>
> v8: Rebased (me)
> 	Restricting NV12 changes to BXT and KBL
> 	Restricting NV12 changes for plane 0 (overlay)
>
> Tested-by: Clinton Taylor <clinton.a.taylor@intel.com>
> Reviewed-by: Clinton Taylor <clinton.a.taylor@intel.com>
> Signed-off-by: Chandra Konduru <chandra.konduru@intel.com>
> Signed-off-by: Nabendu Maiti <nabendu.bikash.maiti@intel.com>
> Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_sprite.c | 24 +++++++++++++++++++++---
>  1 file changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 6f98bc5..7e9cfe1 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -1196,6 +1196,19 @@ static bool intel_sprite_plane_format_mod_supported(struct drm_plane *plane,
>          .format_mod_supported = intel_sprite_plane_format_mod_supported,
>  };
>  
> +static uint32_t nv12_plane_formats[] = {
> +	DRM_FORMAT_RGB565,
> +	DRM_FORMAT_ABGR8888,
> +	DRM_FORMAT_ARGB8888,
> +	DRM_FORMAT_XBGR8888,
> +	DRM_FORMAT_XRGB8888,
> +	DRM_FORMAT_YUYV,
> +	DRM_FORMAT_YVYU,
> +	DRM_FORMAT_UYVY,
> +	DRM_FORMAT_VYUY,
> +	DRM_FORMAT_NV12,
> +};

As for intel_display.c you need to extend
skl_sprite_plane_format_mod_supported() with a case for DRM_FORMAT_NV12
so that KMS can advertise the supported modifiers for NV12.

Kristian


> +
>  struct intel_plane *
>  intel_sprite_plane_create(struct drm_i915_private *dev_priv,
>  			  enum pipe pipe, int plane)
> @@ -1238,9 +1251,14 @@ struct intel_plane *
>  
>  		intel_plane->update_plane = skl_update_plane;
>  		intel_plane->disable_plane = skl_disable_plane;
> -
> -		plane_formats = skl_plane_formats;
> -		num_plane_formats = ARRAY_SIZE(skl_plane_formats);
> +		if ((IS_BROXTON(dev_priv) || IS_KABYLAKE(dev_priv)) &&
> +			(pipe == PIPE_A || pipe == PIPE_B) && plane == 0) {
> +			plane_formats = nv12_plane_formats;
> +			num_plane_formats = ARRAY_SIZE(nv12_plane_formats);
> +		} else {
> +			plane_formats = skl_plane_formats;
> +			num_plane_formats = ARRAY_SIZE(skl_plane_formats);
> +		}
>  		modifiers = skl_plane_format_modifiers;
>  	} else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
>  		intel_plane->can_scale = false;
> -- 
> 1.9.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Srinivas, Vidya Oct. 17, 2017, 3:58 a.m. UTC | #2
> -----Original Message-----
> From: Kristian Kristensen [mailto:hoegsberg@gmail.com]
> Sent: Tuesday, October 17, 2017 4:05 AM
> To: Srinivas, Vidya <vidya.srinivas@intel.com>; intel-
> gfx@lists.freedesktop.org
> Cc: Srinivas, Vidya <vidya.srinivas@intel.com>
> Subject: Re: [Intel-gfx] [PATCH 13/14] drm/i915: Add NV12 as supported
> format for sprite plane
> 
> Vidya Srinivas <vidya.srinivas@intel.com> writes:
> 
> > From: Chandra Konduru <chandra.konduru@intel.com>
> >
> > This patch adds NV12 to list of supported formats for sprite plane.
> >
> > v2: Rebased (me)
> >
> > v3: Review comments by Ville addressed
> > 	- Removed skl_plane_formats_with_nv12 and added
> > 	NV12 case in existing skl_plane_formats
> > 	- Added the 10bpc RGB formats
> >
> > v4: Addressed review comments from Clinton A Taylor
> > 	"Why are we adding 10 bit RGB formats with the NV12 series
> patches?
> > 	Trying to set XR30 or AB30 results in error returned even though
> > 	the modes are advertised for the planes"
> > 	- Removed 10bit RGB formats added previously with NV12 series
> >
> > v5: Missed the Tested-by/Reviewed-by in the previous series
> > 	Adding the same to commit message in this version.
> > 	Addressed review comments from Clinton A Taylor
> > 	"Why are we adding 10 bit RGB formats with the NV12 series
> patches?
> > 	Trying to set XR30 or AB30 results in error returned even though
> > 	the modes are advertised for the planes"
> > 	- Previous version has 10bit RGB format removed from VLV formats
> > 	by mistake. Fixing that in this version.
> > 	Removed 10bit RGB formats added previously with NV12 series
> > 	for SKL.
> >
> > v6: Addressed review comments by Ville
> > 	Restricting the NV12 to BXT and PIPE A and B
> >
> > v7: Rebased (me)
> >
> > v8: Rebased (me)
> > 	Restricting NV12 changes to BXT and KBL
> > 	Restricting NV12 changes for plane 0 (overlay)
> >
> > Tested-by: Clinton Taylor <clinton.a.taylor@intel.com>
> > Reviewed-by: Clinton Taylor <clinton.a.taylor@intel.com>
> > Signed-off-by: Chandra Konduru <chandra.konduru@intel.com>
> > Signed-off-by: Nabendu Maiti <nabendu.bikash.maiti@intel.com>
> > Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_sprite.c | 24 +++++++++++++++++++++---
> >  1 file changed, 21 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_sprite.c
> > b/drivers/gpu/drm/i915/intel_sprite.c
> > index 6f98bc5..7e9cfe1 100644
> > --- a/drivers/gpu/drm/i915/intel_sprite.c
> > +++ b/drivers/gpu/drm/i915/intel_sprite.c
> > @@ -1196,6 +1196,19 @@ static bool
> intel_sprite_plane_format_mod_supported(struct drm_plane *plane,
> >          .format_mod_supported =
> > intel_sprite_plane_format_mod_supported,
> >  };
> >
> > +static uint32_t nv12_plane_formats[] = {
> > +	DRM_FORMAT_RGB565,
> > +	DRM_FORMAT_ABGR8888,
> > +	DRM_FORMAT_ARGB8888,
> > +	DRM_FORMAT_XBGR8888,
> > +	DRM_FORMAT_XRGB8888,
> > +	DRM_FORMAT_YUYV,
> > +	DRM_FORMAT_YVYU,
> > +	DRM_FORMAT_UYVY,
> > +	DRM_FORMAT_VYUY,
> > +	DRM_FORMAT_NV12,
> > +};
> 
> As for intel_display.c you need to extend
> skl_sprite_plane_format_mod_supported() with a case for
> DRM_FORMAT_NV12 so that KMS can advertise the supported modifiers for
> NV12.
> 
> Kristian
> 

Thank you. I will add this in the next version before re-floating.

Regards
Vidya
> 
> > +
> >  struct intel_plane *
> >  intel_sprite_plane_create(struct drm_i915_private *dev_priv,
> >  			  enum pipe pipe, int plane)
> > @@ -1238,9 +1251,14 @@ struct intel_plane *
> >
> >  		intel_plane->update_plane = skl_update_plane;
> >  		intel_plane->disable_plane = skl_disable_plane;
> > -
> > -		plane_formats = skl_plane_formats;
> > -		num_plane_formats = ARRAY_SIZE(skl_plane_formats);
> > +		if ((IS_BROXTON(dev_priv) || IS_KABYLAKE(dev_priv)) &&
> > +			(pipe == PIPE_A || pipe == PIPE_B) && plane == 0) {
> > +			plane_formats = nv12_plane_formats;
> > +			num_plane_formats =
> ARRAY_SIZE(nv12_plane_formats);
> > +		} else {
> > +			plane_formats = skl_plane_formats;
> > +			num_plane_formats =
> ARRAY_SIZE(skl_plane_formats);
> > +		}
> >  		modifiers = skl_plane_format_modifiers;
> >  	} else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
> >  		intel_plane->can_scale = false;
> > --
> > 1.9.1
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 6f98bc5..7e9cfe1 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1196,6 +1196,19 @@  static bool intel_sprite_plane_format_mod_supported(struct drm_plane *plane,
         .format_mod_supported = intel_sprite_plane_format_mod_supported,
 };
 
+static uint32_t nv12_plane_formats[] = {
+	DRM_FORMAT_RGB565,
+	DRM_FORMAT_ABGR8888,
+	DRM_FORMAT_ARGB8888,
+	DRM_FORMAT_XBGR8888,
+	DRM_FORMAT_XRGB8888,
+	DRM_FORMAT_YUYV,
+	DRM_FORMAT_YVYU,
+	DRM_FORMAT_UYVY,
+	DRM_FORMAT_VYUY,
+	DRM_FORMAT_NV12,
+};
+
 struct intel_plane *
 intel_sprite_plane_create(struct drm_i915_private *dev_priv,
 			  enum pipe pipe, int plane)
@@ -1238,9 +1251,14 @@  struct intel_plane *
 
 		intel_plane->update_plane = skl_update_plane;
 		intel_plane->disable_plane = skl_disable_plane;
-
-		plane_formats = skl_plane_formats;
-		num_plane_formats = ARRAY_SIZE(skl_plane_formats);
+		if ((IS_BROXTON(dev_priv) || IS_KABYLAKE(dev_priv)) &&
+			(pipe == PIPE_A || pipe == PIPE_B) && plane == 0) {
+			plane_formats = nv12_plane_formats;
+			num_plane_formats = ARRAY_SIZE(nv12_plane_formats);
+		} else {
+			plane_formats = skl_plane_formats;
+			num_plane_formats = ARRAY_SIZE(skl_plane_formats);
+		}
 		modifiers = skl_plane_format_modifiers;
 	} else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
 		intel_plane->can_scale = false;