summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/mgag200
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2019-09-11 14:03:52 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2019-09-17 13:11:09 +0200
commitdcc7b1f3ae99810ad745e5c41c2f7bf19be608c8 (patch)
tree4205b596f335aa456d44e30ba198cbc6959f06ec /drivers/gpu/drm/mgag200
parent820d6606e9c27d7e52bd065a2798e09cc7a35532 (diff)
downloadlinux-dcc7b1f3ae99810ad745e5c41c2f7bf19be608c8.tar.bz2
drm/mgag200: 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 mgag200 cursor handling. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190911120352.20084-4-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/mgag200')
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_cursor.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/gpu/drm/mgag200/mgag200_cursor.c b/drivers/gpu/drm/mgag200/mgag200_cursor.c
index 289ce3e29032..89f61573a497 100644
--- a/drivers/gpu/drm/mgag200/mgag200_cursor.c
+++ b/drivers/gpu/drm/mgag200/mgag200_cursor.c
@@ -85,17 +85,12 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc,
if (!obj)
return -ENOENT;
gbo = drm_gem_vram_of_gem(obj);
- ret = drm_gem_vram_pin(gbo, 0);
- if (ret) {
- dev_err(&dev->pdev->dev, "failed to lock user bo\n");
- goto err_drm_gem_object_put_unlocked;
- }
- src = drm_gem_vram_kmap(gbo, true, NULL);
+ src = drm_gem_vram_vmap(gbo);
if (IS_ERR(src)) {
ret = PTR_ERR(src);
dev_err(&dev->pdev->dev,
- "failed to kmap user buffer updates\n");
- goto err_drm_gem_vram_unpin_src;
+ "failed to map user buffer updates\n");
+ goto err_drm_gem_object_put_unlocked;
}
/* Pin and map up-coming buffer to write colour indices */
@@ -103,7 +98,7 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc,
if (ret) {
dev_err(&dev->pdev->dev,
"failed to pin cursor buffer: %d\n", ret);
- goto err_drm_gem_vram_kunmap_src;
+ goto err_drm_gem_vram_vunmap;
}
dst = drm_gem_vram_kmap(pixels_next, true, NULL);
if (IS_ERR(dst)) {
@@ -213,8 +208,7 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc,
mdev->cursor.pixels_current = pixels_next;
drm_gem_vram_kunmap(pixels_next);
- drm_gem_vram_kunmap(gbo);
- drm_gem_vram_unpin(gbo);
+ drm_gem_vram_vunmap(gbo, src);
drm_gem_object_put_unlocked(obj);
return 0;
@@ -223,10 +217,8 @@ err_drm_gem_vram_kunmap_dst:
drm_gem_vram_kunmap(pixels_next);
err_drm_gem_vram_unpin_dst:
drm_gem_vram_unpin(pixels_next);
-err_drm_gem_vram_kunmap_src:
- drm_gem_vram_kunmap(gbo);
-err_drm_gem_vram_unpin_src:
- drm_gem_vram_unpin(gbo);
+err_drm_gem_vram_vunmap:
+ drm_gem_vram_vunmap(gbo, src);
err_drm_gem_object_put_unlocked:
drm_gem_object_put_unlocked(obj);
return ret;