diff mbox series

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

Message ID 6f33219dc848ccd7122bce6933338033aa18c33c@lausen.nl (mailing list archive)
State Not Applicable
Headers show
Series [v2] drm/msm/dpu: Add support for AR30 format | expand

Commit Message

Leonard Lausen March 21, 2023, 2:58 a.m. UTC
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@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(+)

Comments

Leonard Lausen March 22, 2023, 1:15 p.m. UTC | #1
V2 adds missing AR30 swizzles in dpu_format_map_ubwc to avoid the following errors:

[drm:dpu_get_dpu_format_ext:1044] [dpu error]unsupported fmt: AR30 modifier 0x500000000000001
msm_dpu ae01000.display-controller: [drm:msm_framebuffer_init] *ERROR* unsupported pixel format: AR30
Jessica Zhang March 24, 2023, 6:47 p.m. UTC | #2
On 3/20/2023 7:58 PM, Leonard Lausen wrote:
> 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@lausen.nl>

Hi Leonard,

Was able to validate the changes on SC7180 with null_platform_test and 
modetest.

Reviewed-by: Jessica Zhang <quic_jesszhan@quicinc.com>
Tested-by: Jessica Zhang <quic_jesszhan@quicinc.com> # Trogdor (sc7180)

Thanks,

Jessica Zhang

> ---
>   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
Dmitry Baryshkov March 28, 2023, 1:25 p.m. UTC | #3
On 21/03/2023 04:58, Leonard Lausen wrote:
> 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@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(+)

Your patch doesn't apply as all tabs seems to be expanded to spaces. I 
have fixed this while applying as not to delay it further. Please use 
git-send-email when sending further patches.
Dmitry Baryshkov March 28, 2023, 10:37 p.m. UTC | #4
On Tue, 21 Mar 2023 02:58:04 +0000, Leonard Lausen wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] drm/msm/dpu: Add support for AR30 format
      https://gitlab.freedesktop.org/lumag/msm/-/commit/a8318110b987

Best regards,
diff mbox series

Patch

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,