• Nicholas Kazlauskas's avatar
    drm/amd/display: Refactor CRTC interrupt toggling logic · d6ef9b41
    Nicholas Kazlauskas authored
    [Why]
    The vblank and pageflip interrupts should only be enabled for a CRTC
    that's enabled and has active planes.
    
    The current logic takes care of this, but isn't setup to handle the case
    where the active plane count goes to zero but the stream remains
    enabled.
    
    We currently block this case since we don't allow commits that enable a
    CRTC with no active planes, but shouldn't be any reason we can't support
    this from a hardware perspective and many userspace applications expect
    to be able to do it (like IGT).
    
    [How]
    The count_crtc_active_planes function fills in the number of
    "active_planes" on the dm_crtc_state. This should be the same as
    DC's plane_count on the stream_status but easier to access since we
    don't need to lock the private atomic state with the DC context.
    
    Add the "interrupts_enabled" flag to the dm_crtc_state and set it based
    on whether the stream exists and if there are active planes on the
    stream.
    
    Update the disable and enable logic to make use of this new flag.
    
    There shouldn't be any functional change (yet) with this patch.
    Signed-off-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
    Reviewed-by: default avatarDavid Francis <David.Francis@amd.com>
    Acked-by: default avatarLeo Li <sunpeng.li@amd.com>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    d6ef9b41
amdgpu_dm.c 188 KB