Re: [PATCH:xkbcomp] Adjust a NUL-string assignment to avoid const issues.

2015-07-28 Thread Peter Hutterer
On Tue, Jul 28, 2015 at 05:53:48PM +0200, Thomas Klausner wrote:
> From: Matthew Green 
> 
> Signed-off-by: Thomas Klausner 

pushed, thanks

Cheers,
   Peter

> ---
>  expr.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/expr.c b/expr.c
> index e0f957c..841ab07 100644
> --- a/expr.c
> +++ b/expr.c
> @@ -729,8 +729,8 @@ ExprResolveString(ExprDef * expr,
>  val_rtrn->str = XkbAtomGetString(NULL, expr->value.str);
>  if (val_rtrn->str == NULL)
>  {
> -static const char *empty = "";
> -val_rtrn->str = empty;
> +static char empty_char = '\0';
> +val_rtrn->str = &empty_char;
>  }
>  return True;
>  case ExprIdent:
> -- 
> 2.4.6
> 
> ___
> 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

Re: [PATCH] Improved autoconfig drivers matching

2015-07-28 Thread Aaron Plattner
On 07/22/2015 04:42 PM, Karol Kosik wrote:
> Implementation of new drivers matching algorithm. New approach
> doesn't add duplicate drivers and ease drivers matching phase.
> 
> Signed-off-by: Karol Kosik 

Reviewed-by: Aaron Plattner 

though it might be good for someone else to take a look too.

In case anyone was wondering why this patch helps, the problem is that
xf86PlatformMatchDriver() loops over every platform device, which means
that if you have a whole bunch of GPUs, it keeps adding the same drivers
over and over again, overflowing the 20-element deviceList[].

> ---
>  hw/xfree86/common/xf86AutoConfig.c   | 124 
> +++
>  hw/xfree86/common/xf86MatchDrivers.h |  40 +++
>  hw/xfree86/common/xf86pciBus.c   |  52 ++-
>  hw/xfree86/common/xf86pciBus.h   |  13 ++--
>  hw/xfree86/common/xf86platformBus.c  |  31 +++--
>  hw/xfree86/common/xf86platformBus.h  |   5 +-
>  6 files changed, 150 insertions(+), 115 deletions(-)
>  create mode 100644 hw/xfree86/common/xf86MatchDrivers.h
> 
> diff --git a/hw/xfree86/common/xf86AutoConfig.c 
> b/hw/xfree86/common/xf86AutoConfig.c
> index 6b8d0eb..440434c 100644
> --- a/hw/xfree86/common/xf86AutoConfig.c
> +++ b/hw/xfree86/common/xf86AutoConfig.c
> @@ -37,6 +37,7 @@
>  #include "xf86Parser.h"
>  #include "xf86tokens.h"
>  #include "xf86Config.h"
> +#include "xf86MatchDrivers.h"
>  #include "xf86Priv.h"
>  #include "xf86_OSlib.h"
>  #include "xf86platformBus.h"
> @@ -89,7 +90,7 @@
>  static const char **builtinConfig = NULL;
>  static int builtinLines = 0;
>  
> -static void listPossibleVideoDrivers(char *matches[], int nmatches);
> +static void listPossibleVideoDrivers(XF86MatchedDrivers *md);
>  
>  /*
>   * A built-in config file is stored as an array of strings, with each string
> @@ -140,33 +141,58 @@ AppendToConfig(const char *s)
>  AppendToList(s, &builtinConfig, &builtinLines);
>  }
>  
> +void
> +xf86AddMatchedDriver(XF86MatchedDrivers *md, const char *driver)
> +{
> +int j;
> +int nmatches = md->nmatches;
> +
> +for (j = 0; j < nmatches; ++j) {
> +if (xf86NameCmp(md->matches[j], driver) == 0) {
> +// Driver already in matched drivers
> +return;
> +}
> +}
> +
> +if (nmatches < MATCH_DRIVERS_LIMIT) {
> +md->matches[nmatches] = xnfstrdup(driver);
> +md->nmatches++;
> +}
> +else {
> +xf86Msg(X_WARNING, "Too many drivers registered, can't add %s\n", 
> driver);
> +}
> +}
> +
>  Bool
>  xf86AutoConfig(void)
>  {
> -char *deviceList[20];
> -char **p;
> +XF86MatchedDrivers md;
> +int i;
>  const char **cp;
>  char buf[1024];
>  ConfigStatus ret;
>  
> -listPossibleVideoDrivers(deviceList, 20);
> +listPossibleVideoDrivers(&md);
>  
> -for (p = deviceList; *p; p++) {
> -snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION, *p, 0, *p);
> +for (i = 0; i < md.nmatches; i++) {
> +snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION,
> +md.matches[i], 0, md.matches[i]);
>  AppendToConfig(buf);
> -snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION, *p, 0, *p, 0);
> +snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION,
> +md.matches[i], 0, md.matches[i], 0);
>  AppendToConfig(buf);
>  }
>  
>  AppendToConfig(BUILTIN_LAYOUT_SECTION_PRE);
> -for (p = deviceList; *p; p++) {
> -snprintf(buf, sizeof(buf), BUILTIN_LAYOUT_SCREEN_LINE, *p, 0);
> +for (i = 0; i < md.nmatches; i++) {
> +snprintf(buf, sizeof(buf), BUILTIN_LAYOUT_SCREEN_LINE,
> +md.matches[i], 0);
>  AppendToConfig(buf);
>  }
>  AppendToConfig(BUILTIN_LAYOUT_SECTION_POST);
>  
> -for (p = deviceList; *p; p++) {
> -free(*p);
> +for (i = 0; i < md.nmatches; i++) {
> +free(md.matches[i]);
>  }
>  
>  xf86MsgVerb(X_DEFAULT, 0,
> @@ -190,22 +216,19 @@ xf86AutoConfig(void)
>  }
>  
>  static void
> -listPossibleVideoDrivers(char *matches[], int nmatches)
> +listPossibleVideoDrivers(XF86MatchedDrivers *md)
>  {
>  int i;
>  
> -for (i = 0; i < nmatches; i++) {
> -matches[i] = NULL;
> -}
> -i = 0;
> +md->nmatches = 0;
>  
>  #ifdef XSERVER_PLATFORM_BUS
> -i = xf86PlatformMatchDriver(matches, nmatches);
> +xf86PlatformMatchDriver(md);
>  #endif
>  #ifdef sun
>  /* Check for driver type based on /dev/fb type and if valid, use
> it instead of PCI bus probe results */
> -if (xf86Info.consoleFd >= 0 && (i < (nmatches - 1))) {
> +if (xf86Info.consoleFd >= 0) {
>  struct vis_identifier visid;
>  const char *cp;
>  int iret;
> @@ -231,7 +254,7 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
>  
>  /* Special case from before the general case was set */
>  if (strcmp(visid.name, "NVDAnvda") == 0) {
> -matches[i++] = xnfstrdup("nvidia");
>

[PATCH:xserver] Move X11/Xpoll.h include earlier than sys/select.h

2015-07-28 Thread Thomas Klausner
From: Matthew Green 

Assures setting FD_SETSIZE early enough.

Signed-off-by: Thomas Klausner 
---
 os/WaitFor.c| 3 ++-
 os/connection.c | 3 ++-
 os/io.c | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/os/WaitFor.c b/os/WaitFor.c
index 431f1a6..ad9fd3d 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -56,6 +56,8 @@ SOFTWARE.
 #include 
 #endif
 
+#include 
+
 #ifdef WIN32
 #include 
 #endif
@@ -66,7 +68,6 @@ SOFTWARE.
 #include "misc.h"
 
 #include "osdep.h"
-#include 
 #include "dixstruct.h"
 #include "opaque.h"
 #ifdef DPMSExtension
diff --git a/os/connection.c b/os/connection.c
index c36b125..acafc09 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -64,6 +64,8 @@ SOFTWARE.
 #include 
 #endif
 
+#include 
+
 #ifdef WIN32
 #include 
 #endif
@@ -103,7 +105,6 @@ SOFTWARE.
 #endif  /* WIN32 */
 #include "misc.h"   /* for typedef of pointer */
 #include "osdep.h"
-#include 
 #include "opaque.h"
 #include "dixstruct.h"
 #include "xace.h"
diff --git a/os/io.c b/os/io.c
index 96a243d..ae973cf 100644
--- a/os/io.c
+++ b/os/io.c
@@ -57,6 +57,8 @@ SOFTWARE.
 
 #undef DEBUG_COMMUNICATION
 
+#include 
+
 #ifdef WIN32
 #include 
 #endif
@@ -74,7 +76,6 @@ SOFTWARE.
 #include 
 #include "os.h"
 #include "osdep.h"
-#include 
 #include "opaque.h"
 #include "dixstruct.h"
 #include "misc.h"
-- 
2.4.6

___
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-video-tdfx] Don't mess with BARs if only one card is present.

2015-07-28 Thread Thomas Klausner
From: Michael Lorenz 

Fixes this driver on NetBSD/macppc.

Signed-off-by: Thomas Klausner 
---
 src/tdfx_driver.c | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/tdfx_driver.c b/src/tdfx_driver.c
index 03fa165..b15ff9c 100644
--- a/src/tdfx_driver.c
+++ b/src/tdfx_driver.c
@@ -661,7 +661,20 @@ TDFXInitChips(ScrnInfoPtr pScrn)
 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
   "TDFXInitChips: cfgbits = 0x%08lx\n", cfgbits);
 
-for (i = 0; i < pTDFX->numChips; i++) {
+if (pTDFX->numChips == 1) {
+  /*
+   * Do not fudge BARs with only one chip present.
+   */
+  pTDFX->MMIOAddr[0] = mem0base & 0xff00;
+  pTDFX->LinearAddr[0] = mem1base & 0xff00;
+  xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+"TDFXInitChips: MMIOAddr[%d] = 0x%08lx\n",
+0, pTDFX->MMIOAddr[0]);
+  xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+"TDFXInitChips: LinearAddr[%d] = 0x%08lx\n",
+0, pTDFX->LinearAddr[0]);
+} else {
+  for (i = 0; i < pTDFX->numChips; i++) {
PCI_WRITE_LONG(initbits | BIT(10), CFG_INIT_ENABLE, i);
 
 #if 0
@@ -692,6 +705,7 @@ TDFXInitChips(ScrnInfoPtr pScrn)
 
PCI_WRITE_LONG(cfgbits, CFG_PCI_DECODE, i);
PCI_WRITE_LONG(initbits, CFG_INIT_ENABLE, i);
+  }
 }
 }
 
