Skip to contentSkip to conversation

drm: Set depth and bpp for XRGB4444 family formats

PATCH In review Fabien Dessenne 4 participants 9 messages Aug 10, 2016 – Sep 9, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: Set depth and bpp for XRGB4444 family formats

These pixel formats are supported by format_check() from drm_crtc.c, so provide there depth and bpp.

---
 drivers/gpu/drm/drm_fourcc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/drm_fourcc.c +11 -0
index 0645c85..aa8c909 100644
@@ -80,6 +80,17 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
 		*depth = 8;
 		*bpp = 8;
 		break;
+	case DRM_FORMAT_XRGB4444:
+	case DRM_FORMAT_XBGR4444:
+	case DRM_FORMAT_RGBX4444:
+	case DRM_FORMAT_BGRX4444:
+	case DRM_FORMAT_ARGB4444:
+	case DRM_FORMAT_ABGR4444:
+	case DRM_FORMAT_RGBA4444:
+	case DRM_FORMAT_BGRA4444:
+		*depth = 12;
+		*bpp = 16;
+		break;
 	case DRM_FORMAT_XRGB1555:
 	case DRM_FORMAT_XBGR1555:
 	case DRM_FORMAT_RGBX5551:
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 4 lines · Fabien Dessenne

These pixel formats are supported by format_check() from drm_crtc.c, so provide there depth and bpp.

Why? Who's going to use this?
-Daniel

Quoted 33 lines
---
 drivers/gpu/drm/drm_fourcc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/drm_fourcc.c +11 -0
index 0645c85..aa8c909 100644
@@ -80,6 +80,17 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
 		*depth = 8;
 		*bpp = 8;
 		break;
+	case DRM_FORMAT_XRGB4444:
+	case DRM_FORMAT_XBGR4444:
+	case DRM_FORMAT_RGBX4444:
+	case DRM_FORMAT_BGRX4444:
+	case DRM_FORMAT_ARGB4444:
+	case DRM_FORMAT_ABGR4444:
+	case DRM_FORMAT_RGBA4444:
+	case DRM_FORMAT_BGRA4444:
+		*depth = 12;
+		*bpp = 16;
+		break;
 	case DRM_FORMAT_XRGB1555:
 	case DRM_FORMAT_XBGR1555:
 	case DRM_FORMAT_RGBX5551:
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 6 lines · Daniel Vetter
Quoted 4 lines · Fabien Dessenne

These pixel formats are supported by format_check() from drm_crtc.c, so provide there depth and bpp.

Why?

At least for consistency between format_check() and drm_fb_get_bpp_depth().

Quoted 1 line

Who's going to use this?

For the time being, I can see 9 drivers that make more or less use of this format (amd, atmel-hlcdc, exynos, fsl-dcu, imx, omapdrm, radeon, rcar-du, sti).
In top of that I am working on a new driver that actually needs this format, and that does not work without this patch.

Quoted 31 lines

-Daniel

Quoted 29 lines
---
  drivers/gpu/drm/drm_fourcc.c | 11 +++++++++++
  1 file changed, 11 insertions(+)
drivers/gpu/drm/drm_fourcc.c +11 -0
index 0645c85..aa8c909 100644
@@ -80,6 +80,17 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
  		*depth = 8;
  		*bpp = 8;
  		break;
+	case DRM_FORMAT_XRGB4444:
+	case DRM_FORMAT_XBGR4444:
+	case DRM_FORMAT_RGBX4444:
+	case DRM_FORMAT_BGRX4444:
+	case DRM_FORMAT_ARGB4444:
+	case DRM_FORMAT_ABGR4444:
+	case DRM_FORMAT_RGBA4444:
+	case DRM_FORMAT_BGRA4444:
+		*depth = 12;
+		*bpp = 16;
+		break;
  	case DRM_FORMAT_XRGB1555:
  	case DRM_FORMAT_XBGR1555:
  	case DRM_FORMAT_RGBX5551:
Signature · 1 line
1.9.1
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 9 lines · Fabien DESSENNE
Quoted 6 lines · Daniel Vetter
Quoted 4 lines · Fabien Dessenne

These pixel formats are supported by format_check() from drm_crtc.c, so provide there depth and bpp.

Why?

At least for consistency between format_check() and drm_fb_get_bpp_depth().

fb_get_bpp_depth is kinda legacy, the recommended way is to have a switch statement in your driver that directly decodes DRM_FORMAT_* into driver register values. The inconsistency is intentional since just looking at bpp and depth removes a lot of information.

Probably a better patch would be to update the kerneldoc for these functions. Also Laurent is working on a complete reorg of all this. -Daniel

Quoted 41 lines
Quoted 1 line

Who's going to use this?

For the time being, I can see 9 drivers that make more or less use of this format (amd, atmel-hlcdc, exynos, fsl-dcu, imx, omapdrm, radeon, rcar-du, sti).
In top of that I am working on a new driver that actually needs this format, and that does not work without this patch.

Quoted 35 lines

-Daniel

