[Freedreno] [PATCH v2] drm/msm/dpu: Add support for AR30 format

Leonard Lausen leonard at lausen.nl
Tue Mar 21 02:58:04 UTC 2023


Commit da7716a249b699978fb5 ("drm/msm/dpu: Add support for XR30 format") enabled
support for the 10-bit XR30 color format but missed enabling support for the
corresponding per-pixel alpha-blending AR30 color format.

Declaring only XR30 but not AR30 color format support can trigger bugs in
userspace. KDE KWin compositor versions prior to 5.27.3 for example prefer
10-bit color formats, rendering a 1cm^2 black box around the cursor due to
missing per-pixel alpha-blending.

Signed-off-by: Leonard Lausen <leonard at lausen.nl>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c    | 11 +++++++++++
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c |  2 ++
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c      |  1 +
 3 files changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
index d95540309d4d..2b1ef186b909 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
@@ -536,6 +536,16 @@ static const struct dpu_format dpu_format_map_ubwc[] = {
                true, 4, DPU_FORMAT_FLAG_DX | DPU_FORMAT_FLAG_COMPRESSED,
                DPU_FETCH_UBWC, 2, DPU_TILE_HEIGHT_UBWC),
 
+       /* XRGB2101010 and ARGB2101010 purposely have the same color
+        * ordering.  The hardware only supports ARGB2101010 UBWC
+        * natively.
+        */
+       INTERLEAVED_RGB_FMT_TILED(ARGB2101010,
+               COLOR_8BIT, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
+               C2_R_Cr, C0_G_Y, C1_B_Cb, C3_ALPHA, 4,
+               true, 4, DPU_FORMAT_FLAG_DX | DPU_FORMAT_FLAG_COMPRESSED,
+               DPU_FETCH_UBWC, 2, DPU_TILE_HEIGHT_UBWC),
+
        PSEUDO_YUV_FMT_TILED(NV12,
                0, COLOR_8BIT, COLOR_8BIT, COLOR_8BIT,
                C1_B_Cb, C2_R_Cr,
@@ -591,6 +601,7 @@ static int _dpu_format_get_media_color_ubwc(const struct dpu_format *fmt)
                {DRM_FORMAT_XBGR8888, COLOR_FMT_RGBA8888_UBWC},
                {DRM_FORMAT_XRGB8888, COLOR_FMT_RGBA8888_UBWC},
                {DRM_FORMAT_ABGR2101010, COLOR_FMT_RGBA1010102_UBWC},
+               {DRM_FORMAT_ARGB2101010, COLOR_FMT_RGBA1010102_UBWC},
                {DRM_FORMAT_XRGB2101010, COLOR_FMT_RGBA1010102_UBWC},
                {DRM_FORMAT_XBGR2101010, COLOR_FMT_RGBA1010102_UBWC},
                {DRM_FORMAT_BGR565, COLOR_FMT_RGB565_UBWC},
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
index e8a217d242ca..6ae9c5358c5c 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
@@ -157,6 +157,7 @@ static const uint32_t plane_formats[] = {
        DRM_FORMAT_RGBX8888,
        DRM_FORMAT_BGRX8888,
        DRM_FORMAT_XBGR8888,
+       DRM_FORMAT_ARGB2101010,
        DRM_FORMAT_XRGB2101010,
        DRM_FORMAT_RGB888,
        DRM_FORMAT_BGR888,
@@ -186,6 +187,7 @@ static const uint32_t plane_formats_yuv[] = {
        DRM_FORMAT_RGBA8888,
        DRM_FORMAT_BGRX8888,
        DRM_FORMAT_BGRA8888,
+       DRM_FORMAT_ARGB2101010,
        DRM_FORMAT_XRGB2101010,
        DRM_FORMAT_XRGB8888,
        DRM_FORMAT_XBGR8888,
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index bfd5be89e8b8..0ed6a1a114c7 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -69,6 +69,7 @@ static const uint32_t qcom_compressed_supported_formats[] = {
        DRM_FORMAT_ARGB8888,
        DRM_FORMAT_XBGR8888,
        DRM_FORMAT_XRGB8888,
+       DRM_FORMAT_ARGB2101010,
        DRM_FORMAT_XRGB2101010,
        DRM_FORMAT_BGR565,
 
-- 
2.30.2


More information about the Freedreno mailing list