| Message ID | 20180523091402.91851-1-thellstrom@vmware.com |
|---|---|
| State | Superseded |
| Headers | show |
| Series |
"glamor: Work around GEM usage"
( rev:
1
)
in
X.org (DEPRECATED - USE GITLAB) |
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c index 123e9f2..a75a9b9 100644 --- a/glamor/glamor_egl.c +++ b/glamor/glamor_egl.c @@ -99,8 +99,18 @@ glamor_get_flink_name(int fd, int handle, int *name) struct drm_gem_flink flink; flink.handle = handle; - if (ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink) < 0) - return FALSE; + if (ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink) < 0) { + + /* + * Assume non-GEM kernels have names identical to the handle + */ + if (errno == ENODEV) { + *name = handle; + return TRUE; + } else { + return FALSE; + } + } *name = flink.name; return TRUE; } diff --git a/test-driver b/test-driver index de1e61d..b8521a4 100755 --- a/test-driver +++ b/test-driver @@ -1,9 +1,9 @@ -#!/bin/sh +#! /bin/sh # test-driver - basic testsuite driver script. -scriptversion=2016-01-11.22; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 2011-2017 Free Software Foundation, Inc. +# Copyright (C) 2011-2018 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ scriptversion=2016-01-11.22; # UTC # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -140,7 +140,7 @@ echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0"
On 05/23/2018 11:14 AM, Thomas Hellstrom wrote: > KMS drivers are not required to support GEM. In particular, vmwgfx > doesn't support flink and handles and names are identical. > Getting a bo name should really be part of a lower level API, if needed, > but in the mean time work around this by setting the name identical to > the handle if GEM isn't supported. > > This fixes modesetting driver dri2 on vmwgfx. > > Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> > --- > glamor/glamor_egl.c | 14 ++++++++++++-- > test-driver | 10 +++++----- > 2 files changed, 17 insertions(+), 7 deletions(-) > > diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c > index 123e9f2..a75a9b9 100644 > --- a/glamor/glamor_egl.c > +++ b/glamor/glamor_egl.c > @@ -99,8 +99,18 @@ glamor_get_flink_name(int fd, int handle, int *name) > struct drm_gem_flink flink; > > flink.handle = handle; > - if (ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink) < 0) > - return FALSE; > + if (ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink) < 0) { > + > + /* > + * Assume non-GEM kernels have names identical to the handle > + */ > + if (errno == ENODEV) { > + *name = handle; > + return TRUE; > + } else { > + return FALSE; > + } > + } > *name = flink.name; > return TRUE; > } > diff --git a/test-driver b/test-driver > index de1e61d..b8521a4 100755 > --- a/test-driver > +++ b/test-driver > @@ -1,9 +1,9 @@ > -#!/bin/sh > +#! /bin/sh > # test-driver - basic testsuite driver script. > > -scriptversion=2016-01-11.22; # UTC > +scriptversion=2018-03-07.03; # UTC > > -# Copyright (C) 2011-2017 Free Software Foundation, Inc. > +# Copyright (C) 2011-2018 Free Software Foundation, Inc. > # > # This program is free software; you can redistribute it and/or modify > # it under the terms of the GNU General Public License as published by > @@ -16,7 +16,7 @@ scriptversion=2016-01-11.22; # UTC > # GNU General Public License for more details. > # > # You should have received a copy of the GNU General Public License > -# along with this program. If not, see <http://www.gnu.org/licenses/>. > +# along with this program. If not, see <https://www.gnu.org/licenses/>. > > # As a special exception to the GNU General Public License, if you > # distribute this file as part of a program that contains a > @@ -140,7 +140,7 @@ echo ":copy-in-global-log: $gcopy" >> $trs_file > # Local Variables: > # mode: shell-script > # sh-indentation: 2 > -# eval: (add-hook 'write-file-hooks 'time-stamp) > +# eval: (add-hook 'before-save-hook 'time-stamp) > # time-stamp-start: "scriptversion=" > # time-stamp-format: "%:y-%02m-%02d.%02H" > # time-stamp-time-zone: "UTC0" Hmm. I wonder how the test-driver hunk got included. I'll resend the patch. /Thomas
On Wed, 2018-05-23 at 11:14 +0200, Thomas Hellstrom wrote: > KMS drivers are not required to support GEM. In particular, vmwgfx > doesn't support flink and handles and names are identical. > Getting a bo name should really be part of a lower level API, if needed, > but in the mean time work around this by setting the name identical to > the handle if GEM isn't supported. I'd thought flink was old and busted anyway. Could this path just go away? - ajax
On 05/23/2018 08:00 PM, Adam Jackson wrote: > On Wed, 2018-05-23 at 11:14 +0200, Thomas Hellstrom wrote: >> KMS drivers are not required to support GEM. In particular, vmwgfx >> doesn't support flink and handles and names are identical. >> Getting a bo name should really be part of a lower level API, if needed, >> but in the mean time work around this by setting the name identical to >> the handle if GEM isn't supported. > I'd thought flink was old and busted anyway. Could this path just go > away? > > - ajax I guess it's needed for dri2? If all drivers using glamor are OK with dropping dri2, then that should be OK. /Thomas
> From: Thomas Hellstrom <thellstrom@vmware.com> > Date: Wed, 23 May 2018 22:58:05 +0200 > > On 05/23/2018 08:00 PM, Adam Jackson wrote: > > On Wed, 2018-05-23 at 11:14 +0200, Thomas Hellstrom wrote: > >> KMS drivers are not required to support GEM. In particular, vmwgfx > >> doesn't support flink and handles and names are identical. > >> Getting a bo name should really be part of a lower level API, if needed, > >> but in the mean time work around this by setting the name identical to > >> the handle if GEM isn't supported. > > I'd thought flink was old and busted anyway. Could this path just go > > away? > > > > - ajax > > I guess it's needed for dri2? If all drivers using glamor are OK with > dropping dri2, then that should be OK. OpenBSD doesn't implement dri3 (yet) and relies on the modesetting driver on the newest generations of Intel hardware. And I believe for AMD hardware we rely on glamor as well. The kernel drivers for those do support GEM though.
On 2018-05-23 10:58 PM, Thomas Hellstrom wrote: > On 05/23/2018 08:00 PM, Adam Jackson wrote: >> On Wed, 2018-05-23 at 11:14 +0200, Thomas Hellstrom wrote: >>> KMS drivers are not required to support GEM. In particular, vmwgfx >>> doesn't support flink and handles and names are identical. >>> Getting a bo name should really be part of a lower level API, if needed, >>> but in the mean time work around this by setting the name identical to >>> the handle if GEM isn't supported. >> I'd thought flink was old and busted anyway. Could this path just go >> away? > > I guess it's needed for dri2? If all drivers using glamor are OK with > dropping dri2, then that should be OK. FWIW, our drivers don't use glamor_name_from_pixmap, so they can support DRI2 regardless.
On 23 May 2018 at 22:23, Mark Kettenis <mark.kettenis@xs4all.nl> wrote: >> From: Thomas Hellstrom <thellstrom@vmware.com> >> Date: Wed, 23 May 2018 22:58:05 +0200 >> >> On 05/23/2018 08:00 PM, Adam Jackson wrote: >> > On Wed, 2018-05-23 at 11:14 +0200, Thomas Hellstrom wrote: >> >> KMS drivers are not required to support GEM. In particular, vmwgfx >> >> doesn't support flink and handles and names are identical. >> >> Getting a bo name should really be part of a lower level API, if needed, >> >> but in the mean time work around this by setting the name identical to >> >> the handle if GEM isn't supported. >> > I'd thought flink was old and busted anyway. Could this path just go >> > away? >> > >> > - ajax >> >> I guess it's needed for dri2? If all drivers using glamor are OK with >> dropping dri2, then that should be OK. > > OpenBSD doesn't implement dri3 (yet) AFAICT other BSDs like FreeBSD, DragonFly and NetBSD are in the same boat. That said I think we should incentivise them to implement it sooner than later. -Emil
On 05/24/2018 11:03 AM, Emil Velikov wrote: > On 23 May 2018 at 22:23, Mark Kettenis <mark.kettenis@xs4all.nl> wrote: >>> From: Thomas Hellstrom <thellstrom@vmware.com> >>> Date: Wed, 23 May 2018 22:58:05 +0200 >>> >>> On 05/23/2018 08:00 PM, Adam Jackson wrote: >>>> On Wed, 2018-05-23 at 11:14 +0200, Thomas Hellstrom wrote: >>>>> KMS drivers are not required to support GEM. In particular, vmwgfx >>>>> doesn't support flink and handles and names are identical. >>>>> Getting a bo name should really be part of a lower level API, if needed, >>>>> but in the mean time work around this by setting the name identical to >>>>> the handle if GEM isn't supported. >>>> I'd thought flink was old and busted anyway. Could this path just go >>>> away? >>>> >>>> - ajax >>> I guess it's needed for dri2? If all drivers using glamor are OK with >>> dropping dri2, then that should be OK. >> OpenBSD doesn't implement dri3 (yet) > AFAICT other BSDs like FreeBSD, DragonFly and NetBSD are in the same boat. > > That said I think we should incentivise them to implement it sooner > than later. > > -Emil Then I think we need to live with the "Work around GEM usage" patch until that happens. /Thomas
KMS drivers are not required to support GEM. In particular, vmwgfx doesn't support flink and handles and names are identical. Getting a bo name should really be part of a lower level API, if needed, but in the mean time work around this by setting the name identical to the handle if GEM isn't supported. This fixes modesetting driver dri2 on vmwgfx. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> --- glamor/glamor_egl.c | 14 ++++++++++++-- test-driver | 10 +++++----- 2 files changed, 17 insertions(+), 7 deletions(-)