Re: [PATCH] xfree86: Use same inb/outb asm code for i386 amd64 and ia64
Reviewed-by: Jeremy Huddleston Sequoia> On Oct 21, 2015, at 09:24, Adam Jackson wrote: > > This matches the GCCUSESGAS path from the old monolith build (where that > macro was actually set), and fixes the build on modern OSX. > > Signed-off-by: Adam Jackson > --- > hw/xfree86/common/compiler.h | 49 +--- > 1 file changed, 1 insertion(+), 48 deletions(-) > > diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h > index 85fb35c..5a1fdac 100644 > --- a/hw/xfree86/common/compiler.h > +++ b/hw/xfree86/common/compiler.h > @@ -286,7 +286,7 @@ extern _X_EXPORT unsigned int inl(unsigned int port); > #include > #endif /* __NetBSD__ */ > > -#elif defined(__amd64__) > +#elif defined(__amd64__) || defined(__i386__) || defined(__ia64__) > > #include > > @@ -967,53 +967,6 @@ inl(unsigned PORT_SIZE port) > > #endif /* NDS32_MMIO_SWAP */ > > -#elif defined(__i386__) || defined(__ia64__) > - > -static __inline__ void > -outb(unsigned short port, unsigned char val) > -{ > -__asm__ __volatile__("out%B0 (%1)"::"a"(val), "d"(port)); > -} > - > -static __inline__ void > -outw(unsigned short port, unsigned short val) > -{ > -__asm__ __volatile__("out%W0 (%1)"::"a"(val), "d"(port)); > -} > - > -static __inline__ void > -outl(unsigned short port, unsigned int val) > -{ > -__asm__ __volatile__("out%L0 (%1)"::"a"(val), "d"(port)); > -} > - > -static __inline__ unsigned int > -inb(unsigned short port) > -{ > -unsigned char ret; > -__asm__ __volatile__("in%B0 (%1)":"=a"(ret):"d"(port)); > - > -return ret; > -} > - > -static __inline__ unsigned int > -inw(unsigned short port) > -{ > -unsigned short ret; > -__asm__ __volatile__("in%W0 (%1)":"=a"(ret):"d"(port)); > - > -return ret; > -} > - > -static __inline__ unsigned int > -inl(unsigned short port) > -{ > -unsigned int ret; > -__asm__ __volatile__("in%L0 (%1)":"=a"(ret):"d"(port)); > - > -return ret; > -} > - > #endif /* arch madness */ > > #else /* !GNUC */ > -- > 2.5.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
[PATCH] xfree86: Use same inb/outb asm code for i386 amd64 and ia64
This matches the GCCUSESGAS path from the old monolith build (where that macro was actually set), and fixes the build on modern OSX. Signed-off-by: Adam Jackson--- hw/xfree86/common/compiler.h | 49 +--- 1 file changed, 1 insertion(+), 48 deletions(-) diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h index 85fb35c..5a1fdac 100644 --- a/hw/xfree86/common/compiler.h +++ b/hw/xfree86/common/compiler.h @@ -286,7 +286,7 @@ extern _X_EXPORT unsigned int inl(unsigned int port); #include #endif /* __NetBSD__ */ -#elif defined(__amd64__) +#elif defined(__amd64__) || defined(__i386__) || defined(__ia64__) #include @@ -967,53 +967,6 @@ inl(unsigned PORT_SIZE port) #endif /* NDS32_MMIO_SWAP */ -#elif defined(__i386__) || defined(__ia64__) - -static __inline__ void -outb(unsigned short port, unsigned char val) -{ -__asm__ __volatile__("out%B0 (%1)"::"a"(val), "d"(port)); -} - -static __inline__ void -outw(unsigned short port, unsigned short val) -{ -__asm__ __volatile__("out%W0 (%1)"::"a"(val), "d"(port)); -} - -static __inline__ void -outl(unsigned short port, unsigned int val) -{ -__asm__ __volatile__("out%L0 (%1)"::"a"(val), "d"(port)); -} - -static __inline__ unsigned int -inb(unsigned short port) -{ -unsigned char ret; -__asm__ __volatile__("in%B0 (%1)":"=a"(ret):"d"(port)); - -return ret; -} - -static __inline__ unsigned int -inw(unsigned short port) -{ -unsigned short ret; -__asm__ __volatile__("in%W0 (%1)":"=a"(ret):"d"(port)); - -return ret; -} - -static __inline__ unsigned int -inl(unsigned short port) -{ -unsigned int ret; -__asm__ __volatile__("in%L0 (%1)":"=a"(ret):"d"(port)); - -return ret; -} - #endif /* arch madness */ #else /* !GNUC */ -- 2.5.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 1/1] xfree86: Use the correct __i386__ inline asm fallbacks in compiler.h
On Tue, 2015-10-20 at 11:02 -0700, Jeremy Huddleston Sequoia wrote: > Note that I'm not 100% confident that this is correct. It looks > right to me, but I'm certainly no expert here. That file is chuck > full of cpp-goop that makes my head spin. > > The reason we hadn't seen this until recently is that we were using > -DFAKEIT for builds on darwin because we didn't care about that code > anyways (we just use fake, null, nested drivers). That was removed > in 80446086b9cfcc5e23a400d7fa38ec773fae68fc, and we are just now > jumping to 1.17.x for the next XQuartz release. Note that tinderbox > would've caught this if it were still alive =( I think this is probably fine - it builds fine on Linux at least - but I think we can do better. When I unifdef'd GCCUSESGAS I could probably have done so as if it were always defined instead of undefined, since that's what the monolith effectively did. Had I done so then the wacky %B0-syntax-using code would have been deleted instead. I'll send a patch to move both i386 and ia64 to the amd64 code, which will have the pleasant side effect of being a net deletion. Anything to make compiler.h smaller has to be good... - 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 v2] linux: Do not call FatalError from xf86CloseConsole
On Wed, 2015-10-21 at 11:36 +0200, Hans de Goede wrote: > FatalError ends up calling xf86CloseConsole itself, so calling FatalError > from within xf86CloseConsole is not a good idea. > > Make switch_to log errors using xf86Msg(X_WARNING, ...) and return success > (or failure). > > This makes switch_to match the other error checking done in xf86CloseConsole > which all logs warnings and continues. > > Add checking of the return value in xf86OpenConsole and call > FatalError there when switch_to fails, to preserve the error-handling > behavior of xf86OpenConsole. > > BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1269210 > Signed-off-by: Hans de Goederemote: I: patch #62451 updated using rev 2092f12a243b9f7682f542b593b77c96d455ec89. remote: I: 1 patch(es) updated to state Accepted. To ssh://git.freedesktop.org/git/xorg/xserver ee06f67..2092f12 master -> master - 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
[PATCH] Handle failures in setting a CRTC to a DRM mode properly
From: Stephen Chandler PaulThis fixes a bug where running the card out of PPLL's when hotplugging another monitor would result in all of the displays going blank and failing to work properly until X was restarted or the user switched to another VT. Signed-off-by: Stephen Chandler Paul --- src/drmmode_display.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 64e79d4..5d69fbf 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -762,10 +762,12 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, } ret = drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, fb_id, x, y, output_ids, output_count, ); - if (ret) + if (ret) { xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR, "failed to set mode: %s", strerror(-ret)); - else + ret = FALSE; + goto done; + } else ret = TRUE; if (crtc->scrn->pScreen) -- 2.4.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
[PATCH v2] linux: Do not call FatalError from xf86CloseConsole
FatalError ends up calling xf86CloseConsole itself, so calling FatalError from within xf86CloseConsole is not a good idea. Make switch_to log errors using xf86Msg(X_WARNING, ...) and return success (or failure). This makes switch_to match the other error checking done in xf86CloseConsole which all logs warnings and continues. Add checking of the return value in xf86OpenConsole and call FatalError there when switch_to fails, to preserve the error-handling behavior of xf86OpenConsole. BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1269210 Signed-off-by: Hans de Goede--- Changes in v2: -Always use xf86Msg(X_WARNING, ...) in switch_to, move calling of FatalError on failure to xf86OpenConsole() --- hw/xfree86/os-support/linux/lnx_init.c | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c index ec06a05..1ed213c 100644 --- a/hw/xfree86/os-support/linux/lnx_init.c +++ b/hw/xfree86/os-support/linux/lnx_init.c @@ -63,18 +63,24 @@ drain_console(int fd, void *closure) } } -static void +static int switch_to(int vt, const char *from) { int ret; SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt)); -if (ret < 0) -FatalError("%s: VT_ACTIVATE failed: %s\n", from, strerror(errno)); +if (ret < 0) { +xf86Msg(X_WARNING, "%s: VT_ACTIVATE failed: %s\n", from, strerror(errno)); +return 0; +} SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt)); -if (ret < 0) -FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno)); +if (ret < 0) { +xf86Msg(X_WARNING, "%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno)); +return 0; +} + +return 1; } #pragma GCC diagnostic push @@ -233,7 +239,8 @@ xf86OpenConsole(void) /* * now get the VT. This _must_ succeed, or else fail completely. */ -switch_to(xf86Info.vtno, "xf86OpenConsole"); +if (!switch_to(xf86Info.vtno, "xf86OpenConsole")) +FatalError("xf86OpenConsole: Switching VT failed\n"); SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, )); if (ret < 0) @@ -294,7 +301,8 @@ xf86OpenConsole(void) else { /* serverGeneration != 1 */ if (!xf86Info.ShareVTs && xf86Info.autoVTSwitch) { /* now get the VT */ -switch_to(xf86Info.vtno, "xf86OpenConsole"); +if (!switch_to(xf86Info.vtno, "xf86OpenConsole")) +FatalError("xf86OpenConsole: Switching VT failed\n"); } } } -- 2.5.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