diff mbox series

drm/i915: Support FP16 compressed formats on MTL

Message ID 20231011102356.22014-1-melanie.lobo@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Support FP16 compressed formats on MTL | expand

Commit Message

Melanie Lobo Oct. 11, 2023, 10:23 a.m. UTC
MTL supports FP16 format which is a binary floating-point computer
number format that occupies 16 bits in computer memory.Platform shall
render compression in display engine to receive FP16 compressed formats.

This kernel change was tested with IGT patch,
https://patchwork.freedesktop.org/patch/562014/

Test-with: 20231011095520.10768-1-melanie.lobo@intel.com

Signed-off-by: Melanie Lobo <melanie.lobo@intel.com>
---
 drivers/gpu/drm/i915/display/intel_fb.c            | 2 ++
 drivers/gpu/drm/i915/display/skl_universal_plane.c | 3 +--
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Jani Nikula Oct. 11, 2023, 10:21 a.m. UTC | #1
On Wed, 11 Oct 2023, Melanie Lobo <melanie.lobo@intel.com> wrote:
> MTL supports FP16 format which is a binary floating-point computer
> number format that occupies 16 bits in computer memory.Platform shall
> render compression in display engine to receive FP16 compressed formats.
>
> This kernel change was tested with IGT patch,
> https://patchwork.freedesktop.org/patch/562014/
>
> Test-with: 20231011095520.10768-1-melanie.lobo@intel.com
>
> Signed-off-by: Melanie Lobo <melanie.lobo@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_fb.c            | 2 ++
>  drivers/gpu/drm/i915/display/skl_universal_plane.c | 3 +--
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
> index e7678571b0d7..868cfc75e687 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb.c
> +++ b/drivers/gpu/drm/i915/display/intel_fb.c
> @@ -91,6 +91,8 @@ static const struct drm_format_info gen12_ccs_formats[] = {
>  	{ .format = DRM_FORMAT_P016, .num_planes = 4,
>  	  .char_per_block = { 2, 4, 1, 1 }, .block_w = { 1, 1, 2, 2 }, .block_h = { 1, 1, 1, 1 },
>  	  .hsub = 2, .vsub = 2, .is_yuv = true },
> +	{ .format = DRM_FORMAT_XRGB16161616F, .depth = 64, .num_planes = 2,
> +	  .char_per_block = { 4, 1}, .block_w = { 1, 2}, .block_h = { 1, 1}, .hsub = 1, .vsub = 1 },
>  };
>  
>  /*
> diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> index 245a64332cc7..64c1d6c2bd76 100644
> --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
> +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> @@ -2122,8 +2122,7 @@ static bool gen12_plane_format_mod_supported(struct drm_plane *_plane,
>  	case DRM_FORMAT_Y216:
>  	case DRM_FORMAT_XVYU12_16161616:
>  	case DRM_FORMAT_XVYU16161616:
> -		if (!intel_fb_is_ccs_modifier(modifier))
> -			return true;
> +		return true;
>  		fallthrough;

This becomes nop.

BR,
Jani.

>  	default:
>  		return false;
Melanie Lobo Oct. 11, 2023, 10:35 a.m. UTC | #2
> -----Original Message-----
> From: Jani Nikula <jani.nikula@linux.intel.com>
> Sent: Wednesday, October 11, 2023 3:52 PM
> To: Lobo, Melanie <melanie.lobo@intel.com>; intel-gfx@lists.freedesktop.org
> Cc: Heikkila, Juha-pekka <juha-pekka.heikkila@intel.com>
> Subject: Re: [Intel-gfx] [PATCH] drm/i915: Support FP16 compressed formats
> on MTL
> 
> On Wed, 11 Oct 2023, Melanie Lobo <melanie.lobo@intel.com> wrote:
> > MTL supports FP16 format which is a binary floating-point computer
> > number format that occupies 16 bits in computer memory.Platform shall
> > render compression in display engine to receive FP16 compressed formats.
> >
> > This kernel change was tested with IGT patch,
> > https://patchwork.freedesktop.org/patch/562014/
> >
> > Test-with: 20231011095520.10768-1-melanie.lobo@intel.com
> >
> > Signed-off-by: Melanie Lobo <melanie.lobo@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_fb.c            | 2 ++
> >  drivers/gpu/drm/i915/display/skl_universal_plane.c | 3 +--
> >  2 files changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_fb.c
> > b/drivers/gpu/drm/i915/display/intel_fb.c
> > index e7678571b0d7..868cfc75e687 100644
> > --- a/drivers/gpu/drm/i915/display/intel_fb.c
> > +++ b/drivers/gpu/drm/i915/display/intel_fb.c
> > @@ -91,6 +91,8 @@ static const struct drm_format_info
> gen12_ccs_formats[] = {
> >  	{ .format = DRM_FORMAT_P016, .num_planes = 4,
> >  	  .char_per_block = { 2, 4, 1, 1 }, .block_w = { 1, 1, 2, 2 }, .block_h = { 1,
> 1, 1, 1 },
> >  	  .hsub = 2, .vsub = 2, .is_yuv = true },
> > +	{ .format = DRM_FORMAT_XRGB16161616F, .depth = 64,
> .num_planes = 2,
> > +	  .char_per_block = { 4, 1}, .block_w = { 1, 2}, .block_h = { 1, 1},
> > +.hsub = 1, .vsub = 1 },
> >  };
> >
> >  /*
> > diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c
> > b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> > index 245a64332cc7..64c1d6c2bd76 100644
> > --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
> > +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> > @@ -2122,8 +2122,7 @@ static bool
> gen12_plane_format_mod_supported(struct drm_plane *_plane,
> >  	case DRM_FORMAT_Y216:
> >  	case DRM_FORMAT_XVYU12_16161616:
> >  	case DRM_FORMAT_XVYU16161616:
> > -		if (!intel_fb_is_ccs_modifier(modifier))
> > -			return true;
> > +		return true;
> >  		fallthrough;
> 
> This becomes nop.

Thank you for your suggestion. I will float the next version by removing "fallthrough" statement.

Regards,
Melanie Lobo

> 
> BR,
> Jani.
> 
> >  	default:
> >  		return false;
> 
> --
> Jani Nikula, Intel
Dan Carpenter Oct. 16, 2023, 5:35 a.m. UTC | #3
Hi Melanie,

kernel test robot noticed the following build warnings:

url:    https://github.com/intel-lab-lkp/linux/commits/Melanie-Lobo/drm-i915-Support-FP16-compressed-formats-on-MTL/20231011-181214
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
patch link:    https://lore.kernel.org/r/20231011102356.22014-1-melanie.lobo%40intel.com
patch subject: [Intel-gfx] [PATCH] drm/i915: Support FP16 compressed formats on MTL
config: x86_64-randconfig-161-20231015 (https://download.01.org/0day-ci/archive/20231015/202310150454.S9QF86bl-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231015/202310150454.S9QF86bl-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202310150454.S9QF86bl-lkp@intel.com/

smatch warnings:
drivers/gpu/drm/i915/display/skl_universal_plane.c:2126 gen12_plane_format_mod_supported() warn: ignoring unreachable code.

vim +2126 drivers/gpu/drm/i915/display/skl_universal_plane.c

46d12f911821f7 Dave Airlie           2021-02-05  2120  	case DRM_FORMAT_Y210:
46d12f911821f7 Dave Airlie           2021-02-05  2121  	case DRM_FORMAT_Y212:
46d12f911821f7 Dave Airlie           2021-02-05  2122  	case DRM_FORMAT_Y216:
46d12f911821f7 Dave Airlie           2021-02-05  2123  	case DRM_FORMAT_XVYU12_16161616:
46d12f911821f7 Dave Airlie           2021-02-05  2124  	case DRM_FORMAT_XVYU16161616:
46d12f911821f7 Dave Airlie           2021-02-05  2125  		return true;
46d12f911821f7 Dave Airlie           2021-02-05 @2126  		fallthrough;

This fallthrough annotation is incorrect.

46d12f911821f7 Dave Airlie           2021-02-05  2127  	default:
46d12f911821f7 Dave Airlie           2021-02-05  2128  		return false;
46d12f911821f7 Dave Airlie           2021-02-05  2129  	}
46d12f911821f7 Dave Airlie           2021-02-05  2130  }
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
index e7678571b0d7..868cfc75e687 100644
--- a/drivers/gpu/drm/i915/display/intel_fb.c
+++ b/drivers/gpu/drm/i915/display/intel_fb.c
@@ -91,6 +91,8 @@  static const struct drm_format_info gen12_ccs_formats[] = {
 	{ .format = DRM_FORMAT_P016, .num_planes = 4,
 	  .char_per_block = { 2, 4, 1, 1 }, .block_w = { 1, 1, 2, 2 }, .block_h = { 1, 1, 1, 1 },
 	  .hsub = 2, .vsub = 2, .is_yuv = true },
+	{ .format = DRM_FORMAT_XRGB16161616F, .depth = 64, .num_planes = 2,
+	  .char_per_block = { 4, 1}, .block_w = { 1, 2}, .block_h = { 1, 1}, .hsub = 1, .vsub = 1 },
 };
 
 /*
diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
index 245a64332cc7..64c1d6c2bd76 100644
--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
@@ -2122,8 +2122,7 @@  static bool gen12_plane_format_mod_supported(struct drm_plane *_plane,
 	case DRM_FORMAT_Y216:
 	case DRM_FORMAT_XVYU12_16161616:
 	case DRM_FORMAT_XVYU16161616:
-		if (!intel_fb_is_ccs_modifier(modifier))
-			return true;
+		return true;
 		fallthrough;
 	default:
 		return false;