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. Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx> --- drivers/gpu/drm/mgag200/mgag200_fb.c | 26 ++++++++++++++------------ 1 file 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..dbcf179a120c 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,18 +36,20 @@ 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. + /* We pin the BO to system memory so it won't be moved during + * the update and doesn't waste video ram. If the BO is already + * located in VRAM, the pin operation will simply increment the + * pin count. */ - if (drm_can_sleep()) - ret = drm_gem_vram_lock(gbo, true); - if (ret) { - if (ret != -EBUSY) - return; - + if (drm_can_sleep()) { + ret = drm_gem_vram_pin(gbo, TTM_PL_FLAG_SYSTEM); + if (ret) { + if (ret != -EBUSY) + return; + store_for_later = true; + } + } else store_for_later = true; - } x2 = x + width - 1; y2 = y + height - 1; @@ -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, -- 2.21.0 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel