Skip to contentSkip to conversation

drm/vgem: create a render node for vgem

PATCH In review Emil Velikov 4 participants 11 messages Oct 26, 2018 – Nov 6, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/vgem: create a render node for vgem

From: Emil Velikov <[email protected]>

VGEM doesn't do anything modeset specific, so in a way exposing a primary node is 'wrong'. At the same time, we extensively use if for creating dumb buffers, fences, prime fd <> handle imports/exports.

To the point that we explicitly annotate the vgem fence ioctls as DRM_RENDER_ALLOW and have an IGT test which opens the render node.

close(drm_open_driver_render(DRIVER_VGEM))

Better late than never, let's flip the switch.

Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/vgem/vgem_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/vgem/vgem_drv.c +2 -1
index f1f7ab9dcdbf..f1d1d9e2c82e 100644
@@ -431,7 +431,8 @@ static void vgem_release(struct drm_device *dev)
 }
 
 static struct drm_driver vgem_driver = {
-	.driver_features		= DRIVER_GEM | DRIVER_PRIME,
+	.driver_features		= DRIVER_GEM | DRIVER_PRIME |
+					  DRIVER_RENDER;
 	.release			= vgem_release,
 	.open				= vgem_open,
 	.postclose			= vgem_postclose,
Signature · 6 lines
2.19.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Emil Velikov

From: Emil Velikov <[email protected]>

VGEM doesn't do anything modeset specific, so in a way exposing a primary node is 'wrong'. At the same time, we extensively use if for creating dumb buffers, fences, prime fd <> handle imports/exports.

To the point that we explicitly annotate the vgem fence ioctls as DRM_RENDER_ALLOW and have an IGT test which opens the render node.

close(drm_open_driver_render(DRIVER_VGEM))

Huh, I guess that test doesn't pass?

Quoted 5 lines

Better late than never, let's flip the switch.

Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Quoted 21 lines
---
 drivers/gpu/drm/vgem/vgem_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/vgem/vgem_drv.c +2 -1
index f1f7ab9dcdbf..f1d1d9e2c82e 100644
@@ -431,7 +431,8 @@ static void vgem_release(struct drm_device *dev)
 }
 
 static struct drm_driver vgem_driver = {
-	.driver_features		= DRIVER_GEM | DRIVER_PRIME,
+	.driver_features		= DRIVER_GEM | DRIVER_PRIME |
+					  DRIVER_RENDER;
 	.release			= vgem_release,
 	.open				= vgem_open,
 	.postclose			= vgem_postclose,
Signature · 1 line
2.19.1
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

Quoting Daniel Vetter (2018-10-26 14:40:36)

Quoted 6 lines · Emil Velikov
Quoted 5 lines

From: Emil Velikov <[email protected]>

VGEM doesn't do anything modeset specific, so in a way exposing a primary node is 'wrong'. At the same time, we extensively use if for creating dumb buffers, fences, prime fd <> handle imports/exports.

What problem are you solving? Now if you suggest a way to only expose a render node and not a master node, that might be more interesting. -Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 10 lines · Chris Wilson

Quoting Daniel Vetter (2018-10-26 14:40:36)

Quoted 6 lines · Emil Velikov
Quoted 5 lines

From: Emil Velikov <[email protected]>

VGEM doesn't do anything modeset specific, so in a way exposing a primary node is 'wrong'. At the same time, we extensively use if for creating dumb buffers, fences, prime fd <> handle imports/exports.

What problem are you solving?

Expose a render node, since only the first instance using the card node gets auth.

Quoted 2 lines

Now if you suggest a way to only expose a
render node and not a master node, that might be more interesting.

A couple of years ago, I've proposed a way to have render-only drivers, yet it got shot down. Don't recall was it Daniel V, Dave or someone else.
If you fancy going that route, be my guest.

Keep in mind that is orthogonal to the goal here.

Thanks
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

Quoting Emil Velikov (2018-10-29 12:00:17)

Quoted 6 lines · Chris Wilson
Quoted 5 lines

Quoting Daniel Vetter (2018-10-26 14:40:36)

Quoted 3 lines · Emil Velikov
Quoted 2 lines

From: Emil Velikov <[email protected]>

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

VGEM doesn't do anything modeset specific, so in a way exposing a primary node is 'wrong'. At the same time, we extensively use if for creating dumb buffers, fences, prime fd <> handle imports/exports.

What problem are you solving?

Expose a render node, since only the first instance using the card node gets auth.

More accurately, the fence signal/attach do not need DRM_AUTH since they are operating on resources private to the fd.
-Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
In reply to Daniel Vetter
Quoted 8 lines · Daniel Vetter
Quoted 6 lines · Emil Velikov

From: Emil Velikov <[email protected]>

VGEM doesn't do anything modeset specific, so in a way exposing a primary node is 'wrong'. At the same time, we extensively use if for creating dumb buffers, fences, prime fd <> handle imports/exports.

Quoted 7 lines
Quoted 4 lines

To the point that we explicitly annotate the vgem fence ioctls as DRM_RENDER_ALLOW and have an IGT test which opens the render node.

close(drm_open_driver_render(DRIVER_VGEM))

Huh, I guess that test doesn't pass?

It does since the IGT code seems bonkers... Namely it silently falls back to the primary/card node.
It seems to be for historical reasons... back in the days where render nodes were still experimental and had to be explicitly enabled via kernel arg.

I'll try and follow-up to address that.

Quoted 7 lines
Quoted 5 lines

Better late than never, let's flip the switch.

Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>

Thanks. I'll give it a few more days for others to review/comment.

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw
Quoted 16 lines · Emil Velikov
Quoted 8 lines · Daniel Vetter
Quoted 6 lines · Emil Velikov

From: Emil Velikov <[email protected]>

VGEM doesn't do anything modeset specific, so in a way exposing a primary node is 'wrong'. At the same time, we extensively use if for creating dumb buffers, fences, prime fd <> handle imports/exports.

Quoted 7 lines
Quoted 4 lines

To the point that we explicitly annotate the vgem fence ioctls as DRM_RENDER_ALLOW and have an IGT test which opens the render node.

close(drm_open_driver_render(DRIVER_VGEM))

Huh, I guess that test doesn't pass?

Quoted 7 lines

It does since the IGT code seems bonkers... Namely it silently falls back to the primary/card node.
It seems to be for historical reasons... back in the days where render nodes were still experimental and had to be explicitly enabled via kernel arg.

I'll try and follow-up to address that.

I guess enforcing this with igt is a bit harder, since not much with render nodes is generic across drivers. Hence a lot of the tests are very specific.

But anything we can increase the odds for people using render nodes is good I guess, and if it's just using vgem as a driver copypaste template. -Daniel

Quoted 12 lines
Quoted 8 lines
Quoted 6 lines

Better late than never, let's flip the switch.

Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>

Thanks. I'll give it a few more days for others to review/comment.

-Emil

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw
In reply to Emil Velikov
Thank you for the patch! Yet something to improve:

Hi Emil,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on sof-driver-fuweitax/master]
[also build test ERROR on v4.19 next-20181019]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Emil-Velikov/drm-vgem-create-a-render-node-for-vgem/20181026-233734
base:   https://github.com/fuweitax/linux master
config: i386-randconfig-x077-201842 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/vgem/vgem_drv.c:436:21: error: expected '}' before ';' token
           DRIVER_RENDER;
                        ^
   drivers/gpu/drm/vgem/vgem_drv.c:424:13: warning: 'vgem_release' defined but not used [-Wunused-function]
    static void vgem_release(struct drm_device *dev)
                ^~~~~~~~~~~~
   drivers/gpu/drm/vgem/vgem_drv.c:401:12: warning: 'vgem_prime_mmap' defined but not used [-Wunused-function]
    static int vgem_prime_mmap(struct drm_gem_object *obj,
               ^~~~~~~~~~~~~~~
   drivers/gpu/drm/vgem/vgem_drv.c:393:13: warning: 'vgem_prime_vunmap' defined but not used [-Wunused-function]
    static void vgem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
                ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/vgem/vgem_drv.c:380:14: warning: 'vgem_prime_vmap' defined but not used [-Wunused-function]
    static void *vgem_prime_vmap(struct drm_gem_object *obj)
                 ^~~~~~~~~~~~~~~
   drivers/gpu/drm/vgem/vgem_drv.c:355:31: warning: 'vgem_prime_import_sg_table' defined but not used [-Wunused-function]
    static struct drm_gem_object *vgem_prime_import_sg_table(struct drm_device *dev,
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/vgem/vgem_drv.c:347:31: warning: 'vgem_prime_import' defined but not used [-Wunused-function]
    static struct drm_gem_object* vgem_prime_import(struct drm_device *dev,
                                  ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/vgem/vgem_drv.c:340:25: warning: 'vgem_prime_get_sg_table' defined but not used [-Wunused-function]
    static struct sg_table *vgem_prime_get_sg_table(struct drm_gem_object *obj)
                            ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/vgem/vgem_drv.c:333:13: warning: 'vgem_prime_unpin' defined but not used [-Wunused-function]
    static void vgem_prime_unpin(struct drm_gem_object *obj)
                ^~~~~~~~~~~~~~~~
   drivers/gpu/drm/vgem/vgem_drv.c:315:12: warning: 'vgem_prime_pin' defined but not used [-Wunused-function]
    static int vgem_prime_pin(struct drm_gem_object *obj)
               ^~~~~~~~~~~~~~
   drivers/gpu/drm/vgem/vgem_drv.c:253:30: warning: 'vgem_ioctls' defined but not used [-Wunused-variable]
    static struct drm_ioctl_desc vgem_ioctls[] = {
                                 ^~~~~~~~~~~

drivers/gpu/drm/vgem/vgem_drv.c:227:12: warning: 'vgem_gem_dumb_map' defined but not used [-Wunused-function]
static int vgem_gem_dumb_map(struct drm_file *file, struct drm_device *dev,
^~~~~~~~~~~~~~~~~
drivers/gpu/drm/vgem/vgem_drv.c:204:12: warning: 'vgem_gem_dumb_create' defined but not used [-Wunused-function]
static int vgem_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/vgem/vgem_drv.c:145:13: warning: 'vgem_postclose' defined but not used [-Wunused-function]
static void vgem_postclose(struct drm_device *dev, struct drm_file *file)
^~~~~~~~~~~~~~
drivers/gpu/drm/vgem/vgem_drv.c:125:12: warning: 'vgem_open' defined but not used [-Wunused-function]
static int vgem_open(struct drm_device *dev, struct drm_file *file)
^~~~~~~~~
drivers/gpu/drm/vgem/vgem_drv.c:50:13: warning: 'vgem_gem_free_object' defined but not used [-Wunused-function]
static void vgem_gem_free_object(struct drm_gem_object *obj)
^~~~~~~~~~~~~~~~~~~~

vim +436 drivers/gpu/drm/vgem/vgem_drv.c

433
434 static struct drm_driver vgem_driver = {
435 .driver_features = DRIVER_GEM | DRIVER_PRIME |

 > 436						  DRIVER_RENDER;

437 .release = vgem_release,
438 .open = vgem_open,
439 .postclose = vgem_postclose,
440 .gem_free_object_unlocked = vgem_gem_free_object,
441 .gem_vm_ops = &vgem_gem_vm_ops,
442 .ioctls = vgem_ioctls,
443 .num_ioctls = ARRAY_SIZE(vgem_ioctls),
444 .fops = &vgem_driver_fops,
445
446 .dumb_create = vgem_gem_dumb_create,
447 .dumb_map_offset = vgem_gem_dumb_map,
448
449 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
450 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
451 .gem_prime_pin = vgem_prime_pin,
452 .gem_prime_unpin = vgem_prime_unpin,
453 .gem_prime_import = vgem_prime_import,
454 .gem_prime_export = drm_gem_prime_export,
455 .gem_prime_import_sg_table = vgem_prime_import_sg_table,
456 .gem_prime_get_sg_table = vgem_prime_get_sg_table,
457 .gem_prime_vmap = vgem_prime_vmap,
458 .gem_prime_vunmap = vgem_prime_vunmap,
459 .gem_prime_mmap = vgem_prime_mmap,
460
461 .name = DRIVER_NAME,
462 .desc = DRIVER_DESC,
463 .date = DRIVER_DATE,
464 .major = DRIVER_MAJOR,
465 .minor = DRIVER_MINOR,
466 };
467

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw

Quoting kbuild test robot (2018-10-26 16:55:25)

Quoted 16 lines

Hi Emil,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on sof-driver-fuweitax/master]
[also build test ERROR on v4.19 next-20181019]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Emil-Velikov/drm-vgem-create-a-render-node-for-vgem/20181026-233734
base:   https://github.com/fuweitax/linux master
config: i386-randconfig-x077-201842 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 
Quoted 4 lines

All errors (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/vgem/vgem_drv.c:436:21: error: expected '}' before ';' token

           DRIVER_RENDER;

The build is broken, our CI is offline:

commit 3a6eb795641c0e140424a3e4f301188eb2fd6d63

Author:     Emil Velikov <[email protected]>
AuthorDate: Fri Oct 26 13:06:47 2018 +0100
Commit:     Emil Velikov <[email protected]>
CommitDate: Mon Nov 5 13:06:30 2018 +0000

drm/vgem: create a render node for vgem

-Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#9 lore raw
Quoted 18 lines · Chris Wilson

Quoting kbuild test robot (2018-10-26 16:55:25)

Quoted 16 lines

Hi Emil,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on sof-driver-fuweitax/master]
[also build test ERROR on v4.19 next-20181019]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Emil-Velikov/drm-vgem-create-a-render-node-for-vgem/20181026-233734
base:   https://github.com/fuweitax/linux master
config: i386-randconfig-x077-201842 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386
Quoted 7 lines
Quoted 4 lines

All errors (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/vgem/vgem_drv.c:436:21: error: expected '}' before ';' token

           DRIVER_RENDER;

The build is broken, our CI is offline:

It should be back up, props to Imre.

-Emil

/me looks for brown paper bag
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#10 lore raw
Quoted 24 lines · Emil Velikov
Quoted 23 lines · Chris Wilson

Quoting kbuild test robot (2018-10-26 16:55:25)

Quoted 20 lines

Hi Emil,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on sof-driver-fuweitax/master]
[also build test ERROR on v4.19 next-20181019]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Emil-Velikov/drm-vgem-create-a-render-node-for-vgem/20181026-233734
base:   https://github.com/fuweitax/linux master
config: i386-randconfig-x077-201842 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386

All errors (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/vgem/vgem_drv.c:436:21: error: expected '}' before ';' token

           DRIVER_RENDER;
Quoted 7 lines
Quoted 2 lines

The build is broken, our CI is offline:

It should be back up, props to Imre.

-Emil

/me looks for brown paper bag

When pushing to drm-misc you're supposed to build-test the 3 defconfigs in drm-rerere.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel