Commit 820d6606 authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/ast: Use drm_gem_vram_{vmap,vunmap}() to map cursor source BO

The VRAM helper's vmap interfaces provide pinning and mapping of BO
memory. This patch replaces the respective code in ast cursor handling.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Acked-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190911120352.20084-3-tzimmermann@suse.de
parent c8908bde
...@@ -1167,26 +1167,22 @@ static int ast_cursor_set(struct drm_crtc *crtc, ...@@ -1167,26 +1167,22 @@ static int ast_cursor_set(struct drm_crtc *crtc,
return -ENOENT; return -ENOENT;
} }
gbo = drm_gem_vram_of_gem(obj); gbo = drm_gem_vram_of_gem(obj);
src = drm_gem_vram_vmap(gbo);
ret = drm_gem_vram_pin(gbo, 0);
if (ret)
goto err_drm_gem_object_put_unlocked;
src = drm_gem_vram_kmap(gbo, true, NULL);
if (IS_ERR(src)) { if (IS_ERR(src)) {
ret = PTR_ERR(src); ret = PTR_ERR(src);
goto err_drm_gem_vram_unpin; goto err_drm_gem_object_put_unlocked;
} }
dst = drm_gem_vram_kmap(drm_gem_vram_of_gem(ast->cursor_cache), dst = drm_gem_vram_kmap(drm_gem_vram_of_gem(ast->cursor_cache),
false, NULL); false, NULL);
if (IS_ERR(dst)) { if (IS_ERR(dst)) {
ret = PTR_ERR(dst); ret = PTR_ERR(dst);
goto err_drm_gem_vram_kunmap; goto err_drm_gem_vram_vunmap;
} }
dst_gpu = drm_gem_vram_offset(drm_gem_vram_of_gem(ast->cursor_cache)); dst_gpu = drm_gem_vram_offset(drm_gem_vram_of_gem(ast->cursor_cache));
if (dst_gpu < 0) { if (dst_gpu < 0) {
ret = (int)dst_gpu; ret = (int)dst_gpu;
goto err_drm_gem_vram_kunmap; goto err_drm_gem_vram_vunmap;
} }
dst += (AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE)*ast->next_cursor; dst += (AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE)*ast->next_cursor;
...@@ -1221,16 +1217,13 @@ static int ast_cursor_set(struct drm_crtc *crtc, ...@@ -1221,16 +1217,13 @@ static int ast_cursor_set(struct drm_crtc *crtc,
ast_show_cursor(crtc); ast_show_cursor(crtc);
drm_gem_vram_kunmap(gbo); drm_gem_vram_vunmap(gbo, src);
drm_gem_vram_unpin(gbo);
drm_gem_object_put_unlocked(obj); drm_gem_object_put_unlocked(obj);
return 0; return 0;
err_drm_gem_vram_kunmap: err_drm_gem_vram_vunmap:
drm_gem_vram_kunmap(gbo); drm_gem_vram_vunmap(gbo, src);
err_drm_gem_vram_unpin:
drm_gem_vram_unpin(gbo);
err_drm_gem_object_put_unlocked: err_drm_gem_object_put_unlocked:
drm_gem_object_put_unlocked(obj); drm_gem_object_put_unlocked(obj);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment