1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
From 6ab30a5dd3fb2ccbd918f147e91eb9bfe9849970 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Mon, 16 Oct 2023 12:13:38 +0100
Subject: [PATCH] drm/vc4: Correct address offset for planes with src_[xy]
offsets
11cf37e741b4 switched to using drm_fb_dma_get_gem_addr instead of
drm_fb_dma_get_gem_obj and adding fb->offset[].
However the tiled formats need to compute the offset in a more
involved manner than drm_fb_dma_get_gem_addr applies, and we
were ending up with the offset for src_[xy] being applied twice.
Switch back to using drm_fb_dma_get_gem_obj and fully computing
the offsets ourselves.
Fixes: 11cf37e741b4 ("drm/vc4: Move the buffer offset out of the vc4_plane_state")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/gpu/drm/vc4/vc4_plane.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -1447,9 +1447,9 @@ static int vc4_plane_mode_set(struct drm
vc4_state->ptr0_offset[0] = vc4_state->dlist_count;
for (i = 0; i < num_planes; i++) {
- dma_addr_t paddr = drm_fb_dma_get_gem_addr(fb, state, i);
+ struct drm_gem_dma_object *bo = drm_fb_dma_get_gem_obj(fb, i);
- vc4_dlist_write(vc4_state, paddr + offsets[i]);
+ vc4_dlist_write(vc4_state, bo->dma_addr + fb->offsets[i] + offsets[i]);
}
/* Pointer Context Word 0/1/2: Written by the HVS */
@@ -1842,9 +1842,8 @@ static int vc6_plane_mode_set(struct drm
* TODO: This only covers Raster Scan Order planes
*/
for (i = 0; i < num_planes; i++) {
- dma_addr_t paddr = drm_fb_dma_get_gem_addr(fb, state, i);
-
- paddr += offsets[i];
+ struct drm_gem_dma_object *bo = drm_fb_dma_get_gem_obj(fb, i);
+ dma_addr_t paddr = bo->dma_addr + fb->offsets[i] + offsets[i];
/* Pointer Word 0 */
vc4_state->ptr0_offset[i] = vc4_state->dlist_count;
|