@@ -2230,7 +2244,8 @@ TDFXScreenInit(SCREEN_INIT_ARGS_DECL) {
 
   if (!pTDFX->usePIO) TDFXSetMMIOAccess(pTDFX);
 
-#if USE_PCIVGAIO
+#ifndef USE_PCIVGAIO
+  /* access VGA registers through the IO BAR, not legacy decoding */
   hwp->PIOOffset = pTDFX->PIOBase[0] - 0x300;
 #endif
   vgaHWGetIOBase(hwp);
-- 
2.4.6

___
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:xf86-video-mga 2/2] Use correct type in function call.

2015-07-28 Thread Thomas Klausner
On Tue, Feb 24, 2015 at 07:47:09AM +0100, Mark Kettenis wrote:
> >  On Mon, Feb 23, 2015 at 4:28 AM, Thomas Klausner  wrote:
> > > Fixes
> > > passing argument 2 of 'pci_device_cfg_read_u32' from incompatible
> > > pointer type
> > > pciaccess.h:153:5: note: expected '__uint32_t *' but argument is of type
> > > 'CARD32 *'
> > >
> > > Signed-off-by: Thomas Klausner 
> > > ---
> > >  src/mga_dac3026.c | 6 +-
> > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/src/mga_dac3026.c b/src/mga_dac3026.c
> > > index 97c2c7a..e825702 100644
> > > --- a/src/mga_dac3026.c
> > > +++ b/src/mga_dac3026.c
> > > @@ -852,8 +852,12 @@ MGA3026Save(ScrnInfoPtr pScrn, vgaRegPtr vgaReg,
> > > MGARegPtr mgaReg,
> > > mgaReg->DacRegs[i]   = inTi3026(MGADACregs[i]);
> > >
> > >  #ifdef XSERVER_LIBPCIACCESS
> > > -   pci_device_cfg_read_u32(pMga->PciInfo, & mgaReg->Option,
> > > +{
> > > +   uint32_t Option;
> > > +   pci_device_cfg_read_u32(pMga->PciInfo, & Option,
> > > PCI_OPTION_REG);
> > > +mgaReg->Option = Option;
> >
> >  I don't understand why the previous code generated that warning (isn't
> >  __uint32_t* implicitly castable to CARD32*?)
> 
> On 32-bit systems, CARD32 is "unsigned long", whereas uint32_t is usually
> "unsigned int".  And since "int" and "long" might differ in size on other
> systems, the compiler (rightfully) complains.
> 
> >  but even so, why isn't a cast the appropriate solution?
> 
> Because casts almost never are the appropriate solution if they can be
> avoided?

Anything I can do to make progress with this patch?
 Thomas
___
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:xf86-video-mga] Fix pointer cast warning.

2015-07-28 Thread Thomas Klausner
So what can we do to make this progress?
 Thomas

On Thu, Feb 26, 2015 at 02:59:49AM -0500, Connor Behan wrote:
> On 25/02/15 06:41 PM, Tormod Volden wrote:
> >> And then disable the DownloadFromScreen() implementation, or perhaps
> >> even disable EXA altogether.
> > If nobody can find the real problem that is maybe all that can be done.
> The fix should be:
> 
> char *src = pExa->memoryBase + exaGetPixmapOffset(pSrc);
> 
> When I first saw exaGetPixmapFirstPixel() in savage and mga, I assumed
> this was just a shorthand for the above. But evidently it's not. As for
> other broken EXA drivers, I don't have hardware to test but some basic
> suggestions are:
> 
> 1. Use the above instead of pPix->devPrivate.ptr.
> 2. Make all hooks start by verifying that pSrc is non-NULL.
> 3. Remove UTS / DFS hooks unless they actually do a DRM blit.
> 


___
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] Adjust a NUL-string assignment to avoid const issues.

