Skip to contentSkip to conversation

drm/imx: dc-plane: Add more RGB swizzling options

PATCH Superseded Marek Vasut 2 participants 4 messages Nov 2, 2025 – Nov 4, 2025

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/imx: dc-plane: Add more RGB swizzling options

Add additional buffer format swizzling options beyond XR24, the hardware is capable of sampling other formats, fill them in.

---
Cc: Abel Vesa <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Liu Ying <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: - Adjust commit subject
- Drop the alpha formats for now, add RGB888/BGR888 to dc_plane_formats[]

---
 drivers/gpu/drm/imx/dc/dc-fu.c    | 24 ++++++++++++++++++++++++
 drivers/gpu/drm/imx/dc/dc-plane.c |  6 ++++++
 2 files changed, 30 insertions(+)
drivers/gpu/drm/imx/dc/dc-fu.c +24 -0
index 1d8f74babef8a..b4a3f8c58cbb0 100644
@@ -65,6 +65,30 @@ static const struct dc_fu_pixel_format pixel_formats[] = {
 		DRM_FORMAT_XRGB8888,
 		R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
 		R_SHIFT(16) | G_SHIFT(8)  | B_SHIFT(0)  | A_SHIFT(0),
+	}, {
+		DRM_FORMAT_XBGR8888,
+		R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+		R_SHIFT(0)  | G_SHIFT(8)  | B_SHIFT(16) | A_SHIFT(0),
+	}, {
+		DRM_FORMAT_RGBX8888,
+		R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+		R_SHIFT(24) | G_SHIFT(16) | B_SHIFT(8)  | A_SHIFT(0),
+	}, {
+		DRM_FORMAT_BGRX8888,
+		R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+		R_SHIFT(8)  | G_SHIFT(16) | B_SHIFT(24) | A_SHIFT(0),
+	}, {
+		DRM_FORMAT_RGB888,
+		R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+		R_SHIFT(16) | G_SHIFT(8)  | B_SHIFT(0)  | A_SHIFT(0),
+	}, {
+		DRM_FORMAT_BGR888,
+		R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+		R_SHIFT(0)  | G_SHIFT(8)  | B_SHIFT(16) | A_SHIFT(0),
+	}, {
+		DRM_FORMAT_RGB565,
+		R_BITS(5)   | G_BITS(6)   | B_BITS(5)   | A_BITS(0),
+		R_SHIFT(11) | G_SHIFT(5)  | B_SHIFT(0)  | A_SHIFT(0),
 	},
 };
 
