[PATCH xf86-input-evdev] evdev: Add support for server managed fds
Signed-off-by: Hans de Goede hdego...@redhat.com --- src/evdev.c | 49 - 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index d1ed9ee..ed84f0f 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -97,6 +97,10 @@ #define ABS_MT_TRACKING_ID 0x39 #endif +#ifndef XI86_SERVER_FD +#define XI86_SERVER_FD 0x20 +#endif + static const char *evdevDefaults[] = { XkbRules, evdev, XkbModel, pc104, /* the right model for 'us' */ @@ -2478,32 +2482,32 @@ EvdevOpenDevice(InputInfoPtr pInfo) xf86IDrvMsg(pInfo, X_CONFIG, Device: \%s\\n, device); } -if (pInfo-fd 0) +if (!(pInfo-flags XI86_SERVER_FD) pInfo-fd 0) { do { pInfo-fd = open(device, O_RDWR | O_NONBLOCK, 0); } while (pInfo-fd 0 errno == EINTR); +} -if (pInfo-fd 0) { -xf86IDrvMsg(pInfo, X_ERROR, Unable to open evdev device \%s\.\n, device); -return BadValue; -} +if (pInfo-fd 0) { +xf86IDrvMsg(pInfo, X_ERROR, Unable to open evdev device \%s\.\n, device); +return BadValue; +} -if (libevdev_get_fd(pEvdev-dev) != -1) { -struct input_event ev; +if (libevdev_get_fd(pEvdev-dev) != -1) { +struct input_event ev; -libevdev_change_fd(pEvdev-dev, pInfo-fd); -/* re-sync libevdev's view of the device, but - we don't care about the actual events here */ -libevdev_next_event(pEvdev-dev, LIBEVDEV_READ_FLAG_FORCE_SYNC, ev); -while (libevdev_next_event(pEvdev-dev, LIBEVDEV_READ_FLAG_SYNC, ev) == LIBEVDEV_READ_STATUS_SYNC) -; -} else { -int rc = libevdev_set_fd(pEvdev-dev, pInfo-fd); -if (rc 0) { -xf86IDrvMsg(pInfo, X_ERROR, Unable to query fd: %s\n, strerror(-rc)); -return BadValue; -} +libevdev_change_fd(pEvdev-dev, pInfo-fd); +/* re-sync libevdev's view of the device, but + we don't care about the actual events here */ +libevdev_next_event(pEvdev-dev, LIBEVDEV_READ_FLAG_FORCE_SYNC, ev); +while (libevdev_next_event(pEvdev-dev, LIBEVDEV_READ_FLAG_SYNC, ev) == LIBEVDEV_READ_STATUS_SYNC) +; +} else { +int rc = libevdev_set_fd(pEvdev-dev, pInfo-fd); +if (rc 0) { +xf86IDrvMsg(pInfo, X_ERROR, Unable to query fd: %s\n, strerror(-rc)); +return BadValue; } } @@ -2531,7 +2535,7 @@ static void EvdevCloseDevice(InputInfoPtr pInfo) { EvdevPtr pEvdev = pInfo-private; -if (pInfo-fd = 0) +if (!(pInfo-flags XI86_SERVER_FD) pInfo-fd = 0) { close(pInfo-fd); pInfo-fd = -1; @@ -2679,7 +2683,10 @@ _X_EXPORT InputDriverRec EVDEV = { EvdevPreInit, EvdevUnInit, NULL, -evdevDefaults +evdevDefaults, +#ifdef XI86_DRV_CAP_SERVER_FD +XI86_DRV_CAP_SERVER_FD +#endif }; static void -- 1.8.4.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH xf86-input-synaptics] synaptics: Add support for server managed fds
Signed-off-by: Hans de Goede hdego...@redhat.com --- src/eventcomm.c | 10 -- src/synaptics.c | 30 +- src/synproto.h | 4 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/src/eventcomm.c b/src/eventcomm.c index a0a2af0..49a8a3f 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -942,7 +942,11 @@ EventAutoDevProbe(InputInfoPtr pInfo, const char *device) if (device) { int fd = -1; -SYSCALL(fd = open(device, O_RDONLY)); +if (pInfo-flags XI86_SERVER_FD) +fd = pInfo-fd; +else +SYSCALL(fd = open(device, O_RDONLY)); + if (fd = 0) { int rc; struct libevdev *evdev; @@ -953,7 +957,9 @@ EventAutoDevProbe(InputInfoPtr pInfo, const char *device) libevdev_free(evdev); } -SYSCALL(close(fd)); +if (!(pInfo-flags XI86_SERVER_FD)) +SYSCALL(close(fd)); + /* if a device is set and not a touchpad (or already grabbed), * we must return FALSE. Otherwise, we'll add a device that * wasn't requested for and repeat diff --git a/src/synaptics.c b/src/synaptics.c index f778d39..6df50e6 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -184,6 +184,10 @@ InputDriverRec SYNAPTICS = { SynapticsPreInit, SynapticsUnInit, NULL, +NULL, +#ifdef XI86_DRV_CAP_SERVER_FD +XI86_DRV_CAP_SERVER_FD +#endif }; static XF86ModuleVersionInfo VersionRec = { @@ -898,14 +902,16 @@ SynapticsPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) XisbFree(priv-comm.buffer); priv-comm.buffer = NULL; } -xf86CloseSerial(pInfo-fd); +if (!(pInfo-flags XI86_SERVER_FD)) { +xf86CloseSerial(pInfo-fd); +pInfo-fd = -1; +} } -pInfo-fd = -1; return Success; SetupProc_fail: -if (pInfo-fd = 0) { +if (pInfo-fd = 0 !(pInfo-flags XI86_SERVER_FD)) { xf86CloseSerial(pInfo-fd); pInfo-fd = -1; } @@ -996,8 +1002,10 @@ DeviceOn(DeviceIntPtr dev) priv-comm.buffer = XisbNew(pInfo-fd, INPUT_BUFFER_SIZE); if (!priv-comm.buffer) { -xf86CloseSerial(pInfo-fd); -pInfo-fd = -1; +if (!(pInfo-flags XI86_SERVER_FD)) { +xf86CloseSerial(pInfo-fd); +pInfo-fd = -1; +} return !Success; } @@ -1007,8 +1015,10 @@ DeviceOn(DeviceIntPtr dev) if (!QueryHardware(pInfo)) { XisbFree(priv-comm.buffer); priv-comm.buffer = NULL; -xf86CloseSerial(pInfo-fd); -pInfo-fd = -1; +if (!(pInfo-flags XI86_SERVER_FD)) { +xf86CloseSerial(pInfo-fd); +pInfo-fd = -1; +} return !Success; } @@ -1074,8 +1084,10 @@ DeviceOff(DeviceIntPtr dev) XisbFree(priv-comm.buffer); priv-comm.buffer = NULL; } -xf86CloseSerial(pInfo-fd); -pInfo-fd = -1; +if (!(pInfo-flags XI86_SERVER_FD)) { +xf86CloseSerial(pInfo-fd); +pInfo-fd = -1; +} } dev-public.on = FALSE; return rc; diff --git a/src/synproto.h b/src/synproto.h index f164393..d81ee42 100644 --- a/src/synproto.h +++ b/src/synproto.h @@ -36,6 +36,10 @@ #include xf86Xinput.h #include xisb.h +#ifndef XI86_SERVER_FD +#define XI86_SERVER_FD 0x20 +#endif + struct _SynapticsPrivateRec; typedef struct _SynapticsPrivateRec SynapticsPrivate; -- 1.8.4.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH] xserver: fix build since system-logind.h
on tinderbox and irc Signed-off-by: Dave Airlie airl...@redhat.com --- include/systemd-logind.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/systemd-logind.h b/include/systemd-logind.h index 8b09081..06dd031 100644 --- a/include/systemd-logind.h +++ b/include/systemd-logind.h @@ -36,8 +36,8 @@ void systemd_logind_vtenter(void); #else #define systemd_logind_init() #define systemd_logind_fini() -#define systemd_logind_take_fd(major, minor, path) -1 -#define systemd_logind_release_fd(dev) +#define systemd_logind_take_fd(major, minor, path, paus) -1 +#define systemd_logind_release_fd(major, minor) #define systemd_logind_controls_session() 0 #define systemd_logind_vtenter() #endif -- 1.8.5.3 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] xserver: fix build since system-logind.h
Hi, On 03/08/2014 11:39 AM, Dave Airlie wrote: on tinderbox and irc Signed-off-by: Dave Airlie airl...@redhat.com Oops, sorry about that. Reviewed-by: Hans de Goede hdego...@redhat.com Regards, Hans --- include/systemd-logind.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/systemd-logind.h b/include/systemd-logind.h index 8b09081..06dd031 100644 --- a/include/systemd-logind.h +++ b/include/systemd-logind.h @@ -36,8 +36,8 @@ void systemd_logind_vtenter(void); #else #define systemd_logind_init() #define systemd_logind_fini() -#define systemd_logind_take_fd(major, minor, path) -1 -#define systemd_logind_release_fd(dev) +#define systemd_logind_take_fd(major, minor, path, paus) -1 +#define systemd_logind_release_fd(major, minor) #define systemd_logind_controls_session() 0 #define systemd_logind_vtenter() #endif ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] xserver: fix build since system-logind.h
On Sat, Mar 08, 2014 at 08:39:30PM +1000, Dave Airlie wrote: on tinderbox and irc Signed-off-by: Dave Airlie airl...@redhat.com Reviewed-by: Matthieu Herrb matth...@herrb.eu --- include/systemd-logind.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/systemd-logind.h b/include/systemd-logind.h index 8b09081..06dd031 100644 --- a/include/systemd-logind.h +++ b/include/systemd-logind.h @@ -36,8 +36,8 @@ void systemd_logind_vtenter(void); #else #define systemd_logind_init() #define systemd_logind_fini() -#define systemd_logind_take_fd(major, minor, path) -1 -#define systemd_logind_release_fd(dev) +#define systemd_logind_take_fd(major, minor, path, paus) -1 +#define systemd_logind_release_fd(major, minor) #define systemd_logind_controls_session() 0 #define systemd_logind_vtenter() #endif -- 1.8.5.3 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel -- Matthieu Herrb ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH libxtrans] configure: under glibc define _GNU_SOURCE rather then _BSD_SOURCE
Hi all, On 03/03/2014 03:14 PM, Daniel Stone wrote: Hi, On 3 March 2014 07:56, Hans de Goede hdego...@redhat.com wrote: The latest glibc considers _BSD_SOURCE deprecated, leading to the following warning being issued for pretty much every C-file in the xserver: In file included from /usr/include/stdint.h:25:0, from /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/stdint.h:9, from ../include/misc.h:81, from miexpose.c:82: /usr/include/features.h:145:3: warning: #warning _BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE [-Wcpp] # warning _BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE ^ This silences up these warnings by switching to _GNU_SOURCE, which also includes all the necessary functions from BSD. AC_USE_SYSTEM_EXTENSIONS is better than hardcoded _*_SOURCE. The latter is often reductive (e.g. can mean 'only expose me the functionality from this platform', rather than 'add extensions from this platform'), so the autoconf macro will do the right thing. So I've just been looking into using AC_USE_SYSTEM_EXTENSIONS but that seem pretty useless, it only adds the relevant defines to confdefs.h, not into cflags, and in libxtrans we want to add them to the .pc file, so we need them in a variable. I'm open to different suggestions, but I think my initial patch might be the best way to fix this. Regards, Hans ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH libxtrans] configure: under glibc define _GNU_SOURCE rather then _BSD_SOURCE
On 14-03-08 09:03 AM, Hans de Goede wrote: So I've just been looking into using AC_USE_SYSTEM_EXTENSIONS but that seem pretty useless, it only adds the relevant defines to confdefs.h, not into cflags, and in libxtrans we want to add them to the .pc file, so we need them in a variable. I'm open to different suggestions, but I think my initial patch might be the best way to fix this. Check the pattern in other modules such as libX11. The source code includes the content of the generated config.h (see config.h.in). #ifdef HAVE_CONFIG_H #include config.h #endif which contains definitions such as: /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # define _POSIX_PTHREAD_SEMANTICS 1 #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # define _TANDEM_SOURCE 1 #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # define __EXTENSIONS__ 1 #endif and so on... When a module is configured (running ./configure), the appropriate values are filled-in based on what the platform is. If hard coded in the C code, all this work has to be done all over again. In addition, this mechanism was put in place because the gcc command might be lengthy on some platforms. Check it out, it should solve the problem. ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH libxtrans] configure: under glibc define _GNU_SOURCE rather then _BSD_SOURCE
Date: Sat, 08 Mar 2014 17:11:42 +0100 From: Hans de Goede hdego...@redhat.com Hi, On 03/08/2014 05:07 PM, Gaetan Nadon wrote: On 14-03-08 09:03 AM, Hans de Goede wrote: So I've just been looking into using AC_USE_SYSTEM_EXTENSIONS but that seem pretty useless, it only adds the relevant defines to confdefs.h, not into cflags, and in libxtrans we want to add them to the .pc file, so we need them in a variable. I'm open to different suggestions, but I think my initial patch might be the best way to fix this. Check the pattern in other modules such as libX11. The source code includes the content of the generated config.h (see config.h.in). That won't work for libxtrans, as that provides .c files to be included by other projects (a shared copylib if you want). So there is no config.h, since that would conflict with the config.h from the code including the xtrans .c files. Hence traditionally xtrans.pc had a -D_BSD_SOURCE in its CFLAGS, but that is causing a ton of warnings when building with the latest glibc. Perhaps you should push this back to te glibc developers, pointing out that their change makes it hard to write portable software, pointing out that _BSD_SOURCE is a widely used as a way to make available certain BSD extensions. If they really want to deprecate this functionality, perhaps they can be convinced not to emit the warning if both _GNU_SOURCE and _BSD_SOURCE are defined. Then you could have the .pc file simply contain -D_GNU_SOURCE -D_BSD_SOURCE. ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] xserver: fix build since system-logind.h
On 03/ 8/14 02:39 AM, Dave Airlie wrote: on tinderbox and irc Signed-off-by: Dave Airlie airl...@redhat.com Matches the changes I'd made to my tree last night to make the build work on Solaris, but hadn't gotten committed yet. Reviewed-by: Alan Coopersmith alan.coopersm...@oracle.com -- -Alan Coopersmith- alan.coopersm...@oracle.com Oracle Solaris Engineering - http://blogs.oracle.com/alanc ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH libxtrans] configure: under glibc define _GNU_SOURCE rather then _BSD_SOURCE
Hi, On 03/08/2014 05:31 PM, Mark Kettenis wrote: Date: Sat, 08 Mar 2014 17:11:42 +0100 From: Hans de Goede hdego...@redhat.com Hi, On 03/08/2014 05:07 PM, Gaetan Nadon wrote: On 14-03-08 09:03 AM, Hans de Goede wrote: So I've just been looking into using AC_USE_SYSTEM_EXTENSIONS but that seem pretty useless, it only adds the relevant defines to confdefs.h, not into cflags, and in libxtrans we want to add them to the .pc file, so we need them in a variable. I'm open to different suggestions, but I think my initial patch might be the best way to fix this. Check the pattern in other modules such as libX11. The source code includes the content of the generated config.h (see config.h.in). That won't work for libxtrans, as that provides .c files to be included by other projects (a shared copylib if you want). So there is no config.h, since that would conflict with the config.h from the code including the xtrans .c files. Hence traditionally xtrans.pc had a -D_BSD_SOURCE in its CFLAGS, but that is causing a ton of warnings when building with the latest glibc. Perhaps you should push this back to te glibc developers, pointing out that their change makes it hard to write portable software, pointing out that _BSD_SOURCE is a widely used as a way to make available certain BSD extensions. If they really want to deprecate this functionality, perhaps they can be convinced not to emit the warning if both _GNU_SOURCE and _BSD_SOURCE are defined. Then you could have the .pc file simply contain -D_GNU_SOURCE -D_BSD_SOURCE. Hmm, certainly worth asking, so I've filed a bug for this: https://bugzilla.redhat.com/show_bug.cgi?id=1074180 Regards, Hans ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 1/2] glamor_*gl_has_extension: Move strlen after check for NULL string
Flagged by cppcheck 1.64: [glamor/glamor_core.c:536] - [glamor/glamor_core.c:540]: (warning) Possible null pointer dereference: extension - otherwise it is redundant to check it against null. [glamor/glamor_egl.c:620] - [glamor/glamor_egl.c:622]: (warning) Possible null pointer dereference: extension - otherwise it is redundant to check it against null. Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- glamor/glamor_core.c |4 ++-- glamor/glamor_egl.c |2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/glamor/glamor_core.c b/glamor/glamor_core.c index 5883809..e01ca84 100644 --- a/glamor/glamor_core.c +++ b/glamor/glamor_core.c @@ -533,13 +533,13 @@ glamor_gl_has_extension(const char *extension) const char *pext; int ext_len; -ext_len = strlen(extension); - pext = (const char *) glGetString(GL_EXTENSIONS); if (pext == NULL || extension == NULL) return FALSE; +ext_len = strlen(extension); + while ((pext = strstr(pext, extension)) != NULL) { if (pext[ext_len] == ' ' || pext[ext_len] == '\0') return TRUE; diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c index 05e6bd0..60f8dae 100644 --- a/glamor/glamor_egl.c +++ b/glamor/glamor_egl.c @@ -617,10 +617,10 @@ glamor_egl_has_extension(struct glamor_egl_screen_private *glamor_egl, const char *pext; int ext_len; -ext_len = strlen(extension); pext = (const char *) eglQueryString(glamor_egl-display, EGL_EXTENSIONS); if (pext == NULL || extension == NULL) return FALSE; +ext_len = strlen(extension); while ((pext = strstr(pext, extension)) != NULL) { if (pext[ext_len] == ' ' || pext[ext_len] == '\0') return TRUE; -- 1.7.9.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 2/2] Remove duplicate assignment of repeat_type_uniform_location
Flagged by cppcheck 1.64: [glamor/glamor_gradient.c:987] - [glamor/glamor_gradient.c:991]: (performance) Variable 'repeat_type_uniform_location' is reassigned a value before the old one has been used. Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- glamor/glamor_gradient.c |2 -- 1 file changed, 2 deletions(-) diff --git a/glamor/glamor_gradient.c b/glamor/glamor_gradient.c index 9f6f1b1..114dea6 100644 --- a/glamor/glamor_gradient.c +++ b/glamor/glamor_gradient.c @@ -988,8 +988,6 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen, repeat_type); n_stop_uniform_location = glGetUniformLocation(gradient_prog, n_stop); A_value_uniform_location = glGetUniformLocation(gradient_prog, A_value); -repeat_type_uniform_location =glGetUniformLocation(gradient_prog, - repeat_type); c1_uniform_location = glGetUniformLocation(gradient_prog, c1); r1_uniform_location = glGetUniformLocation(gradient_prog, r1); c2_uniform_location = glGetUniformLocation(gradient_prog, c2); -- 1.7.9.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH 2/2] Remove duplicate assignment of repeat_type_uniform_location
cppcheck also flagged another instance in glamor for which I wasn't sure which value was right: [glamor/glamor_xv.c:301] - [glamor/glamor_xv.c:316]: (performance) Variable 'gamma' is reassigned a value before the old one has been used. In glamor_display_textured_video() in this function, the code is (with lines in question marked with =): cont = RTFContrast(port_priv-contrast); bright = RTFBrightness(port_priv-brightness); = gamma = (float) port_priv-gamma / 1000.0; uvcosf = RTFSaturation(port_priv-saturation) * cos(RTFHue(port_priv-hue)); uvsinf = RTFSaturation(port_priv-saturation) * sin(RTFHue(port_priv-hue)); /* overlay video also does pre-gamma contrast/sat adjust, should we? */ yco = trans[ref].RefLuma * cont; uco[0] = -trans[ref].RefRCr * uvsinf; uco[1] = trans[ref].RefGCb * uvcosf - trans[ref].RefGCr * uvsinf; uco[2] = trans[ref].RefBCb * uvcosf; vco[0] = trans[ref].RefRCr * uvcosf; vco[1] = trans[ref].RefGCb * uvsinf + trans[ref].RefGCr * uvcosf; vco[2] = trans[ref].RefBCb * uvsinf; off[0] = Loff * yco + Coff * (uco[0] + vco[0]) + bright; off[1] = Loff * yco + Coff * (uco[1] + vco[1]) + bright; off[2] = Loff * yco + Coff * (uco[2] + vco[2]) + bright; = gamma = 1.0; So is the calculated value or the hardcoded 1.0 the right one? -- -Alan Coopersmith- alan.coopersm...@oracle.com Oracle Solaris Engineering - http://blogs.oracle.com/alanc ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH:xkbcomp 4/4] Initialize nMatch even if WIN32 is defined
Flagged by cppcheck 1.64: Checking app/xkbcomp/listing.c: WIN32... [app/xkbcomp/listing.c:335]: (error) Uninitialized variable: nMatch Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- listing.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/listing.c b/listing.c index c7f5ef8..945f7f6 100644 --- a/listing.c +++ b/listing.c @@ -292,8 +292,8 @@ AddDirectory(char *head, char *ptrn, char *rest, char *map) #else if ((dirp = opendir((head ? head : .))) == NULL) return 0; -nMatch = 0; #endif +nMatch = 0; #ifdef WIN32 do #else -- 1.7.9.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH:xkbcomp 3/4] Remove useless assignment to 'outline' variable
Flagged by cppcheck 1.64: [app/xkbcomp/geometry.c:2426] - [app/xkbcomp/geometry.c:2427]: (performance) Variable 'outline' is reassigned a value before the old one has been used. Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- geometry.c |1 - 1 file changed, 1 deletion(-) diff --git a/geometry.c b/geometry.c index 2daa213..5d65316 100644 --- a/geometry.c +++ b/geometry.c @@ -2423,7 +2423,6 @@ HandleShapeBody(ShapeDef * def, ShapeInfo * si, unsigned merge, ol-points, info); continue; } -outline = NULL; outline = si-outlines[nOut++]; outline-num_points = ol-nPoints; outline-corner_radius = si-dfltCornerRadius; -- 1.7.9.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH:xkbcomp 1/4] Remove useless checks for NULL before free in OverlayKeyCreate()
There is no need to ensure the pointers passed to free are not NULL, especially right after passing them to strncpy without checking for NULL. Flagged by cppcheck 1.64: [app/xkbcomp/parseutils.c:557] - [app/xkbcomp/parseutils.c:559]: (warning) Possible null pointer dereference: over - otherwise it is redundant to check it against null. [app/xkbcomp/parseutils.c:558] - [app/xkbcomp/parseutils.c:561]: (warning) Possible null pointer dereference: under - otherwise it is redundant to check it against null. Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- parseutils.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/parseutils.c b/parseutils.c index a1b6e9e..c08353d 100644 --- a/parseutils.c +++ b/parseutils.c @@ -556,10 +556,8 @@ OverlayKeyCreate(char *under, char *over) key-common.stmtType = StmtOverlayKeyDef; strncpy(key-over, over, XkbKeyNameLength); strncpy(key-under, under, XkbKeyNameLength); -if (over) -uFree(over); -if (under) -uFree(under); +uFree(over); +uFree(under); } return key; } -- 1.7.9.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH:xkbcomp 2/4] Don't dereference the pointer whose allocation failed
Flagged by cppcheck 1.64: [app/xkbcomp/keycodes.c:264] - [app/xkbcomp/keycodes.c:262]: (warning) Possible null pointer dereference: new - otherwise it is redundant to check it against null. [app/xkbcomp/keytypes.c:600] - [app/xkbcomp/keytypes.c:597]: (warning) Possible null pointer dereference: old - otherwise it is redundant to check it against null. Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- keycodes.c |2 +- keytypes.c |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/keycodes.c b/keycodes.c index 13579ec..22d9eae 100644 --- a/keycodes.c +++ b/keycodes.c @@ -261,7 +261,7 @@ AddIndicatorName(KeyNamesInfo * info, IndicatorNameInfo * new) new = NextIndicatorName(info); if (!new) { -WSGO1(Couldn't allocate name for indicator %d\n, new-ndx); +WSGO1(Couldn't allocate name for indicator %d\n, old-ndx); ACTION(Ignored\n); return False; } diff --git a/keytypes.c b/keytypes.c index 375ca3e..103d860 100644 --- a/keytypes.c +++ b/keytypes.c @@ -597,7 +597,7 @@ AddPreserve(XkbDescPtr xkb, if (!old) { WSGO1(Couldn't allocate preserve in %s\n, TypeTxt(type)); -ACTION1(Preserve[%s] lost\n, PreserveIndexTxt(type, xkb, old)); +ACTION1(Preserve[%s] lost\n, PreserveIndexTxt(type, xkb, new)); return False; } *old = *new; -- 1.7.9.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 8/9] glamor: Fix requested composite VBO size.
The argument to setup_composte_vbo is the number of verts. Signed-off-by: Eric Anholt e...@anholt.net --- glamor/glamor_render.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c index 7829977..63bddfd 100644 --- a/glamor/glamor_render.c +++ b/glamor/glamor_render.c @@ -1253,8 +1253,7 @@ glamor_composite_with_shader(CARD8 op, vert_stride += 4; } -nrect_max = (vert_stride * nrect) GLAMOR_COMPOSITE_VBO_VERT_CNT ? -(GLAMOR_COMPOSITE_VBO_VERT_CNT / vert_stride) : nrect; +nrect_max = MIN(nrect, GLAMOR_COMPOSITE_VBO_VERT_CNT / 4); while (nrect) { int mrect, rect_processed; @@ -1262,7 +1261,7 @@ glamor_composite_with_shader(CARD8 op, float *vertices; mrect = nrect nrect_max ? nrect_max : nrect; -vertices = glamor_setup_composite_vbo(screen, mrect * vert_stride); +vertices = glamor_setup_composite_vbo(screen, mrect * 4); rect_processed = mrect; vb_stride = glamor_priv-vb_stride / sizeof(float); while (mrect--) { -- 1.9.0 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 5/9] glamor: Track the next vertex offset as we go for non-AA traps.
Signed-off-by: Eric Anholt e...@anholt.net --- glamor/glamor_trapezoid.c | 25 ++--- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/glamor/glamor_trapezoid.c b/glamor/glamor_trapezoid.c index 7bbee4b..a774c37 100644 --- a/glamor/glamor_trapezoid.c +++ b/glamor/glamor_trapezoid.c @@ -191,14 +191,16 @@ point_inside_trapezoid(int point[2], xTrapezoid *trap, xFixed cut_y) static void glamor_emit_composite_vert(ScreenPtr screen, + float *vb, const float *src_coords, const float *mask_coords, const float *dst_coords, int i) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); -float *vb = (float *) (glamor_priv-vb + glamor_priv-vbo_offset); int j = 0; +vb += i * glamor_priv-vb_stride / 4; + vb[j++] = dst_coords[i * 2 + 0]; vb[j++] = dst_coords[i * 2 + 1]; if (glamor_priv-has_source_coords) { @@ -216,13 +218,17 @@ glamor_emit_composite_vert(ScreenPtr screen, static void glamor_emit_composite_triangle(ScreenPtr screen, + float *vb, const float *src_coords, const float *mask_coords, const float *dst_coords) { -glamor_emit_composite_vert(screen, src_coords, mask_coords, dst_coords, 0); -glamor_emit_composite_vert(screen, src_coords, mask_coords, dst_coords, 1); -glamor_emit_composite_vert(screen, src_coords, mask_coords, dst_coords, 2); +glamor_emit_composite_vert(screen, vb, + src_coords, mask_coords, dst_coords, 0); +glamor_emit_composite_vert(screen, vb, + src_coords, mask_coords, dst_coords, 1); +glamor_emit_composite_vert(screen, vb, + src_coords, mask_coords, dst_coords, 2); } static void @@ -887,6 +893,8 @@ _glamor_trapezoids_with_shader(CARD8 op, nclip_rect = nbox; while (nclip_rect) { +float *vb; + mclip_rect = (nclip_rect * ntrap * 4) ntriangle_per_loop ? (ntriangle_per_loop / (4 * ntrap)) : nclip_rect; @@ -904,8 +912,9 @@ _glamor_trapezoids_with_shader(CARD8 op, NTRAPS_LOOP_AGAIN: -glamor_setup_composite_vbo(screen, - mclip_rect * traps_count * 4 * vert_stride); +vb = glamor_setup_composite_vbo(screen, +(mclip_rect * traps_count * + 4 * vert_stride)); clip_processed = mclip_rect; while (mclip_rect--) { @@ -963,8 +972,10 @@ _glamor_trapezoids_with_shader(CARD8 op, source_texcoords[4], source_texcoords[5]); } -glamor_emit_composite_triangle(screen, source_texcoords, +glamor_emit_composite_triangle(screen, vb, + source_texcoords, NULL, vertices); +vb += 3 * glamor_priv-vb_stride / 4; } } -- 1.9.0 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 9/9] glamor: Use buffer_storage
v2: - Make the default buffer size a #define. (by Markus Wick) - Fix the return offset for mapping with buffer_storage. (oops!) v3: - Avoid GL error at first rendering from unmapping no buffer. - Rebase on the glBindBuffer(GL_ARRAY_BUFFER, 0) change. v4: Rebase on Markus's vbo init changes. Signed-off-by: Eric Anholt e...@anholt.net --- glamor/glamor.c | 2 ++ glamor/glamor_priv.h | 1 + glamor/glamor_vbo.c | 51 +-- 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/glamor/glamor.c b/glamor/glamor.c index dc69c72..e856179 100644 --- a/glamor/glamor.c +++ b/glamor/glamor.c @@ -353,6 +353,8 @@ glamor_init(ScreenPtr screen, unsigned int flags) glamor_gl_has_extension(GL_MESA_pack_invert); glamor_priv-has_fbo_blit = glamor_gl_has_extension(GL_EXT_framebuffer_blit); +glamor_priv-has_buffer_storage = +glamor_gl_has_extension(GL_ARB_buffer_storage); glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, glamor_priv-max_fbo_size); #ifdef MAX_FBO_SIZE glamor_priv-max_fbo_size = MAX_FBO_SIZE; diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h index 986e729..d15eabd 100644 --- a/glamor/glamor_priv.h +++ b/glamor/glamor_priv.h @@ -208,6 +208,7 @@ typedef struct glamor_screen_private { enum glamor_gl_flavor gl_flavor; int has_pack_invert; int has_fbo_blit; +int has_buffer_storage; int max_fbo_size; struct xorg_list diff --git a/glamor/glamor_vbo.c b/glamor/glamor_vbo.c index be2c2af..f736cbe 100644 --- a/glamor/glamor_vbo.c +++ b/glamor/glamor_vbo.c @@ -52,7 +52,49 @@ glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset) glBindBuffer(GL_ARRAY_BUFFER, glamor_priv-vbo); -if (glamor_priv-gl_flavor == GLAMOR_GL_DESKTOP) { +if (glamor_priv-has_buffer_storage) { +if (glamor_priv-vbo_size glamor_priv-vbo_offset + size) { +if (glamor_priv-vbo_size) +glUnmapBuffer(GL_ARRAY_BUFFER); + +if (size glamor_priv-vbo_size) { +glamor_priv-vbo_size = MAX(GLAMOR_VBO_SIZE, size); + +/* We aren't allowed to resize glBufferStorage() + * buffers, so we need to gen a new one. + */ +glDeleteBuffers(1, glamor_priv-vbo); +glGenBuffers(1, glamor_priv-vbo); +glBindBuffer(GL_ARRAY_BUFFER, glamor_priv-vbo); + +assert(glGetError() == GL_NO_ERROR); +glBufferStorage(GL_ARRAY_BUFFER, glamor_priv-vbo_size, NULL, +GL_MAP_WRITE_BIT | +GL_MAP_PERSISTENT_BIT | +GL_MAP_COHERENT_BIT); + +if (glGetError() != GL_NO_ERROR) { +/* If the driver failed our coherent mapping, fall + * back to the ARB_mbr path. + */ +glamor_priv-has_buffer_storage = false; +glamor_priv-vbo_size = 0; +return glamor_get_vbo_space(screen, size, vbo_offset); +} +} + +glamor_priv-vbo_offset = 0; +glamor_priv-vb = glMapBufferRange(GL_ARRAY_BUFFER, + 0, glamor_priv-vbo_size, + GL_MAP_WRITE_BIT | + GL_MAP_INVALIDATE_BUFFER_BIT | + GL_MAP_PERSISTENT_BIT | + GL_MAP_COHERENT_BIT); +} +*vbo_offset = (void *)(uintptr_t)glamor_priv-vbo_offset; +data = glamor_priv-vb + glamor_priv-vbo_offset; +glamor_priv-vbo_offset += size; +} else if (glamor_priv-gl_flavor == GLAMOR_GL_DESKTOP) { if (glamor_priv-vbo_size glamor_priv-vbo_offset + size) { glamor_priv-vbo_size = MAX(GLAMOR_VBO_SIZE, size); glamor_priv-vbo_offset = 0; @@ -99,7 +141,12 @@ glamor_put_vbo_space(ScreenPtr screen) glamor_get_context(glamor_priv); -if (glamor_priv-gl_flavor == GLAMOR_GL_DESKTOP) { +if (glamor_priv-has_buffer_storage) { +/* If we're in the ARB_buffer_storage path, we have a + * persistent mapping, so we can leave it around until we + * reach the end of the buffer. + */ +} else if (glamor_priv-gl_flavor == GLAMOR_GL_DESKTOP) { glUnmapBuffer(GL_ARRAY_BUFFER); } else { glBufferData(GL_ARRAY_BUFFER, glamor_priv-vbo_offset, -- 1.9.0 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 1/9] glamor: Drop the set of the context to NULL at the end of glamor ops.
The theory here was that it (which I copied from EGL) existed to fix up context switching with indirect GLX. But indirect GLX won't even try to set the context again unless its lastContext field is cleared, so we need to solve this a different way. Signed-off-by: Eric Anholt e...@anholt.net --- glamor/glamor_glx.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/glamor/glamor_glx.c b/glamor/glamor_glx.c index 311bf75..8f47c3d 100644 --- a/glamor/glamor_glx.c +++ b/glamor/glamor_glx.c @@ -53,13 +53,7 @@ glamor_glx_get_context(struct glamor_context *glamor_ctx) static void glamor_glx_put_context(struct glamor_context *glamor_ctx) { -if (--glamor_ctx-get_count) -return; - -/* We actually reset the context, so that indirect GLX's EGL usage - * won't get confused by ours. - */ -glXMakeCurrent(glamor_ctx-display, None, NULL); +--glamor_ctx-get_count; } Bool -- 1.9.0 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 2/9] glamor: Don't forget to set GL_INVALIDATE_RANGE_BIT on GL_ARB_mbr.
We don't need any current contents of the buffer, and this allows an implementation to make a temporary BO for a streamed upload if it wants to. Signed-off-by: Eric Anholt e...@anholt.net --- glamor/glamor_render.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c index f8d103d..98343c3 100644 --- a/glamor/glamor_render.c +++ b/glamor/glamor_render.c @@ -731,7 +731,8 @@ glamor_setup_composite_vbo(ScreenPtr screen, int n_verts) glamor_priv-vbo_offset, vert_size, GL_MAP_WRITE_BIT | - GL_MAP_UNSYNCHRONIZED_BIT); + GL_MAP_UNSYNCHRONIZED_BIT | + GL_MAP_INVALIDATE_RANGE_BIT); assert(glamor_priv-vb != NULL); glamor_priv-vb -= glamor_priv-vbo_offset; } -- 1.9.0 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 6/9] glamor: Track the next vertex offset as we go for AA traps.
Signed-off-by: Eric Anholt e...@anholt.net --- glamor/glamor_trapezoid.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/glamor/glamor_trapezoid.c b/glamor/glamor_trapezoid.c index a774c37..4d2360d 100644 --- a/glamor/glamor_trapezoid.c +++ b/glamor/glamor_trapezoid.c @@ -607,7 +607,7 @@ _glamor_clip_trapezoid_vertex(xTrapezoid *trap, BoxPtr pbox, return TRUE; } -static void +static void * glamor_setup_composite_vbo_for_trapezoid(ScreenPtr screen, int n_verts) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); @@ -701,6 +701,8 @@ glamor_setup_composite_vbo_for_trapezoid(ScreenPtr screen, int n_verts) glEnableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM); glamor_put_context(glamor_priv); + +return glamor_priv-vb + glamor_priv-vbo_offset; } static Bool @@ -1420,7 +1422,6 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture, BoxRec one_trap_bound; int nrect_max; int i, j; -float *vertices; float params[4]; glamor_priv = glamor_get_screen_private(screen); @@ -1461,11 +1462,12 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture, nrect_max = GLAMOR_COMPOSITE_VBO_VERT_CNT / (4 * GLAMOR_VERTEX_RIGHT_PARAM); for (i = 0; i ntrap;) { +float *vertices; int mrect; int stride; mrect = (ntrap - i) nrect_max ? nrect_max : (ntrap - i); -glamor_setup_composite_vbo_for_trapezoid(screen, 4 * mrect); +vertices = glamor_setup_composite_vbo_for_trapezoid(screen, 4 * mrect); stride = glamor_priv-vb_stride / sizeof(float); for (j = 0; j mrect; j++) { @@ -1488,8 +1490,7 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture, miTrapezoidBounds(1, ptrap, one_trap_bound); -vertices = -(float *) (glamor_priv-vb + glamor_priv-vbo_offset) + 2; +vertices += 2; glamor_set_tcoords_ext((pixmap_priv-base.pixmap-drawable.width), (pixmap_priv-base.pixmap-drawable.height), (one_trap_bound.x1), (one_trap_bound.y1), @@ -1561,6 +1562,7 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture, } params[2] = right_slope; glamor_set_const_ext(params, 4, vertices, 4, stride); +vertices += 4; DEBUGF(trap_top = %f, trap_bottom = %f, trap_left_x = %f, trap_left_y = %f, left_slope = %f, @@ -1574,6 +1576,8 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture, glamor_priv-render_nr_verts += 4; glamor_priv-vbo_offset += glamor_priv-vb_stride * 4; + +vertices += 3 * stride; } i += mrect; -- 1.9.0 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
[PATCH 7/9] glamor: Extract the streamed vertex data code used by Render.
We should be uploading any vertex data using this kind of upload style, since it saves a bunch of extra copies of our vertex data. v2: - Add a simple comment about what the function does. - Use get_vbo_space()'s return in trapezoids, instead of dereffing glamor_priv-vb (by Markus Wick). - Fix the double-unmapping by moving put_vbo_space() outside of flush_composite_rects(). - Remove the rest of the composite_vbo_offset usage, and just always use get_vbo_space()'s return value. v3: - Fix failure to put_vbo_space in traps when no prims were generated. - Unbind the VBO from put_vbo_space(). Keeps callers from forgetting to do so. v4: - Split out some changes into the previous 3 commits while trying to track down a regression. - Fix regression due to rebase fail where glamor_priv-vbo_offset wasn't incremented. v5: - Fix GLES2 VBO sizing. - Add a comment about resize behavior. - Move glamor_vbo.c init code to glamor_vbo.c from glamor_render.c. (Derived from Markus's changes, but the GLES2 fix dropped almost all of the code in the functions). Signed-off-by: Eric Anholt e...@anholt.net --- glamor/Makefile.am| 1 + glamor/glamor.c | 2 + glamor/glamor.h | 1 + glamor/glamor_priv.h | 18 ++ glamor/glamor_render.c| 66 +++--- glamor/glamor_trapezoid.c | 72 +--- glamor/glamor_vbo.c | 138 ++ 7 files changed, 184 insertions(+), 114 deletions(-) create mode 100644 glamor/glamor_vbo.c diff --git a/glamor/Makefile.am b/glamor/Makefile.am index 77492bc..ffc8c23 100644 --- a/glamor/Makefile.am +++ b/glamor/Makefile.am @@ -34,6 +34,7 @@ libglamor_la_SOURCES = \ glamor_pixmap.c\ glamor_largepixmap.c\ glamor_picture.c\ + glamor_vbo.c \ glamor_window.c\ glamor_fbo.c\ glamor_compositerects.c\ diff --git a/glamor/glamor.c b/glamor/glamor.c index fe9f761..dc69c72 100644 --- a/glamor/glamor.c +++ b/glamor/glamor.c @@ -439,6 +439,7 @@ glamor_init(ScreenPtr screen, unsigned int flags) ps-DestroyPicture = glamor_destroy_picture; glamor_init_composite_shaders(screen); #endif +glamor_init_vbo(screen); glamor_init_pixmap_fbo(screen); glamor_init_solid_shader(screen); glamor_init_tile_shader(screen); @@ -478,6 +479,7 @@ glamor_release_screen_priv(ScreenPtr screen) #ifdef RENDER glamor_fini_composite_shaders(screen); #endif +glamor_fini_vbo(screen); glamor_fini_pixmap_fbo(screen); glamor_fini_solid_shader(screen); glamor_fini_tile_shader(screen); diff --git a/glamor/glamor.h b/glamor/glamor.h index e12f497..e25dc73 100644 --- a/glamor/glamor.h +++ b/glamor/glamor.h @@ -324,6 +324,7 @@ extern _X_EXPORT int glamor_create_gc(GCPtr gc); extern _X_EXPORT void glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable); + /* Glamor rendering/drawing functions with XXX_nf. * nf means no fallback within glamor internal if possible. If glamor * fail to accelerate the operation, glamor will return a false, and the diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h index b23c12b..986e729 100644 --- a/glamor/glamor_priv.h +++ b/glamor/glamor_priv.h @@ -220,8 +220,15 @@ typedef struct glamor_screen_private { /* vertext/elment_index buffer object for render */ GLuint vbo, ebo; +/** Next offset within the VBO that glamor_get_vbo_space() will use. */ int vbo_offset; int vbo_size; +/** + * Pointer to glamor_get_vbo_space()'s current VBO mapping. + * + * Note that this is not necessarily equal to the pointer returned + * by glamor_get_vbo_space(), so it can't be used in place of that. + */ char *vb; int vb_stride; Bool has_source_coords, has_mask_coords; @@ -744,6 +751,17 @@ void glamor_triangles(CARD8 op, void glamor_pixmap_init(ScreenPtr screen); void glamor_pixmap_fini(ScreenPtr screen); +/* glamor_vbo.c */ + +void glamor_init_vbo(ScreenPtr screen); +void glamor_fini_vbo(ScreenPtr screen); + +void * +glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset); + +void +glamor_put_vbo_space(ScreenPtr screen); + /** * Download a pixmap's texture to cpu memory. If success, * One copy of current pixmap's texture will be put into diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c index 69a22d9..7829977 100644 --- a/glamor/glamor_render.c +++ b/glamor/glamor_render.c @@ -403,12 +403,10 @@ glamor_init_composite_shaders(ScreenPtr screen) { glamor_screen_private *glamor_priv; unsigned short *eb; -float *vb = NULL; int eb_size; glamor_priv = glamor_get_screen_private(screen); glamor_get_context(glamor_priv); -glGenBuffers(1, glamor_priv-vbo); glGenBuffers(1, glamor_priv-ebo); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv-ebo); @@ -419,9
[PATCH:libXext] XeviGetVisualInfo: Free clear *evi_return, not evi_return pointer
evi_return is passed in as a pointer to a location into which XeviGetVisualInfo is expected to write a pointer to the memory it allocated for the returned structures. If we're failing and bailing out, we need to dispose of the pointer we set, not the one passed into us (which the caller may have put on the stack or allocated as part of a larger structure). Flagged by cppcheck 1.64: [lib/libXext/src/XEVI.c:182] - [lib/libXext/src/XEVI.c:186]: (warning) Possible null pointer dereference: evi_return - otherwise it is redundant to check it against null. Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- src/XEVI.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/XEVI.c b/src/XEVI.c index 6d77fdf..c9b172c 100644 --- a/src/XEVI.c +++ b/src/XEVI.c @@ -183,8 +183,10 @@ Status XeviGetVisualInfo( _XEatDataWords(dpy, rep.length); UnlockDisplay(dpy); SyncHandle(); - if (evi_return) - Xfree(evi_return); + if (*evi_return) { + Xfree(*evi_return); + *evi_return = NULL; + } if (temp_xInfo) Xfree(temp_xInfo); if (temp_conflict) -- 1.7.9.2 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel