diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2019-06-13 09:30:38 +0200 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2019-06-13 13:37:23 +0200 |
commit | f4ce5af71bc267a741672bf66467dd70282ff7ef (patch) | |
tree | db199a2f04d4aaed9836a47fbe957d381fd5e472 | |
parent | drm/ast: Pin framebuffer BO during dirty update (diff) | |
download | linux-f4ce5af71bc267a741672bf66467dd70282ff7ef.tar.xz linux-f4ce5af71bc267a741672bf66467dd70282ff7ef.zip |
drm/mgag200: Pin framebuffer BO during dirty update
Another explicit lock operation of a GEM VRAM BO is located in mgag200's
framebuffer update code. Instead of locking the BO, we pin it to wherever
it is.
v2:
* update with pin flag of 0
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190613073041.29350-7-tzimmermann@suse.de
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_fb.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c b/drivers/gpu/drm/mgag200/mgag200_fb.c index 97c575a9a86f..2a56796f5938 100644 --- a/drivers/gpu/drm/mgag200/mgag200_fb.c +++ b/drivers/gpu/drm/mgag200/mgag200_fb.c @@ -26,7 +26,7 @@ static void mga_dirty_update(struct mga_fbdev *mfbdev, struct drm_gem_vram_object *gbo; int src_offset, dst_offset; int bpp = mfbdev->mfb.base.format->cpp[0]; - int ret = -EBUSY; + int ret; u8 *dst; bool unmap = false; bool store_for_later = false; @@ -36,16 +36,18 @@ static void mga_dirty_update(struct mga_fbdev *mfbdev, obj = mfbdev->mfb.obj; gbo = drm_gem_vram_of_gem(obj); - /* Try to lock the BO. If we fail with -EBUSY then - * the BO is being moved and we should store up the - * damage until later. - */ - if (drm_can_sleep()) - ret = drm_gem_vram_lock(gbo, true); - if (ret) { - if (ret != -EBUSY) - return; - + if (drm_can_sleep()) { + /* We pin the BO so it won't be moved during the + * update. The actual location, video RAM or system + * memory, is not important. + */ + ret = drm_gem_vram_pin(gbo, 0); + if (ret) { + if (ret != -EBUSY) + return; + store_for_later = true; + } + } else { store_for_later = true; } @@ -100,7 +102,7 @@ static void mga_dirty_update(struct mga_fbdev *mfbdev, drm_gem_vram_kunmap(gbo); out: - drm_gem_vram_unlock(gbo); + drm_gem_vram_unpin(gbo); } static void mga_fillrect(struct fb_info *info, |