From 82ff2fb5d184e95c7877c58359cef4f5d43df9c1 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Thu, 16 May 2019 18:27:45 +0200 Subject: drm: Add drm_gem_vram_{pin/unpin}_reserved() and convert mgag200 The new interfaces drm_gem_vram_{pin/unpin}_reserved() are variants of the GEM VRAM pin/unpin functions that do not reserve the BO during validation. The mgag200 driver requires this behavior for its cursor handling. The patch also converts the driver to use the new interfaces. Signed-off-by: Thomas Zimmermann Link: http://patchwork.freedesktop.org/patch/msgid/20190516162746.11636-2-tzimmermann@suse.de Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/mgag200/mgag200_cursor.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'drivers/gpu/drm/mgag200') diff --git a/drivers/gpu/drm/mgag200/mgag200_cursor.c b/drivers/gpu/drm/mgag200/mgag200_cursor.c index 6c1a9d724d85..1c4fc85315a0 100644 --- a/drivers/gpu/drm/mgag200/mgag200_cursor.c +++ b/drivers/gpu/drm/mgag200/mgag200_cursor.c @@ -23,9 +23,9 @@ static void mga_hide_cursor(struct mga_device *mdev) WREG8(MGA_CURPOSXL, 0); WREG8(MGA_CURPOSXH, 0); if (mdev->cursor.pixels_1->pin_count) - drm_gem_vram_unpin(mdev->cursor.pixels_1); + drm_gem_vram_unpin_reserved(mdev->cursor.pixels_1); if (mdev->cursor.pixels_2->pin_count) - drm_gem_vram_unpin(mdev->cursor.pixels_2); + drm_gem_vram_unpin_reserved(mdev->cursor.pixels_2); } int mga_crtc_cursor_set(struct drm_crtc *crtc, @@ -96,26 +96,28 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc, /* Move cursor buffers into VRAM if they aren't already */ if (!pixels_1->pin_count) { - ret = drm_gem_vram_pin(pixels_1, DRM_GEM_VRAM_PL_FLAG_VRAM); + ret = drm_gem_vram_pin_reserved(pixels_1, + DRM_GEM_VRAM_PL_FLAG_VRAM); if (ret) goto out1; gpu_addr = drm_gem_vram_offset(pixels_1); if (gpu_addr < 0) { - drm_gem_vram_unpin(pixels_1); + drm_gem_vram_unpin_reserved(pixels_1); goto out1; } mdev->cursor.pixels_1_gpu_addr = gpu_addr; } if (!pixels_2->pin_count) { - ret = drm_gem_vram_pin(pixels_2, DRM_GEM_VRAM_PL_FLAG_VRAM); + ret = drm_gem_vram_pin_reserved(pixels_2, + DRM_GEM_VRAM_PL_FLAG_VRAM); if (ret) { - drm_gem_vram_unpin(pixels_1); + drm_gem_vram_unpin_reserved(pixels_1); goto out1; } gpu_addr = drm_gem_vram_offset(pixels_2); if (gpu_addr < 0) { - drm_gem_vram_unpin(pixels_1); - drm_gem_vram_unpin(pixels_2); + drm_gem_vram_unpin_reserved(pixels_1); + drm_gem_vram_unpin_reserved(pixels_2); goto out1; } mdev->cursor.pixels_2_gpu_addr = gpu_addr; -- cgit v1.2.3