[PATCH] drm/amd/display: add cursor pitch check

Simon Ser contact at emersion.fr
Fri Nov 13 13:22:40 UTC 2020


Hmm. I've written new patches to check the remaining plane state [1],
but I'm confused. On my RX 580 machine, it turns out the pitch used by
my cursor is not 128 or 256, it's 512. Here's a drm_info excerpt:

    ├───DRM_CAP_CURSOR_WIDTH = 128
    ├───DRM_CAP_CURSOR_HEIGHT = 128
    […]
    ├───Plane 6
    │   ├───Object ID: 52
    │   ├───CRTCs: {0}
    │   ├───Formats:
    │   │   └───ARGB8888 (0x34325241)
    │   └───Properties
    │       ├───"type" (immutable): enum {Overlay, Primary, Cursor} = Cursor
    │       ├───"FB_ID" (atomic): object framebuffer = 106
    │       │   ├───Object ID: 106
    │       │   ├───Size: 128x128
    │       │   ├───Format: ARGB8888 (0x34325241)
    │       │   └───Planes:
    │       │       └───Plane 0: offset = 0, pitch = 512
    │       ├───"IN_FENCE_FD" (atomic): srange [-1, INT32_MAX] = -1
    │       ├───"CRTC_ID" (atomic): object CRTC = 54
    │       ├───"CRTC_X" (atomic): srange [INT32_MIN, INT32_MAX] = 792
    │       ├───"CRTC_Y" (atomic): srange [INT32_MIN, INT32_MAX] = 1302
    │       ├───"CRTC_W" (atomic): range [0, INT32_MAX] = 128
    │       ├───"CRTC_H" (atomic): range [0, INT32_MAX] = 128
    │       ├───"SRC_X" (atomic): range [0, UINT32_MAX] = 0
    │       ├───"SRC_Y" (atomic): range [0, UINT32_MAX] = 0
    │       ├───"SRC_W" (atomic): range [0, UINT32_MAX] = 128
    │       ├───"SRC_H" (atomic): range [0, UINT32_MAX] = 128

However the cursor is displayed just fine. It seems like amdgpu sets
dc_cursor_attributes.pitch to the FB width in handle_cursor_update:

    attributes.pitch = attributes.width;

Is this expected? Did I get the cursor pitch constraint wrong? Should
we check for alignment instead?

Thanks,

Simon

[1]: https://github.com/emersion/linux/commits/amdgpu-cursor-pitch


More information about the amd-gfx mailing list