Commit aa8ec5d7 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov Committed by Maxime Ripard

drm/vkms: move wb's atomic_check from encoder to connector

As the renamed drm_atomic_helper_check_wb_connector_state() now accepts
drm_writeback_connector as the first argument (instead of drm_encoder),
move the VKMS writeback atomic_check from drm_encoder_helper_funcs to
drm_connector_helper_funcs. Also drop the vkms_wb_encoder_helper_funcs,
which have become empty now.
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: default avatarMaxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20231208010314.3395904-3-dmitry.baryshkov@linaro.org
parent 66f01114
...@@ -30,18 +30,25 @@ static const struct drm_connector_funcs vkms_wb_connector_funcs = { ...@@ -30,18 +30,25 @@ static const struct drm_connector_funcs vkms_wb_connector_funcs = {
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
}; };
static int vkms_wb_encoder_atomic_check(struct drm_encoder *encoder, static int vkms_wb_atomic_check(struct drm_connector *connector,
struct drm_crtc_state *crtc_state, struct drm_atomic_state *state)
struct drm_connector_state *conn_state)
{ {
struct drm_connector *connector = conn_state->connector; struct drm_connector_state *conn_state =
drm_atomic_get_new_connector_state(state, connector);
struct drm_crtc_state *crtc_state;
struct drm_framebuffer *fb; struct drm_framebuffer *fb;
const struct drm_display_mode *mode = &crtc_state->mode; const struct drm_display_mode *mode;
int ret; int ret;
if (!conn_state->writeback_job || !conn_state->writeback_job->fb) if (!conn_state->writeback_job || !conn_state->writeback_job->fb)
return 0; return 0;
if (!conn_state->crtc)
return 0;
crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
mode = &crtc_state->mode;
fb = conn_state->writeback_job->fb; fb = conn_state->writeback_job->fb;
if (fb->width != mode->hdisplay || fb->height != mode->vdisplay) { if (fb->width != mode->hdisplay || fb->height != mode->vdisplay) {
DRM_DEBUG_KMS("Invalid framebuffer size %ux%u\n", DRM_DEBUG_KMS("Invalid framebuffer size %ux%u\n",
...@@ -49,17 +56,13 @@ static int vkms_wb_encoder_atomic_check(struct drm_encoder *encoder, ...@@ -49,17 +56,13 @@ static int vkms_wb_encoder_atomic_check(struct drm_encoder *encoder,
return -EINVAL; return -EINVAL;
} }
ret = drm_atomic_helper_check_wb_connector_state(connector, conn_state->state); ret = drm_atomic_helper_check_wb_connector_state(connector, state);
if (ret < 0) if (ret < 0)
return ret; return ret;
return 0; return 0;
} }
static const struct drm_encoder_helper_funcs vkms_wb_encoder_helper_funcs = {
.atomic_check = vkms_wb_encoder_atomic_check,
};
static int vkms_wb_connector_get_modes(struct drm_connector *connector) static int vkms_wb_connector_get_modes(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
...@@ -162,6 +165,7 @@ static const struct drm_connector_helper_funcs vkms_wb_conn_helper_funcs = { ...@@ -162,6 +165,7 @@ static const struct drm_connector_helper_funcs vkms_wb_conn_helper_funcs = {
.prepare_writeback_job = vkms_wb_prepare_job, .prepare_writeback_job = vkms_wb_prepare_job,
.cleanup_writeback_job = vkms_wb_cleanup_job, .cleanup_writeback_job = vkms_wb_cleanup_job,
.atomic_commit = vkms_wb_atomic_commit, .atomic_commit = vkms_wb_atomic_commit,
.atomic_check = vkms_wb_atomic_check,
}; };
int vkms_enable_writeback_connector(struct vkms_device *vkmsdev) int vkms_enable_writeback_connector(struct vkms_device *vkmsdev)
...@@ -172,7 +176,7 @@ int vkms_enable_writeback_connector(struct vkms_device *vkmsdev) ...@@ -172,7 +176,7 @@ int vkms_enable_writeback_connector(struct vkms_device *vkmsdev)
return drm_writeback_connector_init(&vkmsdev->drm, wb, return drm_writeback_connector_init(&vkmsdev->drm, wb,
&vkms_wb_connector_funcs, &vkms_wb_connector_funcs,
&vkms_wb_encoder_helper_funcs, NULL,
vkms_wb_formats, vkms_wb_formats,
ARRAY_SIZE(vkms_wb_formats), ARRAY_SIZE(vkms_wb_formats),
1); 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment