• Thomas Zimmermann's avatar
    drm/mgag200: Add vblank support · 89c6ea20
    Thomas Zimmermann authored
    There's no VBLANK interrupt on Matrox chipsets. The workaround that is
    being used here and in other free Matrox drivers is to program <linecomp>
    to the value of <vblkstr> and enable the VLINE interrupt. This triggers
    an interrupt at the time when VBLANK begins.
    
    VLINE uses separate registers for enabling and clearing pending interrupts.
    No extra synchronization between irq handler and the rest of the driver is
    required.
    
    v6:
    - clear VLINE status bit before registering IRQ (Jocelyn)
    
    v5:
    - disable all interrupts before registering IRQ (Jocelyn)
    - don't read from ICLEAR (Jocelyn)
    
    v4:
    - recreate patch on latest upstream
    - use devm_request_irq() for managed cleanup
    - fail if vblanking cannot be initialized
    - rename register constants (Sam, Emil)
    - clear interrupt before registering handler (Ville)
    - move <linecomp> programming into separate commit
    - set <linecomp> to <vblkstr>
    - fix typo in commit message
    
    v3:
    - set <linecomp> to <vdisplay> + 1 to trigger at VBLANK
    - expand comment on linecomp
    
    v2:
    - only signal vblank on CRTC 0
    - use constants for registers and fields
    - set VLINECLR before enabling interrupt
    - test against STATUS and IEN in irq handler
    - coding-style fixes
    Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
    Reviewed-by: default avatarJocelyn Falempe <jfalempe@redhat.com>
    Acked-by: default avatarGerd Hoffmann <kraxel@redhat.com>
    Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
    Tested-by: default avatarJocelyn Falempe <jfalempe@redhat.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240718104551.575912-7-tzimmermann@suse.de
    89c6ea20
mgag200_g200wb.c 8.25 KB