]> git.ipfire.org Git - thirdparty/openwrt.git/blob
b0e5566ac13f7e78695c5477048285803e64eef4
[thirdparty/openwrt.git] /
1 From 8346446098032c62d1de891a97c7f62264b18f81 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Wed, 14 Aug 2024 16:41:07 +0100
4 Subject: [PATCH] drm/vc4: txp: Add a rotation property to the writeback
5 connector
6
7 The txp block can implement transpose as it writes out the image
8 data, so expose that through the new connector rotation property.
9
10 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
11 ---
12 drivers/gpu/drm/vc4/vc4_txp.c | 21 +++++++++++++++++----
13 1 file changed, 17 insertions(+), 4 deletions(-)
14
15 --- a/drivers/gpu/drm/vc4/vc4_txp.c
16 +++ b/drivers/gpu/drm/vc4/vc4_txp.c
17 @@ -15,6 +15,7 @@
18
19 #include <drm/drm_atomic.h>
20 #include <drm/drm_atomic_helper.h>
21 +#include <drm/drm_blend.h>
22 #include <drm/drm_drv.h>
23 #include <drm/drm_edid.h>
24 #include <drm/drm_fb_dma_helper.h>
25 @@ -259,10 +260,15 @@ static int vc4_txp_connector_atomic_chec
26 crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
27
28 fb = conn_state->writeback_job->fb;
29 - if (fb->width != crtc_state->mode.hdisplay ||
30 - fb->height != crtc_state->mode.vdisplay) {
31 - DRM_DEBUG_KMS("Invalid framebuffer size %ux%u\n",
32 - fb->width, fb->height);
33 + if ((conn_state->rotation == DRM_MODE_ROTATE_0 &&
34 + fb->width != crtc_state->mode.hdisplay &&
35 + fb->height != crtc_state->mode.vdisplay) ||
36 + (conn_state->rotation == (DRM_MODE_ROTATE_0 | DRM_MODE_TRANSPOSE) &&
37 + fb->width != crtc_state->mode.vdisplay &&
38 + fb->height != crtc_state->mode.hdisplay)) {
39 + DRM_DEBUG_KMS("Invalid framebuffer size %ux%u vs mode %ux%u\n",
40 + fb->width, fb->height,
41 + crtc_state->mode.hdisplay, crtc_state->mode.vdisplay);
42 return -EINVAL;
43 }
44
45 @@ -330,6 +336,9 @@ static void vc4_txp_connector_atomic_com
46 */
47 ctrl |= TXP_ALPHA_INVERT;
48
49 + if (conn_state->rotation & DRM_MODE_TRANSPOSE)
50 + ctrl |= TXP_TRANSPOSE;
51 +
52 if (!drm_dev_enter(drm, &idx))
53 return;
54
55 @@ -608,6 +617,10 @@ static int vc4_txp_bind(struct device *d
56 if (ret)
57 return ret;
58
59 + drm_connector_create_rotation_property(&txp->connector.base, DRM_MODE_ROTATE_0,
60 + DRM_MODE_ROTATE_0 |
61 + DRM_MODE_TRANSPOSE);
62 +
63 ret = devm_request_irq(dev, irq, vc4_txp_interrupt, 0,
64 dev_name(dev), txp);
65 if (ret)