2015-07-28 Thread Thomas Klausner
From: Matthew Green 

Signed-off-by: Thomas Klausner 
---
 expr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/expr.c b/expr.c
index e0f957c..841ab07 100644
--- a/expr.c
+++ b/expr.c
@@ -729,8 +729,8 @@ ExprResolveString(ExprDef * expr,
 val_rtrn->str = XkbAtomGetString(NULL, expr->value.str);
 if (val_rtrn->str == NULL)
 {
-static const char *empty = "";
-val_rtrn->str = empty;
+static char empty_char = '\0';
+val_rtrn->str = &empty_char;
 }
 return True;
 case ExprIdent:
-- 
2.4.6

___
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/2] Add Bonaire 0x665F

2015-07-28 Thread Alex Deucher
On Sun, Jul 26, 2015 at 5:35 PM, Josef Larsson  wrote:
> The PCI ID was missing so the xorg radeon driver could not find my
> graphics card (XFX Radeon R7 360), so I added it and now it works fine:
>
> # lspci | grep VGA
> 01:00.0 VGA compatible controller: Advanced Micro Devices, Inc.
> [AMD/ATI] Device 665f (rev 81)
>
> Perhaps one should should also assume that a 0x665e revision also exists
> (I did not include this in the patches).
>
> This patch is for xserver, and I am not sure if it is necessary. The
> second patch (in next message) for xf86-video-ati however is absolutely
> necessary. Please note that this patch was applied on the tag
> xf86-video-ati-7.5.0 and will not apply cleanly on the master branch.