Quoted 33 lines
---
  drivers/gpu/drm/drm_fourcc.c | 11 +++++++++++
  1 file changed, 11 insertions(+)
drivers/gpu/drm/drm_fourcc.c +11 -0
index 0645c85..aa8c909 100644
@@ -80,6 +80,17 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
  		*depth = 8;
  		*bpp = 8;
  		break;
+	case DRM_FORMAT_XRGB4444:
+	case DRM_FORMAT_XBGR4444:
+	case DRM_FORMAT_RGBX4444:
+	case DRM_FORMAT_BGRX4444:
+	case DRM_FORMAT_ARGB4444:
+	case DRM_FORMAT_ABGR4444:
+	case DRM_FORMAT_RGBA4444:
+	case DRM_FORMAT_BGRA4444:
+		*depth = 12;
+		*bpp = 16;
+		break;
  	case DRM_FORMAT_XRGB1555:
  	case DRM_FORMAT_XBGR1555:
  	case DRM_FORMAT_RGBX5551:
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw
Quoted 6 lines · Daniel Vetter
Quoted 5 lines · Fabien DESSENNE
Quoted 4 lines · Daniel Vetter
Quoted 3 lines · Fabien Dessenne

These pixel formats are supported by format_check() from drm_crtc.c, so provide there depth and bpp.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

Why?

At least for consistency between format_check() and drm_fb_get_bpp_depth().

fb_get_bpp_depth is kinda legacy, the recommended way is to have a switch statement in your driver that directly decodes DRM_FORMAT_* into driver register values. The inconsistency is intentional since just looking at bpp and depth removes a lot of information.

I can understand that fb_get_bpp_depth() shall not be called by (new) drivers.
But it is also called by the core part through drm_format_plane_cpp() which is not a legacy interface and is used across many drivers (I think that this is a recent change initiated by Ville).

Quoted 2 lines

Probably a better patch would be to update the kerneldoc for these functions.

For the time being we have an issue with the current drivers that use the 4444 DRM formats and updating kerneldoc won't fix them

Quoted 1 line

Also Laurent is working on a complete reorg of all this.

Looping Laurent who may have a different opinion, or plan to consider the 4444 DRM formats in its rework.

Fabien

Quoted 39 lines

-Daniel

Quoted 37 lines
Quoted 1 line

Who's going to use this?

For the time being, I can see 9 drivers that make more or less use of this format (amd, atmel-hlcdc, exynos, fsl-dcu, imx, omapdrm, radeon, rcar-du, sti).
In top of that I am working on a new driver that actually needs this format, and that does not work without this patch.

Quoted 31 lines

-Daniel

Quoted 29 lines
---
   drivers/gpu/drm/drm_fourcc.c | 11 +++++++++++
   1 file changed, 11 insertions(+)
drivers/gpu/drm/drm_fourcc.c +11 -0
index 0645c85..aa8c909 100644
@@ -80,6 +80,17 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
   		*depth = 8;
   		*bpp = 8;
   		break;
+	case DRM_FORMAT_XRGB4444:
+	case DRM_FORMAT_XBGR4444:
+	case DRM_FORMAT_RGBX4444:
+	case DRM_FORMAT_BGRX4444:
+	case DRM_FORMAT_ARGB4444:
+	case DRM_FORMAT_ABGR4444:
+	case DRM_FORMAT_RGBA4444:
+	case DRM_FORMAT_BGRA4444:
+		*depth = 12;
+		*bpp = 16;
+		break;
   	case DRM_FORMAT_XRGB1555:
   	case DRM_FORMAT_XBGR1555:
   	case DRM_FORMAT_RGBX5551:
Signature · 1 line
1.9.1
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
Quoted 14 lines · Fabien DESSENNE
Quoted 6 lines · Daniel Vetter
Quoted 5 lines · Fabien DESSENNE
Quoted 4 lines · Daniel Vetter
Quoted 3 lines · Fabien Dessenne

These pixel formats are supported by format_check() from drm_crtc.c, so provide there depth and bpp.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

Why?

At least for consistency between format_check() and drm_fb_get_bpp_depth().

fb_get_bpp_depth is kinda legacy, the recommended way is to have a switch statement in your driver that directly decodes DRM_FORMAT_* into driver register values. The inconsistency is intentional since just looking at bpp and depth removes a lot of information.

Quoted 5 lines

I can understand that fb_get_bpp_depth() shall not be called by (new) drivers.
But it is also called by the core part through drm_format_plane_cpp() which is not a legacy interface and is used across many drivers (I think that this is a recent change initiated by Ville).

I've dug around and the only places I've found changes is from 2012. I think rgb444 formats just plain never worked. But in case I've missed something and this is a regression then indeed we need to fix it. For the real solution it's better to sync up with Laurent and his plans to rework the fourcc handling we have in drm.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw
Quoted 21 lines · Daniel Vetter
Quoted 14 lines · Fabien DESSENNE
Quoted 6 lines · Daniel Vetter
Quoted 5 lines · Fabien DESSENNE
Quoted 4 lines · Daniel Vetter
Quoted 3 lines · Fabien Dessenne

