Skip to content

vc4 drm planes should not define all CRTCs as possible  #3734

Closed
@schauveau

Description

@schauveau

In the current vc4 driver each CRTC is using 3 planes (one of each type) each created with possible_crtcs=0xff
That value comes from the 3rd argument of

ret = drm_universal_plane_init(dev, plane, 0xff,

This is incorrect for 2 reasons.

First, some unused bits are sets. This is unexpected and that could potentially confuse some client implementations that rely on the detection of the last possible crtcs.

Second, and this is the most important, having multiple bits means that the client can freely associate each plane to each CRTC. This is clearly not the intention here. For example, I used a modified version of sway/wlroots to assign the 1st crtc to the 2nd cursor plane and the 2nd crtc to the 1st cursor plane. This is supposed to be a PERFECTLY LEGAL interpretation of the DRM api. On my rpi4 with 2 monitors, the result was that my left screen was showing the right screen cursor (and the other way around).

So my advice is to change vc4_firmware_kms.c as follow:

  1. Add an argument uint32_t possible_crtcs to vc4_fkms_plane_init.
  2. Replace 0xff by possible_crtcs in the call of drm_universal_plane_init.
  3. In each call of vc4_fkms_plane_init, use drm_crtc_mask(ctrc) for the possible_crtrs argument.

See also:
swaywm/wlroots#2333
swaywm/wlroots#1943

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions