Skip to content

Commit acfbdae

Browse files
6by9popcornmix
authored andcommitted
drm/vc4: txp: Add a rotation property to the writeback connector
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 <dave.stevenson@raspberrypi.com>
1 parent 7192bac commit acfbdae

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

drivers/gpu/drm/vc4/vc4_txp.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include <drm/drm_atomic.h>
1717
#include <drm/drm_atomic_helper.h>
18+
#include <drm/drm_blend.h>
1819
#include <drm/drm_drv.h>
1920
#include <drm/drm_edid.h>
2021
#include <drm/drm_fb_dma_helper.h>
@@ -259,10 +260,15 @@ static int vc4_txp_connector_atomic_check(struct drm_connector *conn,
259260
crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
260261

261262
fb = conn_state->writeback_job->fb;
262-
if (fb->width != crtc_state->mode.hdisplay ||
263-
fb->height != crtc_state->mode.vdisplay) {
264-
DRM_DEBUG_KMS("Invalid framebuffer size %ux%u\n",
265-
fb->width, fb->height);
263+
if ((conn_state->rotation == DRM_MODE_ROTATE_0 &&
264+
fb->width != crtc_state->mode.hdisplay &&
265+
fb->height != crtc_state->mode.vdisplay) ||
266+
(conn_state->rotation == (DRM_MODE_ROTATE_0 | DRM_MODE_TRANSPOSE) &&
267+
fb->width != crtc_state->mode.vdisplay &&
268+
fb->height != crtc_state->mode.hdisplay)) {
269+
DRM_DEBUG_KMS("Invalid framebuffer size %ux%u vs mode %ux%u\n",
270+
fb->width, fb->height,
271+
crtc_state->mode.hdisplay, crtc_state->mode.vdisplay);
266272
return -EINVAL;
267273
}
268274

@@ -330,6 +336,9 @@ static void vc4_txp_connector_atomic_commit(struct drm_connector *conn,
330336
*/
331337
ctrl |= TXP_ALPHA_INVERT;
332338

339+
if (conn_state->rotation & DRM_MODE_TRANSPOSE)
340+
ctrl |= TXP_TRANSPOSE;
341+
333342
if (!drm_dev_enter(drm, &idx))
334343
return;
335344

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

620+
drm_connector_create_rotation_property(&txp->connector.base, DRM_MODE_ROTATE_0,
621+
DRM_MODE_ROTATE_0 |
622+
DRM_MODE_TRANSPOSE);
623+
611624
ret = devm_request_irq(dev, irq, vc4_txp_interrupt, 0,
612625
dev_name(dev), txp);
613626
if (ret)

0 commit comments

Comments
 (0)