Commit 94567420 authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/qxl: Acquire reservation lock in GEM pin/unpin callbacks

Acquire the reservation lock directly in GEM pin callback. Same for
unpin. Prepares for further changes.

Dma-buf locking semantics require callers to hold the buffer's
reservation lock when invoking the pin and unpin callbacks. Prepare
qxl accordingly by pushing locking out of the implementation. A
follow-up patch will fix locking for all GEM code at once.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarDmitry Osipenko <dmitry.osipenko@collabora.com>
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> # virtio-gpu
Acked-by: default avatarChristian König <christian.koenig@amd.com>
Acked-by: default avatarZack Rusin <zack.rusin@broadcom.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240227113853.8464-9-tzimmermann@suse.de
parent b170783a
......@@ -31,15 +31,27 @@
int qxl_gem_prime_pin(struct drm_gem_object *obj)
{
struct qxl_bo *bo = gem_to_qxl_bo(obj);
int r;
return qxl_bo_pin(bo);
r = qxl_bo_reserve(bo);
if (r)
return r;
r = qxl_bo_pin_locked(bo);
qxl_bo_unreserve(bo);
return r;
}
void qxl_gem_prime_unpin(struct drm_gem_object *obj)
{
struct qxl_bo *bo = gem_to_qxl_bo(obj);
int r;
qxl_bo_unpin(bo);
r = qxl_bo_reserve(bo);
if (r)
return;
qxl_bo_unpin_locked(bo);
qxl_bo_unreserve(bo);
}
struct sg_table *qxl_gem_prime_get_sg_table(struct drm_gem_object *obj)
......
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