mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
drm/virtio: Use dma_buf from GEM object instance
Avoid dereferencing struct drm_gem_object.import_attach for the imported dma-buf. The dma_buf field in the GEM object instance refers to the same buffer. Prepares to make import_attach optional. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Link: https://lore.kernel.org/r/20250414131507.566072-3-tzimmermann@suse.de
This commit is contained in:
parent
964f2a5c0e
commit
415cb45895
1 changed files with 2 additions and 3 deletions
|
@ -204,16 +204,15 @@ static void virtgpu_dma_buf_free_obj(struct drm_gem_object *obj)
|
|||
{
|
||||
struct virtio_gpu_object *bo = gem_to_virtio_gpu_obj(obj);
|
||||
struct virtio_gpu_device *vgdev = obj->dev->dev_private;
|
||||
struct dma_buf_attachment *attach = obj->import_attach;
|
||||
|
||||
if (drm_gem_is_imported(obj)) {
|
||||
struct dma_buf *dmabuf = attach->dmabuf;
|
||||
struct dma_buf *dmabuf = obj->dma_buf;
|
||||
|
||||
dma_resv_lock(dmabuf->resv, NULL);
|
||||
virtgpu_dma_buf_unmap(bo);
|
||||
dma_resv_unlock(dmabuf->resv);
|
||||
|
||||
dma_buf_detach(dmabuf, attach);
|
||||
dma_buf_detach(dmabuf, obj->import_attach);
|
||||
dma_buf_put(dmabuf);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue