• Rodrigo Siqueira's avatar
    drm/amd/display: Fix two cursor duplication when using overlay · ddab8bd7
    Rodrigo Siqueira authored
    Our driver supports overlay planes, and as expected, some userspace
    compositor takes advantage of these features. If the userspace is not
    enabling the cursor, they can use multiple planes as they please.
    Nevertheless, we start to have constraints when userspace tries to
    enable hardware cursor with various planes. Basically, we cannot draw
    the cursor at the same size and position on two separated pipes since it
    uses extra bandwidth and DML only run with one cursor.
    
    For those reasons, when we enable hardware cursor and multiple planes,
    our driver should accept variations like the ones described below:
    
      +-------------+   +--------------+
      | +---------+ |   |              |
      | |Primary  | |   | Primary      |
      | |         | |   | Overlay      |
      | +---------+ |   |              |
      |Overlay      |   |              |
      +-------------+   +--------------+
    
    In this scenario, we can have the desktop UI in the overlay and some
    other framebuffer attached to the primary plane (e.g., video). However,
    userspace needs to obey some rules and avoid scenarios like the ones
    described below (when enabling hw cursor):
    
                                          +--------+
                                          |Overlay |
     +-------------+    +-----+-------+ +-|        |--+
     | +--------+  | +--------+       | | +--------+  |
     | |Overlay |  | |Overlay |       | |             |
     | |        |  | |        |       | |             |
     | +--------+  | +--------+       | |             |
     | Primary     |    | Primary     | | Primary     |
     +-------------+    +-------------+ +-------------+
    
     +-------------+   +-------------+
     |     +--------+  |  Primary    |
     |     |Overlay |  |             |
     |     |        |  |             |
     |     +--------+  | +--------+  |
     | Primary     |   | |Overlay |  |
     +-------------+   +-|        |--+
                         +--------+
    
    If the userspace violates some of the above scenarios, our driver needs
    to reject the commit; otherwise, we can have unexpected behavior. Since
    we don't have a proper driver validation for the above case, we can see
    some problems like a duplicate cursor in applications that use multiple
    planes. This commit fixes the cursor issue and others by adding adequate
    verification for multiple planes.
    
    Change since V1 (Harry and Sean):
    - Remove cursor verification from the equation.
    
    Cc: Louis Li <Ching-shih.Li@amd.com>
    Cc: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
    Cc: Harry Wentland <Harry.Wentland@amd.com>
    Cc: Hersen Wu <hersenxs.wu@amd.com>
    Cc: Sean Paul <seanpaul@chromium.org>
    Signed-off-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
    Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    ddab8bd7
amdgpu_dm.c 304 KB