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
This commit is contained in:
Thomas Zimmermann 2024-08-05 15:06:00 +02:00
parent 9d09cac47d
commit 0f9ff361ad
5 changed files with 20 additions and 15 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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,
};