aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen-Yu Tsai <wens@csie.org>2017-10-14 00:02:48 -0400
committerMaxime Ripard <maxime.ripard@free-electrons.com>2017-10-16 03:53:55 -0400
commitcff2192f807d442e498d43a20e54c6851cd4cb56 (patch)
tree07f3500089578d4c72fe8e211fa04f64e51fd642
parent8270249fbeaf0a37250b0c533fd3613886ca3493 (diff)
drm/sun4i: backend: Use drm_fb_cma_get_gem_addr() to get display memory
Commit 4636ce93d5b2 ("drm/fb-cma-helper: Add drm_fb_cma_get_gem_addr()") adds a new helper, which covers fetching a drm_framebuffer's GEM object and calculating the buffer address for a given plane. This patch uses this helper to replace our own open coded version of the same function. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Link: https://patchwork.freedesktop.org/patch/msgid/20171014040252.9621-4-wens@csie.org
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_backend.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c
index 1cc1780f5091..243ddfdc9403 100644
--- a/drivers/gpu/drm/sun4i/sun4i_backend.c
+++ b/drivers/gpu/drm/sun4i/sun4i_backend.c
@@ -209,22 +209,11 @@ int sun4i_backend_update_layer_buffer(struct sun4i_backend *backend,
209{ 209{
210 struct drm_plane_state *state = plane->state; 210 struct drm_plane_state *state = plane->state;
211 struct drm_framebuffer *fb = state->fb; 211 struct drm_framebuffer *fb = state->fb;
212 struct drm_gem_cma_object *gem;
213 u32 lo_paddr, hi_paddr; 212 u32 lo_paddr, hi_paddr;
214 dma_addr_t paddr; 213 dma_addr_t paddr;
215 int bpp;
216
217 /* Get the physical address of the buffer in memory */
218 gem = drm_fb_cma_get_gem_obj(fb, 0);
219
220 DRM_DEBUG_DRIVER("Using GEM @ %pad\n", &gem->paddr);
221
222 /* Compute the start of the displayed memory */
223 bpp = fb->format->cpp[0];
224 paddr = gem->paddr + fb->offsets[0];
225 paddr += (state->src_x >> 16) * bpp;
226 paddr += (state->src_y >> 16) * fb->pitches[0];
227 214
215 /* Get the start of the displayed memory */
216 paddr = drm_fb_cma_get_gem_addr(fb, state, 0);
228 DRM_DEBUG_DRIVER("Setting buffer address to %pad\n", &paddr); 217 DRM_DEBUG_DRIVER("Setting buffer address to %pad\n", &paddr);
229 218
230 /* Write the 32 lower bits of the address (in bits) */ 219 /* Write the 32 lower bits of the address (in bits) */