Skip to content

Commit

Permalink
drm/vc4: txp: Add a rotation property to the writeback connector
Browse files Browse the repository at this point in the history
The txp block can implement transpose as it writes out the image
data, so expose that through the new connector rotation property.

Signed-off-by: Dave Stevenson <[email protected]>
  • Loading branch information
6by9 committed Oct 22, 2024
1 parent 717503c commit cf8b5ad
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions drivers/gpu/drm/vc4/vc4_txp.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_blend.h>
#include <drm/drm_drv.h>
#include <drm/drm_edid.h>
#include <drm/drm_fb_dma_helper.h>
Expand Down Expand Up @@ -259,10 +260,15 @@ static int vc4_txp_connector_atomic_check(struct drm_connector *conn,
crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);

fb = conn_state->writeback_job->fb;
if (fb->width != crtc_state->mode.hdisplay ||
fb->height != crtc_state->mode.vdisplay) {
DRM_DEBUG_KMS("Invalid framebuffer size %ux%u\n",
fb->width, fb->height);
if ((conn_state->rotation == DRM_MODE_ROTATE_0 &&
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)) {
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);
return -EINVAL;
}

Expand Down Expand Up @@ -330,6 +336,9 @@ static void vc4_txp_connector_atomic_commit(struct drm_connector *conn,
*/
ctrl |= TXP_ALPHA_INVERT;

if (conn_state->rotation & DRM_MODE_TRANSPOSE)
ctrl |= TXP_TRANSPOSE;

if (!drm_dev_enter(drm, &idx))
return;

Expand Down Expand Up @@ -608,6 +617,10 @@ static int vc4_txp_bind(struct device *dev, struct device *master, void *data)
if (ret)
return ret;

drm_connector_create_rotation_property(&txp->connector.base, DRM_MODE_ROTATE_0,
DRM_MODE_ROTATE_0 |
DRM_MODE_TRANSPOSE);

ret = devm_request_irq(dev, irq, vc4_txp_interrupt, 0,
dev_name(dev), txp);
if (ret)
Expand Down

0 comments on commit cf8b5ad

Please sign in to comment.