[2/2] drm: vc4: enable XBGR8888 and ABGR8888 pixel formats
diff mbox

Message ID 1465507165-16345-2-git-send-email-robh@kernel.org
State New
Headers show

Commit Message

Rob Herring June 9, 2016, 9:19 p.m. UTC
DRM_FORMAT_XBGR8888 and DRM_FORMAT_ABGR8888 are 2 of the native formats
used in Android, so enable them for VC4. There seems to be no logic behind
HVS_PIXEL_ORDER_xxxx naming, but HVS_PIXEL_ORDER_ARGB seems to work
correctly.

Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/gpu/drm/vc4/vc4_plane.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Eric Anholt June 10, 2016, 12:22 a.m. UTC | #1
Rob Herring <robh@kernel.org> writes:

> DRM_FORMAT_XBGR8888 and DRM_FORMAT_ABGR8888 are 2 of the native formats
> used in Android, so enable them for VC4. There seems to be no logic behind
> HVS_PIXEL_ORDER_xxxx naming, but HVS_PIXEL_ORDER_ARGB seems to work
> correctly.

Spent a little bit digging into how the pixel orderings work and didn't
come up with an answer.  I'll try to look into this one again later.
Eric Anholt July 8, 2016, 1:47 a.m. UTC | #2
Eric Anholt <eric@anholt.net> writes:

> Rob Herring <robh@kernel.org> writes:
>
>> DRM_FORMAT_XBGR8888 and DRM_FORMAT_ABGR8888 are 2 of the native formats
>> used in Android, so enable them for VC4. There seems to be no logic behind
>> HVS_PIXEL_ORDER_xxxx naming, but HVS_PIXEL_ORDER_ARGB seems to work
>> correctly.
>
> Spent a little bit digging into how the pixel orderings work and didn't
> come up with an answer.  I'll try to look into this one again later.

Never came up with a good answer, but it's rendering correctly in
modetest, so I've reviewed and applied it to drm-vc4-next.

Thanks!

Patch
diff mbox

diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 4037b52..b12deef 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -94,6 +94,14 @@  static const struct hvs_format {
 		.pixel_order = HVS_PIXEL_ORDER_ABGR, .has_alpha = true,
 	},
 	{
+		.drm = DRM_FORMAT_ABGR8888, .hvs = HVS_PIXEL_FORMAT_RGBA8888,
+		.pixel_order = HVS_PIXEL_ORDER_ARGB, .has_alpha = true,
+	},
+	{
+		.drm = DRM_FORMAT_XBGR8888, .hvs = HVS_PIXEL_FORMAT_RGBA8888,
+		.pixel_order = HVS_PIXEL_ORDER_ARGB, .has_alpha = false,
+	},
+	{
 		.drm = DRM_FORMAT_RGB565, .hvs = HVS_PIXEL_FORMAT_RGB565,
 		.pixel_order = HVS_PIXEL_ORDER_XRGB, .has_alpha = false,
 	},