drivers/gpu/drm/imx/dc/dc-plane.c +6 -0
index e40d5d66c5c1f..4fd58afef16bb 100644
@@ -33,6 +33,12 @@ do {									\
 
 static const uint32_t dc_plane_formats[] = {
 	DRM_FORMAT_XRGB8888,
+	DRM_FORMAT_XBGR8888,
+	DRM_FORMAT_RGBX8888,
+	DRM_FORMAT_BGRX8888,
+	DRM_FORMAT_RGB888,
+	DRM_FORMAT_BGR888,
+	DRM_FORMAT_RGB565,
 };
 
 static const struct drm_plane_funcs dc_plane_funcs = {
Signature · 1 line
2.51.0
maintainer
#1 lore raw
Quoted 70 lines · Marek Vasut

Add additional buffer format swizzling options beyond XR24, the hardware is capable of sampling other formats, fill them in.

---
Cc: Abel Vesa <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Liu Ying <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: - Adjust commit subject
- Drop the alpha formats for now, add RGB888/BGR888 to dc_plane_formats[]

---
 drivers/gpu/drm/imx/dc/dc-fu.c    | 24 ++++++++++++++++++++++++
 drivers/gpu/drm/imx/dc/dc-plane.c |  6 ++++++
 2 files changed, 30 insertions(+)
drivers/gpu/drm/imx/dc/dc-fu.c +24 -0
index 1d8f74babef8a..b4a3f8c58cbb0 100644
@@ -65,6 +65,30 @@ static const struct dc_fu_pixel_format pixel_formats[] = {
 		DRM_FORMAT_XRGB8888,
 		R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
 		R_SHIFT(16) | G_SHIFT(8)  | B_SHIFT(0)  | A_SHIFT(0),
+	}, {
+		DRM_FORMAT_XBGR8888,
+		R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+		R_SHIFT(0)  | G_SHIFT(8)  | B_SHIFT(16) | A_SHIFT(0),
+	}, {
+		DRM_FORMAT_RGBX8888,
+		R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+		R_SHIFT(24) | G_SHIFT(16) | B_SHIFT(8)  | A_SHIFT(0),
+	}, {
+		DRM_FORMAT_BGRX8888,
+		R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+		R_SHIFT(8)  | G_SHIFT(16) | B_SHIFT(24) | A_SHIFT(0),
+	}, {
+		DRM_FORMAT_RGB888,
+		R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+		R_SHIFT(16) | G_SHIFT(8)  | B_SHIFT(0)  | A_SHIFT(0),
+	}, {
+		DRM_FORMAT_BGR888,
+		R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+		R_SHIFT(0)  | G_SHIFT(8)  | B_SHIFT(16) | A_SHIFT(0),
+	}, {
+		DRM_FORMAT_RGB565,
+		R_BITS(5)   | G_BITS(6)   | B_BITS(5)   | A_BITS(0),
+		R_SHIFT(11) | G_SHIFT(5)  | B_SHIFT(0)  | A_SHIFT(0),
 	},
 };
 
drivers/gpu/drm/imx/dc/dc-plane.c +0 -0
index e40d5d66c5c1f..4fd58afef16bb 100644

drivers/gpu/drm/imx/dc/dc-plane.c do { \ · line 40

Quoted 8 lines
drivers/gpu/drm/imx/dc/dc-plane.c +5 -0
@@ -33,6 +33,12 @@ do {									\
 
 static const uint32_t dc_plane_formats[] = {
 	DRM_FORMAT_XRGB8888,
+	DRM_FORMAT_XBGR8888,
+	DRM_FORMAT_RGBX8888,
+	DRM_FORMAT_BGRX8888,
+	DRM_FORMAT_RGB888,
+	DRM_FORMAT_BGR888,

Can you please drop the above two formats, as I said in v1 comment that it would the driver a lot more complicated when prefetch engines are added?

Quoted 4 lines
drivers/gpu/drm/imx/dc/dc-plane.c +1 -0
+	DRM_FORMAT_RGB565,
 };
 
 static const struct drm_plane_funcs dc_plane_funcs = {
Signature · 2 lines
Regards,
Liu Ying
#2 lore raw
Quoted 72 lines · Liu Ying
Quoted 71 lines · Marek Vasut

Add additional buffer format swizzling options beyond XR24, the hardware is capable of sampling other formats, fill them in.

---
Cc: Abel Vesa <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Liu Ying <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: - Adjust commit subject
- Drop the alpha formats for now, add RGB888/BGR888 to dc_plane_formats[]

---
  drivers/gpu/drm/imx/dc/dc-fu.c    | 24 ++++++++++++++++++++++++
  drivers/gpu/drm/imx/dc/dc-plane.c |  6 ++++++
  2 files changed, 30 insertions(+)
drivers/gpu/drm/imx/dc/dc-fu.c +24 -0
index 1d8f74babef8a..b4a3f8c58cbb0 100644
@@ -65,6 +65,30 @@ static const struct dc_fu_pixel_format pixel_formats[] = {
  		DRM_FORMAT_XRGB8888,
  		R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
  		R_SHIFT(16) | G_SHIFT(8)  | B_SHIFT(0)  | A_SHIFT(0),
+	}, {
+		DRM_FORMAT_XBGR8888,
+		R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+		R_SHIFT(0)  | G_SHIFT(8)  | B_SHIFT(16) | A_SHIFT(0),
+	}, {
+		DRM_FORMAT_RGBX8888,
+		R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+		R_SHIFT(24) | G_SHIFT(16) | B_SHIFT(8)  | A_SHIFT(0),
+	}, {
+		DRM_FORMAT_BGRX8888,
+		R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+		R_SHIFT(8)  | G_SHIFT(16) | B_SHIFT(24) | A_SHIFT(0),
+	}, {
+		DRM_FORMAT_RGB888,
+		R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+		R_SHIFT(16) | G_SHIFT(8)  | B_SHIFT(0)  | A_SHIFT(0),
+	}, {
+		DRM_FORMAT_BGR888,
+		R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+		R_SHIFT(0)  | G_SHIFT(8)  | B_SHIFT(16) | A_SHIFT(0),
+	}, {
+		DRM_FORMAT_RGB565,
+		R_BITS(5)   | G_BITS(6)   | B_BITS(5)   | A_BITS(0),
+		R_SHIFT(11) | G_SHIFT(5)  | B_SHIFT(0)  | A_SHIFT(0),
  	},
  };
 
drivers/gpu/drm/imx/dc/dc-plane.c +0 -0
index e40d5d66c5c1f..4fd58afef16bb 100644
@@ -33,6 +33,12 @@ do {									\
 
Quoted 10 lines

drivers/gpu/drm/imx/dc/dc-plane.c do { \ · line 40

Quoted 7 lines
drivers/gpu/drm/imx/dc/dc-plane.c +5 -0
  static const uint32_t dc_plane_formats[] = {
  	DRM_FORMAT_XRGB8888,
+	DRM_FORMAT_XBGR8888,
+	DRM_FORMAT_RGBX8888,
+	DRM_FORMAT_BGRX8888,
+	DRM_FORMAT_RGB888,
+	DRM_FORMAT_BGR888,

Can you please drop the above two formats, as I said in v1 comment that it would the driver a lot more complicated when prefetch engines are added?

Can you elaborate on that ? RGB888 is not packed and should be similar to RGBX8888, what kind of problem with prefetch would this cause ?

maintainer
#3 lore raw
Quoted 82 lines · Marek Vasut
Quoted 72 lines · Liu Ying
Quoted 71 lines · Marek Vasut

Add additional buffer format swizzling options beyond XR24, the hardware is capable of sampling other formats, fill them in.

---
Cc: Abel Vesa <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Liu Ying <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: - Adjust commit subject
- Drop the alpha formats for now, add RGB888/BGR888 to dc_plane_formats[]

---
  drivers/gpu/drm/imx/dc/dc-fu.c    | 24 ++++++++++++++++++++++++
  drivers/gpu/drm/imx/dc/dc-plane.c |  6 ++++++
  2 files changed, 30 insertions(+)
drivers/gpu/drm/imx/dc/dc-fu.c +24 -0
index 1d8f74babef8a..b4a3f8c58cbb0 100644
@@ -65,6 +65,30 @@ static const struct dc_fu_pixel_format pixel_formats[] = {
          DRM_FORMAT_XRGB8888,
          R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
          R_SHIFT(16) | G_SHIFT(8)  | B_SHIFT(0)  | A_SHIFT(0),
+    }, {
+        DRM_FORMAT_XBGR8888,
+        R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+        R_SHIFT(0)  | G_SHIFT(8)  | B_SHIFT(16) | A_SHIFT(0),
+    }, {
+        DRM_FORMAT_RGBX8888,
+        R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+        R_SHIFT(24) | G_SHIFT(16) | B_SHIFT(8)  | A_SHIFT(0),
+    }, {
+        DRM_FORMAT_BGRX8888,
+        R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+        R_SHIFT(8)  | G_SHIFT(16) | B_SHIFT(24) | A_SHIFT(0),
+    }, {
+        DRM_FORMAT_RGB888,
+        R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+        R_SHIFT(16) | G_SHIFT(8)  | B_SHIFT(0)  | A_SHIFT(0),
+    }, {
+        DRM_FORMAT_BGR888,
+        R_BITS(8)   | G_BITS(8)   | B_BITS(8)   | A_BITS(0),
+        R_SHIFT(0)  | G_SHIFT(8)  | B_SHIFT(16) | A_SHIFT(0),
+    }, {
+        DRM_FORMAT_RGB565,
+        R_BITS(5)   | G_BITS(6)   | B_BITS(5)   | A_BITS(0),
+        R_SHIFT(11) | G_SHIFT(5)  | B_SHIFT(0)  | A_SHIFT(0),
      },
  };
  diff --git a/drivers/gpu/drm/imx/dc/dc-plane.c b/drivers/gpu/drm/imx/dc/dc-plane.c

index e40d5d66c5c1f..4fd58afef16bb 100644

drivers/gpu/drm/imx/dc/dc-plane.c +0 -0
@@ -33,6 +33,12 @@ do {                                    \
    static const uint32_t dc_plane_formats[] = {
      DRM_FORMAT_XRGB8888,
Quoted 8 lines

drivers/gpu/drm/imx/dc/dc-plane.c do { \ · line 39

Quoted 5 lines
drivers/gpu/drm/imx/dc/dc-plane.c +5 -0
+    DRM_FORMAT_XBGR8888,
+    DRM_FORMAT_RGBX8888,
+    DRM_FORMAT_BGRX8888,
+    DRM_FORMAT_RGB888,
+    DRM_FORMAT_BGR888,

Can you please drop the above two formats, as I said in v1 comment that it would the driver a lot more complicated when prefetch engines are added?

Quoted 2 lines

Can you elaborate on that ? RGB888 is not packed and should be similar to RGBX8888, what kind of problem with prefetch would this cause ?

As I mentioned in v1 comment, prefetch engines don't support these two formats.

For example, if you want to switch formats between DRM_FORMAT_XRGB8888 and DRM_FORMAT_RGB888, then display driver needs to support enabling prefetch engine and bypassing prefetch engine, plus disabling display controller properly w/wo prefetch engine. Also, primary and overlay planes may use different formats. This adds branches to display driver and hence a lot more complicated. So, please set these two formats aside first. Prefetch engine has attractive tile resolving feature. If you really want to support these two formats, revisit after prefetch engine is added(I hope I don't need to go into that rabbit hole).

Signature · 2 lines
Regards,
Liu Ying