mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 15:51:30 -05:00
drm/gem-framebuffer: 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: Anusha Srivatsa <asrivats@redhat.com> Reviewed-by: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250226172457.217725-8-tzimmermann@suse.de
This commit is contained in:
@@ -419,7 +419,6 @@ EXPORT_SYMBOL(drm_gem_fb_vunmap);
|
||||
static void __drm_gem_fb_end_cpu_access(struct drm_framebuffer *fb, enum dma_data_direction dir,
|
||||
unsigned int num_planes)
|
||||
{
|
||||
struct dma_buf_attachment *import_attach;
|
||||
struct drm_gem_object *obj;
|
||||
int ret;
|
||||
|
||||
@@ -428,10 +427,9 @@ static void __drm_gem_fb_end_cpu_access(struct drm_framebuffer *fb, enum dma_dat
|
||||
obj = drm_gem_fb_get_obj(fb, num_planes);
|
||||
if (!obj)
|
||||
continue;
|
||||
import_attach = obj->import_attach;
|
||||
if (!drm_gem_is_imported(obj))
|
||||
continue;
|
||||
ret = dma_buf_end_cpu_access(import_attach->dmabuf, dir);
|
||||
ret = dma_buf_end_cpu_access(obj->dma_buf, dir);
|
||||
if (ret)
|
||||
drm_err(fb->dev, "dma_buf_end_cpu_access(%u, %d) failed: %d\n",
|
||||
ret, num_planes, dir);
|
||||
@@ -454,7 +452,6 @@ static void __drm_gem_fb_end_cpu_access(struct drm_framebuffer *fb, enum dma_dat
|
||||
*/
|
||||
int drm_gem_fb_begin_cpu_access(struct drm_framebuffer *fb, enum dma_data_direction dir)
|
||||
{
|
||||
struct dma_buf_attachment *import_attach;
|
||||
struct drm_gem_object *obj;
|
||||
unsigned int i;
|
||||
int ret;
|
||||
@@ -465,10 +462,9 @@ int drm_gem_fb_begin_cpu_access(struct drm_framebuffer *fb, enum dma_data_direct
|
||||
ret = -EINVAL;
|
||||
goto err___drm_gem_fb_end_cpu_access;
|
||||
}
|
||||
import_attach = obj->import_attach;
|
||||
if (!drm_gem_is_imported(obj))
|
||||
continue;
|
||||
ret = dma_buf_begin_cpu_access(import_attach->dmabuf, dir);
|
||||
ret = dma_buf_begin_cpu_access(obj->dma_buf, dir);
|
||||
if (ret)
|
||||
goto err___drm_gem_fb_end_cpu_access;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user