[PATCH] backtrace.c: Fix word cast to a pointer
backtrace.c uses a word size provided by libunwind. In some architectures like MIPS, libunwind makes that word size 64-bit for all variants of the architecture. In the lines #90 and #98, backtrace.c tries to do a cast to a pointer, which fails in all MIPS variants with 32-bit pointers, like MIPS32 or MIPS64 n32, because it's trying to do a cast from a 64-bit wide variable to a 32-bit pointer: Making all in os make[2]: Entering directory `/home/test/test/1/output/build/xserver_xorg-server-1.15.1/os' CC WaitFor.lo CC access.lo CC auth.lo CC backtrace.lo backtrace.c: In function 'xorg_backtrace': backtrace.c:90:20: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] if (dladdr((void *)(pip.start_ip + off), dlinfo) dlinfo.dli_fname ^ backtrace.c:98:13: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] (void *)(pip.start_ip + off)); ^ cc1: some warnings being treated as errors make[2]: *** [backtrace.lo] Error 1 make[2]: *** Waiting for unfinished jobs Making the cast to a pointer-sized integer, and then to a pointer fixes the problem. Related: https://bugs.freedesktop.org/show_bug.cgi?id=79939 Signed-off-by: Vicente Olivert Riera vincent.ri...@imgtec.com --- os/backtrace.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/os/backtrace.c b/os/backtrace.c index 3d1195b..3c101ae 100644 --- a/os/backtrace.c +++ b/os/backtrace.c @@ -87,7 +87,7 @@ xorg_backtrace(void) procname[1] = 0; } -if (dladdr((void *)(pip.start_ip + off), dlinfo) dlinfo.dli_fname +if (dladdr((void *)(long)(pip.start_ip + off), dlinfo) dlinfo.dli_fname *dlinfo.dli_fname) filename = dlinfo.dli_fname; else @@ -95,7 +95,7 @@ xorg_backtrace(void) ErrorFSigSafe(%u: %s (%s%s+0x%x) [%p]\n, i++, filename, procname, ret == -UNW_ENOMEM ? ... : , (int)off, -(void *)(pip.start_ip + off)); +(void *)(long)(pip.start_ip + off)); ret = unw_step(cursor); if (ret 0) -- 1.7.1 ___ 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 v2:libXxf86vm] Discard correct length for old-format replies in XF86VidModeGetGamma
On Tue, Jan 06, 2015 at 12:03:37AM -0800, Alan Coopersmith wrote: Regression introduced in libXxf86vm 1.1.3 / commit 284a88e21fc05a63466 Unlikely to be hit in practice since it requires out-of-range privsize or malloc failure while talking to a server using the XFree86 3.x version of the protocol. Found by Oracle Parfait 1.5.1: Error: Uninitialised memory (CWE 456) Possible access to uninitialised memory 'rep.length' at line 279 of open-src/lib/libXxf86vm/unpacked-src/src/XF86VMode.c in function 'XF86VidModeGetModeLine'. rep.length allocated at line 218. rep.length uninitialised when majorVersion 2 at line 233. Not tested, but it looks right to me. So Reviewed-by: Matthieu Herrb matth...@herrb.eu Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- src/XF86VMode.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/XF86VMode.c b/src/XF86VMode.c index c7169c7..d13da14 100644 --- a/src/XF86VMode.c +++ b/src/XF86VMode.c @@ -204,10 +204,9 @@ XF86VidModeGetModeLine(Display* dpy, int screen, int* dotclock, XF86VidModeModeLine* modeline) { XExtDisplayInfo *info = find_display (dpy); -xXF86VidModeGetModeLineReply rep; -xXF86OldVidModeGetModeLineReply oldrep; xXF86VidModeGetModeLineReq *req; int majorVersion, minorVersion; +CARD32 remaining_len; Bool result = True; XF86VidModeCheckExtension (dpy, info, False); @@ -220,12 +219,16 @@ XF86VidModeGetModeLine(Display* dpy, int screen, int* dotclock, req-screen = screen; if (majorVersion 2) { + xXF86OldVidModeGetModeLineReply oldrep; + if (!_XReply(dpy, (xReply *)oldrep, (SIZEOF(xXF86OldVidModeGetModeLineReply) - SIZEOF(xReply)) 2, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } + remaining_len = oldrep.length - + ((SIZEOF(xXF86OldVidModeGetModeLineReply) - SIZEOF(xReply)) 2); *dotclock = oldrep.dotclock; modeline-hdisplay = oldrep.hdisplay; modeline-hsyncstart = oldrep.hsyncstart; @@ -239,12 +242,16 @@ XF86VidModeGetModeLine(Display* dpy, int screen, int* dotclock, modeline-flags = oldrep.flags; modeline-privsize = oldrep.privsize; } else { + xXF86VidModeGetModeLineReply rep; + if (!_XReply(dpy, (xReply *)rep, (SIZEOF(xXF86VidModeGetModeLineReply) - SIZEOF(xReply)) 2, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } + remaining_len = rep.length - + ((SIZEOF(xXF86VidModeGetModeLineReply) - SIZEOF(xReply)) 2); *dotclock = rep.dotclock; modeline-hdisplay = rep.hdisplay; modeline-hsyncstart = rep.hsyncstart; @@ -265,8 +272,7 @@ XF86VidModeGetModeLine(Display* dpy, int screen, int* dotclock, else modeline-private = NULL; if (modeline-private == NULL) { - _XEatDataWords(dpy, rep.length - - ((SIZEOF(xXF86VidModeGetModeLineReply) - SIZEOF(xReply)) 2)); + _XEatDataWords(dpy, remaining_len); result = False; } else _XRead(dpy, (char*)modeline-private, modeline-privsize * sizeof(INT32)); -- 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 -- 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
[PATCH v2:libXxf86vm] Discard correct length for old-format replies in XF86VidModeGetGamma
Regression introduced in libXxf86vm 1.1.3 / commit 284a88e21fc05a63466 Unlikely to be hit in practice since it requires out-of-range privsize or malloc failure while talking to a server using the XFree86 3.x version of the protocol. Found by Oracle Parfait 1.5.1: Error: Uninitialised memory (CWE 456) Possible access to uninitialised memory 'rep.length' at line 279 of open-src/lib/libXxf86vm/unpacked-src/src/XF86VMode.c in function 'XF86VidModeGetModeLine'. rep.length allocated at line 218. rep.length uninitialised when majorVersion 2 at line 233. Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com --- src/XF86VMode.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/XF86VMode.c b/src/XF86VMode.c index c7169c7..d13da14 100644 --- a/src/XF86VMode.c +++ b/src/XF86VMode.c @@ -204,10 +204,9 @@ XF86VidModeGetModeLine(Display* dpy, int screen, int* dotclock, XF86VidModeModeLine* modeline) { XExtDisplayInfo *info = find_display (dpy); -xXF86VidModeGetModeLineReply rep; -xXF86OldVidModeGetModeLineReply oldrep; xXF86VidModeGetModeLineReq *req; int majorVersion, minorVersion; +CARD32 remaining_len; Bool result = True; XF86VidModeCheckExtension (dpy, info, False); @@ -220,12 +219,16 @@ XF86VidModeGetModeLine(Display* dpy, int screen, int* dotclock, req-screen = screen; if (majorVersion 2) { + xXF86OldVidModeGetModeLineReply oldrep; + if (!_XReply(dpy, (xReply *)oldrep, (SIZEOF(xXF86OldVidModeGetModeLineReply) - SIZEOF(xReply)) 2, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } + remaining_len = oldrep.length - + ((SIZEOF(xXF86OldVidModeGetModeLineReply) - SIZEOF(xReply)) 2); *dotclock = oldrep.dotclock; modeline-hdisplay = oldrep.hdisplay; modeline-hsyncstart = oldrep.hsyncstart; @@ -239,12 +242,16 @@ XF86VidModeGetModeLine(Display* dpy, int screen, int* dotclock, modeline-flags = oldrep.flags; modeline-privsize = oldrep.privsize; } else { + xXF86VidModeGetModeLineReply rep; + if (!_XReply(dpy, (xReply *)rep, (SIZEOF(xXF86VidModeGetModeLineReply) - SIZEOF(xReply)) 2, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } + remaining_len = rep.length - + ((SIZEOF(xXF86VidModeGetModeLineReply) - SIZEOF(xReply)) 2); *dotclock = rep.dotclock; modeline-hdisplay = rep.hdisplay; modeline-hsyncstart = rep.hsyncstart; @@ -265,8 +272,7 @@ XF86VidModeGetModeLine(Display* dpy, int screen, int* dotclock, else modeline-private = NULL; if (modeline-private == NULL) { - _XEatDataWords(dpy, rep.length - - ((SIZEOF(xXF86VidModeGetModeLineReply) - SIZEOF(xReply)) 2)); + _XEatDataWords(dpy, remaining_len); result = False; } else _XRead(dpy, (char*)modeline-private, modeline-privsize * sizeof(INT32)); -- 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] xwininfo: do not segfault on IO error
If the connection to the X server is lost while waiting for the user to select a window interactively, xwininfo segfaults. This is a regression introduced with the port to XCB, because xcb_wait_for_event() can return NULL in case of an IO error and xwininfo does not check for the actual returned value. Signed-off-by: Olivier Fourdan ofour...@redhat.com --- dsimple.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dsimple.c b/dsimple.c index 6432e13..ca746e9 100644 --- a/dsimple.c +++ b/dsimple.c @@ -205,6 +205,8 @@ xcb_window_t Select_Window(xcb_connection_t *dpy, xcb_allow_events (dpy, XCB_ALLOW_SYNC_POINTER, XCB_TIME_CURRENT_TIME); xcb_flush (dpy); event = xcb_wait_for_event (dpy); + if (event == NULL) + Fatal_Error (Fatal IO error); switch (event-response_type 0x7f) { case XCB_BUTTON_PRESS: { -- 2.1.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] Synchronize capslock in Xnest and Xephyr
In Xnest or Xephyr, pressing CapsLock when focus is on another window does not update the state in the nested X server. This is because when synchronizing the lock modifier, sending a keypress or a key release only is not sufficient to toggle the state, unlike regular modifiers, one has to emulate a full press/release to lock or unlock the modifier. Signed-off-by: Olivier Fourdan ofour...@redhat.com --- hw/kdrive/ephyr/ephyr.c | 8 +++- hw/xnest/Keyboard.c | 9 - 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c index 907bbeb..164ebdc 100644 --- a/hw/kdrive/ephyr/ephyr.c +++ b/hw/kdrive/ephyr/ephyr.c @@ -806,7 +806,11 @@ ephyrUpdateModifierState(unsigned int state) for (key = 0; key MAP_LENGTH; key++) if (keyc-xkbInfo-desc-map-modmap[key] mask) { -if (key_is_down(pDev, key, KEY_PROCESSED)) +if (mask == XCB_MOD_MASK_LOCK) { +KdEnqueueKeyboardEvent(ephyrKbd, key, FALSE); +KdEnqueueKeyboardEvent(ephyrKbd, key, TRUE); +} +else if (key_is_down(pDev, key, KEY_PROCESSED)) KdEnqueueKeyboardEvent(ephyrKbd, key, TRUE); if (--count == 0) @@ -820,6 +824,8 @@ ephyrUpdateModifierState(unsigned int state) for (key = 0; key MAP_LENGTH; key++) if (keyc-xkbInfo-desc-map-modmap[key] mask) { KdEnqueueKeyboardEvent(ephyrKbd, key, FALSE); +if (mask == XCB_MOD_MASK_LOCK) +KdEnqueueKeyboardEvent(ephyrKbd, key, TRUE); break; } } diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c index 2cf1624..ee3f68e 100644 --- a/hw/xnest/Keyboard.c +++ b/hw/xnest/Keyboard.c @@ -18,6 +18,7 @@ is without express or implied warranty. #include X11/X.h #include X11/Xproto.h +#include xcb/xcb_keysyms.h #include X11/keysym.h #include screenint.h #include inputstr.h @@ -247,7 +248,11 @@ xnestUpdateModifierState(unsigned int state) for (key = 0; key MAP_LENGTH; key++) if (keyc-xkbInfo-desc-map-modmap[key] mask) { -if (key_is_down(pDev, key, KEY_PROCESSED)) +if (mask == XCB_MOD_MASK_LOCK) { +xnestQueueKeyEvent(KeyPress, key); +xnestQueueKeyEvent(KeyRelease, key); +} +else if (key_is_down(pDev, key, KEY_PROCESSED)) xnestQueueKeyEvent(KeyRelease, key); if (--count == 0) @@ -261,6 +266,8 @@ xnestUpdateModifierState(unsigned int state) for (key = 0; key MAP_LENGTH; key++) if (keyc-xkbInfo-desc-map-modmap[key] mask) { xnestQueueKeyEvent(KeyPress, key); +if (mask == XCB_MOD_MASK_LOCK) +xnestQueueKeyEvent(KeyRelease, key); break; } } -- 2.1.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
Re: [PATCH] xwininfo: do not segfault on IO error
On Tue, 2015-01-06 at 11:57 +0100, Olivier Fourdan wrote: If the connection to the X server is lost while waiting for the user to select a window interactively, xwininfo segfaults. This is a regression introduced with the port to XCB, because xcb_wait_for_event() can return NULL in case of an IO error and xwininfo does not check for the actual returned value. Reviewed-by: Adam Jackson a...@redhat.com - ajax ___ 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:intel-gpu-tools 1/7] Fix #ifdef check for _SC_AVPHYS_PAGES in intel_get_avail_ram_mb()
On Tue, Dec 23, 2014 at 07:07:08PM -0800, Alan Coopersmith wrote: Check for the sysconf value used here, not the one used in the previous function. Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com Thanks for the patches, all merged. Aside: Do you really run all the testcases on solaris or wouldn't it be better to just disable them? And please cc intel-gfx for igt patches and Thomas Wood (who's doing maintainer duties for it now) in the future. Thanks, Daniel --- lib/intel_os.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/intel_os.c b/lib/intel_os.c index db7889b..1badd3e 100644 --- a/lib/intel_os.c +++ b/lib/intel_os.c @@ -112,7 +112,7 @@ intel_get_avail_ram_mb(void) retval = sysinf.freeram; retval *= sysinf.mem_unit; -#elif defined(_SC_PAGESIZE) defined(_SC_PHYS_PAGES) /* Solaris */ +#elif defined(_SC_PAGESIZE) defined(_SC_AVPHYS_PAGES) /* Solaris */ long pagesize, npages; pagesize = sysconf(_SC_PAGESIZE); -- 1.7.9.2 -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch ___ 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: [Intel-gfx] [PATCH:intel-gpu-tools 1/7] Fix #ifdef check for _SC_AVPHYS_PAGES in intel_get_avail_ram_mb()
On Mon, 5 Jan 2015, Alan Coopersmith wrote: On 01/ 5/15 08:11 AM, Daniel Vetter wrote: On Tue, Dec 23, 2014 at 07:07:08PM -0800, Alan Coopersmith wrote: Check for the sysconf value used here, not the one used in the previous function. Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com Thanks for the patches, all merged. Aside: Do you really run all the testcases on solaris or wouldn't it be better to just disable them? And please cc intel-gfx for igt patches and Thomas Wood (who's doing maintainer duties for it now) in the future. Thanks - and I'm not actually sure which of the tests our intel driver porting team run on Solaris, I was just trying to reduce the number of bits that failed to build altogether. (Though I'm sure some that build will fail at runtime since they won't be able to open files in debugfs on Solaris.) We don't run any of the tests in intel-gpu-tools due to various incompatibilities, and currently opt for a small set of sanity tests that are specific to Solaris. There was an intent to investigate these tests more closely once we had a stable environment, but haven't yet undertaken that task (mostly due to the limited resources available to do the work). A couple of the tools themselves have been quite useful, though. Randy ___ 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] backtrace.c: Fix word cast to a pointer
backtrace.c uses a word size provided by libunwind. In some architectures like MIPS, libunwind makes that word size 64-bit for all variants of the architecture. In the lines #90 and #98, backtrace.c tries to do a cast to a pointer, which fails in all MIPS variants with 32-bit pointers, like MIPS32 or MIPS64 n32, because it's trying to do a cast from a 64-bit wide variable to a 32-bit pointer: Making all in os make[2]: Entering directory `/home/test/test/1/output/build/xserver_xorg-server-1.15.1/os' CC WaitFor.lo CC access.lo CC auth.lo CC backtrace.lo backtrace.c: In function 'xorg_backtrace': backtrace.c:90:20: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] if (dladdr((void *)(pip.start_ip + off), dlinfo) dlinfo.dli_fname ^ backtrace.c:98:13: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] (void *)(pip.start_ip + off)); ^ cc1: some warnings being treated as errors make[2]: *** [backtrace.lo] Error 1 make[2]: *** Waiting for unfinished jobs Making the cast to a pointer-sized integer, and then to a pointer fixes the problem. Related: https://bugs.freedesktop.org/show_bug.cgi?id=79939 Signed-off-by: Vicente Olivert Riera vincent.ri...@imgtec.com --- os/backtrace.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/os/backtrace.c b/os/backtrace.c index 3d1195b..3c101ae 100644 --- a/os/backtrace.c +++ b/os/backtrace.c @@ -87,7 +87,7 @@ xorg_backtrace(void) procname[1] = 0; } -if (dladdr((void *)(pip.start_ip + off), dlinfo) dlinfo.dli_fname +if (dladdr((void *)(long)(pip.start_ip + off), dlinfo) dlinfo.dli_fname *dlinfo.dli_fname) filename = dlinfo.dli_fname; else @@ -95,7 +95,7 @@ xorg_backtrace(void) ErrorFSigSafe(%u: %s (%s%s+0x%x) [%p]\n, i++, filename, procname, ret == -UNW_ENOMEM ? ... : , (int)off, -(void *)(pip.start_ip + off)); +(void *)(long)(pip.start_ip + off)); ret = unw_step(cursor); if (ret 0) -- 1.7.1 ___ 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
[PULL] subwindow event fixes, capslock in Xephyr/Xnest
The following changes since commit b058dec281568d6a9c5b5e230c20eed096cbdc6d: mi: fix accidental x/y coordinate swap (2015-01-05 14:26:45 -0800) are available in the git repository at: git://people.freedesktop.org/~whot/xserver for-keith for you to fetch changes up to 43014795087a0a8774dd9687f5967329b15f06a2: Synchronize capslock in Xnest and Xephyr (2015-01-07 09:22:12 +1000) Olivier Fourdan (2): Fix subwindow in Xi emulated events Synchronize capslock in Xnest and Xephyr Xi/exevents.c | 5 +++-- hw/kdrive/ephyr/ephyr.c | 8 +++- hw/xnest/Keyboard.c | 9 - 3 files changed, 18 insertions(+), 4 deletions(-) ___ 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: [PATCHv2] dri2: Set vdpau driver name if ddx does not provide any driver name
On 01/ 3/15 12:12 PM, Adel Gadllah wrote: Currently when the ddx does not set any driver name we set DRI2 driver but not the VDPAU driver name. The result is that VDPAU drivers will not get found by libvdpau when the modesetting driver is being used. Just assume that the VDPAU driver matches the DRI2 driver name, this is true for nouveau, r300, r600 and radeonsi i.e all VDPAU drivers currently supported by mesa. Signed-off-by: Adel Gadllah adel.gadl...@gmail.com --- hw/xfree86/dri2/dri2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index c8fcd62..68518c4 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -1573,15 +1573,15 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) if (info-version == 3 || info-numDrivers == 0) { /* Driver too old: use the old-style driverName field */ -ds-numDrivers = 1; -ds-driverNames = malloc(sizeof(*ds-driverNames)); +ds-numDrivers = info-driverName ? 1 : 2; +ds-driverNames = malloc(ds-numDrivers * sizeof(*ds-driverNames)); if (!ds-driverNames) goto err_out; if (info-driverName) { ds-driverNames[0] = info-driverName; } else { -ds-driverNames[0] = dri2_probe_driver_name(pScreen, info); +ds-driverNames[0] = ds-driverNames[1] = dri2_probe_driver_name(pScreen, info); if (!ds-driverNames[0]) return FALSE; } Thanks for fixing - I assume you lucked out in previous testing that you weren't overwriting anything important (perhaps just malloc padding), but we can't rely on everyone always being so lucky. 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
[PATCH] randr: attempt to fix primary on slave output (v2)
From: Dave Airlie airl...@redhat.com If the user wants to set one of the slave devices as the primary output, we shouldn't fail to do so, we were returning BadMatch which was tripping up gnome-settings-daemon and bad things ensues. Fix all the places we use primaryOutput to work out primaryCrtc and take it into a/c when slave gpus are in use. v2: review from Aaron, fix indent, unhide has_primary from macro. I left the int vs Bool alone to be consistent with code below, a future patch could fix both. Signed-off-by: Dave Airlie airl...@redhat.com Reviewed-by: Aaron Plattner aplatt...@nvidia.com --- randr/rroutput.c | 6 +- randr/rrscreen.c | 22 ++ randr/rrxinerama.c | 12 ++-- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/randr/rroutput.c b/randr/rroutput.c index f824f50..1649309 100644 --- a/randr/rroutput.c +++ b/randr/rroutput.c @@ -540,7 +540,11 @@ ProcRRSetOutputPrimary(ClientPtr client) if (stuff-output) { VERIFY_RR_OUTPUT(stuff-output, output, DixReadAccess); -if (output-pScreen != pWin-drawable.pScreen) { +if (!output-pScreen-isGPU output-pScreen != pWin-drawable.pScreen) { +client-errorValue = stuff-window; +return BadMatch; +} +if (output-pScreen-isGPU output-pScreen-current_master != pWin-drawable.pScreen) { client-errorValue = stuff-window; return BadMatch; } diff --git a/randr/rrscreen.c b/randr/rrscreen.c index 36179ae..e7ea49d 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -322,8 +322,13 @@ static inline void swap_modeinfos(xRRModeInfo *modeinfos, int i) swapl(modeinfos[i].modeFlags); } -#define update_arrays(gpuscreen, pScrPriv) do {\ +#define update_arrays(gpuscreen, pScrPriv, primary_crtc, has_primary) do { \ for (j = 0; j pScrPriv-numCrtcs; j++) { \ +if (has_primary \ +primary_crtc == pScrPriv-crtcs[j]) { \ +has_primary = 0; \ +continue; \ +}\ crtcs[crtc_count] = pScrPriv-crtcs[j]-id;\ if (client-swapped) \ swapl(crtcs[crtc_count]); \ @@ -366,9 +371,11 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen) unsigned long extraLen; CARD8 *extra; RRCrtc *crtcs; +RRCrtcPtr primary_crtc = NULL; RROutput *outputs; xRRModeInfo *modeinfos; CARD8 *names; +int has_primary = 0; /* we need to iterate all the GPU masters and all their output slaves */ total_crtcs = 0; @@ -426,18 +433,25 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen) modeinfos = (xRRModeInfo *)(outputs + total_outputs); names = (CARD8 *)(modeinfos + total_modes); -/* TODO primary */ crtc_count = 0; output_count = 0; mode_count = 0; pScrPriv = rrGetScrPriv(pScreen); -update_arrays(pScreen, pScrPriv); +if (pScrPriv-primaryOutput pScrPriv-primaryOutput-crtc) { +has_primary = 1; +primary_crtc = pScrPriv-primaryOutput-crtc; +crtcs[0] = pScrPriv-primaryOutput-crtc-id; +if (client-swapped) +swapl(crtcs[0]); +crtc_count = 1; +} +update_arrays(pScreen, pScrPriv, primary_crtc, has_primary); xorg_list_for_each_entry(iter, pScreen-output_slave_list, output_head) { pScrPriv = rrGetScrPriv(iter); -update_arrays(iter, pScrPriv); +update_arrays(iter, pScrPriv, primary_crtc, has_primary); } assert(bytes_to_int32((char *) names - (char *) extra) == rep.length); diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c index 26894a6..b336bd7 100644 --- a/randr/rrxinerama.c +++ b/randr/rrxinerama.c @@ -344,15 +344,17 @@ ProcRRXineramaQueryScreens(ClientPtr client) ScreenPtr slave; rrScrPriv(pScreen); int has_primary = 0; +RRCrtcPtr primary_crtc = NULL; if (pScrPriv-primaryOutput pScrPriv-primaryOutput-crtc) { has_primary = 1; +primary_crtc = pScrPriv-primaryOutput-crtc; RRXineramaWriteCrtc(client, pScrPriv-primaryOutput-crtc); } for (i = 0; i pScrPriv-numCrtcs; i++) { if (has_primary -pScrPriv-primaryOutput-crtc == pScrPriv-crtcs[i]) { +primary_crtc == pScrPriv-crtcs[i]) { has_primary = 0; continue; } @@ -362,8 +364,14 @@ ProcRRXineramaQueryScreens(ClientPtr client) xorg_list_for_each_entry(slave, pScreen-output_slave_list, output_head) { rrScrPrivPtr pSlavePriv; pSlavePriv = rrGetScrPriv(slave); -for (i = 0; i pSlavePriv-numCrtcs; i++) +for (i = 0; i pSlavePriv-numCrtcs; i++) { +if (has_primary +primary_crtc == pSlavePriv-crtcs[i]) { +
Re: [PATCH] hw: Fix visual colormap_size mixup causing missing visuals.
Bumping this. Hopefully the holiday rush has slimmed a bit by now. Alex On Sun, Nov 30, 2014 at 2:38 PM, Alex Orange crazyca...@gmail.com wrote: Please ignore the first patch, got old comment lines left in by accident. Probably forgot to git add. Alex On Sun, Nov 30, 2014 at 2:37 PM, Alex Orange crazyca...@gmail.com wrote: Likely fixes: https://bugs.freedesktop.org/show_bug.cgi?id=24642 dmx uses fb to handle many action. As such is uses fbScreenInit. The trouble is that fbScreenInit uses mi to generate the visuals. mi has trouble with 32-bit (rgba) depths. It tries to treat these depths as 10-bits per pixels. This results in colormap_sizes in the visuals being 2048 instead of 256. Also, the comments in micmap.c about the macros, _CE is the relevant one, suggest that these numbers may be driver defined. To this end, this patch simply copies the visuals into the visuals and depths structs instead of trying to coax mi into creating the right visuals. The code was mostly just taken from xnest with changes since dmx uses fb. The result depends on miScreenInit simply stuffing visuals in the screen and not doing anything more with them. In the future perhaps fbScreenInit can take an optional set of visuals to use instead of calling miInitVisuals. Signed-off-by: Alex Orange crazyca...@gmail.com Tested-by: Alex Orange crazyca...@gmail.com --- hw/dmx/dmxscrinit.c | 159 hw/dmx/dmxscrinit.h | 5 ++ 2 files changed, 129 insertions(+), 35 deletions(-) diff --git a/hw/dmx/dmxscrinit.c b/hw/dmx/dmxscrinit.c index 963d3a9..3c68708 100644 --- a/hw/dmx/dmxscrinit.c +++ b/hw/dmx/dmxscrinit.c @@ -54,9 +54,12 @@ #include dmxpict.h -#include fb.h +#include X11/X.h +#include mi.h #include mipointer.h #include micmap.h +#include resource.h +#include fb.h extern Bool dmxCloseScreen(ScreenPtr pScreen); static Bool dmxSaveScreen(ScreenPtr pScreen, int what); @@ -172,12 +175,28 @@ dmxBEScreenInit(ScreenPtr pScreen) } } +static int +offset(unsigned long mask) +{ +int count; + +for (count = 0; !(mask 1) count 32; count++) +mask = 1; + +return count; +} + /** Initialize screen number \a pScreen-myNum. */ Bool dmxScreenInit(ScreenPtr pScreen, int argc, char *argv[]) { DMXScreenInfo *dmxScreen = dmxScreens[pScreen-myNum]; -int i, j; +int i, j, depthIndex; +VisualPtr visuals; +DepthPtr depths; +int numVisuals, numDepths; +VisualID defaultBEVisual, defaultVisual; +int rootDepth; if (!dixRegisterPrivateKey(dmxScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) return FALSE; @@ -202,41 +221,95 @@ dmxScreenInit(ScreenPtr pScreen, int argc, char *argv[]) if (!dmxInitPixmap(pScreen)) return FALSE; -/* - * Initalise the visual types. miSetVisualTypesAndMasks() requires - * that all of the types for each depth be collected together. It's - * intended for slightly different usage to what we would like here. - * Maybe a miAddVisualTypeAndMask() function will be added to make - * things easier here. - */ -for (i = 0; i dmxScreen-beNumDepths; i++) { -int depth; -int visuals = 0; -int bitsPerRgb = 0; -int preferredClass = -1; -Pixel redMask = 0; -Pixel greenMask = 0; -Pixel blueMask = 0; - -depth = dmxScreen-beDepths[i]; -for (j = 0; j dmxScreen-beNumVisuals; j++) { -XVisualInfo *vi; - -vi = dmxScreen-beVisuals[j]; -if (vi-depth == depth) { -/* Assume the masks are all the same. */ -visuals |= (1 vi-class); -bitsPerRgb = vi-bits_per_rgb; -redMask = vi-red_mask; -greenMask = vi-green_mask; -blueMask = vi-blue_mask; -if (j == dmxScreen-beDefVisualIndex) { -preferredClass = vi-class; -} +visuals = (VisualPtr) malloc(dmxScreen-beNumVisuals * sizeof(VisualRec)); +numVisuals = 0; + +depths = (DepthPtr) malloc(MAXDEPTH * sizeof(DepthRec)); +depths[0].depth = 1; +depths[0].numVids = 0; +depths[0].vids = (VisualID *) malloc(MAXVISUALSPERDEPTH * sizeof(VisualID)); +numDepths = 1; + +defaultBEVisual = XVisualIDFromVisual(DefaultVisual(dmxScreen-beDisplay, +DefaultScreen + (dmxScreen-beDisplay))); +rootDepth = UNDEFINED; +defaultVisual = UNDEFINED; + +for (i = 0; i dmxScreen-beNumVisuals; i++) { +visuals[numVisuals].class = dmxScreen-beVisuals[i].class; +visuals[numVisuals].bitsPerRGBValue = +dmxScreen-beVisuals[i].bits_per_rgb; +visuals[numVisuals].ColormapEntries = +dmxScreen-beVisuals[i].colormap_size; +
Re: [PATCHv2] dri2: Set vdpau driver name if ddx does not provide any driver name
On Sat, Jan 3, 2015 at 3:12 PM, Adel Gadllah adel.gadl...@gmail.com wrote: Currently when the ddx does not set any driver name we set DRI2 driver but not the VDPAU driver name. The result is that VDPAU drivers will not get found by libvdpau when the modesetting driver is being used. Just assume that the VDPAU driver matches the DRI2 driver name, this is true for nouveau, r300, r600 and radeonsi i.e all VDPAU drivers currently supported by mesa. Signed-off-by: Adel Gadllah adel.gadl...@gmail.com Reviewed-by: Alex Deucher alexander.deuc...@amd.com --- hw/xfree86/dri2/dri2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index c8fcd62..68518c4 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -1573,15 +1573,15 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) if (info-version == 3 || info-numDrivers == 0) { /* Driver too old: use the old-style driverName field */ -ds-numDrivers = 1; -ds-driverNames = malloc(sizeof(*ds-driverNames)); +ds-numDrivers = info-driverName ? 1 : 2; +ds-driverNames = malloc(ds-numDrivers * sizeof(*ds-driverNames)); if (!ds-driverNames) goto err_out; if (info-driverName) { ds-driverNames[0] = info-driverName; } else { -ds-driverNames[0] = dri2_probe_driver_name(pScreen, info); +ds-driverNames[0] = ds-driverNames[1] = dri2_probe_driver_name(pScreen, info); if (!ds-driverNames[0]) return FALSE; } -- 2.1.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 ___ 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