It's already included in xf86-video-ati:
http://cgit.freedesktop.org/xorg/driver/xf86-video-ati/commit/?id=7c4b78ab10b82c6dba9f72034ff7583859cca63d

Alex

>
> From 4f7417e6cfe36fdb6fbef003fc47a21ed00d10cc Mon Sep 17 00:00:00 2001
> From: Josef Larsson 
> Date: Sun, 26 Jul 2015 00:30:31 +0200
> Subject: [PATCH] Add Bonaire 0x665F
>
> ---
>  hw/xfree86/dri2/pci_ids/radeonsi_pci_ids.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/hw/xfree86/dri2/pci_ids/radeonsi_pci_ids.h
> b/hw/xfree86/dri2/pci_ids/radeonsi_pci_ids.h
> index 571e863..cd5da99 100644
> --- a/hw/xfree86/dri2/pci_ids/radeonsi_pci_ids.h
> +++ b/hw/xfree86/dri2/pci_ids/radeonsi_pci_ids.h
> @@ -85,6 +85,7 @@ CHIPSET(0x6651, BONAIRE_6651, BONAIRE)
>  CHIPSET(0x6658, BONAIRE_6658, BONAIRE)
>  CHIPSET(0x665C, BONAIRE_665C, BONAIRE)
>  CHIPSET(0x665D, BONAIRE_665D, BONAIRE)
> +CHIPSET(0x665F, BONAIRE_665F, BONAIRE)
>
>  CHIPSET(0x9830, KABINI_9830, KABINI)
>  CHIPSET(0x9831, KABINI_9831, KABINI)
> --
> 2.3.6
> ___
> 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