Commit 093bd9cf authored by Gurchetan Singh's avatar Gurchetan Singh Committed by Gerd Hoffmann

drm/virtio: simplify getting fake offset

This is a little simpler.
Signed-off-by: default avatarGurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20191219005733.18960-4-gurchetansingh@chromium.orgSigned-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 9e07d461
...@@ -365,18 +365,12 @@ int virtio_gpu_object_create(struct virtio_gpu_device *vgdev, ...@@ -365,18 +365,12 @@ int virtio_gpu_object_create(struct virtio_gpu_device *vgdev,
struct virtio_gpu_object_params *params, struct virtio_gpu_object_params *params,
struct virtio_gpu_object **bo_ptr, struct virtio_gpu_object **bo_ptr,
struct virtio_gpu_fence *fence); struct virtio_gpu_fence *fence);
/* virtgpu_prime.c */ /* virtgpu_prime.c */
struct drm_gem_object *virtgpu_gem_prime_import_sg_table( struct drm_gem_object *virtgpu_gem_prime_import_sg_table(
struct drm_device *dev, struct dma_buf_attachment *attach, struct drm_device *dev, struct dma_buf_attachment *attach,
struct sg_table *sgt); struct sg_table *sgt);
static inline u64 virtio_gpu_object_mmap_offset(struct virtio_gpu_object *bo) /* virgl debugfs */
{
return drm_vma_node_offset_addr(&bo->base.base.vma_node);
}
/* virgl debufs */
int virtio_gpu_debugfs_init(struct drm_minor *minor); int virtio_gpu_debugfs_init(struct drm_minor *minor);
#endif #endif
...@@ -96,14 +96,12 @@ int virtio_gpu_mode_dumb_mmap(struct drm_file *file_priv, ...@@ -96,14 +96,12 @@ int virtio_gpu_mode_dumb_mmap(struct drm_file *file_priv,
uint32_t handle, uint64_t *offset_p) uint32_t handle, uint64_t *offset_p)
{ {
struct drm_gem_object *gobj; struct drm_gem_object *gobj;
struct virtio_gpu_object *obj;
BUG_ON(!offset_p); BUG_ON(!offset_p);
gobj = drm_gem_object_lookup(file_priv, handle); gobj = drm_gem_object_lookup(file_priv, handle);
if (gobj == NULL) if (gobj == NULL)
return -ENOENT; return -ENOENT;
obj = gem_to_virtio_gpu_obj(gobj); *offset_p = drm_vma_node_offset_addr(&gobj->vma_node);
*offset_p = virtio_gpu_object_mmap_offset(obj);
drm_gem_object_put_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
return 0; return 0;
} }
......
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