Skip to content

Commit e6be0a9

Browse files
robherringatseanpaul
authored andcommitted
Revert "drm/panfrost: Use drm_gem_map_offset()"
This reverts commit 583bbf4. Turns out we need mmap to work on imported BOs even if the current code is buggy. Signed-off-by: Rob Herring <[email protected]> Signed-off-by: Sean Paul <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 0a0b65d commit e6be0a9

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/gpu/drm/panfrost/panfrost_drv.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,26 @@ static int panfrost_ioctl_mmap_bo(struct drm_device *dev, void *data,
291291
struct drm_file *file_priv)
292292
{
293293
struct drm_panfrost_mmap_bo *args = data;
294+
struct drm_gem_object *gem_obj;
295+
int ret;
294296

295297
if (args->flags != 0) {
296298
DRM_INFO("unknown mmap_bo flags: %d\n", args->flags);
297299
return -EINVAL;
298300
}
299301

300-
return drm_gem_map_offset(file_priv, dev, args->handle,
301-
&args->offset);
302+
gem_obj = drm_gem_object_lookup(file_priv, args->handle);
303+
if (!gem_obj) {
304+
DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle);
305+
return -ENOENT;
306+
}
307+
308+
ret = drm_gem_create_mmap_offset(gem_obj);
309+
if (ret == 0)
310+
args->offset = drm_vma_node_offset_addr(&gem_obj->vma_node);
311+
drm_gem_object_put_unlocked(gem_obj);
312+
313+
return ret;
302314
}
303315

304316
static int panfrost_ioctl_get_bo_offset(struct drm_device *dev, void *data,

0 commit comments

Comments
 (0)