• Lyude Paul's avatar
    drm/nouveau/kms/nv50-: Always validate LUTs in nv50_head_atomic_check_lut() · 79af598a
    Lyude Paul authored
    When it comes to gamma or degamma luts, nouveau will actually skip the
    calculation of certain LUTs depending on the head and plane states. For
    instance, when the head is disabled we don't perform any error checking on
    the gamma LUT, and likewise if no planes are present and enabled in our
    atomic state we will skip error checking the degamma LUT. This is a bit of
    a problem though, since the per-head gamma and degamma props in DRM can be
    changed even while a head is disabled - a situation which can be triggered
    by the igt testcase mentioned down below.
    
    Originally I thought this was a bit silly and was tempted to just fix the
    igt test to only set gamma/degamma with the head enabled. After a bit of
    thinking though I realized we should fix this in nouveau. This is because
    if a program decides to set an invalid LUT for a head before enabling the
    head, such a property change would succeed while also making it impossible
    to turn the head back on until the LUT is removed or corrected - something
    that could be painful for a user to figure out.
    
    So, fix this checking both degamma and gamma LUTs unconditionally during
    atomic checks. We start by calling nv50_head_atomic_check_lut() regardless
    of whether the head is active or not in nv50_head_atomic_check(). Then we
    move the ilut error checking into nv50_head_atomic_check_lut() and add a
    per-head hook for it, primarily because as a per-CRTC property DRM we want
    the LUT to be error checked by the head any time it's included in an atomic
    state. Of course though, actual programming of the degamma lut to hardware
    is still handled in each plane's atomic check and commit.
    Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
    Testcase: igt/kms_color/pipe-invalid-*-lut-sizes
    Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
    Reviewed-by: default avatarKarol Herbst <kherbst@redhat.com>
    Signed-off-by: default avatarKarol Herbst <kherbst@redhat.com>
    Link: https://gitlab.freedesktop.org/drm/nouveau/-/merge_requests/10
    79af598a
wndwc37e.c 11.1 KB