* drm/vgem fixes and new ioctl for testing prime
@ 2016-07-11 13:08 Chris Wilson
2016-07-11 13:08 ` [PATCH 1/3] drm/vgem: Fix mmaping Chris Wilson
` (3 more replies)
0 siblings, 4 replies; 13+ messages in thread
From: Chris Wilson @ 2016-07-11 13:08 UTC (permalink / raw)
To: dri-devel, daniel.vetter; +Cc: intel-gfx
Just a quick resend of the existing vgem patches, all 3 have been acked,
but only the first 2 have reviews. The third involves both new ioctl and
dma-buf/fences, so perhaps people have been reluctant... But now is a
good time! These patches are exercised by intel-gpu-tools (or will be once
the new ioctls are ratified).
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 1/3] drm/vgem: Fix mmaping 2016-07-11 13:08 drm/vgem fixes and new ioctl for testing prime Chris Wilson @ 2016-07-11 13:08 ` Chris Wilson 2016-07-11 13:08 ` [PATCH 2/3] drm/vgem: Enable dmabuf interface for export Chris Wilson ` (2 subsequent siblings) 3 siblings, 0 replies; 13+ messages in thread From: Chris Wilson @ 2016-07-11 13:08 UTC (permalink / raw) To: dri-devel, daniel.vetter; +Cc: Zach Reizner, intel-gfx, Matthew Auld The vGEM mmap code has bitrotted slightly and now immediately BUGs. Since vGEM was last updated, there are new core GEM facilities to provide more common functions, so let's use those here. v2: drm_gem_free_mmap_offset() is performed from drm_gem_object_release() so we can remove the redundant call. Testcase: igt/vgem_basic/mmap Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96603 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Sean Paul <seanpaul@chromium.org> Cc: Zach Reizner <zachr@google.com> Cc: Matthew Auld <matthew.auld@intel.com> Tested-by: Humberto Israel Perez Rodriguez <humberto.i.perez.rodriguez@intel.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Acked-by: Zach Reizner <zachr@google.com> --- drivers/gpu/drm/vgem/vgem_drv.c | 164 +++++++++++++++------------------------- drivers/gpu/drm/vgem/vgem_drv.h | 6 -- 2 files changed, 61 insertions(+), 109 deletions(-) diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c index 35ea5d02a827..c161b6d7e427 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.c +++ b/drivers/gpu/drm/vgem/vgem_drv.c @@ -42,81 +42,38 @@ #define DRIVER_MAJOR 1 #define DRIVER_MINOR 0 -void vgem_gem_put_pages(struct drm_vgem_gem_object *obj) -{ - drm_gem_put_pages(&obj->base, obj->pages, false, false); - obj->pages = NULL; -} - static void vgem_gem_free_object(struct drm_gem_object *obj) { struct drm_vgem_gem_object *vgem_obj = to_vgem_bo(obj); - drm_gem_free_mmap_offset(obj); - - if (vgem_obj->use_dma_buf && obj->dma_buf) { - dma_buf_put(obj->dma_buf); - obj->dma_buf = NULL; - } - drm_gem_object_release(obj); - - if (vgem_obj->pages) - vgem_gem_put_pages(vgem_obj); - - vgem_obj->pages = NULL; - kfree(vgem_obj); } -int vgem_gem_get_pages(struct drm_vgem_gem_object *obj) -{ - struct page **pages; - - if (obj->pages || obj->use_dma_buf) - return 0; - - pages = drm_gem_get_pages(&obj->base); - if (IS_ERR(pages)) { - return PTR_ERR(pages); - } - - obj->pages = pages; - - return 0; -} - static int vgem_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { struct drm_vgem_gem_object *obj = vma->vm_private_data; - loff_t num_pages; - pgoff_t page_offset; - int ret; - /* We don't use vmf->pgoff since that has the fake offset */ - page_offset = ((unsigned long)vmf->virtual_address - vma->vm_start) >> - PAGE_SHIFT; - - num_pages = DIV_ROUND_UP(obj->base.size, PAGE_SIZE); - - if (page_offset > num_pages) - return VM_FAULT_SIGBUS; - - ret = vm_insert_page(vma, (unsigned long)vmf->virtual_address, - obj->pages[page_offset]); - switch (ret) { - case 0: - return VM_FAULT_NOPAGE; - case -ENOMEM: - return VM_FAULT_OOM; - case -EBUSY: - return VM_FAULT_RETRY; - case -EFAULT: - case -EINVAL: - return VM_FAULT_SIGBUS; - default: - WARN_ON(1); - return VM_FAULT_SIGBUS; + unsigned long vaddr = (unsigned long)vmf->virtual_address; + struct page *page; + + page = shmem_read_mapping_page(file_inode(obj->base.filp)->i_mapping, + (vaddr - vma->vm_start) >> PAGE_SHIFT); + if (!IS_ERR(page)) { + vmf->page = page; + return 0; + } else switch (PTR_ERR(page)) { + case -ENOSPC: + case -ENOMEM: + return VM_FAULT_OOM; + case -EBUSY: + return VM_FAULT_RETRY; + case -EFAULT: + case -EINVAL: + return VM_FAULT_SIGBUS; + default: + WARN_ON_ONCE(PTR_ERR(page)); + return VM_FAULT_SIGBUS; } } @@ -134,57 +91,43 @@ static struct drm_gem_object *vgem_gem_create(struct drm_device *dev, unsigned long size) { struct drm_vgem_gem_object *obj; - struct drm_gem_object *gem_object; - int err; - - size = roundup(size, PAGE_SIZE); + int ret; obj = kzalloc(sizeof(*obj), GFP_KERNEL); if (!obj) return ERR_PTR(-ENOMEM); - gem_object = &obj->base; - - err = drm_gem_object_init(dev, gem_object, size); - if (err) - goto out; - - err = vgem_gem_get_pages(obj); - if (err) - goto out; - - err = drm_gem_handle_create(file, gem_object, handle); - if (err) - goto handle_out; + ret = drm_gem_object_init(dev, &obj->base, roundup(size, PAGE_SIZE)); + if (ret) + goto err_free; - drm_gem_object_unreference_unlocked(gem_object); + ret = drm_gem_handle_create(file, &obj->base, handle); + drm_gem_object_unreference_unlocked(&obj->base); + if (ret) + goto err; - return gem_object; + return &obj->base; -handle_out: - drm_gem_object_release(gem_object); -out: +err_free: kfree(obj); - return ERR_PTR(err); +err: + return ERR_PTR(ret); } static int vgem_gem_dumb_create(struct drm_file *file, struct drm_device *dev, struct drm_mode_create_dumb *args) { struct drm_gem_object *gem_object; - uint64_t size; - uint64_t pitch = args->width * DIV_ROUND_UP(args->bpp, 8); + u64 pitch, size; + pitch = args->width * DIV_ROUND_UP(args->bpp, 8); size = args->height * pitch; if (size == 0) return -EINVAL; gem_object = vgem_gem_create(dev, file, &args->handle, size); - - if (IS_ERR(gem_object)) { - DRM_DEBUG_DRIVER("object creation failed\n"); + if (IS_ERR(gem_object)) return PTR_ERR(gem_object); - } args->size = gem_object->size; args->pitch = pitch; @@ -194,26 +137,26 @@ static int vgem_gem_dumb_create(struct drm_file *file, struct drm_device *dev, return 0; } -int vgem_gem_dumb_map(struct drm_file *file, struct drm_device *dev, - uint32_t handle, uint64_t *offset) +static int vgem_gem_dumb_map(struct drm_file *file, struct drm_device *dev, + uint32_t handle, uint64_t *offset) { - int ret = 0; struct drm_gem_object *obj; + int ret; obj = drm_gem_object_lookup(file, handle); if (!obj) return -ENOENT; + if (!obj->filp) { + ret = -EINVAL; + goto unref; + } + ret = drm_gem_create_mmap_offset(obj); if (ret) goto unref; - BUG_ON(!obj->filp); - - obj->filp->private_data = obj; - *offset = drm_vma_node_offset_addr(&obj->vma_node); - unref: drm_gem_object_unreference_unlocked(obj); @@ -223,10 +166,26 @@ unref: static struct drm_ioctl_desc vgem_ioctls[] = { }; +static int vgem_mmap(struct file *filp, struct vm_area_struct *vma) +{ + unsigned long flags = vma->vm_flags; + int ret; + + ret = drm_gem_mmap(filp, vma); + if (ret) + return ret; + + /* Keep the WC mmaping set by drm_gem_mmap() but our pages + * are ordinary and not special. + */ + vma->vm_flags = flags | VM_DONTEXPAND | VM_DONTDUMP; + return 0; +} + static const struct file_operations vgem_driver_fops = { .owner = THIS_MODULE, .open = drm_open, - .mmap = drm_gem_mmap, + .mmap = vgem_mmap, .poll = drm_poll, .read = drm_read, .unlocked_ioctl = drm_ioctl, @@ -248,7 +207,7 @@ static struct drm_driver vgem_driver = { .minor = DRIVER_MINOR, }; -struct drm_device *vgem_device; +static struct drm_device *vgem_device; static int __init vgem_init(void) { @@ -261,7 +220,6 @@ static int __init vgem_init(void) } ret = drm_dev_register(vgem_device, 0); - if (ret) goto out_unref; diff --git a/drivers/gpu/drm/vgem/vgem_drv.h b/drivers/gpu/drm/vgem/vgem_drv.h index e9f92f7ee275..988cbaae7588 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.h +++ b/drivers/gpu/drm/vgem/vgem_drv.h @@ -35,12 +35,6 @@ #define to_vgem_bo(x) container_of(x, struct drm_vgem_gem_object, base) struct drm_vgem_gem_object { struct drm_gem_object base; - struct page **pages; - bool use_dma_buf; }; -/* vgem_drv.c */ -extern void vgem_gem_put_pages(struct drm_vgem_gem_object *obj); -extern int vgem_gem_get_pages(struct drm_vgem_gem_object *obj); - #endif -- 2.8.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/3] drm/vgem: Enable dmabuf interface for export 2016-07-11 13:08 drm/vgem fixes and new ioctl for testing prime Chris Wilson 2016-07-11 13:08 ` [PATCH 1/3] drm/vgem: Fix mmaping Chris Wilson @ 2016-07-11 13:08 ` Chris Wilson 2016-07-12 10:45 ` Daniel Vetter 2016-07-11 13:08 ` [PATCH 3/3] drm/vgem: Attach sw fences to exported vGEM dma-buf (ioctl) Chris Wilson 2016-07-11 14:02 ` ✗ Ro.CI.BAT: failure for series starting with [1/3] drm/vgem: Fix mmaping Patchwork 3 siblings, 1 reply; 13+ messages in thread From: Chris Wilson @ 2016-07-11 13:08 UTC (permalink / raw) To: dri-devel, daniel.vetter; +Cc: Zach Reizner, intel-gfx Enable the standard GEM dma-buf interface provided by the DRM core, but only for exporting the VGEM object. This allows passing around the VGEM objects created from the dumb interface and using them as sources elsewhere. Creating a VGEM object for a foriegn handle is not supported. v2: With additional completeness. v3: Need to clear the CPU cache upon exporting the dma-addresses. v4: Use drm_gem_put_pages() as well. v5: Use drm_prime_pages_to_sg() Testcase: igt/vgem_basic/dmabuf-* Testcase: igt/prime_vgem Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Sean Paul <seanpaul@chromium.org> Cc: Zach Reizner <zachr@google.com> Acked-by: Zach Reizner <zachr@google.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com> --- drivers/gpu/drm/vgem/vgem_drv.c | 89 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c index c161b6d7e427..b5fb968d2d5c 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.c +++ b/drivers/gpu/drm/vgem/vgem_drv.c @@ -192,14 +192,101 @@ static const struct file_operations vgem_driver_fops = { .release = drm_release, }; +static int vgem_prime_pin(struct drm_gem_object *obj) +{ + long n_pages = obj->size >> PAGE_SHIFT; + struct page **pages; + + /* Flush the object from the CPU cache so that importers can rely + * on coherent indirect access via the exported dma-address. + */ + pages = drm_gem_get_pages(obj); + if (IS_ERR(pages)) + return PTR_ERR(pages); + + drm_clflush_pages(pages, n_pages); + drm_gem_put_pages(obj, pages, true, false); + + return 0; +} + +static struct sg_table *vgem_prime_get_sg_table(struct drm_gem_object *obj) +{ + struct sg_table *st; + struct page **pages; + + pages = drm_gem_get_pages(obj); + if (IS_ERR(pages)) + return ERR_CAST(pages); + + st = drm_prime_pages_to_sg(pages, obj->size >> PAGE_SHIFT); + drm_gem_put_pages(obj, pages, false, false); + + return st; +} + +static void *vgem_prime_vmap(struct drm_gem_object *obj) +{ + long n_pages = obj->size >> PAGE_SHIFT; + struct page **pages; + void *addr; + + pages = drm_gem_get_pages(obj); + if (IS_ERR(pages)) + return NULL; + + addr = vmap(pages, n_pages, 0, pgprot_writecombine(PAGE_KERNEL_IO)); + drm_gem_put_pages(obj, pages, false, false); + + return addr; +} + +static void vgem_prime_vunmap(struct drm_gem_object *obj, void *vaddr) +{ + vunmap(vaddr); +} + +static int vgem_prime_mmap(struct drm_gem_object *obj, + struct vm_area_struct *vma) +{ + int ret; + + if (obj->size < vma->vm_end - vma->vm_start) + return -EINVAL; + + if (!obj->filp) + return -ENODEV; + + ret = obj->filp->f_op->mmap(obj->filp, vma); + if (ret) + return ret; + + fput(vma->vm_file); + vma->vm_file = get_file(obj->filp); + vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; + vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags)); + + return 0; +} + static struct drm_driver vgem_driver = { - .driver_features = DRIVER_GEM, + .driver_features = DRIVER_GEM | DRIVER_PRIME, .gem_free_object_unlocked = vgem_gem_free_object, .gem_vm_ops = &vgem_gem_vm_ops, .ioctls = vgem_ioctls, .fops = &vgem_driver_fops, + .dumb_create = vgem_gem_dumb_create, .dumb_map_offset = vgem_gem_dumb_map, + + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, + .gem_prime_pin = vgem_prime_pin, + .gem_prime_export = drm_gem_prime_export, + .gem_prime_get_sg_table = vgem_prime_get_sg_table, + .gem_prime_vmap = vgem_prime_vmap, + .gem_prime_vunmap = vgem_prime_vunmap, + .gem_prime_mmap = vgem_prime_mmap, + .name = DRIVER_NAME, .desc = DRIVER_DESC, .date = DRIVER_DATE, -- 2.8.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 2/3] drm/vgem: Enable dmabuf interface for export 2016-07-11 13:08 ` [PATCH 2/3] drm/vgem: Enable dmabuf interface for export Chris Wilson @ 2016-07-12 10:45 ` Daniel Vetter 0 siblings, 0 replies; 13+ messages in thread From: Daniel Vetter @ 2016-07-12 10:45 UTC (permalink / raw) To: Chris Wilson; +Cc: daniel.vetter, intel-gfx, Zach Reizner, dri-devel On Mon, Jul 11, 2016 at 02:08:07PM +0100, Chris Wilson wrote: > Enable the standard GEM dma-buf interface provided by the DRM core, but > only for exporting the VGEM object. This allows passing around the VGEM > objects created from the dumb interface and using them as sources > elsewhere. Creating a VGEM object for a foriegn handle is not supported. > > v2: With additional completeness. > v3: Need to clear the CPU cache upon exporting the dma-addresses. > v4: Use drm_gem_put_pages() as well. > v5: Use drm_prime_pages_to_sg() > > Testcase: igt/vgem_basic/dmabuf-* > Testcase: igt/prime_vgem > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Sean Paul <seanpaul@chromium.org> > Cc: Zach Reizner <zachr@google.com> > Acked-by: Zach Reizner <zachr@google.com> > Reviewed-by: Matthew Auld <matthew.auld@intel.com> Merged the first 2 patches from this series. -Daniel > --- > drivers/gpu/drm/vgem/vgem_drv.c | 89 ++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 88 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c > index c161b6d7e427..b5fb968d2d5c 100644 > --- a/drivers/gpu/drm/vgem/vgem_drv.c > +++ b/drivers/gpu/drm/vgem/vgem_drv.c > @@ -192,14 +192,101 @@ static const struct file_operations vgem_driver_fops = { > .release = drm_release, > }; > > +static int vgem_prime_pin(struct drm_gem_object *obj) > +{ > + long n_pages = obj->size >> PAGE_SHIFT; > + struct page **pages; > + > + /* Flush the object from the CPU cache so that importers can rely > + * on coherent indirect access via the exported dma-address. > + */ > + pages = drm_gem_get_pages(obj); > + if (IS_ERR(pages)) > + return PTR_ERR(pages); > + > + drm_clflush_pages(pages, n_pages); > + drm_gem_put_pages(obj, pages, true, false); > + > + return 0; > +} > + > +static struct sg_table *vgem_prime_get_sg_table(struct drm_gem_object *obj) > +{ > + struct sg_table *st; > + struct page **pages; > + > + pages = drm_gem_get_pages(obj); > + if (IS_ERR(pages)) > + return ERR_CAST(pages); > + > + st = drm_prime_pages_to_sg(pages, obj->size >> PAGE_SHIFT); > + drm_gem_put_pages(obj, pages, false, false); > + > + return st; > +} > + > +static void *vgem_prime_vmap(struct drm_gem_object *obj) > +{ > + long n_pages = obj->size >> PAGE_SHIFT; > + struct page **pages; > + void *addr; > + > + pages = drm_gem_get_pages(obj); > + if (IS_ERR(pages)) > + return NULL; > + > + addr = vmap(pages, n_pages, 0, pgprot_writecombine(PAGE_KERNEL_IO)); > + drm_gem_put_pages(obj, pages, false, false); > + > + return addr; > +} > + > +static void vgem_prime_vunmap(struct drm_gem_object *obj, void *vaddr) > +{ > + vunmap(vaddr); > +} > + > +static int vgem_prime_mmap(struct drm_gem_object *obj, > + struct vm_area_struct *vma) > +{ > + int ret; > + > + if (obj->size < vma->vm_end - vma->vm_start) > + return -EINVAL; > + > + if (!obj->filp) > + return -ENODEV; > + > + ret = obj->filp->f_op->mmap(obj->filp, vma); > + if (ret) > + return ret; > + > + fput(vma->vm_file); > + vma->vm_file = get_file(obj->filp); > + vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; > + vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags)); > + > + return 0; > +} > + > static struct drm_driver vgem_driver = { > - .driver_features = DRIVER_GEM, > + .driver_features = DRIVER_GEM | DRIVER_PRIME, > .gem_free_object_unlocked = vgem_gem_free_object, > .gem_vm_ops = &vgem_gem_vm_ops, > .ioctls = vgem_ioctls, > .fops = &vgem_driver_fops, > + > .dumb_create = vgem_gem_dumb_create, > .dumb_map_offset = vgem_gem_dumb_map, > + > + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, > + .gem_prime_pin = vgem_prime_pin, > + .gem_prime_export = drm_gem_prime_export, > + .gem_prime_get_sg_table = vgem_prime_get_sg_table, > + .gem_prime_vmap = vgem_prime_vmap, > + .gem_prime_vunmap = vgem_prime_vunmap, > + .gem_prime_mmap = vgem_prime_mmap, > + > .name = DRIVER_NAME, > .desc = DRIVER_DESC, > .date = DRIVER_DATE, > -- > 2.8.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 3/3] drm/vgem: Attach sw fences to exported vGEM dma-buf (ioctl) 2016-07-11 13:08 drm/vgem fixes and new ioctl for testing prime Chris Wilson 2016-07-11 13:08 ` [PATCH 1/3] drm/vgem: Fix mmaping Chris Wilson 2016-07-11 13:08 ` [PATCH 2/3] drm/vgem: Enable dmabuf interface for export Chris Wilson @ 2016-07-11 13:08 ` Chris Wilson 2016-07-11 15:10 ` Gustavo Padovan 2016-07-11 14:02 ` ✗ Ro.CI.BAT: failure for series starting with [1/3] drm/vgem: Fix mmaping Patchwork 3 siblings, 1 reply; 13+ messages in thread From: Chris Wilson @ 2016-07-11 13:08 UTC (permalink / raw) To: dri-devel, daniel.vetter; +Cc: Zach Reizner, intel-gfx, Gustavo Padovan vGEM buffers are useful for passing data between software clients and hardware renders. By allowing the user to create and attach fences to the exported vGEM buffers (on the dma-buf), the user can implement a deferred renderer and queue hardware operations like flipping and then signal the buffer readiness (i.e. this allows the user to schedule operations out-of-order, but have them complete in-order). This also makes it much easier to write tightly controlled testcases for dma-buf fencing and signaling between hardware drivers. Testcase: igt/vgem_basic/dmabuf-fence Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Sean Paul <seanpaul@chromium.org> Cc: Zach Reizner <zachr@google.com> Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Acked-by: Zach Reizner <zachr@google.com> --- drivers/gpu/drm/vgem/Makefile | 2 +- drivers/gpu/drm/vgem/vgem_drv.c | 34 ++++++ drivers/gpu/drm/vgem/vgem_drv.h | 18 ++++ drivers/gpu/drm/vgem/vgem_fence.c | 220 ++++++++++++++++++++++++++++++++++++++ include/uapi/drm/vgem_drm.h | 62 +++++++++++ 5 files changed, 335 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/vgem/vgem_fence.c create mode 100644 include/uapi/drm/vgem_drm.h diff --git a/drivers/gpu/drm/vgem/Makefile b/drivers/gpu/drm/vgem/Makefile index 3f4c7b842028..bfcdea1330e6 100644 --- a/drivers/gpu/drm/vgem/Makefile +++ b/drivers/gpu/drm/vgem/Makefile @@ -1,4 +1,4 @@ ccflags-y := -Iinclude/drm -vgem-y := vgem_drv.o +vgem-y := vgem_drv.o vgem_fence.o obj-$(CONFIG_DRM_VGEM) += vgem.o diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c index b5fb968d2d5c..2659e5cda857 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.c +++ b/drivers/gpu/drm/vgem/vgem_drv.c @@ -83,6 +83,34 @@ static const struct vm_operations_struct vgem_gem_vm_ops = { .close = drm_gem_vm_close, }; +static int vgem_open(struct drm_device *dev, struct drm_file *file) +{ + struct vgem_file *vfile; + int ret; + + vfile = kzalloc(sizeof(*vfile), GFP_KERNEL); + if (!vfile) + return -ENOMEM; + + file->driver_priv = vfile; + + ret = vgem_fence_open(vfile); + if (ret) { + kfree(vfile); + return ret; + } + + return 0; +} + +static void vgem_preclose(struct drm_device *dev, struct drm_file *file) +{ + struct vgem_file *vfile = file->driver_priv; + + vgem_fence_close(vfile); + kfree(vfile); +} + /* ioctls */ static struct drm_gem_object *vgem_gem_create(struct drm_device *dev, @@ -164,6 +192,8 @@ unref: } static struct drm_ioctl_desc vgem_ioctls[] = { + DRM_IOCTL_DEF_DRV(VGEM_FENCE_ATTACH, vgem_fence_attach_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(VGEM_FENCE_SIGNAL, vgem_fence_signal_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), }; static int vgem_mmap(struct file *filp, struct vm_area_struct *vma) @@ -271,9 +301,12 @@ static int vgem_prime_mmap(struct drm_gem_object *obj, static struct drm_driver vgem_driver = { .driver_features = DRIVER_GEM | DRIVER_PRIME, + .open = vgem_open, + .preclose = vgem_preclose, .gem_free_object_unlocked = vgem_gem_free_object, .gem_vm_ops = &vgem_gem_vm_ops, .ioctls = vgem_ioctls, + .num_ioctls = ARRAY_SIZE(vgem_ioctls), .fops = &vgem_driver_fops, .dumb_create = vgem_gem_dumb_create, @@ -328,5 +361,6 @@ module_init(vgem_init); module_exit(vgem_exit); MODULE_AUTHOR("Red Hat, Inc."); +MODULE_AUTHOR("Intel Corporation"); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL and additional rights"); diff --git a/drivers/gpu/drm/vgem/vgem_drv.h b/drivers/gpu/drm/vgem/vgem_drv.h index 988cbaae7588..88ce21010e28 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.h +++ b/drivers/gpu/drm/vgem/vgem_drv.h @@ -32,9 +32,27 @@ #include <drm/drmP.h> #include <drm/drm_gem.h> +#include <uapi/drm/vgem_drm.h> + +struct vgem_file { + struct idr fence_idr; + struct mutex fence_mutex; + u64 fence_context; + atomic_t fence_seqno; +}; + #define to_vgem_bo(x) container_of(x, struct drm_vgem_gem_object, base) struct drm_vgem_gem_object { struct drm_gem_object base; }; +int vgem_fence_open(struct vgem_file *file); +int vgem_fence_attach_ioctl(struct drm_device *dev, + void *data, + struct drm_file *file); +int vgem_fence_signal_ioctl(struct drm_device *dev, + void *data, + struct drm_file *file); +void vgem_fence_close(struct vgem_file *file); + #endif diff --git a/drivers/gpu/drm/vgem/vgem_fence.c b/drivers/gpu/drm/vgem/vgem_fence.c new file mode 100644 index 000000000000..649e9e1cee35 --- /dev/null +++ b/drivers/gpu/drm/vgem/vgem_fence.c @@ -0,0 +1,220 @@ +/* + * Copyright 2016 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software") + * to deal in the software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * them Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include <linux/dma-buf.h> +#include <linux/reservation.h> + +#include "vgem_drv.h" + +struct vgem_fence { + struct fence base; + struct spinlock lock; +}; + +static const char *vgem_fence_get_driver_name(struct fence *fence) +{ + return "vgem"; +} + +static const char *vgem_fence_get_timeline_name(struct fence *fence) +{ + return "file"; +} + +static bool vgem_fence_signaled(struct fence *fence) +{ + return false; +} + +static bool vgem_fence_enable_signaling(struct fence *fence) +{ + return true; +} + +static void vgem_fence_value_str(struct fence *fence, char *str, int size) +{ + snprintf(str, size, "%u", fence->seqno); +} + +static void vgem_fence_timeline_value_str(struct fence *fence, char *str, + int size) +{ + snprintf(str, size, "%u", 0); +} + +const struct fence_ops vgem_fence_ops = { + .get_driver_name = vgem_fence_get_driver_name, + .get_timeline_name = vgem_fence_get_timeline_name, + .enable_signaling = vgem_fence_enable_signaling, + .signaled = vgem_fence_signaled, + .wait = fence_default_wait, + .fence_value_str = vgem_fence_value_str, + .timeline_value_str = vgem_fence_timeline_value_str, +}; + +static u32 vgem_fence_next_seqno(struct vgem_file *vfile) +{ + u32 seqno; + + seqno = atomic_inc_return(&vfile->fence_seqno); + if (seqno == 0) + seqno = atomic_inc_return(&vfile->fence_seqno); + + return seqno; +} + +static struct fence *vgem_fence_create(struct vgem_file *vfile) +{ + struct vgem_fence *fence; + + fence = kzalloc(sizeof(*fence), GFP_KERNEL); + if (!fence) + return NULL; + + spin_lock_init(&fence->lock); + fence_init(&fence->base, + &vgem_fence_ops, + &fence->lock, + vfile->fence_context, + vgem_fence_next_seqno(vfile)); + + return &fence->base; +} + +static int attach_dmabuf(struct drm_device *dev, + struct drm_gem_object *obj) +{ + struct dma_buf *dmabuf; + + if (obj->dma_buf) + return 0; + + dmabuf = dev->driver->gem_prime_export(dev, obj, 0); + if (IS_ERR(dmabuf)) + return PTR_ERR(dmabuf); + + obj->dma_buf = dmabuf; + drm_gem_object_reference(obj); + return 0; +} + +int vgem_fence_attach_ioctl(struct drm_device *dev, + void *data, + struct drm_file *file) +{ + struct drm_vgem_fence_attach *arg = data; + struct vgem_file *vfile = file->driver_priv; + struct reservation_object *resv; + struct drm_gem_object *obj; + struct fence *fence; + int ret; + + if (arg->flags & ~VGEM_FENCE_WRITE) + return -EINVAL; + + if (arg->pad) + return -EINVAL; + + obj = drm_gem_object_lookup(file, arg->handle); + if (!obj) + return -ENOENT; + + ret = attach_dmabuf(dev, obj); + if (ret) + goto out; + + fence = vgem_fence_create(vfile); + if (!fence) { + ret = -ENOMEM; + goto out; + } + + ret = 0; + resv = obj->dma_buf->resv; + mutex_lock(&resv->lock.base); + if (arg->flags & VGEM_FENCE_WRITE) + reservation_object_add_excl_fence(resv, fence); + else if ((ret = reservation_object_reserve_shared(resv)) == 0) + reservation_object_add_shared_fence(resv, fence); + mutex_unlock(&resv->lock.base); + + if (ret == 0) { + mutex_lock(&vfile->fence_mutex); + ret = idr_alloc(&vfile->fence_idr, fence, 1, 0, GFP_KERNEL); + mutex_unlock(&vfile->fence_mutex); + if (ret > 0) { + arg->out_fence = ret; + ret = 0; + } + } + if (ret) + fence_put(fence); +out: + drm_gem_object_unreference_unlocked(obj); + return ret; +} + +int vgem_fence_signal_ioctl(struct drm_device *dev, + void *data, + struct drm_file *file) +{ + struct vgem_file *vfile = file->driver_priv; + struct drm_vgem_fence_signal *arg = data; + struct fence *fence; + + if (arg->flags) + return -EINVAL; + + mutex_lock(&vfile->fence_mutex); + fence = idr_replace(&vfile->fence_idr, NULL, arg->fence); + mutex_unlock(&vfile->fence_mutex); + if (!fence) + return -ENOENT; + if (IS_ERR(fence)) + return PTR_ERR(fence); + + fence_signal(fence); + fence_put(fence); + return 0; +} + +int vgem_fence_open(struct vgem_file *vfile) +{ + mutex_init(&vfile->fence_mutex); + idr_init(&vfile->fence_idr); + vfile->fence_context = fence_context_alloc(1); + + return 0; +} + +static int __vgem_fence_idr_fini(int id, void *p, void *data) +{ + fence_signal(p); + fence_put(p); + return 0; +} + +void vgem_fence_close(struct vgem_file *vfile) +{ + idr_for_each(&vfile->fence_idr, __vgem_fence_idr_fini, vfile); + idr_destroy(&vfile->fence_idr); +} diff --git a/include/uapi/drm/vgem_drm.h b/include/uapi/drm/vgem_drm.h new file mode 100644 index 000000000000..352d2fae8de9 --- /dev/null +++ b/include/uapi/drm/vgem_drm.h @@ -0,0 +1,62 @@ +/* + * Copyright 2016 Intel Corporation + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef _UAPI_VGEM_DRM_H_ +#define _UAPI_VGEM_DRM_H_ + +#include "drm.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +/* Please note that modifications to all structs defined here are + * subject to backwards-compatibility constraints. + */ +#define DRM_VGEM_FENCE_ATTACH 0x1 +#define DRM_VGEM_FENCE_SIGNAL 0x2 + +#define DRM_IOCTL_VGEM_FENCE_ATTACH DRM_IOWR( DRM_COMMAND_BASE + DRM_VGEM_FENCE_ATTACH, struct drm_vgem_fence_attach) +#define DRM_IOCTL_VGEM_FENCE_SIGNAL DRM_IOW( DRM_COMMAND_BASE + DRM_VGEM_FENCE_SIGNAL, struct drm_vgem_fence_signal) + +struct drm_vgem_fence_attach { + __u32 handle; + __u32 flags; +#define VGEM_FENCE_WRITE 0x1 + __u32 out_fence; + __u32 pad; +}; + +struct drm_vgem_fence_signal { + __u32 fence; + __u32 flags; +}; + +#if defined(__cplusplus) +} +#endif + +#endif /* _UAPI_VGEM_DRM_H_ */ -- 2.8.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 3/3] drm/vgem: Attach sw fences to exported vGEM dma-buf (ioctl) 2016-07-11 13:08 ` [PATCH 3/3] drm/vgem: Attach sw fences to exported vGEM dma-buf (ioctl) Chris Wilson @ 2016-07-11 15:10 ` Gustavo Padovan 2016-07-11 15:24 ` Chris Wilson 0 siblings, 1 reply; 13+ messages in thread From: Gustavo Padovan @ 2016-07-11 15:10 UTC (permalink / raw) To: Chris Wilson Cc: Gustavo Padovan, daniel.vetter, intel-gfx, Zach Reizner, dri-devel 2016-07-11 Chris Wilson <chris@chris-wilson.co.uk>: > vGEM buffers are useful for passing data between software clients and > hardware renders. By allowing the user to create and attach fences to > the exported vGEM buffers (on the dma-buf), the user can implement a > deferred renderer and queue hardware operations like flipping and then > signal the buffer readiness (i.e. this allows the user to schedule > operations out-of-order, but have them complete in-order). > > This also makes it much easier to write tightly controlled testcases for > dma-buf fencing and signaling between hardware drivers. > > Testcase: igt/vgem_basic/dmabuf-fence > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Sean Paul <seanpaul@chromium.org> > Cc: Zach Reizner <zachr@google.com> > Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk> > Acked-by: Zach Reizner <zachr@google.com> > --- > drivers/gpu/drm/vgem/Makefile | 2 +- > drivers/gpu/drm/vgem/vgem_drv.c | 34 ++++++ > drivers/gpu/drm/vgem/vgem_drv.h | 18 ++++ > drivers/gpu/drm/vgem/vgem_fence.c | 220 ++++++++++++++++++++++++++++++++++++++ > include/uapi/drm/vgem_drm.h | 62 +++++++++++ > 5 files changed, 335 insertions(+), 1 deletion(-) > create mode 100644 drivers/gpu/drm/vgem/vgem_fence.c > create mode 100644 include/uapi/drm/vgem_drm.h > > diff --git a/drivers/gpu/drm/vgem/Makefile b/drivers/gpu/drm/vgem/Makefile > index 3f4c7b842028..bfcdea1330e6 100644 > --- a/drivers/gpu/drm/vgem/Makefile > +++ b/drivers/gpu/drm/vgem/Makefile > @@ -1,4 +1,4 @@ > ccflags-y := -Iinclude/drm > -vgem-y := vgem_drv.o > +vgem-y := vgem_drv.o vgem_fence.o > > obj-$(CONFIG_DRM_VGEM) += vgem.o > diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c > index b5fb968d2d5c..2659e5cda857 100644 > --- a/drivers/gpu/drm/vgem/vgem_drv.c > +++ b/drivers/gpu/drm/vgem/vgem_drv.c > @@ -83,6 +83,34 @@ static const struct vm_operations_struct vgem_gem_vm_ops = { > .close = drm_gem_vm_close, > }; > > +static int vgem_open(struct drm_device *dev, struct drm_file *file) > +{ > + struct vgem_file *vfile; > + int ret; > + > + vfile = kzalloc(sizeof(*vfile), GFP_KERNEL); > + if (!vfile) > + return -ENOMEM; > + > + file->driver_priv = vfile; > + > + ret = vgem_fence_open(vfile); > + if (ret) { > + kfree(vfile); > + return ret; > + } > + > + return 0; > +} > + > +static void vgem_preclose(struct drm_device *dev, struct drm_file *file) > +{ > + struct vgem_file *vfile = file->driver_priv; > + > + vgem_fence_close(vfile); > + kfree(vfile); > +} > + > /* ioctls */ > > static struct drm_gem_object *vgem_gem_create(struct drm_device *dev, > @@ -164,6 +192,8 @@ unref: > } > > static struct drm_ioctl_desc vgem_ioctls[] = { > + DRM_IOCTL_DEF_DRV(VGEM_FENCE_ATTACH, vgem_fence_attach_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), > + DRM_IOCTL_DEF_DRV(VGEM_FENCE_SIGNAL, vgem_fence_signal_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), > }; > > static int vgem_mmap(struct file *filp, struct vm_area_struct *vma) > @@ -271,9 +301,12 @@ static int vgem_prime_mmap(struct drm_gem_object *obj, > > static struct drm_driver vgem_driver = { > .driver_features = DRIVER_GEM | DRIVER_PRIME, > + .open = vgem_open, > + .preclose = vgem_preclose, > .gem_free_object_unlocked = vgem_gem_free_object, > .gem_vm_ops = &vgem_gem_vm_ops, > .ioctls = vgem_ioctls, > + .num_ioctls = ARRAY_SIZE(vgem_ioctls), > .fops = &vgem_driver_fops, > > .dumb_create = vgem_gem_dumb_create, > @@ -328,5 +361,6 @@ module_init(vgem_init); > module_exit(vgem_exit); > > MODULE_AUTHOR("Red Hat, Inc."); > +MODULE_AUTHOR("Intel Corporation"); > MODULE_DESCRIPTION(DRIVER_DESC); > MODULE_LICENSE("GPL and additional rights"); > diff --git a/drivers/gpu/drm/vgem/vgem_drv.h b/drivers/gpu/drm/vgem/vgem_drv.h > index 988cbaae7588..88ce21010e28 100644 > --- a/drivers/gpu/drm/vgem/vgem_drv.h > +++ b/drivers/gpu/drm/vgem/vgem_drv.h > @@ -32,9 +32,27 @@ > #include <drm/drmP.h> > #include <drm/drm_gem.h> > > +#include <uapi/drm/vgem_drm.h> > + > +struct vgem_file { > + struct idr fence_idr; > + struct mutex fence_mutex; > + u64 fence_context; > + atomic_t fence_seqno; > +}; > + > #define to_vgem_bo(x) container_of(x, struct drm_vgem_gem_object, base) > struct drm_vgem_gem_object { > struct drm_gem_object base; > }; > > +int vgem_fence_open(struct vgem_file *file); > +int vgem_fence_attach_ioctl(struct drm_device *dev, > + void *data, > + struct drm_file *file); > +int vgem_fence_signal_ioctl(struct drm_device *dev, > + void *data, > + struct drm_file *file); > +void vgem_fence_close(struct vgem_file *file); > + > #endif > diff --git a/drivers/gpu/drm/vgem/vgem_fence.c b/drivers/gpu/drm/vgem/vgem_fence.c > new file mode 100644 > index 000000000000..649e9e1cee35 > --- /dev/null > +++ b/drivers/gpu/drm/vgem/vgem_fence.c > @@ -0,0 +1,220 @@ > +/* > + * Copyright 2016 Intel Corporation > + * > + * Permission is hereby granted, free of charge, to any person obtaining a > + * copy of this software and associated documentation files (the "Software") > + * to deal in the software without restriction, including without limitation > + * on the rights to use, copy, modify, merge, publish, distribute, sub > + * license, and/or sell copies of the Software, and to permit persons to whom > + * them Software is furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice (including the next > + * paragraph) shall be included in all copies or substantial portions of the > + * Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL > + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER > + * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN > + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. > + */ > + > +#include <linux/dma-buf.h> > +#include <linux/reservation.h> > + > +#include "vgem_drv.h" > + > +struct vgem_fence { > + struct fence base; > + struct spinlock lock; > +}; > + > +static const char *vgem_fence_get_driver_name(struct fence *fence) > +{ > + return "vgem"; > +} > + > +static const char *vgem_fence_get_timeline_name(struct fence *fence) > +{ > + return "file"; > +} > + > +static bool vgem_fence_signaled(struct fence *fence) > +{ > + return false; > +} > + > +static bool vgem_fence_enable_signaling(struct fence *fence) > +{ > + return true; > +} > + > +static void vgem_fence_value_str(struct fence *fence, char *str, int size) > +{ > + snprintf(str, size, "%u", fence->seqno); > +} > + > +static void vgem_fence_timeline_value_str(struct fence *fence, char *str, > + int size) > +{ > + snprintf(str, size, "%u", 0); > +} I think this would be mainly used for debug purposes but it would be nice to actually return the current timeline value here, i.e., the seqno of the last signalled fence. This would also allow to return if the fence was signaled or not in vgem_fence_signaled() instead of just return false. But if the fence_put() after fence_signal() releases the last reference to the fence vgem_fence_signaled() would be never be called after it signalled. > + > +const struct fence_ops vgem_fence_ops = { > + .get_driver_name = vgem_fence_get_driver_name, > + .get_timeline_name = vgem_fence_get_timeline_name, > + .enable_signaling = vgem_fence_enable_signaling, > + .signaled = vgem_fence_signaled, > + .wait = fence_default_wait, > + .fence_value_str = vgem_fence_value_str, > + .timeline_value_str = vgem_fence_timeline_value_str, > +}; > + > +static u32 vgem_fence_next_seqno(struct vgem_file *vfile) > +{ > + u32 seqno; > + > + seqno = atomic_inc_return(&vfile->fence_seqno); > + if (seqno == 0) > + seqno = atomic_inc_return(&vfile->fence_seqno); > + > + return seqno; > +} > + > +static struct fence *vgem_fence_create(struct vgem_file *vfile) > +{ > + struct vgem_fence *fence; > + > + fence = kzalloc(sizeof(*fence), GFP_KERNEL); > + if (!fence) > + return NULL; > + > + spin_lock_init(&fence->lock); > + fence_init(&fence->base, > + &vgem_fence_ops, > + &fence->lock, > + vfile->fence_context, > + vgem_fence_next_seqno(vfile)); Shall we make seqno u64 too? Gustavo _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/3] drm/vgem: Attach sw fences to exported vGEM dma-buf (ioctl) 2016-07-11 15:10 ` Gustavo Padovan @ 2016-07-11 15:24 ` Chris Wilson 2016-07-12 10:44 ` Daniel Vetter 0 siblings, 1 reply; 13+ messages in thread From: Chris Wilson @ 2016-07-11 15:24 UTC (permalink / raw) To: Gustavo Padovan, dri-devel, daniel.vetter, Zach Reizner, intel-gfx, Gustavo Padovan On Mon, Jul 11, 2016 at 12:10:40PM -0300, Gustavo Padovan wrote: > 2016-07-11 Chris Wilson <chris@chris-wilson.co.uk>: > > > vGEM buffers are useful for passing data between software clients and > > hardware renders. By allowing the user to create and attach fences to > > the exported vGEM buffers (on the dma-buf), the user can implement a > > deferred renderer and queue hardware operations like flipping and then > > signal the buffer readiness (i.e. this allows the user to schedule > > operations out-of-order, but have them complete in-order). > > > > This also makes it much easier to write tightly controlled testcases for > > dma-buf fencing and signaling between hardware drivers. > > > > Testcase: igt/vgem_basic/dmabuf-fence > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > > Cc: Sean Paul <seanpaul@chromium.org> > > Cc: Zach Reizner <zachr@google.com> > > Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk> > > Acked-by: Zach Reizner <zachr@google.com> > > --- > > drivers/gpu/drm/vgem/Makefile | 2 +- > > drivers/gpu/drm/vgem/vgem_drv.c | 34 ++++++ > > drivers/gpu/drm/vgem/vgem_drv.h | 18 ++++ > > drivers/gpu/drm/vgem/vgem_fence.c | 220 ++++++++++++++++++++++++++++++++++++++ > > include/uapi/drm/vgem_drm.h | 62 +++++++++++ > > 5 files changed, 335 insertions(+), 1 deletion(-) > > create mode 100644 drivers/gpu/drm/vgem/vgem_fence.c > > create mode 100644 include/uapi/drm/vgem_drm.h > > > > diff --git a/drivers/gpu/drm/vgem/Makefile b/drivers/gpu/drm/vgem/Makefile > > index 3f4c7b842028..bfcdea1330e6 100644 > > --- a/drivers/gpu/drm/vgem/Makefile > > +++ b/drivers/gpu/drm/vgem/Makefile > > @@ -1,4 +1,4 @@ > > ccflags-y := -Iinclude/drm > > -vgem-y := vgem_drv.o > > +vgem-y := vgem_drv.o vgem_fence.o > > > > obj-$(CONFIG_DRM_VGEM) += vgem.o > > diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c > > index b5fb968d2d5c..2659e5cda857 100644 > > --- a/drivers/gpu/drm/vgem/vgem_drv.c > > +++ b/drivers/gpu/drm/vgem/vgem_drv.c > > @@ -83,6 +83,34 @@ static const struct vm_operations_struct vgem_gem_vm_ops = { > > .close = drm_gem_vm_close, > > }; > > > > +static int vgem_open(struct drm_device *dev, struct drm_file *file) > > +{ > > + struct vgem_file *vfile; > > + int ret; > > + > > + vfile = kzalloc(sizeof(*vfile), GFP_KERNEL); > > + if (!vfile) > > + return -ENOMEM; > > + > > + file->driver_priv = vfile; > > + > > + ret = vgem_fence_open(vfile); > > + if (ret) { > > + kfree(vfile); > > + return ret; > > + } > > + > > + return 0; > > +} > > + > > +static void vgem_preclose(struct drm_device *dev, struct drm_file *file) > > +{ > > + struct vgem_file *vfile = file->driver_priv; > > + > > + vgem_fence_close(vfile); > > + kfree(vfile); > > +} > > + > > /* ioctls */ > > > > static struct drm_gem_object *vgem_gem_create(struct drm_device *dev, > > @@ -164,6 +192,8 @@ unref: > > } > > > > static struct drm_ioctl_desc vgem_ioctls[] = { > > + DRM_IOCTL_DEF_DRV(VGEM_FENCE_ATTACH, vgem_fence_attach_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), > > + DRM_IOCTL_DEF_DRV(VGEM_FENCE_SIGNAL, vgem_fence_signal_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), > > }; > > > > static int vgem_mmap(struct file *filp, struct vm_area_struct *vma) > > @@ -271,9 +301,12 @@ static int vgem_prime_mmap(struct drm_gem_object *obj, > > > > static struct drm_driver vgem_driver = { > > .driver_features = DRIVER_GEM | DRIVER_PRIME, > > + .open = vgem_open, > > + .preclose = vgem_preclose, > > .gem_free_object_unlocked = vgem_gem_free_object, > > .gem_vm_ops = &vgem_gem_vm_ops, > > .ioctls = vgem_ioctls, > > + .num_ioctls = ARRAY_SIZE(vgem_ioctls), > > .fops = &vgem_driver_fops, > > > > .dumb_create = vgem_gem_dumb_create, > > @@ -328,5 +361,6 @@ module_init(vgem_init); > > module_exit(vgem_exit); > > > > MODULE_AUTHOR("Red Hat, Inc."); > > +MODULE_AUTHOR("Intel Corporation"); > > MODULE_DESCRIPTION(DRIVER_DESC); > > MODULE_LICENSE("GPL and additional rights"); > > diff --git a/drivers/gpu/drm/vgem/vgem_drv.h b/drivers/gpu/drm/vgem/vgem_drv.h > > index 988cbaae7588..88ce21010e28 100644 > > --- a/drivers/gpu/drm/vgem/vgem_drv.h > > +++ b/drivers/gpu/drm/vgem/vgem_drv.h > > @@ -32,9 +32,27 @@ > > #include <drm/drmP.h> > > #include <drm/drm_gem.h> > > > > +#include <uapi/drm/vgem_drm.h> > > + > > +struct vgem_file { > > + struct idr fence_idr; > > + struct mutex fence_mutex; > > + u64 fence_context; > > + atomic_t fence_seqno; > > +}; > > + > > #define to_vgem_bo(x) container_of(x, struct drm_vgem_gem_object, base) > > struct drm_vgem_gem_object { > > struct drm_gem_object base; > > }; > > > > +int vgem_fence_open(struct vgem_file *file); > > +int vgem_fence_attach_ioctl(struct drm_device *dev, > > + void *data, > > + struct drm_file *file); > > +int vgem_fence_signal_ioctl(struct drm_device *dev, > > + void *data, > > + struct drm_file *file); > > +void vgem_fence_close(struct vgem_file *file); > > + > > #endif > > diff --git a/drivers/gpu/drm/vgem/vgem_fence.c b/drivers/gpu/drm/vgem/vgem_fence.c > > new file mode 100644 > > index 000000000000..649e9e1cee35 > > --- /dev/null > > +++ b/drivers/gpu/drm/vgem/vgem_fence.c > > @@ -0,0 +1,220 @@ > > +/* > > + * Copyright 2016 Intel Corporation > > + * > > + * Permission is hereby granted, free of charge, to any person obtaining a > > + * copy of this software and associated documentation files (the "Software") > > + * to deal in the software without restriction, including without limitation > > + * on the rights to use, copy, modify, merge, publish, distribute, sub > > + * license, and/or sell copies of the Software, and to permit persons to whom > > + * them Software is furnished to do so, subject to the following conditions: > > + * > > + * The above copyright notice and this permission notice (including the next > > + * paragraph) shall be included in all copies or substantial portions of the > > + * Software. > > + * > > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY, > > + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL > > + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER > > + * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN > > + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. > > + */ > > + > > +#include <linux/dma-buf.h> > > +#include <linux/reservation.h> > > + > > +#include "vgem_drv.h" > > + > > +struct vgem_fence { > > + struct fence base; > > + struct spinlock lock; > > +}; > > + > > +static const char *vgem_fence_get_driver_name(struct fence *fence) > > +{ > > + return "vgem"; > > +} > > + > > +static const char *vgem_fence_get_timeline_name(struct fence *fence) > > +{ > > + return "file"; > > +} > > + > > +static bool vgem_fence_signaled(struct fence *fence) > > +{ > > + return false; > > +} > > + > > +static bool vgem_fence_enable_signaling(struct fence *fence) > > +{ > > + return true; > > +} > > + > > +static void vgem_fence_value_str(struct fence *fence, char *str, int size) > > +{ > > + snprintf(str, size, "%u", fence->seqno); > > +} > > + > > +static void vgem_fence_timeline_value_str(struct fence *fence, char *str, > > + int size) > > +{ > > + snprintf(str, size, "%u", 0); > > +} > > I think this would be mainly used for debug purposes but it would be > nice to actually return the current timeline value here, i.e., the > seqno of the last signalled fence. The fences can and will be signaled in any order, there is no timeline here under the control of userspace, we only give them fences. > This would also allow to return if the fence was signaled or not > in vgem_fence_signaled() instead of just return false. That doesn't fit the out-of-order unbound nature of the interface. The interface is just a collection of fences that userspace associates with the buffer that it may signal at any time. (Having no strict timeline is an advantage!) -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/3] drm/vgem: Attach sw fences to exported vGEM dma-buf (ioctl) 2016-07-11 15:24 ` Chris Wilson @ 2016-07-12 10:44 ` Daniel Vetter 2016-07-12 11:04 ` Chris Wilson 0 siblings, 1 reply; 13+ messages in thread From: Daniel Vetter @ 2016-07-12 10:44 UTC (permalink / raw) To: Chris Wilson, Gustavo Padovan, dri-devel, daniel.vetter, Zach Reizner, intel-gfx, Gustavo Padovan On Mon, Jul 11, 2016 at 04:24:45PM +0100, Chris Wilson wrote: > On Mon, Jul 11, 2016 at 12:10:40PM -0300, Gustavo Padovan wrote: > > 2016-07-11 Chris Wilson <chris@chris-wilson.co.uk>: > > > > > vGEM buffers are useful for passing data between software clients and > > > hardware renders. By allowing the user to create and attach fences to > > > the exported vGEM buffers (on the dma-buf), the user can implement a > > > deferred renderer and queue hardware operations like flipping and then > > > signal the buffer readiness (i.e. this allows the user to schedule > > > operations out-of-order, but have them complete in-order). > > > > > > This also makes it much easier to write tightly controlled testcases for > > > dma-buf fencing and signaling between hardware drivers. > > > > > > Testcase: igt/vgem_basic/dmabuf-fence > > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > > > Cc: Sean Paul <seanpaul@chromium.org> > > > Cc: Zach Reizner <zachr@google.com> > > > Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk> > > > Acked-by: Zach Reizner <zachr@google.com> > > > --- > > > drivers/gpu/drm/vgem/Makefile | 2 +- > > > drivers/gpu/drm/vgem/vgem_drv.c | 34 ++++++ > > > drivers/gpu/drm/vgem/vgem_drv.h | 18 ++++ > > > drivers/gpu/drm/vgem/vgem_fence.c | 220 ++++++++++++++++++++++++++++++++++++++ > > > include/uapi/drm/vgem_drm.h | 62 +++++++++++ > > > 5 files changed, 335 insertions(+), 1 deletion(-) > > > create mode 100644 drivers/gpu/drm/vgem/vgem_fence.c > > > create mode 100644 include/uapi/drm/vgem_drm.h > > > > > > diff --git a/drivers/gpu/drm/vgem/Makefile b/drivers/gpu/drm/vgem/Makefile > > > index 3f4c7b842028..bfcdea1330e6 100644 > > > --- a/drivers/gpu/drm/vgem/Makefile > > > +++ b/drivers/gpu/drm/vgem/Makefile > > > @@ -1,4 +1,4 @@ > > > ccflags-y := -Iinclude/drm > > > -vgem-y := vgem_drv.o > > > +vgem-y := vgem_drv.o vgem_fence.o > > > > > > obj-$(CONFIG_DRM_VGEM) += vgem.o > > > diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c > > > index b5fb968d2d5c..2659e5cda857 100644 > > > --- a/drivers/gpu/drm/vgem/vgem_drv.c > > > +++ b/drivers/gpu/drm/vgem/vgem_drv.c > > > @@ -83,6 +83,34 @@ static const struct vm_operations_struct vgem_gem_vm_ops = { > > > .close = drm_gem_vm_close, > > > }; > > > > > > +static int vgem_open(struct drm_device *dev, struct drm_file *file) > > > +{ > > > + struct vgem_file *vfile; > > > + int ret; > > > + > > > + vfile = kzalloc(sizeof(*vfile), GFP_KERNEL); > > > + if (!vfile) > > > + return -ENOMEM; > > > + > > > + file->driver_priv = vfile; > > > + > > > + ret = vgem_fence_open(vfile); > > > + if (ret) { > > > + kfree(vfile); > > > + return ret; > > > + } > > > + > > > + return 0; > > > +} > > > + > > > +static void vgem_preclose(struct drm_device *dev, struct drm_file *file) > > > +{ > > > + struct vgem_file *vfile = file->driver_priv; > > > + > > > + vgem_fence_close(vfile); > > > + kfree(vfile); > > > +} > > > + > > > /* ioctls */ > > > > > > static struct drm_gem_object *vgem_gem_create(struct drm_device *dev, > > > @@ -164,6 +192,8 @@ unref: > > > } > > > > > > static struct drm_ioctl_desc vgem_ioctls[] = { > > > + DRM_IOCTL_DEF_DRV(VGEM_FENCE_ATTACH, vgem_fence_attach_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), > > > + DRM_IOCTL_DEF_DRV(VGEM_FENCE_SIGNAL, vgem_fence_signal_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), > > > }; > > > > > > static int vgem_mmap(struct file *filp, struct vm_area_struct *vma) > > > @@ -271,9 +301,12 @@ static int vgem_prime_mmap(struct drm_gem_object *obj, > > > > > > static struct drm_driver vgem_driver = { > > > .driver_features = DRIVER_GEM | DRIVER_PRIME, > > > + .open = vgem_open, > > > + .preclose = vgem_preclose, > > > .gem_free_object_unlocked = vgem_gem_free_object, > > > .gem_vm_ops = &vgem_gem_vm_ops, > > > .ioctls = vgem_ioctls, > > > + .num_ioctls = ARRAY_SIZE(vgem_ioctls), > > > .fops = &vgem_driver_fops, > > > > > > .dumb_create = vgem_gem_dumb_create, > > > @@ -328,5 +361,6 @@ module_init(vgem_init); > > > module_exit(vgem_exit); > > > > > > MODULE_AUTHOR("Red Hat, Inc."); > > > +MODULE_AUTHOR("Intel Corporation"); > > > MODULE_DESCRIPTION(DRIVER_DESC); > > > MODULE_LICENSE("GPL and additional rights"); > > > diff --git a/drivers/gpu/drm/vgem/vgem_drv.h b/drivers/gpu/drm/vgem/vgem_drv.h > > > index 988cbaae7588..88ce21010e28 100644 > > > --- a/drivers/gpu/drm/vgem/vgem_drv.h > > > +++ b/drivers/gpu/drm/vgem/vgem_drv.h > > > @@ -32,9 +32,27 @@ > > > #include <drm/drmP.h> > > > #include <drm/drm_gem.h> > > > > > > +#include <uapi/drm/vgem_drm.h> > > > + > > > +struct vgem_file { > > > + struct idr fence_idr; > > > + struct mutex fence_mutex; > > > + u64 fence_context; > > > + atomic_t fence_seqno; > > > +}; > > > + > > > #define to_vgem_bo(x) container_of(x, struct drm_vgem_gem_object, base) > > > struct drm_vgem_gem_object { > > > struct drm_gem_object base; > > > }; > > > > > > +int vgem_fence_open(struct vgem_file *file); > > > +int vgem_fence_attach_ioctl(struct drm_device *dev, > > > + void *data, > > > + struct drm_file *file); > > > +int vgem_fence_signal_ioctl(struct drm_device *dev, > > > + void *data, > > > + struct drm_file *file); > > > +void vgem_fence_close(struct vgem_file *file); > > > + > > > #endif > > > diff --git a/drivers/gpu/drm/vgem/vgem_fence.c b/drivers/gpu/drm/vgem/vgem_fence.c > > > new file mode 100644 > > > index 000000000000..649e9e1cee35 > > > --- /dev/null > > > +++ b/drivers/gpu/drm/vgem/vgem_fence.c > > > @@ -0,0 +1,220 @@ > > > +/* > > > + * Copyright 2016 Intel Corporation > > > + * > > > + * Permission is hereby granted, free of charge, to any person obtaining a > > > + * copy of this software and associated documentation files (the "Software") > > > + * to deal in the software without restriction, including without limitation > > > + * on the rights to use, copy, modify, merge, publish, distribute, sub > > > + * license, and/or sell copies of the Software, and to permit persons to whom > > > + * them Software is furnished to do so, subject to the following conditions: > > > + * > > > + * The above copyright notice and this permission notice (including the next > > > + * paragraph) shall be included in all copies or substantial portions of the > > > + * Software. > > > + * > > > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > > > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY, > > > + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL > > > + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER > > > + * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN > > > + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. > > > + */ > > > + > > > +#include <linux/dma-buf.h> > > > +#include <linux/reservation.h> > > > + > > > +#include "vgem_drv.h" > > > + > > > +struct vgem_fence { > > > + struct fence base; > > > + struct spinlock lock; > > > +}; > > > + > > > +static const char *vgem_fence_get_driver_name(struct fence *fence) > > > +{ > > > + return "vgem"; > > > +} > > > + > > > +static const char *vgem_fence_get_timeline_name(struct fence *fence) > > > +{ > > > + return "file"; > > > +} > > > + > > > +static bool vgem_fence_signaled(struct fence *fence) > > > +{ > > > + return false; > > > +} > > > + > > > +static bool vgem_fence_enable_signaling(struct fence *fence) > > > +{ > > > + return true; > > > +} > > > + > > > +static void vgem_fence_value_str(struct fence *fence, char *str, int size) > > > +{ > > > + snprintf(str, size, "%u", fence->seqno); > > > +} > > > + > > > +static void vgem_fence_timeline_value_str(struct fence *fence, char *str, > > > + int size) > > > +{ > > > + snprintf(str, size, "%u", 0); > > > +} > > > > I think this would be mainly used for debug purposes but it would be > > nice to actually return the current timeline value here, i.e., the > > seqno of the last signalled fence. > > The fences can and will be signaled in any order, there is no timeline > here under the control of userspace, we only give them fences. > > > This would also allow to return if the fence was signaled or not > > in vgem_fence_signaled() instead of just return false. > > That doesn't fit the out-of-order unbound nature of the interface. The > interface is just a collection of fences that userspace associates with > the buffer that it may signal at any time. (Having no strict timeline is > an advantage!) Fences on the same timeline are supposed to be signalled in-order. If you want full out-of-order fences then you need to grab a new timeline number for each one. Drivers can and do merge fences on the same timeline and just carry the one with the largest seqno around. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/3] drm/vgem: Attach sw fences to exported vGEM dma-buf (ioctl) 2016-07-12 10:44 ` Daniel Vetter @ 2016-07-12 11:04 ` Chris Wilson 2016-07-12 14:23 ` Daniel Vetter 0 siblings, 1 reply; 13+ messages in thread From: Chris Wilson @ 2016-07-12 11:04 UTC (permalink / raw) To: Daniel Vetter Cc: intel-gfx, dri-devel, Zach Reizner, daniel.vetter, Gustavo Padovan On Tue, Jul 12, 2016 at 12:44:17PM +0200, Daniel Vetter wrote: > On Mon, Jul 11, 2016 at 04:24:45PM +0100, Chris Wilson wrote: > > That doesn't fit the out-of-order unbound nature of the interface. The > > interface is just a collection of fences that userspace associates with > > the buffer that it may signal at any time. (Having no strict timeline is > > an advantage!) > > Fences on the same timeline are supposed to be signalled in-order. If you > want full out-of-order fences then you need to grab a new timeline number > for each one. Drivers can and do merge fences on the same timeline and > just carry the one with the largest seqno around. Ugh. Timelines simply don't mean anything everywhere - a very leaky abstration. Nevertheless, a fence_context per vgem_fence would do the trick. -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/3] drm/vgem: Attach sw fences to exported vGEM dma-buf (ioctl) 2016-07-12 11:04 ` Chris Wilson @ 2016-07-12 14:23 ` Daniel Vetter 0 siblings, 0 replies; 13+ messages in thread From: Daniel Vetter @ 2016-07-12 14:23 UTC (permalink / raw) To: Chris Wilson, Daniel Vetter, Gustavo Padovan, dri-devel, daniel.vetter, Zach Reizner, intel-gfx, Gustavo Padovan On Tue, Jul 12, 2016 at 12:04:03PM +0100, Chris Wilson wrote: > On Tue, Jul 12, 2016 at 12:44:17PM +0200, Daniel Vetter wrote: > > On Mon, Jul 11, 2016 at 04:24:45PM +0100, Chris Wilson wrote: > > > That doesn't fit the out-of-order unbound nature of the interface. The > > > interface is just a collection of fences that userspace associates with > > > the buffer that it may signal at any time. (Having no strict timeline is > > > an advantage!) > > > > Fences on the same timeline are supposed to be signalled in-order. If you > > want full out-of-order fences then you need to grab a new timeline number > > for each one. Drivers can and do merge fences on the same timeline and > > just carry the one with the largest seqno around. > > Ugh. Timelines simply don't mean anything everywhere - a very leaky > abstration. > > Nevertheless, a fence_context per vgem_fence would do the trick. Yeah it's a bit meh, but allocating plenty of them is how we currently cope with it. I suggested that we have a special FENCE_TIMELINE_UNORDERED flag (we need it for fence_array too), but that wasn't popular. I still expect it to happen eventually ;-) -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 13+ messages in thread
* ✗ Ro.CI.BAT: failure for series starting with [1/3] drm/vgem: Fix mmaping 2016-07-11 13:08 drm/vgem fixes and new ioctl for testing prime Chris Wilson ` (2 preceding siblings ...) 2016-07-11 13:08 ` [PATCH 3/3] drm/vgem: Attach sw fences to exported vGEM dma-buf (ioctl) Chris Wilson @ 2016-07-11 14:02 ` Patchwork 3 siblings, 0 replies; 13+ messages in thread From: Patchwork @ 2016-07-11 14:02 UTC (permalink / raw) To: Chris Wilson; +Cc: intel-gfx == Series Details == Series: series starting with [1/3] drm/vgem: Fix mmaping URL : https://patchwork.freedesktop.org/series/9716/ State : failure == Summary == Series 9716v1 Series without cover letter http://patchwork.freedesktop.org/api/1.0/series/9716/revisions/1/mbox Test drv_module_reload_basic: pass -> DMESG-WARN (ro-bdw-i7-5600u) Test gem_sync: Subgroup basic-store-each: pass -> DMESG-FAIL (ro-bdw-i7-5600u) Test kms_pipe_crc_basic: Subgroup nonblocking-crc-pipe-b-frame-sequence: pass -> SKIP (fi-skl-i5-6260u) Subgroup suspend-read-crc-pipe-a: skip -> DMESG-WARN (ro-bdw-i7-5557U) Test prime_vgem: Subgroup basic-busy-default: skip -> FAIL (ro-bdw-i7-5557U) skip -> FAIL (ro-ilk1-i5-650) skip -> FAIL (ro-hsw-i3-4010u) skip -> FAIL (fi-skl-i5-6260u) skip -> FAIL (ro-bdw-i7-5600u) skip -> FAIL (ro-snb-i7-2620M) skip -> FAIL (ro-bdw-i5-5250u) skip -> FAIL (ro-hsw-i7-4770r) skip -> FAIL (fi-snb-i7-2600) skip -> FAIL (ro-ivb-i7-3770) skip -> FAIL (ro-byt-n2820) skip -> FAIL (fi-skl-i7-6700k) skip -> FAIL (ro-skl3-i5-6260u) Subgroup basic-gtt: skip -> PASS (ro-bdw-i7-5557U) skip -> PASS (ro-ilk1-i5-650) skip -> PASS (ro-hsw-i3-4010u) skip -> PASS (fi-skl-i5-6260u) skip -> PASS (ro-bdw-i7-5600u) skip -> PASS (ro-snb-i7-2620M) skip -> PASS (ro-bdw-i5-5250u) skip -> PASS (ro-hsw-i7-4770r) skip -> PASS (fi-snb-i7-2600) skip -> PASS (ro-ivb-i7-3770) skip -> PASS (ro-byt-n2820) skip -> PASS (fi-skl-i7-6700k) skip -> PASS (ro-skl3-i5-6260u) Subgroup basic-read: skip -> PASS (ro-bdw-i7-5557U) skip -> PASS (ro-ilk1-i5-650) skip -> PASS (ro-hsw-i3-4010u) skip -> PASS (fi-skl-i5-6260u) skip -> PASS (ro-bdw-i7-5600u) skip -> PASS (ro-snb-i7-2620M) skip -> PASS (ro-bdw-i5-5250u) skip -> PASS (ro-hsw-i7-4770r) skip -> PASS (fi-snb-i7-2600) skip -> PASS (ro-ivb-i7-3770) skip -> PASS (ro-byt-n2820) skip -> PASS (fi-skl-i7-6700k) skip -> PASS (ro-skl3-i5-6260u) Subgroup basic-sync-default: skip -> FAIL (ro-bdw-i7-5557U) skip -> FAIL (ro-ilk1-i5-650) skip -> FAIL (ro-hsw-i3-4010u) skip -> FAIL (fi-skl-i5-6260u) skip -> FAIL (ro-bdw-i7-5600u) skip -> FAIL (ro-snb-i7-2620M) skip -> FAIL (ro-bdw-i5-5250u) skip -> FAIL (ro-hsw-i7-4770r) skip -> FAIL (fi-snb-i7-2600) skip -> FAIL (ro-ivb-i7-3770) skip -> FAIL (ro-byt-n2820) skip -> FAIL (fi-skl-i7-6700k) skip -> FAIL (ro-skl3-i5-6260u) Subgroup basic-wait-default: skip -> FAIL (ro-bdw-i7-5557U) skip -> FAIL (ro-ilk1-i5-650) skip -> FAIL (ro-hsw-i3-4010u) skip -> FAIL (fi-skl-i5-6260u) skip -> FAIL (ro-bdw-i7-5600u) skip -> FAIL (ro-snb-i7-2620M) skip -> FAIL (ro-bdw-i5-5250u) skip -> FAIL (ro-hsw-i7-4770r) skip -> FAIL (fi-snb-i7-2600) skip -> FAIL (ro-ivb-i7-3770) skip -> FAIL (ro-byt-n2820) skip -> FAIL (fi-skl-i7-6700k) skip -> FAIL (ro-skl3-i5-6260u) Subgroup basic-write: skip -> PASS (ro-bdw-i7-5557U) skip -> PASS (ro-ilk1-i5-650) skip -> PASS (ro-hsw-i3-4010u) skip -> PASS (fi-skl-i5-6260u) skip -> PASS (ro-bdw-i7-5600u) skip -> PASS (ro-snb-i7-2620M) skip -> PASS (ro-bdw-i5-5250u) skip -> PASS (ro-hsw-i7-4770r) skip -> PASS (fi-snb-i7-2600) skip -> PASS (ro-ivb-i7-3770) skip -> PASS (ro-byt-n2820) skip -> PASS (fi-skl-i7-6700k) skip -> PASS (ro-skl3-i5-6260u) Test vgem_basic: Subgroup dmabuf-export: WARNING: Long output truncated Results at /archive/results/CI_IGT_test/RO_Patchwork_1465/ e549c0b drm-intel-nightly: 2016y-07m-11d-12h-49m-29s UTC integration manifest 2b8a9a3 drm/vgem: Attach sw fences to exported vGEM dma-buf (ioctl) 9693738 drm/vgem: Enable dmabuf interface for export c4633a0 drm/vgem: Fix mmaping _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/3] drm/vgem: Fix mmaping @ 2016-06-23 14:35 Chris Wilson 2016-06-23 14:35 ` [PATCH 3/3] drm/vgem: Attach sw fences to exported vGEM dma-buf (ioctl) Chris Wilson 0 siblings, 1 reply; 13+ messages in thread From: Chris Wilson @ 2016-06-23 14:35 UTC (permalink / raw) To: dri-devel; +Cc: Zach Reizner, intel-gfx, matthew.auld The vGEM mmap code has bitrotted slightly and now immediately BUGs. Since vGEM was last updated, there are new core GEM facilities to provide more common functions, so let's use those here. v2: drm_gem_free_mmap_offset() is performed from drm_gem_object_release() so we can remove the redundant call. Testcase: igt/vgem_basic/mmap Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96603 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Sean Paul <seanpaul@chromium.org> Cc: Zach Reizner <zachr@google.com> Cc: Matthew Auld <matthew.auld@intel.com> Tested-by: Humberto Israel Perez Rodriguez <humberto.i.perez.rodriguez@intel.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com> --- drivers/gpu/drm/vgem/vgem_drv.c | 164 +++++++++++++++------------------------- drivers/gpu/drm/vgem/vgem_drv.h | 6 -- 2 files changed, 61 insertions(+), 109 deletions(-) diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c index 35ea5d02a827..c161b6d7e427 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.c +++ b/drivers/gpu/drm/vgem/vgem_drv.c @@ -42,81 +42,38 @@ #define DRIVER_MAJOR 1 #define DRIVER_MINOR 0 -void vgem_gem_put_pages(struct drm_vgem_gem_object *obj) -{ - drm_gem_put_pages(&obj->base, obj->pages, false, false); - obj->pages = NULL; -} - static void vgem_gem_free_object(struct drm_gem_object *obj) { struct drm_vgem_gem_object *vgem_obj = to_vgem_bo(obj); - drm_gem_free_mmap_offset(obj); - - if (vgem_obj->use_dma_buf && obj->dma_buf) { - dma_buf_put(obj->dma_buf); - obj->dma_buf = NULL; - } - drm_gem_object_release(obj); - - if (vgem_obj->pages) - vgem_gem_put_pages(vgem_obj); - - vgem_obj->pages = NULL; - kfree(vgem_obj); } -int vgem_gem_get_pages(struct drm_vgem_gem_object *obj) -{ - struct page **pages; - - if (obj->pages || obj->use_dma_buf) - return 0; - - pages = drm_gem_get_pages(&obj->base); - if (IS_ERR(pages)) { - return PTR_ERR(pages); - } - - obj->pages = pages; - - return 0; -} - static int vgem_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { struct drm_vgem_gem_object *obj = vma->vm_private_data; - loff_t num_pages; - pgoff_t page_offset; - int ret; - /* We don't use vmf->pgoff since that has the fake offset */ - page_offset = ((unsigned long)vmf->virtual_address - vma->vm_start) >> - PAGE_SHIFT; - - num_pages = DIV_ROUND_UP(obj->base.size, PAGE_SIZE); - - if (page_offset > num_pages) - return VM_FAULT_SIGBUS; - - ret = vm_insert_page(vma, (unsigned long)vmf->virtual_address, - obj->pages[page_offset]); - switch (ret) { - case 0: - return VM_FAULT_NOPAGE; - case -ENOMEM: - return VM_FAULT_OOM; - case -EBUSY: - return VM_FAULT_RETRY; - case -EFAULT: - case -EINVAL: - return VM_FAULT_SIGBUS; - default: - WARN_ON(1); - return VM_FAULT_SIGBUS; + unsigned long vaddr = (unsigned long)vmf->virtual_address; + struct page *page; + + page = shmem_read_mapping_page(file_inode(obj->base.filp)->i_mapping, + (vaddr - vma->vm_start) >> PAGE_SHIFT); + if (!IS_ERR(page)) { + vmf->page = page; + return 0; + } else switch (PTR_ERR(page)) { + case -ENOSPC: + case -ENOMEM: + return VM_FAULT_OOM; + case -EBUSY: + return VM_FAULT_RETRY; + case -EFAULT: + case -EINVAL: + return VM_FAULT_SIGBUS; + default: + WARN_ON_ONCE(PTR_ERR(page)); + return VM_FAULT_SIGBUS; } } @@ -134,57 +91,43 @@ static struct drm_gem_object *vgem_gem_create(struct drm_device *dev, unsigned long size) { struct drm_vgem_gem_object *obj; - struct drm_gem_object *gem_object; - int err; - - size = roundup(size, PAGE_SIZE); + int ret; obj = kzalloc(sizeof(*obj), GFP_KERNEL); if (!obj) return ERR_PTR(-ENOMEM); - gem_object = &obj->base; - - err = drm_gem_object_init(dev, gem_object, size); - if (err) - goto out; - - err = vgem_gem_get_pages(obj); - if (err) - goto out; - - err = drm_gem_handle_create(file, gem_object, handle); - if (err) - goto handle_out; + ret = drm_gem_object_init(dev, &obj->base, roundup(size, PAGE_SIZE)); + if (ret) + goto err_free; - drm_gem_object_unreference_unlocked(gem_object); + ret = drm_gem_handle_create(file, &obj->base, handle); + drm_gem_object_unreference_unlocked(&obj->base); + if (ret) + goto err; - return gem_object; + return &obj->base; -handle_out: - drm_gem_object_release(gem_object); -out: +err_free: kfree(obj); - return ERR_PTR(err); +err: + return ERR_PTR(ret); } static int vgem_gem_dumb_create(struct drm_file *file, struct drm_device *dev, struct drm_mode_create_dumb *args) { struct drm_gem_object *gem_object; - uint64_t size; - uint64_t pitch = args->width * DIV_ROUND_UP(args->bpp, 8); + u64 pitch, size; + pitch = args->width * DIV_ROUND_UP(args->bpp, 8); size = args->height * pitch; if (size == 0) return -EINVAL; gem_object = vgem_gem_create(dev, file, &args->handle, size); - - if (IS_ERR(gem_object)) { - DRM_DEBUG_DRIVER("object creation failed\n"); + if (IS_ERR(gem_object)) return PTR_ERR(gem_object); - } args->size = gem_object->size; args->pitch = pitch; @@ -194,26 +137,26 @@ static int vgem_gem_dumb_create(struct drm_file *file, struct drm_device *dev, return 0; } -int vgem_gem_dumb_map(struct drm_file *file, struct drm_device *dev, - uint32_t handle, uint64_t *offset) +static int vgem_gem_dumb_map(struct drm_file *file, struct drm_device *dev, + uint32_t handle, uint64_t *offset) { - int ret = 0; struct drm_gem_object *obj; + int ret; obj = drm_gem_object_lookup(file, handle); if (!obj) return -ENOENT; + if (!obj->filp) { + ret = -EINVAL; + goto unref; + } + ret = drm_gem_create_mmap_offset(obj); if (ret) goto unref; - BUG_ON(!obj->filp); - - obj->filp->private_data = obj; - *offset = drm_vma_node_offset_addr(&obj->vma_node); - unref: drm_gem_object_unreference_unlocked(obj); @@ -223,10 +166,26 @@ unref: static struct drm_ioctl_desc vgem_ioctls[] = { }; +static int vgem_mmap(struct file *filp, struct vm_area_struct *vma) +{ + unsigned long flags = vma->vm_flags; + int ret; + + ret = drm_gem_mmap(filp, vma); + if (ret) + return ret; + + /* Keep the WC mmaping set by drm_gem_mmap() but our pages + * are ordinary and not special. + */ + vma->vm_flags = flags | VM_DONTEXPAND | VM_DONTDUMP; + return 0; +} + static const struct file_operations vgem_driver_fops = { .owner = THIS_MODULE, .open = drm_open, - .mmap = drm_gem_mmap, + .mmap = vgem_mmap, .poll = drm_poll, .read = drm_read, .unlocked_ioctl = drm_ioctl, @@ -248,7 +207,7 @@ static struct drm_driver vgem_driver = { .minor = DRIVER_MINOR, }; -struct drm_device *vgem_device; +static struct drm_device *vgem_device; static int __init vgem_init(void) { @@ -261,7 +220,6 @@ static int __init vgem_init(void) } ret = drm_dev_register(vgem_device, 0); - if (ret) goto out_unref; diff --git a/drivers/gpu/drm/vgem/vgem_drv.h b/drivers/gpu/drm/vgem/vgem_drv.h index e9f92f7ee275..988cbaae7588 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.h +++ b/drivers/gpu/drm/vgem/vgem_drv.h @@ -35,12 +35,6 @@ #define to_vgem_bo(x) container_of(x, struct drm_vgem_gem_object, base) struct drm_vgem_gem_object { struct drm_gem_object base; - struct page **pages; - bool use_dma_buf; }; -/* vgem_drv.c */ -extern void vgem_gem_put_pages(struct drm_vgem_gem_object *obj); -extern int vgem_gem_get_pages(struct drm_vgem_gem_object *obj); - #endif -- 2.8.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/3] drm/vgem: Attach sw fences to exported vGEM dma-buf (ioctl) 2016-06-23 14:35 [PATCH 1/3] " Chris Wilson @ 2016-06-23 14:35 ` Chris Wilson 2016-06-30 15:40 ` Zach Reizner 0 siblings, 1 reply; 13+ messages in thread From: Chris Wilson @ 2016-06-23 14:35 UTC (permalink / raw) To: dri-devel; +Cc: Zach Reizner, intel-gfx, matthew.auld vGEM buffers are useful for passing data between software clients and hardware renders. By allowing the user to create and attach fences to the exported vGEM buffers (on the dma-buf), the user can implement a deferred renderer and queue hardware operations like flipping and then signal the buffer readiness (i.e. this allows the user to schedule operations out-of-order, but have them complete in-order). This also makes it much easier to write tightly controlled testcases for dma-buf fencing and signaling between hardware drivers. Testcase: igt/vgem_basic/dmabuf-fence Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Sean Paul <seanpaul@chromium.org> Cc: Zach Reizner <zachr@google.com> --- drivers/gpu/drm/vgem/Makefile | 2 +- drivers/gpu/drm/vgem/vgem_drv.c | 34 ++++++ drivers/gpu/drm/vgem/vgem_drv.h | 18 ++++ drivers/gpu/drm/vgem/vgem_fence.c | 217 ++++++++++++++++++++++++++++++++++++++ include/uapi/drm/vgem_drm.h | 62 +++++++++++ 5 files changed, 332 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/vgem/vgem_fence.c create mode 100644 include/uapi/drm/vgem_drm.h diff --git a/drivers/gpu/drm/vgem/Makefile b/drivers/gpu/drm/vgem/Makefile index 3f4c7b842028..bfcdea1330e6 100644 --- a/drivers/gpu/drm/vgem/Makefile +++ b/drivers/gpu/drm/vgem/Makefile @@ -1,4 +1,4 @@ ccflags-y := -Iinclude/drm -vgem-y := vgem_drv.o +vgem-y := vgem_drv.o vgem_fence.o obj-$(CONFIG_DRM_VGEM) += vgem.o diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c index 69468b5f3d82..56e348701382 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.c +++ b/drivers/gpu/drm/vgem/vgem_drv.c @@ -83,6 +83,34 @@ static const struct vm_operations_struct vgem_gem_vm_ops = { .close = drm_gem_vm_close, }; +static int vgem_open(struct drm_device *dev, struct drm_file *file) +{ + struct vgem_file *vfile; + int ret; + + vfile = kzalloc(sizeof(*vfile), GFP_KERNEL); + if (!vfile) + return -ENOMEM; + + file->driver_priv = vfile; + + ret = vgem_fence_open(vfile); + if (ret) { + kfree(vfile); + return ret; + } + + return 0; +} + +static void vgem_preclose(struct drm_device *dev, struct drm_file *file) +{ + struct vgem_file *vfile = file->driver_priv; + + vgem_fence_close(vfile); + kfree(vfile); +} + /* ioctls */ static struct drm_gem_object *vgem_gem_create(struct drm_device *dev, @@ -164,6 +192,8 @@ unref: } static struct drm_ioctl_desc vgem_ioctls[] = { + DRM_IOCTL_DEF_DRV(VGEM_FENCE_ATTACH, vgem_fence_attach_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(VGEM_FENCE_SIGNAL, vgem_fence_signal_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), }; static int vgem_mmap(struct file *filp, struct vm_area_struct *vma) @@ -286,9 +316,12 @@ static int vgem_prime_mmap(struct drm_gem_object *obj, static struct drm_driver vgem_driver = { .driver_features = DRIVER_GEM | DRIVER_PRIME, + .open = vgem_open, + .preclose = vgem_preclose, .gem_free_object_unlocked = vgem_gem_free_object, .gem_vm_ops = &vgem_gem_vm_ops, .ioctls = vgem_ioctls, + .num_ioctls = ARRAY_SIZE(vgem_ioctls), .fops = &vgem_driver_fops, .dumb_create = vgem_gem_dumb_create, @@ -343,5 +376,6 @@ module_init(vgem_init); module_exit(vgem_exit); MODULE_AUTHOR("Red Hat, Inc."); +MODULE_AUTHOR("Intel Corporation"); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL and additional rights"); diff --git a/drivers/gpu/drm/vgem/vgem_drv.h b/drivers/gpu/drm/vgem/vgem_drv.h index 988cbaae7588..88ce21010e28 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.h +++ b/drivers/gpu/drm/vgem/vgem_drv.h @@ -32,9 +32,27 @@ #include <drm/drmP.h> #include <drm/drm_gem.h> +#include <uapi/drm/vgem_drm.h> + +struct vgem_file { + struct idr fence_idr; + struct mutex fence_mutex; + u64 fence_context; + atomic_t fence_seqno; +}; + #define to_vgem_bo(x) container_of(x, struct drm_vgem_gem_object, base) struct drm_vgem_gem_object { struct drm_gem_object base; }; +int vgem_fence_open(struct vgem_file *file); +int vgem_fence_attach_ioctl(struct drm_device *dev, + void *data, + struct drm_file *file); +int vgem_fence_signal_ioctl(struct drm_device *dev, + void *data, + struct drm_file *file); +void vgem_fence_close(struct vgem_file *file); + #endif diff --git a/drivers/gpu/drm/vgem/vgem_fence.c b/drivers/gpu/drm/vgem/vgem_fence.c new file mode 100644 index 000000000000..46130e4a3506 --- /dev/null +++ b/drivers/gpu/drm/vgem/vgem_fence.c @@ -0,0 +1,217 @@ +/* + * Copyright 2016 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software") + * to deal in the software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * them Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include <linux/dma-buf.h> +#include <linux/reservation.h> + +#include "vgem_drv.h" + +struct vgem_fence { + struct fence base; + struct spinlock lock; +}; + +static const char *vgem_fence_get_driver_name(struct fence *fence) +{ + return "vgem"; +} + +static const char *vgem_fence_get_timeline_name(struct fence *fence) +{ + return "file"; +} + +static bool vgem_fence_signaled(struct fence *fence) +{ + return false; +} + +static bool vgem_fence_enable_signaling(struct fence *fence) +{ + return true; +} + +static void vgem_fence_value_str(struct fence *fence, char *str, int size) +{ + snprintf(str, size, "%u", fence->seqno); +} + +static void vgem_fence_timeline_value_str(struct fence *fence, char *str, + int size) +{ + snprintf(str, size, "%u", 0); +} + +const struct fence_ops vgem_fence_ops = { + .get_driver_name = vgem_fence_get_driver_name, + .get_timeline_name = vgem_fence_get_timeline_name, + .enable_signaling = vgem_fence_enable_signaling, + .signaled = vgem_fence_signaled, + .wait = fence_default_wait, + .fence_value_str = vgem_fence_value_str, + .timeline_value_str = vgem_fence_timeline_value_str, +}; + +static u32 vgem_fence_next_seqno(struct vgem_file *vfile) +{ + u32 seqno; + + seqno = atomic_inc_return(&vfile->fence_seqno); + if (seqno == 0) + seqno = atomic_inc_return(&vfile->fence_seqno); + + return seqno; +} + +static struct fence *vgem_fence_create(struct vgem_file *vfile) +{ + struct vgem_fence *fence; + + fence = kzalloc(sizeof(*fence), GFP_KERNEL); + if (!fence) + return NULL; + + spin_lock_init(&fence->lock); + fence_init(&fence->base, + &vgem_fence_ops, + &fence->lock, + vfile->fence_context, + vgem_fence_next_seqno(vfile)); + + return &fence->base; +} + +static int attach_dmabuf(struct drm_device *dev, + struct drm_gem_object *obj) +{ + struct dma_buf *dmabuf; + + if (obj->dma_buf) + return 0; + + dmabuf = dev->driver->gem_prime_export(dev, obj, 0); + if (IS_ERR(dmabuf)) + return PTR_ERR(dmabuf); + + obj->dma_buf = dmabuf; + drm_gem_object_reference(obj); + return 0; +} + +int vgem_fence_attach_ioctl(struct drm_device *dev, + void *data, + struct drm_file *file) +{ + struct drm_vgem_fence_attach *arg = data; + struct vgem_file *vfile = file->driver_priv; + struct reservation_object *resv; + struct drm_gem_object *obj; + struct fence *fence; + int ret; + + if (arg->flags & ~VGEM_FENCE_WRITE) + return -EINVAL; + + obj = drm_gem_object_lookup(file, arg->handle); + if (!obj) + return -ENOENT; + + ret = attach_dmabuf(dev, obj); + if (ret) + goto out; + + fence = vgem_fence_create(vfile); + if (!fence) { + ret = -ENOMEM; + goto out; + } + + ret = 0; + resv = obj->dma_buf->resv; + mutex_lock(&resv->lock.base); + if (arg->flags & VGEM_FENCE_WRITE) + reservation_object_add_excl_fence(resv, fence); + else if ((ret = reservation_object_reserve_shared(resv)) == 0) + reservation_object_add_shared_fence(resv, fence); + mutex_unlock(&resv->lock.base); + + if (ret == 0) { + mutex_lock(&vfile->fence_mutex); + ret = idr_alloc(&vfile->fence_idr, fence, 1, 0, GFP_KERNEL); + mutex_unlock(&vfile->fence_mutex); + if (ret > 0) { + arg->out_fence = ret; + ret = 0; + } + } + if (ret) + fence_put(fence); +out: + drm_gem_object_unreference_unlocked(obj); + return ret; +} + +int vgem_fence_signal_ioctl(struct drm_device *dev, + void *data, + struct drm_file *file) +{ + struct vgem_file *vfile = file->driver_priv; + struct drm_vgem_fence_signal *arg = data; + struct fence *fence; + + if (arg->flags) + return -EINVAL; + + mutex_lock(&vfile->fence_mutex); + fence = idr_replace(&vfile->fence_idr, NULL, arg->fence); + mutex_unlock(&vfile->fence_mutex); + if (!fence) + return -ENOENT; + if (IS_ERR(fence)) + return PTR_ERR(fence); + + fence_signal(fence); + fence_put(fence); + return 0; +} + +int vgem_fence_open(struct vgem_file *vfile) +{ + mutex_init(&vfile->fence_mutex); + idr_init(&vfile->fence_idr); + vfile->fence_context = fence_context_alloc(1); + + return 0; +} + +static int __vgem_fence_idr_fini(int id, void *p, void *data) +{ + fence_signal(p); + fence_put(p); + return 0; +} + +void vgem_fence_close(struct vgem_file *vfile) +{ + idr_for_each(&vfile->fence_idr, __vgem_fence_idr_fini, vfile); + idr_destroy(&vfile->fence_idr); +} diff --git a/include/uapi/drm/vgem_drm.h b/include/uapi/drm/vgem_drm.h new file mode 100644 index 000000000000..352d2fae8de9 --- /dev/null +++ b/include/uapi/drm/vgem_drm.h @@ -0,0 +1,62 @@ +/* + * Copyright 2016 Intel Corporation + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef _UAPI_VGEM_DRM_H_ +#define _UAPI_VGEM_DRM_H_ + +#include "drm.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +/* Please note that modifications to all structs defined here are + * subject to backwards-compatibility constraints. + */ +#define DRM_VGEM_FENCE_ATTACH 0x1 +#define DRM_VGEM_FENCE_SIGNAL 0x2 + +#define DRM_IOCTL_VGEM_FENCE_ATTACH DRM_IOWR( DRM_COMMAND_BASE + DRM_VGEM_FENCE_ATTACH, struct drm_vgem_fence_attach) +#define DRM_IOCTL_VGEM_FENCE_SIGNAL DRM_IOW( DRM_COMMAND_BASE + DRM_VGEM_FENCE_SIGNAL, struct drm_vgem_fence_signal) + +struct drm_vgem_fence_attach { + __u32 handle; + __u32 flags; +#define VGEM_FENCE_WRITE 0x1 + __u32 out_fence; + __u32 pad; +}; + +struct drm_vgem_fence_signal { + __u32 fence; + __u32 flags; +}; + +#if defined(__cplusplus) +} +#endif + +#endif /* _UAPI_VGEM_DRM_H_ */ -- 2.8.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 3/3] drm/vgem: Attach sw fences to exported vGEM dma-buf (ioctl) 2016-06-23 14:35 ` [PATCH 3/3] drm/vgem: Attach sw fences to exported vGEM dma-buf (ioctl) Chris Wilson @ 2016-06-30 15:40 ` Zach Reizner 0 siblings, 0 replies; 13+ messages in thread From: Zach Reizner @ 2016-06-30 15:40 UTC (permalink / raw) To: Chris Wilson, dri-devel; +Cc: intel-gfx, matthew.auld [-- Attachment #1.1: Type: text/plain, Size: 14588 bytes --] On Thu, Jun 23, 2016 at 10:35 AM Chris Wilson <chris@chris-wilson.co.uk> wrote: > vGEM buffers are useful for passing data between software clients and > hardware renders. By allowing the user to create and attach fences to > the exported vGEM buffers (on the dma-buf), the user can implement a > deferred renderer and queue hardware operations like flipping and then > signal the buffer readiness (i.e. this allows the user to schedule > operations out-of-order, but have them complete in-order). > > This also makes it much easier to write tightly controlled testcases for > dma-buf fencing and signaling between hardware drivers. > > Testcase: igt/vgem_basic/dmabuf-fence > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Sean Paul <seanpaul@chromium.org> > Cc: Zach Reizner <zachr@google.com> > --- > drivers/gpu/drm/vgem/Makefile | 2 +- > drivers/gpu/drm/vgem/vgem_drv.c | 34 ++++++ > drivers/gpu/drm/vgem/vgem_drv.h | 18 ++++ > drivers/gpu/drm/vgem/vgem_fence.c | 217 > ++++++++++++++++++++++++++++++++++++++ > include/uapi/drm/vgem_drm.h | 62 +++++++++++ > 5 files changed, 332 insertions(+), 1 deletion(-) > create mode 100644 drivers/gpu/drm/vgem/vgem_fence.c > create mode 100644 include/uapi/drm/vgem_drm.h > > diff --git a/drivers/gpu/drm/vgem/Makefile b/drivers/gpu/drm/vgem/Makefile > index 3f4c7b842028..bfcdea1330e6 100644 > --- a/drivers/gpu/drm/vgem/Makefile > +++ b/drivers/gpu/drm/vgem/Makefile > @@ -1,4 +1,4 @@ > ccflags-y := -Iinclude/drm > -vgem-y := vgem_drv.o > +vgem-y := vgem_drv.o vgem_fence.o > > obj-$(CONFIG_DRM_VGEM) += vgem.o > diff --git a/drivers/gpu/drm/vgem/vgem_drv.c > b/drivers/gpu/drm/vgem/vgem_drv.c > index 69468b5f3d82..56e348701382 100644 > --- a/drivers/gpu/drm/vgem/vgem_drv.c > +++ b/drivers/gpu/drm/vgem/vgem_drv.c > @@ -83,6 +83,34 @@ static const struct vm_operations_struct > vgem_gem_vm_ops = { > .close = drm_gem_vm_close, > }; > > +static int vgem_open(struct drm_device *dev, struct drm_file *file) > +{ > + struct vgem_file *vfile; > + int ret; > + > + vfile = kzalloc(sizeof(*vfile), GFP_KERNEL); > + if (!vfile) > + return -ENOMEM; > + > + file->driver_priv = vfile; > + > + ret = vgem_fence_open(vfile); > + if (ret) { > + kfree(vfile); > + return ret; > + } > + > + return 0; > +} > + > +static void vgem_preclose(struct drm_device *dev, struct drm_file *file) > +{ > + struct vgem_file *vfile = file->driver_priv; > + > + vgem_fence_close(vfile); > + kfree(vfile); > +} > + > /* ioctls */ > > static struct drm_gem_object *vgem_gem_create(struct drm_device *dev, > @@ -164,6 +192,8 @@ unref: > } > > static struct drm_ioctl_desc vgem_ioctls[] = { > + DRM_IOCTL_DEF_DRV(VGEM_FENCE_ATTACH, vgem_fence_attach_ioctl, > DRM_AUTH|DRM_RENDER_ALLOW), > + DRM_IOCTL_DEF_DRV(VGEM_FENCE_SIGNAL, vgem_fence_signal_ioctl, > DRM_AUTH|DRM_RENDER_ALLOW), > }; > > static int vgem_mmap(struct file *filp, struct vm_area_struct *vma) > @@ -286,9 +316,12 @@ static int vgem_prime_mmap(struct drm_gem_object *obj, > > static struct drm_driver vgem_driver = { > .driver_features = DRIVER_GEM | DRIVER_PRIME, > + .open = vgem_open, > + .preclose = vgem_preclose, > .gem_free_object_unlocked = vgem_gem_free_object, > .gem_vm_ops = &vgem_gem_vm_ops, > .ioctls = vgem_ioctls, > + .num_ioctls = ARRAY_SIZE(vgem_ioctls), > .fops = &vgem_driver_fops, > > .dumb_create = vgem_gem_dumb_create, > @@ -343,5 +376,6 @@ module_init(vgem_init); > module_exit(vgem_exit); > > MODULE_AUTHOR("Red Hat, Inc."); > +MODULE_AUTHOR("Intel Corporation"); > MODULE_DESCRIPTION(DRIVER_DESC); > MODULE_LICENSE("GPL and additional rights"); > diff --git a/drivers/gpu/drm/vgem/vgem_drv.h > b/drivers/gpu/drm/vgem/vgem_drv.h > index 988cbaae7588..88ce21010e28 100644 > --- a/drivers/gpu/drm/vgem/vgem_drv.h > +++ b/drivers/gpu/drm/vgem/vgem_drv.h > @@ -32,9 +32,27 @@ > #include <drm/drmP.h> > #include <drm/drm_gem.h> > > +#include <uapi/drm/vgem_drm.h> > + > +struct vgem_file { > + struct idr fence_idr; > + struct mutex fence_mutex; > + u64 fence_context; > + atomic_t fence_seqno; > +}; > + > #define to_vgem_bo(x) container_of(x, struct drm_vgem_gem_object, base) > struct drm_vgem_gem_object { > struct drm_gem_object base; > }; > > +int vgem_fence_open(struct vgem_file *file); > +int vgem_fence_attach_ioctl(struct drm_device *dev, > + void *data, > + struct drm_file *file); > +int vgem_fence_signal_ioctl(struct drm_device *dev, > + void *data, > + struct drm_file *file); > +void vgem_fence_close(struct vgem_file *file); > + > #endif > diff --git a/drivers/gpu/drm/vgem/vgem_fence.c > b/drivers/gpu/drm/vgem/vgem_fence.c > new file mode 100644 > index 000000000000..46130e4a3506 > --- /dev/null > +++ b/drivers/gpu/drm/vgem/vgem_fence.c > @@ -0,0 +1,217 @@ > +/* > + * Copyright 2016 Intel Corporation > + * > + * Permission is hereby granted, free of charge, to any person obtaining a > + * copy of this software and associated documentation files (the > "Software") > + * to deal in the software without restriction, including without > limitation > + * on the rights to use, copy, modify, merge, publish, distribute, sub > + * license, and/or sell copies of the Software, and to permit persons to > whom > + * them Software is furnished to do so, subject to the following > conditions: > + * > + * The above copyright notice and this permission notice (including the > next > + * paragraph) shall be included in all copies or substantial portions of > the > + * Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, > EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF > MERCHANTIBILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT > SHALL > + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, > WHETHER > + * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR > IN > + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE > SOFTWARE. > + */ > + > +#include <linux/dma-buf.h> > +#include <linux/reservation.h> > + > +#include "vgem_drv.h" > + > +struct vgem_fence { > + struct fence base; > + struct spinlock lock; > +}; > + > +static const char *vgem_fence_get_driver_name(struct fence *fence) > +{ > + return "vgem"; > +} > + > +static const char *vgem_fence_get_timeline_name(struct fence *fence) > +{ > + return "file"; > +} > + > +static bool vgem_fence_signaled(struct fence *fence) > +{ > + return false; > +} > + > +static bool vgem_fence_enable_signaling(struct fence *fence) > +{ > + return true; > +} > + > +static void vgem_fence_value_str(struct fence *fence, char *str, int size) > +{ > + snprintf(str, size, "%u", fence->seqno); > +} > + > +static void vgem_fence_timeline_value_str(struct fence *fence, char *str, > + int size) > +{ > + snprintf(str, size, "%u", 0); > +} > + > +const struct fence_ops vgem_fence_ops = { > + .get_driver_name = vgem_fence_get_driver_name, > + .get_timeline_name = vgem_fence_get_timeline_name, > + .enable_signaling = vgem_fence_enable_signaling, > + .signaled = vgem_fence_signaled, > + .wait = fence_default_wait, > + .fence_value_str = vgem_fence_value_str, > + .timeline_value_str = vgem_fence_timeline_value_str, > +}; > + > +static u32 vgem_fence_next_seqno(struct vgem_file *vfile) > +{ > + u32 seqno; > + > + seqno = atomic_inc_return(&vfile->fence_seqno); > + if (seqno == 0) > + seqno = atomic_inc_return(&vfile->fence_seqno); > + > + return seqno; > +} > + > +static struct fence *vgem_fence_create(struct vgem_file *vfile) > +{ > + struct vgem_fence *fence; > + > + fence = kzalloc(sizeof(*fence), GFP_KERNEL); > + if (!fence) > + return NULL; > + > + spin_lock_init(&fence->lock); > + fence_init(&fence->base, > + &vgem_fence_ops, > + &fence->lock, > + vfile->fence_context, > + vgem_fence_next_seqno(vfile)); > + > + return &fence->base; > +} > + > +static int attach_dmabuf(struct drm_device *dev, > + struct drm_gem_object *obj) > +{ > + struct dma_buf *dmabuf; > + > + if (obj->dma_buf) > + return 0; > + > + dmabuf = dev->driver->gem_prime_export(dev, obj, 0); > + if (IS_ERR(dmabuf)) > + return PTR_ERR(dmabuf); > + > + obj->dma_buf = dmabuf; > + drm_gem_object_reference(obj); > + return 0; > +} > + > +int vgem_fence_attach_ioctl(struct drm_device *dev, > + void *data, > + struct drm_file *file) > +{ > + struct drm_vgem_fence_attach *arg = data; > + struct vgem_file *vfile = file->driver_priv; > + struct reservation_object *resv; > + struct drm_gem_object *obj; > + struct fence *fence; > + int ret; > + > + if (arg->flags & ~VGEM_FENCE_WRITE) > + return -EINVAL; > + > + obj = drm_gem_object_lookup(file, arg->handle); > + if (!obj) > + return -ENOENT; > + > + ret = attach_dmabuf(dev, obj); > + if (ret) > + goto out; > + > + fence = vgem_fence_create(vfile); > + if (!fence) { > + ret = -ENOMEM; > + goto out; > + } > + > + ret = 0; > + resv = obj->dma_buf->resv; > + mutex_lock(&resv->lock.base); > + if (arg->flags & VGEM_FENCE_WRITE) > + reservation_object_add_excl_fence(resv, fence); > + else if ((ret = reservation_object_reserve_shared(resv)) == 0) > + reservation_object_add_shared_fence(resv, fence); > + mutex_unlock(&resv->lock.base); > + > + if (ret == 0) { > + mutex_lock(&vfile->fence_mutex); > + ret = idr_alloc(&vfile->fence_idr, fence, 1, 0, > GFP_KERNEL); > + mutex_unlock(&vfile->fence_mutex); > + if (ret > 0) { > + arg->out_fence = ret; > + ret = 0; > + } > + } > + if (ret) > + fence_put(fence); > +out: > + drm_gem_object_unreference_unlocked(obj); > + return ret; > +} > + > +int vgem_fence_signal_ioctl(struct drm_device *dev, > + void *data, > + struct drm_file *file) > +{ > + struct vgem_file *vfile = file->driver_priv; > + struct drm_vgem_fence_signal *arg = data; > + struct fence *fence; > + > + if (arg->flags) > + return -EINVAL; > + > + mutex_lock(&vfile->fence_mutex); > + fence = idr_replace(&vfile->fence_idr, NULL, arg->fence); > + mutex_unlock(&vfile->fence_mutex); > + if (!fence) > + return -ENOENT; > + if (IS_ERR(fence)) > + return PTR_ERR(fence); > + > + fence_signal(fence); > + fence_put(fence); > + return 0; > +} > + > +int vgem_fence_open(struct vgem_file *vfile) > +{ > + mutex_init(&vfile->fence_mutex); > + idr_init(&vfile->fence_idr); > + vfile->fence_context = fence_context_alloc(1); > + > + return 0; > +} > + > +static int __vgem_fence_idr_fini(int id, void *p, void *data) > +{ > + fence_signal(p); > + fence_put(p); > + return 0; > +} > + > +void vgem_fence_close(struct vgem_file *vfile) > +{ > + idr_for_each(&vfile->fence_idr, __vgem_fence_idr_fini, vfile); > + idr_destroy(&vfile->fence_idr); > +} > diff --git a/include/uapi/drm/vgem_drm.h b/include/uapi/drm/vgem_drm.h > new file mode 100644 > index 000000000000..352d2fae8de9 > --- /dev/null > +++ b/include/uapi/drm/vgem_drm.h > @@ -0,0 +1,62 @@ > +/* > + * Copyright 2016 Intel Corporation > + * All Rights Reserved. > + * > + * Permission is hereby granted, free of charge, to any person obtaining a > + * copy of this software and associated documentation files (the > + * "Software"), to deal in the Software without restriction, including > + * without limitation the rights to use, copy, modify, merge, publish, > + * distribute, sub license, and/or sell copies of the Software, and to > + * permit persons to whom the Software is furnished to do so, subject to > + * the following conditions: > + * > + * The above copyright notice and this permission notice (including the > + * next paragraph) shall be included in all copies or substantial portions > + * of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS > + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF > + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. > + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR > + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF > CONTRACT, > + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE > + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. > + * > + */ > + > +#ifndef _UAPI_VGEM_DRM_H_ > +#define _UAPI_VGEM_DRM_H_ > + > +#include "drm.h" > + > +#if defined(__cplusplus) > +extern "C" { > +#endif > + > +/* Please note that modifications to all structs defined here are > + * subject to backwards-compatibility constraints. > + */ > +#define DRM_VGEM_FENCE_ATTACH 0x1 > +#define DRM_VGEM_FENCE_SIGNAL 0x2 > + > +#define DRM_IOCTL_VGEM_FENCE_ATTACH DRM_IOWR( DRM_COMMAND_BASE + > DRM_VGEM_FENCE_ATTACH, struct drm_vgem_fence_attach) > +#define DRM_IOCTL_VGEM_FENCE_SIGNAL DRM_IOW( DRM_COMMAND_BASE + > DRM_VGEM_FENCE_SIGNAL, struct drm_vgem_fence_signal) > + > +struct drm_vgem_fence_attach { > + __u32 handle; > + __u32 flags; > +#define VGEM_FENCE_WRITE 0x1 > + __u32 out_fence; > + __u32 pad; > +}; > + > +struct drm_vgem_fence_signal { > + __u32 fence; > + __u32 flags; > +}; > + > +#if defined(__cplusplus) > +} > +#endif > + > +#endif /* _UAPI_VGEM_DRM_H_ */ > -- > 2.8.1 > Acked-by: Zach Reizner <zachr@google.com> [-- Attachment #1.2: Type: text/html, Size: 18242 bytes --] [-- Attachment #2: Type: text/plain, Size: 160 bytes --] _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2016-07-12 14:23 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-07-11 13:08 drm/vgem fixes and new ioctl for testing prime Chris Wilson 2016-07-11 13:08 ` [PATCH 1/3] drm/vgem: Fix mmaping Chris Wilson 2016-07-11 13:08 ` [PATCH 2/3] drm/vgem: Enable dmabuf interface for export Chris Wilson 2016-07-12 10:45 ` Daniel Vetter 2016-07-11 13:08 ` [PATCH 3/3] drm/vgem: Attach sw fences to exported vGEM dma-buf (ioctl) Chris Wilson 2016-07-11 15:10 ` Gustavo Padovan 2016-07-11 15:24 ` Chris Wilson 2016-07-12 10:44 ` Daniel Vetter 2016-07-12 11:04 ` Chris Wilson 2016-07-12 14:23 ` Daniel Vetter 2016-07-11 14:02 ` ✗ Ro.CI.BAT: failure for series starting with [1/3] drm/vgem: Fix mmaping Patchwork -- strict thread matches above, loose matches on Subject: below -- 2016-06-23 14:35 [PATCH 1/3] " Chris Wilson 2016-06-23 14:35 ` [PATCH 3/3] drm/vgem: Attach sw fences to exported vGEM dma-buf (ioctl) Chris Wilson 2016-06-30 15:40 ` Zach Reizner
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.