1 From e7ecdf293b07f35f23684badcab6afa58928257a Mon Sep 17 00:00:00 2001
2 From: popcornmix <popcornmix@gmail.com>
3 Date: Tue, 18 Apr 2017 21:43:46 +0100
4 Subject: [PATCH 114/454] vc4_fkms: Apply firmware overscan offset to hardware
8 drivers/gpu/drm/vc4/vc4_firmware_kms.c | 17 +++++++++++++++++
9 1 file changed, 17 insertions(+)
11 --- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
12 +++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
13 @@ -39,6 +39,7 @@ struct vc4_crtc {
16 struct drm_pending_vblank_event *event;
20 static inline struct vc4_crtc *to_vc4_crtc(struct drm_crtc *crtc)
21 @@ -180,6 +181,7 @@ static void vc4_cursor_plane_atomic_upda
22 struct drm_plane_state *old_state)
24 struct vc4_dev *vc4 = to_vc4_dev(plane->dev);
25 + struct vc4_crtc *vc4_crtc = to_vc4_crtc(plane->crtc);
26 struct drm_plane_state *state = plane->state;
27 struct drm_framebuffer *fb = state->fb;
28 struct drm_gem_cma_object *bo = drm_fb_cma_get_gem_obj(fb, 0);
29 @@ -200,6 +202,12 @@ static void vc4_cursor_plane_atomic_upda
30 bo->paddr + fb->offsets[0],
33 + /* add on the top/left offsets when overscan is active */
35 + packet_state[1] += vc4_crtc->overscan[0];
36 + packet_state[2] += vc4_crtc->overscan[1];
39 ret = rpi_firmware_property(vc4->firmware,
40 RPI_FIRMWARE_SET_CURSOR_STATE,
42 @@ -641,6 +649,15 @@ static int vc4_fkms_bind(struct device *
44 goto err_destroy_connector;
46 + ret = rpi_firmware_property(vc4->firmware,
47 + RPI_FIRMWARE_FRAMEBUFFER_GET_OVERSCAN,
48 + &vc4_crtc->overscan,
49 + sizeof(vc4_crtc->overscan));
51 + DRM_ERROR("Failed to get overscan state: 0x%08x\n", vc4_crtc->overscan[0]);
52 + memset(&vc4_crtc->overscan, 0, sizeof(vc4_crtc->overscan));
55 platform_set_drvdata(pdev, vc4_crtc);