diff mbox

[v4] drm/i915: Adding YUV444 packed format(DRM_FORMAT_AYUV) support.

Message ID 20180704094152.2445-1-stanislav.lisovskiy@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lisovskiy, Stanislav July 4, 2018, 9:41 a.m. UTC
From: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>

PLANE_CTL_FORMAT_AYUV is already supported, according to hardware
specification.

v2: Edited commit message, removed redundant whitespaces.

v3: Fixed fallthrough logic for the format switch cases.

v4: Yet again fixed fallthrough logic, to reuse code from other case
    labels.

Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 7 +++++++
 drivers/gpu/drm/i915/intel_sprite.c  | 1 +
 2 files changed, 8 insertions(+)

Comments

Daniel Vetter July 4, 2018, 1:53 p.m. UTC | #1
On Wed, Jul 04, 2018 at 12:41:52PM +0300, StanLis wrote:
> From: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> 
> PLANE_CTL_FORMAT_AYUV is already supported, according to hardware
> specification.
> 
> v2: Edited commit message, removed redundant whitespaces.
> 
> v3: Fixed fallthrough logic for the format switch cases.
> 
> v4: Yet again fixed fallthrough logic, to reuse code from other case
>     labels.
> 
> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>

Do we have userspace and igt testcases for this?
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_display.c | 7 +++++++
>  drivers/gpu/drm/i915/intel_sprite.c  | 1 +
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 56818a45181c..b121b3378aa2 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -86,6 +86,7 @@ static const uint32_t skl_primary_formats[] = {
>  	DRM_FORMAT_YVYU,
>  	DRM_FORMAT_UYVY,
>  	DRM_FORMAT_VYUY,
> +	DRM_FORMAT_AYUV,
>  };
>  
>  static const uint32_t skl_pri_planar_formats[] = {
> @@ -102,6 +103,7 @@ static const uint32_t skl_pri_planar_formats[] = {
>  	DRM_FORMAT_UYVY,
>  	DRM_FORMAT_VYUY,
>  	DRM_FORMAT_NV12,
> +	DRM_FORMAT_AYUV,
>  };
>  
>  static const uint64_t skl_format_modifiers_noccs[] = {
> @@ -3497,6 +3499,8 @@ static u32 skl_plane_ctl_format(uint32_t pixel_format)
>  		return PLANE_CTL_FORMAT_XRGB_2101010;
>  	case DRM_FORMAT_XBGR2101010:
>  		return PLANE_CTL_ORDER_RGBX | PLANE_CTL_FORMAT_XRGB_2101010;
> +	case DRM_FORMAT_AYUV:
> +		return PLANE_CTL_FORMAT_AYUV;
>  	case DRM_FORMAT_YUYV:
>  		return PLANE_CTL_FORMAT_YUV422 | PLANE_CTL_YUV422_YUYV;
>  	case DRM_FORMAT_YVYU:
> @@ -13371,6 +13375,7 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane,
>  	}
>  
>  	switch (format) {
> +
>  	case DRM_FORMAT_XRGB8888:
>  	case DRM_FORMAT_XBGR8888:
>  	case DRM_FORMAT_ARGB8888:
> @@ -13390,6 +13395,7 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane,
>  		if (modifier == I915_FORMAT_MOD_Yf_TILED)
>  			return true;
>  		/* fall through */
> +	case DRM_FORMAT_AYUV:
>  	case DRM_FORMAT_C8:
>  		if (modifier == DRM_FORMAT_MOD_LINEAR ||
>  		    modifier == I915_FORMAT_MOD_X_TILED ||
> @@ -14510,6 +14516,7 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
>  			goto err;
>  		}
>  		break;
> +	case DRM_FORMAT_AYUV:
>  	case DRM_FORMAT_YUYV:
>  	case DRM_FORMAT_UYVY:
>  	case DRM_FORMAT_YVYU:
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 344c0e709b19..ee9f7242aa2b 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -1424,6 +1424,7 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane,
>  		if (modifier == I915_FORMAT_MOD_Yf_TILED)
>  			return true;
>  		/* fall through */
> +	case DRM_FORMAT_AYUV:
>  	case DRM_FORMAT_C8:
>  		if (modifier == DRM_FORMAT_MOD_LINEAR ||
>  		    modifier == I915_FORMAT_MOD_X_TILED ||
> -- 
> 2.17.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Lisovskiy, Stanislav July 5, 2018, 7:32 a.m. UTC | #2
On Wed, 2018-07-04 at 15:53 +0200, Daniel Vetter wrote:
> On Wed, Jul 04, 2018 at 12:41:52PM +0300, StanLis wrote:

> > From: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>

> > 

> > PLANE_CTL_FORMAT_AYUV is already supported, according to hardware

> > specification.

> > 

> > v2: Edited commit message, removed redundant whitespaces.

> > 

> > v3: Fixed fallthrough logic for the format switch cases.

> > 

> > v4: Yet again fixed fallthrough logic, to reuse code from other

> > case

> >     labels.

> > 

> > Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>

> 

> Do we have userspace and igt testcases for this?

> -Daniel


So far, I've checked it only with own test program and VLC player,
however currently I'm working on igt test case for that also. 

> 

> > ---

> >  drivers/gpu/drm/i915/intel_display.c | 7 +++++++

> >  drivers/gpu/drm/i915/intel_sprite.c  | 1 +

> >  2 files changed, 8 insertions(+)

> > 

> > diff --git a/drivers/gpu/drm/i915/intel_display.c

> > b/drivers/gpu/drm/i915/intel_display.c

> > index 56818a45181c..b121b3378aa2 100644

> > --- a/drivers/gpu/drm/i915/intel_display.c

> > +++ b/drivers/gpu/drm/i915/intel_display.c

> > @@ -86,6 +86,7 @@ static const uint32_t skl_primary_formats[] = {

> >  	DRM_FORMAT_YVYU,

> >  	DRM_FORMAT_UYVY,

> >  	DRM_FORMAT_VYUY,

> > +	DRM_FORMAT_AYUV,

> >  };

> >  

> >  static const uint32_t skl_pri_planar_formats[] = {

> > @@ -102,6 +103,7 @@ static const uint32_t skl_pri_planar_formats[]

> > = {

> >  	DRM_FORMAT_UYVY,

> >  	DRM_FORMAT_VYUY,

> >  	DRM_FORMAT_NV12,

> > +	DRM_FORMAT_AYUV,

> >  };

> >  

> >  static const uint64_t skl_format_modifiers_noccs[] = {

> > @@ -3497,6 +3499,8 @@ static u32 skl_plane_ctl_format(uint32_t

> > pixel_format)

> >  		return PLANE_CTL_FORMAT_XRGB_2101010;

> >  	case DRM_FORMAT_XBGR2101010:

> >  		return PLANE_CTL_ORDER_RGBX |

> > PLANE_CTL_FORMAT_XRGB_2101010;

> > +	case DRM_FORMAT_AYUV:

> > +		return PLANE_CTL_FORMAT_AYUV;

> >  	case DRM_FORMAT_YUYV:

> >  		return PLANE_CTL_FORMAT_YUV422 |

> > PLANE_CTL_YUV422_YUYV;

> >  	case DRM_FORMAT_YVYU:

> > @@ -13371,6 +13375,7 @@ static bool

> > skl_plane_format_mod_supported(struct drm_plane *_plane,

> >  	}

> >  

> >  	switch (format) {

> > +

> >  	case DRM_FORMAT_XRGB8888:

> >  	case DRM_FORMAT_XBGR8888:

> >  	case DRM_FORMAT_ARGB8888:

> > @@ -13390,6 +13395,7 @@ static bool

> > skl_plane_format_mod_supported(struct drm_plane *_plane,

> >  		if (modifier == I915_FORMAT_MOD_Yf_TILED)

> >  			return true;

> >  		/* fall through */

> > +	case DRM_FORMAT_AYUV:

> >  	case DRM_FORMAT_C8:

> >  		if (modifier == DRM_FORMAT_MOD_LINEAR ||

> >  		    modifier == I915_FORMAT_MOD_X_TILED ||

> > @@ -14510,6 +14516,7 @@ static int intel_framebuffer_init(struct

> > intel_framebuffer *intel_fb,

> >  			goto err;

> >  		}

> >  		break;

> > +	case DRM_FORMAT_AYUV:

> >  	case DRM_FORMAT_YUYV:

> >  	case DRM_FORMAT_UYVY:

> >  	case DRM_FORMAT_YVYU:

> > diff --git a/drivers/gpu/drm/i915/intel_sprite.c

> > b/drivers/gpu/drm/i915/intel_sprite.c

> > index 344c0e709b19..ee9f7242aa2b 100644

> > --- a/drivers/gpu/drm/i915/intel_sprite.c

> > +++ b/drivers/gpu/drm/i915/intel_sprite.c

> > @@ -1424,6 +1424,7 @@ static bool

> > skl_plane_format_mod_supported(struct drm_plane *_plane,

> >  		if (modifier == I915_FORMAT_MOD_Yf_TILED)

> >  			return true;

> >  		/* fall through */

> > +	case DRM_FORMAT_AYUV:

> >  	case DRM_FORMAT_C8:

> >  		if (modifier == DRM_FORMAT_MOD_LINEAR ||

> >  		    modifier == I915_FORMAT_MOD_X_TILED ||

> > -- 

> > 2.17.0

> > 

> > _______________________________________________

> > Intel-gfx mailing list

> > Intel-gfx@lists.freedesktop.org

> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx

> 

> 

-- 
Best Regards,

Lisovskiy Stanislav
Ville Syrjälä July 5, 2018, 12:12 p.m. UTC | #3
On Wed, Jul 04, 2018 at 12:41:52PM +0300, StanLis wrote:
> From: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> 
> PLANE_CTL_FORMAT_AYUV is already supported, according to hardware
> specification.
> 
> v2: Edited commit message, removed redundant whitespaces.
> 
> v3: Fixed fallthrough logic for the format switch cases.
> 
> v4: Yet again fixed fallthrough logic, to reuse code from other case
>     labels.
> 
> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 7 +++++++
>  drivers/gpu/drm/i915/intel_sprite.c  | 1 +
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 56818a45181c..b121b3378aa2 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -86,6 +86,7 @@ static const uint32_t skl_primary_formats[] = {
>  	DRM_FORMAT_YVYU,
>  	DRM_FORMAT_UYVY,
>  	DRM_FORMAT_VYUY,
> +	DRM_FORMAT_AYUV,

We'll need an XYUV format because the hw doesn't do alpha with these
IIRC. Also I believe this should be already be available since ~IVB.

>  };
>  
>  static const uint32_t skl_pri_planar_formats[] = {
> @@ -102,6 +103,7 @@ static const uint32_t skl_pri_planar_formats[] = {
>  	DRM_FORMAT_UYVY,
>  	DRM_FORMAT_VYUY,
>  	DRM_FORMAT_NV12,
> +	DRM_FORMAT_AYUV,
>  };
>  
>  static const uint64_t skl_format_modifiers_noccs[] = {
> @@ -3497,6 +3499,8 @@ static u32 skl_plane_ctl_format(uint32_t pixel_format)
>  		return PLANE_CTL_FORMAT_XRGB_2101010;
>  	case DRM_FORMAT_XBGR2101010:
>  		return PLANE_CTL_ORDER_RGBX | PLANE_CTL_FORMAT_XRGB_2101010;
> +	case DRM_FORMAT_AYUV:
> +		return PLANE_CTL_FORMAT_AYUV;
>  	case DRM_FORMAT_YUYV:
>  		return PLANE_CTL_FORMAT_YUV422 | PLANE_CTL_YUV422_YUYV;
>  	case DRM_FORMAT_YVYU:
> @@ -13371,6 +13375,7 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane,
>  	}
>  
>  	switch (format) {
> +
>  	case DRM_FORMAT_XRGB8888:
>  	case DRM_FORMAT_XBGR8888:
>  	case DRM_FORMAT_ARGB8888:
> @@ -13390,6 +13395,7 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane,
>  		if (modifier == I915_FORMAT_MOD_Yf_TILED)
>  			return true;
>  		/* fall through */
> +	case DRM_FORMAT_AYUV:
>  	case DRM_FORMAT_C8:

I think Yf should be perfecly fine with this format.

>  		if (modifier == DRM_FORMAT_MOD_LINEAR ||
>  		    modifier == I915_FORMAT_MOD_X_TILED ||
> @@ -14510,6 +14516,7 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
>  			goto err;
>  		}
>  		break;
> +	case DRM_FORMAT_AYUV:
>  	case DRM_FORMAT_YUYV:
>  	case DRM_FORMAT_UYVY:
>  	case DRM_FORMAT_YVYU:
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 344c0e709b19..ee9f7242aa2b 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -1424,6 +1424,7 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane,
>  		if (modifier == I915_FORMAT_MOD_Yf_TILED)
>  			return true;
>  		/* fall through */
> +	case DRM_FORMAT_AYUV:
>  	case DRM_FORMAT_C8:
>  		if (modifier == DRM_FORMAT_MOD_LINEAR ||
>  		    modifier == I915_FORMAT_MOD_X_TILED ||

Looks like you're missing a lot of stuff from the sprite plane code. But
rather than add all that duplicated junk I recommed that you review
https://patchwork.freedesktop.org/series/39390/ instead as there I
remove all this silly duplication between the two plane types.


> -- 
> 2.17.0
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 56818a45181c..b121b3378aa2 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -86,6 +86,7 @@  static const uint32_t skl_primary_formats[] = {
 	DRM_FORMAT_YVYU,
 	DRM_FORMAT_UYVY,
 	DRM_FORMAT_VYUY,
+	DRM_FORMAT_AYUV,
 };
 
 static const uint32_t skl_pri_planar_formats[] = {
@@ -102,6 +103,7 @@  static const uint32_t skl_pri_planar_formats[] = {
 	DRM_FORMAT_UYVY,
 	DRM_FORMAT_VYUY,
 	DRM_FORMAT_NV12,
+	DRM_FORMAT_AYUV,
 };
 
 static const uint64_t skl_format_modifiers_noccs[] = {
@@ -3497,6 +3499,8 @@  static u32 skl_plane_ctl_format(uint32_t pixel_format)
 		return PLANE_CTL_FORMAT_XRGB_2101010;
 	case DRM_FORMAT_XBGR2101010:
 		return PLANE_CTL_ORDER_RGBX | PLANE_CTL_FORMAT_XRGB_2101010;
+	case DRM_FORMAT_AYUV:
+		return PLANE_CTL_FORMAT_AYUV;
 	case DRM_FORMAT_YUYV:
 		return PLANE_CTL_FORMAT_YUV422 | PLANE_CTL_YUV422_YUYV;
 	case DRM_FORMAT_YVYU:
@@ -13371,6 +13375,7 @@  static bool skl_plane_format_mod_supported(struct drm_plane *_plane,
 	}
 
 	switch (format) {
+
 	case DRM_FORMAT_XRGB8888:
 	case DRM_FORMAT_XBGR8888:
 	case DRM_FORMAT_ARGB8888:
@@ -13390,6 +13395,7 @@  static bool skl_plane_format_mod_supported(struct drm_plane *_plane,
 		if (modifier == I915_FORMAT_MOD_Yf_TILED)
 			return true;
 		/* fall through */
+	case DRM_FORMAT_AYUV:
 	case DRM_FORMAT_C8:
 		if (modifier == DRM_FORMAT_MOD_LINEAR ||
 		    modifier == I915_FORMAT_MOD_X_TILED ||
@@ -14510,6 +14516,7 @@  static int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
 			goto err;
 		}
 		break;
+	case DRM_FORMAT_AYUV:
 	case DRM_FORMAT_YUYV:
 	case DRM_FORMAT_UYVY:
 	case DRM_FORMAT_YVYU:
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 344c0e709b19..ee9f7242aa2b 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1424,6 +1424,7 @@  static bool skl_plane_format_mod_supported(struct drm_plane *_plane,
 		if (modifier == I915_FORMAT_MOD_Yf_TILED)
 			return true;
 		/* fall through */
+	case DRM_FORMAT_AYUV:
 	case DRM_FORMAT_C8:
 		if (modifier == DRM_FORMAT_MOD_LINEAR ||
 		    modifier == I915_FORMAT_MOD_X_TILED ||