These pixel formats are supported by format_check() from drm_crtc.c, so provide there depth and bpp.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

Why?

At least for consistency between format_check() and drm_fb_get_bpp_depth().

fb_get_bpp_depth is kinda legacy, the recommended way is to have a switch statement in your driver that directly decodes DRM_FORMAT_* into driver register values. The inconsistency is intentional since just looking at bpp and depth removes a lot of information.

Quoted 5 lines

I can understand that fb_get_bpp_depth() shall not be called by (new) drivers.
But it is also called by the core part through drm_format_plane_cpp() which is not a legacy interface and is used across many drivers (I think that this is a recent change initiated by Ville).

Quoted 3 lines

I've dug around and the only places I've found changes is from 2012. I think rgb444 formats just plain never worked. But in case I've missed something and this is a regression then indeed we need to fix it.

Looks like I just plain forgot about these formats when I added drm_format_plane_cpp().

Quoted 12 lines

For
the real solution it's better to sync up with Laurent and his plans to rework the fourcc handling we have in drm.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw
In reply to Fabien DESSENNE

Hi Laurent,

Daniel talked about a planned reorg from you around DRM formats (or something like this) and I have proposed to fix some missing parts with the XRGB444 formats.

Can you let us know if you can consider this fix as part of your reorg?

If you can't what would be the best option to get this fixed?

Fabien

Quoted 75 lines · Fabien DESSENNE
Quoted 8 lines · Daniel Vetter
Quoted 7 lines · Fabien DESSENNE
Quoted 6 lines · Daniel Vetter
Quoted 5 lines · Fabien Dessenne

These pixel formats are supported by format_check() from drm_crtc.c, so
provide there depth and bpp.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Why?

At least for consistency between format_check() and drm_fb_get_bpp_depth().

fb_get_bpp_depth is kinda legacy, the recommended way is to have a switch
statement in your driver that directly decodes DRM_FORMAT_* into driver register values. The inconsistency is intentional since just looking at bpp and depth removes a lot of information.

I can understand that fb_get_bpp_depth() shall not be called by (new) drivers.
But it is also called by the core part through drm_format_plane_cpp() which is not a legacy interface and is used across many drivers (I think that this is a recent change initiated by Ville).

Quoted 2 lines

Probably a better patch would be to update the kerneldoc for these functions.

For the time being we have an issue with the current drivers that use the 4444 DRM formats and updating kerneldoc won't fix them

Quoted 1 line

Also Laurent is working on a complete reorg of all this.

Looping Laurent who may have a different opinion, or plan to consider the 4444 DRM formats in its rework.

Fabien

Quoted 41 lines

-Daniel

Quoted 39 lines
Quoted 1 line

Who's going to use this?

For the time being, I can see 9 drivers that make more or less use of this format (amd, atmel-hlcdc, exynos, fsl-dcu, imx, omapdrm, radeon, rcar-du, sti).
In top of that I am working on a new driver that actually needs this format, and that does not work without this patch.

Quoted 33 lines

-Daniel

Quoted 31 lines
---
   drivers/gpu/drm/drm_fourcc.c | 11 +++++++++++
   1 file changed, 11 insertions(+)
drivers/gpu/drm/drm_fourcc.c +11 -0
index 0645c85..aa8c909 100644
@@ -80,6 +80,17 @@ void drm_fb_get_bpp_depth(uint32_t format, 
 unsigned int *depth,
           *depth = 8;
           *bpp = 8;
           break;
+    case DRM_FORMAT_XRGB4444:
+    case DRM_FORMAT_XBGR4444:
+    case DRM_FORMAT_RGBX4444:
+    case DRM_FORMAT_BGRX4444:
+    case DRM_FORMAT_ARGB4444:
+    case DRM_FORMAT_ABGR4444:
+    case DRM_FORMAT_RGBA4444:
+    case DRM_FORMAT_BGRA4444:
+        *depth = 12;
+        *bpp = 16;
+        break;
       case DRM_FORMAT_XRGB1555:
       case DRM_FORMAT_XBGR1555:
       case DRM_FORMAT_RGBX5551:
Signature · 1 line
1.9.1
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw

Hi Fabien,

Quoted 7 lines · On Friday 19 Aug 2016 11:01:37 Fabien DESSENNE wrote:

Hi Laurent,

Daniel talked about a planned reorg from you around DRM formats (or something like this) and I have proposed to fix some missing parts with the XRGB444 formats.

Can you let us know if you can consider this fix as part of your reorg?

I don't, because it's already there :-) See "[PATCH v4 00/14] Centralize format information" posted to this mailing list.

The series removes the drm_fb_get_bpp_depth() function. You have several options:

- Use drm_format_info() to retrieve format information that include the depth and the number of bytes per pixel per plane.

- Use drm_format_plane_cpp() if you only need the number of bytes per pixel per plane.

- Check the formats directly in your driver instead of basing decisions on the number of bytes per pixel, as Daniel mentioned.

Quoted 1 line

If you can't what would be the best option to get this fixed?

Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel