From 7f56ffc2b206a7966bf2ab2d6319fff597600121 Mon Sep 17 00:00:00 2001 From: Jeongjun Park Date: Sun, 29 Mar 2026 11:57:38 +0900 Subject: [PATCH 1/2] drm/vc4: txp: fix incorrect width and height check logic in vc4_txp_atomic_check Since incorrect conditional operator was used in vc4_txp_atomic_check(), the check may be bypassed if only one of the width or height does not match. To prevent this, the conditional operator must be corrected. Fixes: c5d3a57a17df ("drm/vc4: txp: Add a rotation property to the writeback connector") Signed-off-by: Jeongjun Park --- drivers/gpu/drm/vc4/vc4_txp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_txp.c b/drivers/gpu/drm/vc4/vc4_txp.c index f739303b2e9ebe..d3cdfe330912c0 100644 --- a/drivers/gpu/drm/vc4/vc4_txp.c +++ b/drivers/gpu/drm/vc4/vc4_txp.c @@ -261,11 +261,11 @@ static int vc4_txp_connector_atomic_check(struct drm_connector *conn, fb = conn_state->writeback_job->fb; if ((conn_state->rotation == DRM_MODE_ROTATE_0 && - fb->width != crtc_state->mode.hdisplay && - fb->height != crtc_state->mode.vdisplay) || + (fb->width != crtc_state->mode.hdisplay || + fb->height != crtc_state->mode.vdisplay)) || (conn_state->rotation == (DRM_MODE_ROTATE_0 | DRM_MODE_TRANSPOSE) && - fb->width != crtc_state->mode.vdisplay && - fb->height != crtc_state->mode.hdisplay)) { + (fb->width != crtc_state->mode.vdisplay || + fb->height != crtc_state->mode.hdisplay))) { DRM_DEBUG_KMS("Invalid framebuffer size %ux%u vs mode %ux%u\n", fb->width, fb->height, crtc_state->mode.hdisplay, crtc_state->mode.vdisplay); From 81efcb834676f416cfb6aef855cf511e68dfa479 Mon Sep 17 00:00:00 2001 From: Jeongjun Park Date: Thu, 9 Apr 2026 19:11:29 +0900 Subject: [PATCH 2/2] drm/vc4: txp: add implementation of the missing connector reset custom function In the previous commit, we added a rotation parameter to be used in the connector, but because we are still using the default reset function without implementing a custom reset function to properly initialize it, the rotation variable remains NULL until it is initialized directly in userspace. To prevent this, we must implement a custom reset function that properly initializes the rotation parameter. Fixes: 30c7044e03f4 ("drm: Add a rotation parameter to connectors.") Signed-off-by: Jeongjun Park --- drivers/gpu/drm/vc4/vc4_drv.h | 1 + drivers/gpu/drm/vc4/vc4_txp.c | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index a5f9f3d8ffed55..f0005f1307b98d 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -1087,6 +1087,7 @@ extern struct platform_driver vc4_vec_driver; /* vc4_txp.c */ extern struct platform_driver vc4_txp_driver; +void vc4_txp_connector_reset(struct drm_connector *connector); /* vc4_irq.c */ void vc4_irq_enable(struct drm_device *dev); diff --git a/drivers/gpu/drm/vc4/vc4_txp.c b/drivers/gpu/drm/vc4/vc4_txp.c index d3cdfe330912c0..92ad7105976919 100644 --- a/drivers/gpu/drm/vc4/vc4_txp.c +++ b/drivers/gpu/drm/vc4/vc4_txp.c @@ -390,11 +390,27 @@ vc4_txp_connector_detect(struct drm_connector *connector, bool force) return connector_status_connected; } +void vc4_txp_connector_reset(struct drm_connector *connector) +{ + uint64_t rotation = DRM_MODE_ROTATE_0; + + drm_atomic_helper_connector_reset(connector); + + if (connector->state) { + if (connector->rotation_property) + drm_object_property_get_default_value(&connector->base, + connector->rotation_property, + &rotation); + + connector->state->rotation = rotation; + } +} + static const struct drm_connector_funcs vc4_txp_connector_funcs = { .detect = vc4_txp_connector_detect, .fill_modes = drm_helper_probe_single_connector_modes, .destroy = drm_connector_cleanup, - .reset = drm_atomic_helper_connector_reset, + .reset = vc4_txp_connector_reset, .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };