diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2024-08-05 15:06:00 +0200 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2024-08-09 08:13:47 +0200 |
commit | 0f9ff361ad823b887cfb09dd78ecc8f25d32ecfa (patch) | |
tree | 0828ba1c89b5bb13c2172a2c3f3d870ef9a76f33 | |
parent | 9d09cac47de5358ace64dddd14278fea002e68c3 (diff) |
drm/mgag200: vga-bmc: Control BMC scanout from encoder
Move calls to stop and start BMC scanout from CRTC helpers to the
VGA-BMC encoder's atomic_disable and atomic_enable. Makes the BMC
scanout transparent to the CRTC.
DRM's atomic helpers call an encoder's atomic_disable and atomic_enable
helpers for all enabled encoders. The BMC stops scanning out the VGA
signal if modeset disables the VGA encoder, and starts scanning out
if the modeset enables the VGA encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240805130622.63458-5-tzimmermann@suse.de
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_g200er.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_g200ev.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_g200se.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_mode.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_vga_bmc.c | 20 |
5 files changed, 20 insertions, 15 deletions
diff --git a/drivers/gpu/drm/mgag200/mgag200_g200er.c b/drivers/gpu/drm/mgag200/mgag200_g200er.c index e0f7816ad87a..b99b308a7e54 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200er.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200er.c @@ -207,9 +207,6 @@ static void mgag200_g200er_crtc_helper_atomic_enable(struct drm_crtc *crtc, mgag200_enable_display(mdev); - if (mdev->info->sync_bmc) - mgag200_bmc_start_scanout(mdev); - drm_crtc_vblank_on(crtc); } diff --git a/drivers/gpu/drm/mgag200/mgag200_g200ev.c b/drivers/gpu/drm/mgag200/mgag200_g200ev.c index a2c683f82127..717e4357adcc 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200ev.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200ev.c @@ -208,9 +208,6 @@ static void mgag200_g200ev_crtc_helper_atomic_enable(struct drm_crtc *crtc, mgag200_enable_display(mdev); - if (mdev->info->sync_bmc) - mgag200_bmc_start_scanout(mdev); - drm_crtc_vblank_on(crtc); } diff --git a/drivers/gpu/drm/mgag200/mgag200_g200se.c b/drivers/gpu/drm/mgag200/mgag200_g200se.c index b83f3f31ed0e..0db7e14e3328 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200se.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200se.c @@ -339,9 +339,6 @@ static void mgag200_g200se_crtc_helper_atomic_enable(struct drm_crtc *crtc, mgag200_enable_display(mdev); - if (mdev->info->sync_bmc) - mgag200_bmc_start_scanout(mdev); - drm_crtc_vblank_on(crtc); } diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index 8dc16821e1cd..7159909aca1e 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -693,9 +693,6 @@ void mgag200_crtc_helper_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_ mgag200_enable_display(mdev); - if (mdev->info->sync_bmc) - mgag200_bmc_start_scanout(mdev); - drm_crtc_vblank_on(crtc); } @@ -705,9 +702,6 @@ void mgag200_crtc_helper_atomic_disable(struct drm_crtc *crtc, struct drm_atomic drm_crtc_vblank_off(crtc); - if (mdev->info->sync_bmc) - mgag200_bmc_stop_scanout(mdev); - mgag200_disable_display(mdev); } diff --git a/drivers/gpu/drm/mgag200/mgag200_vga_bmc.c b/drivers/gpu/drm/mgag200/mgag200_vga_bmc.c index 77340f2dee17..a5a3ac108bd5 100644 --- a/drivers/gpu/drm/mgag200/mgag200_vga_bmc.c +++ b/drivers/gpu/drm/mgag200/mgag200_vga_bmc.c @@ -8,6 +8,24 @@ #include "mgag200_ddc.h" #include "mgag200_drv.h" +static void mgag200_vga_bmc_encoder_atomic_disable(struct drm_encoder *encoder, + struct drm_atomic_state *state) +{ + struct mga_device *mdev = to_mga_device(encoder->dev); + + if (mdev->info->sync_bmc) + mgag200_bmc_stop_scanout(mdev); +} + +static void mgag200_vga_bmc_encoder_atomic_enable(struct drm_encoder *encoder, + struct drm_atomic_state *state) +{ + struct mga_device *mdev = to_mga_device(encoder->dev); + + if (mdev->info->sync_bmc) + mgag200_bmc_start_scanout(mdev); +} + static int mgag200_vga_bmc_encoder_atomic_check(struct drm_encoder *encoder, struct drm_crtc_state *new_crtc_state, struct drm_connector_state *new_connector_state) @@ -21,6 +39,8 @@ static int mgag200_vga_bmc_encoder_atomic_check(struct drm_encoder *encoder, } static const struct drm_encoder_helper_funcs mgag200_dac_encoder_helper_funcs = { + .atomic_disable = mgag200_vga_bmc_encoder_atomic_disable, + .atomic_enable = mgag200_vga_bmc_encoder_atomic_enable, .atomic_check = mgag200_vga_bmc_encoder_atomic_check, }; |