[PATCH 0/2] drm/amdgpu/display: Make multi-plane configurations more flexible

Leo Li sunpeng.li at amd.com
Fri Apr 12 20:14:28 UTC 2024



On 2024-04-12 11:31, Alex Deucher wrote:
> On Fri, Apr 12, 2024 at 11:08 AM Pekka Paalanen
> <pekka.paalanen at collabora.com> wrote:
>>
>> On Fri, 12 Apr 2024 10:28:52 -0400
>> Leo Li <sunpeng.li at amd.com> wrote:
>>
>>> On 2024-04-12 04:03, Pekka Paalanen wrote:
>>>> On Thu, 11 Apr 2024 16:33:57 -0400
>>>> Leo Li <sunpeng.li at amd.com> wrote:
>>>>
>>
>> ...
>>
>>>>> That begs the question of what can be nailed down and what can left to
>>>>> independent implementation. I guess things like which plane should be enabled
>>>>> first (PRIMARY), and how zpos should be interpreted (overlay, underlay, mixed)
>>>>> can be defined. How to handle atomic test failures could be as well.
>>>>
>>>> What room is there for the interpretation of zpos values?
>>>>
>>>> I thought they are unambiguous already: only the relative numerical
>>>> order matters, and that uniquely defines the KMS plane ordering.
>>>
>>> The zpos value of the PRIMARY plane relative to OVERLAYS, for example, as a way
>>> for vendors to communicate overlay, underlay, or mixed-arrangement support. I
>>> don't think allowing OVERLAYs to be placed under the PRIMARY is currently
>>> documented as a way to support underlay.
>>
>> I always thought it's obvious that the zpos numbers dictate the plane
>> order without any other rules. After all, we have the universal planes
>> concept, where the plane type is only informational to aid heuristics
>> rather than defining anything.
>>
>> Only if the zpos property does not exist, the plane types would come
>> into play.
>>
>> Of course, if there actually exists userspace that fails if zpos allows
>> an overlay type plane to be placed below primary, or fails if primary
>> zpos is not zero, then DRM needs a new client cap.

Right, it wasn't immediately clear to me that the API allowed placement of 
things beneath the PRIMARY. But reading the docs for drm_plane_create_zpos*, 
there's nothing that forbids it.

>>
>>> libliftoff for example, assumes that the PRIMARY has the lowest zpos. So
>>> underlay arrangements will use an OVERLAY for the scanout plane, and the PRIMARY
>>> for the underlay view.
>>
>> That's totally ok. It works, right? Plane type does not matter if the
>> KMS driver accepts the configuration.
>>
>> What is a "scanout plane"? Aren't all KMS planes by definition scanout
>> planes?

Pardon my terminology, I thought the scanout plane was where weston rendered
non-offloadable surfaces to. I guess it's more correct to call it the "render
plane". On weston, it seems to be always assigned to the PRIMARY.


For libliftoff, using OVERLAYs as the render plane and PRIMARY as the underlay
plane would work. But I think keeping the render plane on PRIMARY (a la weston)
makes underlay arrangements easier to allocate, and would be nice to incorporate
into a shared algorithm.

In an underlay arrangement, pushing down an OVERLAY's zpos below the PRIMARY's
zpos is simpler than swapping their surfaces. If such an arrangement fails
atomic_test, we won't have to worry about swapping the surfaces back. Of course,
it's not that we can't keep track of that in the algorithm, but I think it does
make things easier.

It may help with reducing the amount of atomic tests. Assuming that the same DRM
plane provides the same format/color management/transformation support
regardless of it's zpos, we should be able to reasonably expect that changing
it's z-ordering will not cause atomic_test failures (or at least, expect less
causes for failure). In other words, swapping the render plane from the PRIMARY
to an OVERLAY might have more causes for an atomic_test fail, versus changing
their z-ordering. The driver might have to do more things under-the-hood to
provide this consistent behavior, but I think that's the right place for it.
After all, drivers should know more about their hardware's behavior.

The assumption that the PRIMARY has the lowest zpos isn't always true. I
was made aware that the imx8mq platform places all of their OVERLAYS beneath the
PRIMARY. Granted, the KMS code for enabling OVERLAYS is not upstream yet, but it
is available from this thread:
https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1258#note_2319898
. I guess this is more of a bad assumption that should be fixed in libliftoff.

>>
>> IOW, if the KMS client understands zpos and can do a proper KMS
>> configuration search, and all planes have zpos property, then there is
>> no need to look at the plane type at all. That is the goal of the
>> universal planes feature.
> 
> The optimal configuration with DCN hardware is using underlays.  E.g.,
> the desktop plane would be at the top and would have holes cut out of
> it for videos or windows that want their own plane.  If you do it the
> other way around, there are lots of limitations.
> 
> Alex

Right, patch 1/2 tries to work around one of these limitations (cursor-on-yuv). 
Others have mentioned we can do the same for scaling.

Thanks,
Leo

> 
>>
>>
>> Thanks,
>> pq


More information about the amd-gfx mailing list