Re: [PATCH xserver] tests: Build test programs only when testing

2016-12-12 Thread Peter Hutterer
On Sun, Dec 11, 2016 at 07:45:44AM +0500, Mihail Konev wrote:
> Signed-off-by: Mihail Konev 
> ---
> In case it is the [exact] opposite of the effect intended
> (test linking of test programs on every build),
> should then this be conditioned as a ./configure option?

NAK, there's a reason we do that. If we only build them on testing, we're
quite likely to introduce build errors that no-one spots. This way even if
no-one runs the tests at least we know they build.

Cheers,
   Peter

> 
>  test/Makefile.am | 2 +-
>  test/xi1/Makefile.am | 2 +-
>  test/xi2/Makefile.am | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/test/Makefile.am b/test/Makefile.am
> index 064e1c5b736f..58165aa69236 100644
> --- a/test/Makefile.am
> +++ b/test/Makefile.am
> @@ -12,7 +12,7 @@ endif
>  endif
>  check_LTLIBRARIES = libxservertest.la
>  
> -noinst_PROGRAMS = \
> +check_PROGRAMS = \
>   simple-xinit \
>   $(TEST_PROGS) \
>   $(NULL)
> diff --git a/test/xi1/Makefile.am b/test/xi1/Makefile.am
> index 907fa7aea5f3..d0312b63f9a7 100644
> --- a/test/xi1/Makefile.am
> +++ b/test/xi1/Makefile.am
> @@ -1,6 +1,6 @@
>  if ENABLE_UNIT_TESTS
>  if HAVE_LD_WRAP
> -noinst_PROGRAMS =  \
> +check_PROGRAMS =  \
>   protocol-xchangedevicecontrol
>  
>  TESTS=$(noinst_PROGRAMS)
> diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
> index bfddfef133fd..fc5169fc4010 100644
> --- a/test/xi2/Makefile.am
> +++ b/test/xi2/Makefile.am
> @@ -1,6 +1,6 @@
>  if ENABLE_UNIT_TESTS
>  if HAVE_LD_WRAP
> -noinst_PROGRAMS =  \
> +check_PROGRAMS =  \
>   protocol-xiqueryversion \
>   protocol-xiquerydevice \
>   protocol-xiselectevents \
> -- 
> 2.9.2
> 
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel
> 
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH libX11] German Locale Updates

2016-12-12 Thread Matthias Dieter Wallnöfer
This commit adds the necessary changes to recognise the new de_IT locale
present in GLIBC 2.24 onwards.
It fixes also a small issue in the de_LI ISO8859-15 locale mapping.

https://bugs.freedesktop.org/show_bug.cgi?id=98857

Signed-off-by: Matthias Dieter Wallnöfer 
---
 nls/compose.dir.pre  |  3 +++
 nls/locale.alias.pre | 17 +
 nls/locale.dir.pre   |  5 -
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/nls/compose.dir.pre b/nls/compose.dir.pre
index e59cbe8..19db258 100644
--- a/nls/compose.dir.pre
+++ b/nls/compose.dir.pre
@@ -57,6 +57,8 @@ iso8859-1/Compose:de_CH.ISO8859-1
 iso8859-15/Compose:de_CH.ISO8859-15
 iso8859-1/Compose: de_DE.ISO8859-1
 iso8859-15/Compose:de_DE.ISO8859-15
+iso8859-1/Compose: de_IT.ISO8859-1
+iso8859-15/Compose:de_IT.ISO8859-15
 iso8859-1/Compose: de_LI.ISO8859-1
 iso8859-15/Compose:de_LI.ISO8859-15
 iso8859-1/Compose: de_LU.ISO8859-1
@@ -308,6 +310,7 @@ en_US.UTF-8/Compose:de_AT.UTF-8
 en_US.UTF-8/Compose:   de_BE.UTF-8
 en_US.UTF-8/Compose:   de_CH.UTF-8
 en_US.UTF-8/Compose:   de_DE.UTF-8
+en_US.UTF-8/Compose:   de_IT.UTF-8
 en_US.UTF-8/Compose:   de_LI.UTF-8
 en_US.UTF-8/Compose:   de_LU.UTF-8
 el_GR.UTF-8/Compose:   el_CY.UTF-8
diff --git a/nls/locale.alias.pre b/nls/locale.alias.pre
index d9f0785..49bc278 100644
--- a/nls/locale.alias.pre
+++ b/nls/locale.alias.pre
@@ -270,6 +270,22 @@ de_DE.8859-15@euro:
de_DE.ISO8859-15
 de_DE.ISO-8859-15@euro:de_DE.ISO8859-15
 de_DE.UTF-8@euro:  de_DE.UTF-8
 de_DE.utf8:de_DE.UTF-8
+de_IT: de_IT.ISO8859-1
+de_IT.iso88591:de_IT.ISO8859-1
+de_IT.ISO_8859-1:  de_IT.ISO8859-1
+de_IT.ISO-8859-1:  de_IT.ISO8859-1
+de_IT.iso885915:   de_IT.ISO8859-15
+de_IT.ISO_8859-15: de_IT.ISO8859-15
+de_IT.ISO-8859-15: de_IT.ISO8859-15
+de_IT.utf8:de_IT.UTF-8
+de_LI: de_LI.ISO8859-1
+de_LI.iso88591:de_LI.ISO8859-1
+de_LI.ISO_8859-1:  de_LI.ISO8859-1
+de_LI.ISO-8859-1:  de_LI.ISO8859-1
+de_LI.iso885915:   de_LI.ISO8859-15
+de_LI.ISO_8859-15: de_LI.ISO8859-15
+de_LI.ISO-8859-15: de_LI.ISO8859-15
+de_LI.utf8:de_LI.UTF-8
 de_LU: de_LU.ISO8859-1
 de_LU@euro:de_LU.ISO8859-15
 de_LU.iso88591:de_LU.ISO8859-1
@@ -1308,6 +1324,7 @@ Danish_Denmark.1252:  
da_DK.ISO8859-1
 German_Austria.1252:   de_AT.ISO8859-1
 German_Switzerland.1252:   de_CH.ISO8859-1
 German_Germany.1252:   de_DE.ISO8859-1
+German_Italy.1252: de_IT.ISO8859-1
 German_Liechtenstein.1252: de_LI.ISO8859-1
 German_Luxembourg.1252:de_LU.ISO8859-1
 Greek_Greece.1253: el_GR.ISO8859-7
diff --git a/nls/locale.dir.pre b/nls/locale.dir.pre
index c4740a7..97872c9 100644
--- a/nls/locale.dir.pre
+++ b/nls/locale.dir.pre
@@ -58,8 +58,10 @@ iso8859-1/XLC_LOCALE:de_CH.ISO8859-1
 iso8859-15/XLC_LOCALE: de_CH.ISO8859-15
 iso8859-1/XLC_LOCALE:  de_DE.ISO8859-1
 iso8859-15/XLC_LOCALE: de_DE.ISO8859-15
+iso8859-1/XLC_LOCALE:  de_IT.ISO8859-1
+iso8859-15/XLC_LOCALE: de_IT.ISO8859-15
 iso8859-1/XLC_LOCALE:  de_LI.ISO8859-1
-iso8859-1/XLC_LOCALE:  de_LI.ISO8859-15
+iso8859-15/XLC_LOCALE: de_LI.ISO8859-15
 iso8859-1/XLC_LOCALE:  de_LU.ISO8859-1
 iso8859-15/XLC_LOCALE: de_LU.ISO8859-15
 iso8859-7/XLC_LOCALE:  el_GR.ISO8859-7
@@ -310,6 +312,7 @@ en_US.UTF-8/XLC_LOCALE: de_AT.UTF-8
 en_US.UTF-8/XLC_LOCALE:de_BE.UTF-8
 en_US.UTF-8/XLC_LOCALE:de_CH.UTF-8
 en_US.UTF-8/XLC_LOCALE:de_DE.UTF-8
+en_US.UTF-8/XLC_LOCALE:de_IT.UTF-8
 en_US.UTF-8/XLC_LOCALE:de_LI.UTF-8
 en_US.UTF-8/XLC_LOCALE:de_LU.UTF-8
 en_US.UTF-8/XLC_LOCALE:el_CY.UTF-8
-- 
2.9.3

Re: [PATCH xserver 05/11] vfb: Remove -pixdepths option

2016-12-12 Thread Keith Packard
Adam Jackson  writes:

> I'm thinking we could just make the pixmap format list constant: depths
> 1, 4, 8, 12, 15, 16, 18, 24, 30, 32. (Yes 18, apparently r6g6b6 is a
> thing.) Why leave anything out, after all.

Sounds good. It almost does that already...

-- 
-keith


signature.asc
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver 11/11] shadow: Remove unused shadowAlloc

2016-12-12 Thread Adam Jackson
On Sat, 2016-12-10 at 09:27 -0800, Keith Packard wrote:
> Adam Jackson  writes:
> 
> > Signed-off-by: Adam Jackson 
> 
> Reviewed-by: Keith Packard 

Merged the reviewed bits, thanks:

remote: I: patch #126653 updated using rev 
e900a00f8dc5a1db63bafddd4ad1cde744975db1.
remote: I: patch #126655 updated using rev 
98caba9f5669291e84f8610cc3071a9ac2df205f.
remote: E: failed to find patch for rev 
2b486f052d8a7d3bada9eb2615aa19d79e999cbe.
remote: E: failed to find patch for rev 
1ae09800863992cfb1d5d21c600e2bc29e3b6ab2.
remote: I: patch #126659 updated using rev 
a530dc2a62349d922de77a75786a3795102aec11.
remote: I: patch #126660 updated using rev 
8d985c1e696bf46edaea0021f03f6f613ce37860.
remote: I: patch #126662 updated using rev 
6dd65a6e9bd41237afe7615bea1cc9510e82781a.
remote: I: 5 patch(es) updated to state Accepted.
To ssh://git.freedesktop.org/git/xorg/xserver
   8b335d9..6dd65a6  master -> master

- ajax
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver 08/11] shadow: Lift 32->24 conversion from modesetting to dix

2016-12-12 Thread Adam Jackson
On Sat, 2016-12-10 at 09:24 -0800, Keith Packard wrote:
> Adam Jackson  writes:
> 
> > Signed-off-by: Adam Jackson 
> 
> Seems like a bunch of the other logic in msUpdatePacked might want to
> move someday too?

It might be cool to move that feature up, yeah. I think tigervnc has an
similar trick in their ddx to minimize the number of tiles they write
to the viewer.

- ajax
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [edid-decode] [PATCH 2/2] Calculate DisplayID checksums. Refactor do_checksum.

2016-12-12 Thread walter harms


Am 10.12.2016 20:44, schrieb Mark Ferry:
> ---
>  edid-decode.c | 40 +---
>  1 file changed, 25 insertions(+), 15 deletions(-)
> 
> diff --git a/edid-decode.c b/edid-decode.c
> index c18697f..6df2b6e 100644
> --- a/edid-decode.c
> +++ b/edid-decode.c
> @@ -47,6 +47,7 @@ static int has_range_descriptor = 0;
>  static int has_preferred_timing = 0;
>  static int has_valid_checksum = 1;
>  static int has_valid_cvt = 1;
> +static int has_valid_displayid_checksum = 1;
>  static int has_valid_dummy_block = 1;
>  static int has_valid_week = 0;
>  static int has_valid_year = 0;
> @@ -560,23 +561,27 @@ detailed_block(unsigned char *x, int in_extension)
>  return 1;
>  }
>  
> -static void
> -do_checksum(unsigned char *x)
> +static unsigned char
> +do_checksum(unsigned char *x, size_t len)
>  {
> -printf("Checksum: 0x%hx", x[0x7f]);
> -{
> - unsigned char sum = 0;
> - int i;
> - for (i = 0; i < 128; i++)
> - sum += x[i];
> - if (sum) {
> - printf(" (should be 0x%hx)", (unsigned char)(x[0x7f] - sum));
> - has_valid_checksum = 0;
> - } else printf(" (valid)");
> -}
> +unsigned char sum = 0;
> +int i;
> +
> +printf("Checksum: 0x%hx", x[len -1]);
> +
> +for (i = 0; i < len; i++)
> +sum += x[i];
> +
> +if (sum) {
> +printf(" (should be 0x%hx)", (unsigned char)(x[len-1] - sum));
> +} else printf(" (valid)");
> +
>  printf("\n");

any reason not to move the \n to the printf in front ?
just thinking of it ..
perhaps this can be reduced to invalid/valid ? i do not know anyone
seeing more in that information.
then you can simply return 0/-1.

> +
> +return sum;
>  }
>  
> +
>  /* CEA extension */
>  
>  static const char *
> @@ -1281,7 +1286,7 @@ parse_cea(unsigned char *x)
>   detailed_block(detailed, 1);
>  } while (0);
>  
> -do_checksum(x);
> +(void) do_checksum(x, 128);
>  
>  return ret;
>  }
> @@ -1371,6 +1376,9 @@ parse_displayid(unsigned char *x)
>  int ext_count = x[4];
>  int i;
>  printf("Length %d, version %d, extension count %d\n", length, version, 
> ext_count);
> +
> +has_valid_displayid_checksum = (do_checksum(x+1, length + 5) == 0x0);
> +
>  int offset = 5;
>  while (length > 0) {
> int tag = x[offset];
> @@ -2037,7 +2045,7 @@ int main(int argc, char **argv)
>   has_valid_extension_count = 1;
>  }
>  
> -do_checksum(edid);
> +(void) do_checksum(edid, 128);
>  
in General i am a fan of checking return values,
why not here ?
and why the magic 128 ?
Perhaps we can avoid the global ?

hope that helps,
re,
 wh

>  x = edid;
>  for (edid_lines /= 8; edid_lines > 1; edid_lines--) {
> @@ -2127,6 +2135,8 @@ int main(int argc, char **argv)
>   printf("\tInvalid detailed timing descriptor ordering\n");
>   if (!has_valid_range_descriptor)
>   printf("\tRange descriptor contains garbage\n");
> + if (!has_valid_displayid_checksum)
> + printf("\tBlock has broken DisplayID checksum\n");
>   if (!has_valid_max_dotclock)
>   printf("\tEDID 1.4 block does not set max dotclock\n");
>  }
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver 05/11] vfb: Remove -pixdepths option

2016-12-12 Thread Adam Jackson
On Sat, 2016-12-10 at 09:09 -0800, Keith Packard wrote:
> > Adam Jackson  writes:
> 
> > This really isn't especially useful, and we'd rather not be in the
> > business of supporting arbitrary pixel formats.
> 
> I recall playing with this when I heard of a strange piece of hardware
> DEC was planning on making (depth 1, 8 bpp), but it wasn't all that
> useful.
> 
> However, I'd say it remains useful for testing software rendering code
> for depth 12, 15 and 30. Those are no longer included in the default set
> of depths provided by vfb, leaving us no easy way to validate them.

I'm thinking we could just make the pixmap format list constant: depths
1, 4, 8, 12, 15, 16, 18, 24, 30, 32. (Yes 18, apparently r6g6b6 is a
thing.) Why leave anything out, after all.

- ajax
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver] Revert "damage: Make damageRegionProcessPending take a damage not a drawable"

2016-12-12 Thread Adam Jackson
The commit message makes the assertion that the code below damage is not
allowed to change whether there's a damage monitor for the drawable.
That turns out not to be the case! exa's mixed code, at least, will
create and destroy a damage in PrepareAccess. The destroy path can then
be catastrophic, as damageRegionProcessPending will attempt to
RegionEmpty memory from the middle of a freed block.

I'd wanted that invariant for performance, but faster isn't worth
broken, so revert it. I think what exa's doing is reasonable, so the
better way to improve performance for the unmonitored case is to either
revisit dynamically wrapping into the GC, or inline damage into dix.

This reverts commit 4e124203f2260daaf54155f4a05fe469733e0b97.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1389886
Signed-off-by: Adam Jackson 
---
 miext/damage/damage.c | 121 +-
 1 file changed, 60 insertions(+), 61 deletions(-)

diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index 17c2abf..d6a3614 100644
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -282,8 +282,10 @@ damageRegionAppend(DrawablePtr pDrawable, RegionPtr 
pRegion, Bool clip,
 }
 
 static void
-damageRegionProcessPending(DamagePtr pDamage)
+damageRegionProcessPending(DrawablePtr pDrawable)
 {
+drawableDamage(pDrawable);
+
 for (; pDamage != NULL; pDamage = pDamage->pNext) {
 if (pDamage->reportAfter) {
 /* It's possible that there is only interest in postRendering 
reporting. */
@@ -358,7 +360,6 @@ damageCreateGC(GCPtr pGC)
 
 #define DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable) \
 damageGCPriv(pGC);  \
-drawableDamage(pDrawable); \
 const GCFuncs *oldFuncs = pGC->funcs; \
 unwrap(pGCPriv, pGC, funcs);  \
 unwrap(pGCPriv, pGC, ops); \
@@ -456,7 +457,7 @@ damageDestroyClip(GCPtr pGC)
 #define BOX_NOT_EMPTY(box) \
 (((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0))
 
-#define checkGCDamage(d,g) (d && \
+#define checkGCDamage(d,g) (getDrawableDamage(d) && \
 (!g->pCompositeClip ||\
  RegionNotEmpty(g->pCompositeClip)))
 
@@ -468,7 +469,8 @@ damageDestroyClip(GCPtr pGC)
 if(box.y2 > extents->y2) box.y2 = extents->y2; \
 }
 
-#define checkPictureDamage(d, p) (d && RegionNotEmpty(p->pCompositeClip))
+#define checkPictureDamage(p)  (getDrawableDamage(p->pDrawable) && \
+RegionNotEmpty(p->pCompositeClip))
 
 static void
 damageComposite(CARD8 op,
@@ -485,9 +487,8 @@ damageComposite(CARD8 op,
 PictureScreenPtr ps = GetPictureScreen(pScreen);
 
 damageScrPriv(pScreen);
-drawableDamage(pDst->pDrawable);
 
-if (checkPictureDamage(pDamage, pDst)) {
+if (checkPictureDamage(pDst)) {
 BoxRec box;
 
 box.x1 = xDst + pDst->pDrawable->x;
@@ -504,7 +505,7 @@ damageComposite(CARD8 op,
   pMask,
   pDst,
   xSrc, ySrc, xMask, yMask, xDst, yDst, width, height);
-damageRegionProcessPending(pDamage);
+damageRegionProcessPending(pDst->pDrawable);
 wrap(pScrPriv, ps, Composite, damageComposite);
 }
 
@@ -520,9 +521,8 @@ damageGlyphs(CARD8 op,
 PictureScreenPtr ps = GetPictureScreen(pScreen);
 
 damageScrPriv(pScreen);
-drawableDamage(pDst->pDrawable);
 
-if (checkPictureDamage(pDamage, pDst)) {
+if (checkPictureDamage(pDst)) {
 int nlistTmp = nlist;
 GlyphListPtr listTmp = list;
 GlyphPtr *glyphsTmp = glyphs;
@@ -567,7 +567,7 @@ damageGlyphs(CARD8 op,
 }
 unwrap(pScrPriv, ps, Glyphs);
 (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, 
glyphs);
-damageRegionProcessPending(pDamage);
+damageRegionProcessPending(pDst->pDrawable);
 wrap(pScrPriv, ps, Glyphs, damageGlyphs);
 }
 
@@ -579,9 +579,8 @@ damageAddTraps(PicturePtr pPicture,
 PictureScreenPtr ps = GetPictureScreen(pScreen);
 
 damageScrPriv(pScreen);
-drawableDamage(pPicture->pDrawable);
 
-if (checkPictureDamage(pDamage, pPicture)) {
+if (checkPictureDamage(pPicture)) {
 BoxRec box;
 int i;
 int x, y;
@@ -616,7 +615,7 @@ damageAddTraps(PicturePtr pPicture,
 }
 unwrap(pScrPriv, ps, AddTraps);
 (*ps->AddTraps) (pPicture, x_off, y_off, ntrap, traps);
-damageRegionProcessPending(pDamage);
+damageRegionProcessPending(pPicture->pDrawable);
 wrap(pScrPriv, ps, AddTraps, damageAddTraps);
 }
 
@@ -628,7 +627,7 @@ damageFillSpans(DrawablePtr pDrawable,
 {
 DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
 
-if (npt && checkGCDamage(pDamage, pGC)) {
+if (npt && checkGCDamage(pDrawable, pGC)) {
 int nptTmp = npt;
 DDXPointPtr pptTmp = ppt;
 int *pwidthTmp = pwidth;
@@ -664,7 +663,7 @@ damageFillSpans(DrawablePtr pDrawable,
 
 (*pGC->ops->FillSpans) (pDrawable, pGC, npt, ppt, pwidth, fSorted);
 
-

[PATCH xserver 5/6] xfree86: Allow overriding primary GPU detection from an OutputClass section

2016-12-12 Thread Hans de Goede
Allow using:

Option "PrimaryGPU" "yes"

In an OutputClass section to override the default primary GPU device
selection which selects the GPU used as output by the firmware.

If multiple output devices match an OutputClass section with
the PrimaryGPU option set, the first one enumerated becomes the
primary GPU.

Signed-off-by: Hans de Goede 
---
 hw/xfree86/common/xf86platformBus.c | 19 +++
 hw/xfree86/man/xorg.conf.man| 12 +++-
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/hw/xfree86/common/xf86platformBus.c 
b/hw/xfree86/common/xf86platformBus.c
index fb4b6ea..665bb74 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -287,6 +287,7 @@ xf86platformProbe(void)
 {
 int i;
 Bool pci = TRUE;
+XF86ConfOutputClassPtr cl;
 
 config_odev_probe(xf86PlatformDeviceProbe);
 
@@ -302,6 +303,24 @@ xf86platformProbe(void)
 }
 }
 
+/* First see if there is an OutputClass match marking a device as primary 
*/
+for (i = 0; i < xf86_num_platform_devices; i++) {
+struct xf86_platform_device *dev = _platform_devices[i];
+for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) 
{
+if (!OutputClassMatches(cl, dev))
+continue;
+
+if (xf86CheckBoolOption(cl->option_lst, "PrimaryGPU", FALSE)) {
+xf86Msg(X_CONFIG, "OutputClass \"%s\" setting %s as 
PrimaryGPU\n",
+cl->identifier, dev->attribs->path);
+primaryBus.type = BUS_PLATFORM;
+primaryBus.id.plat = dev;
+return 0;
+}
+}
+}
+
+/* Then check for pci_device_is_boot_vga() */
 for (i = 0; i < xf86_num_platform_devices; i++) {
 struct xf86_platform_device *dev = _platform_devices[i];
 
diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
index 990a3be..4668957 100644
--- a/hw/xfree86/man/xorg.conf.man
+++ b/hw/xfree86/man/xorg.conf.man
@@ -1291,11 +1291,21 @@ When an output device has been matched to the
 .B OutputClass
 section, any
 .B Option
-entries are applied to the device. See the
+entries are applied to the device. One
+.B OutputClass
+specific
+.B Option
+is recognized. See the
 .B Device
 section below for a description of the remaining
 .B Option
 entries.
+.TP 7
+.BI "Option \*qPrimaryGPU\*q \*q" boolean \*q
+This option specifies that the matched device should be treated as the
+primary GPU, replacing the selection of the GPU used as output by the
+firmware. If multiple output devices match an OutputClass section with
+the PrimaryGPU option set, the first one enumerated becomes the primary GPU.
 .SH "DEVICE SECTION"
 The config file may have multiple
 .B Device
-- 
2.9.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 6/6] xfree86: Add ModulePath support for OutputClass config Sections

2016-12-12 Thread Hans de Goede
Allow OutputClass config snippets to modify the module-path.

Note that any specified ModulePaths will be pre-pended to the normal
ModulePath. The idea behind this is that any output hardware specific
modules should have preference over the normal modules.

One use-case for this is the nvidia binary driver, this allows a
config snippet like this:

Section "OutputClass"
MatchDriver "nvidia"
Modulepath "/usr/lib64/nvidia/modules"
EndSection

To get the nvidia glx specific glx module loaded, but only when the
nvidia kernel driver is loaded.

Together with the glvnd work done recently, this allows the nouveau
+ mesa and nvidia-binary userspace stacks to co-exist on the same
system without any ldconfig / xorg.conf tweaking and the xserver will
automatically do the right thing depending on which kernel driver
(nouveau or nvidia) is loaded.

Signed-off-by: Hans de Goede 
---
 hw/xfree86/common/xf86platformBus.c | 23 +++
 hw/xfree86/loader/loadmod.c |  1 +
 hw/xfree86/man/xorg.conf.man| 16 
 hw/xfree86/parser/OutputClass.c | 15 +++
 hw/xfree86/parser/xf86Parser.h  |  1 +
 5 files changed, 56 insertions(+)

diff --git a/hw/xfree86/common/xf86platformBus.c 
b/hw/xfree86/common/xf86platformBus.c
index 665bb74..61bd75b 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -40,6 +40,7 @@
 #include "hotplug.h"
 #include "systemd-logind.h"
 
+#include "loaderProcs.h"
 #include "xf86.h"
 #include "xf86_OSproc.h"
 #include "xf86Priv.h"
@@ -288,6 +289,7 @@ xf86platformProbe(void)
 int i;
 Bool pci = TRUE;
 XF86ConfOutputClassPtr cl;
+char *old_path, *path = NULL;
 
 config_odev_probe(xf86PlatformDeviceProbe);
 
@@ -301,8 +303,29 @@ xf86platformProbe(void)
 if (pci && (strncmp(busid, "pci:", 4) == 0)) {
 platform_find_pci_info(_platform_devices[i], busid);
 }
+
+/*
+ * Deal with OutputClass ModulePath directives, these must be
+ * processed before we do any module loading.
+ */
+for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) 
{
+if (!OutputClassMatches(cl, _platform_devices[i]))
+continue;
+
+if (cl->modulepath && xf86ModPathFrom != X_CMDLINE) {
+old_path = path;
+XNFasprintf(, "%s,%s", cl->modulepath,
+path ? path : xf86ModulePath);
+free(old_path);
+xf86Msg(X_CONFIG, "OutputClass \"%s\" ModulePath extended to 
\"%s\"\n",
+cl->identifier, path);
+LoaderSetPath(path);
+}
+}
 }
 
+free(path);
+
 /* First see if there is an OutputClass match marking a device as primary 
*/
 for (i = 0; i < xf86_num_platform_devices; i++) {
 struct xf86_platform_device *dev = _platform_devices[i];
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 8bf6836..940f5fc 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -184,6 +184,7 @@ LoaderSetPath(const char *path)
 if (!path)
 return;
 
+FreeStringList(defaultPathList);
 defaultPathList = InitPathList(path);
 }
 
diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
index 4668957..5a68f24 100644
--- a/hw/xfree86/man/xorg.conf.man
+++ b/hw/xfree86/man/xorg.conf.man
@@ -1306,6 +1306,22 @@ This option specifies that the matched device should be 
treated as the
 primary GPU, replacing the selection of the GPU used as output by the
 firmware. If multiple output devices match an OutputClass section with
 the PrimaryGPU option set, the first one enumerated becomes the primary GPU.
+.PP
+A
+.B OutputClass
+Section may contain
+.B ModulePath
+entries. When an output device matches an
+.B OutputClass
+section, any
+.B ModulePath
+entries in that
+.B OutputClass
+are pre-pended to the search path for loadable Xorg server modules. See
+.B ModulePath
+in the
+.B Files
+section for more info.
 .SH "DEVICE SECTION"
 The config file may have multiple
 .B Device
diff --git a/hw/xfree86/parser/OutputClass.c b/hw/xfree86/parser/OutputClass.c
index f813ee6..01b348f 100644
--- a/hw/xfree86/parser/OutputClass.c
+++ b/hw/xfree86/parser/OutputClass.c
@@ -36,6 +36,7 @@ static const xf86ConfigSymTabRec OutputClassTab[] = {
 {ENDSECTION, "endsection"},
 {IDENTIFIER, "identifier"},
 {DRIVER, "driver"},
+{MODULEPATH, "modulepath"},
 {OPTION, "option"},
 {MATCH_DRIVER, "matchdriver"},
 {-1, ""},
@@ -53,6 +54,7 @@ xf86freeOutputClassList(XF86ConfOutputClassPtr ptr)
 TestFree(ptr->identifier);
 TestFree(ptr->comment);
 TestFree(ptr->driver);
+TestFree(ptr->modulepath);
 
 xorg_list_for_each_entry_safe(group, next, >match_driver, entry) {
 xorg_list_del(>entry);
@@ -115,6 +117,19 @@ 

[PATCH xserver 3/6] xfree86: Add options support for OutputClass Options

2016-12-12 Thread Hans de Goede
Add support for setting options in OutputClass Sections and having these
applied to any matching output devices.

Signed-off-by: Hans de Goede 
---
 hw/xfree86/common/xf86Option.c  |  5 -
 hw/xfree86/common/xf86platformBus.c | 42 +
 hw/xfree86/common/xf86platformBus.h |  2 ++
 hw/xfree86/man/xorg.conf.man| 10 +
 hw/xfree86/parser/OutputClass.c |  6 ++
 hw/xfree86/parser/xf86Parser.h  |  1 +
 6 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
index 0e8bc1f..929724d 100644
--- a/hw/xfree86/common/xf86Option.c
+++ b/hw/xfree86/common/xf86Option.c
@@ -44,6 +44,7 @@
 #include "xf86Xinput.h"
 #include "xf86Optrec.h"
 #include "xf86Parser.h"
+#include "xf86platformBus.h" /* For OutputClass functions */
 #include "optionstr.h"
 
 static Bool ParseOptionValue(int scrnIndex, XF86OptionPtr options,
@@ -64,7 +65,7 @@ static Bool ParseOptionValue(int scrnIndex, XF86OptionPtr 
options,
  *
  * The order of precedence for options is:
  *
- *   extraOpts, display, confScreen, monitor, device
+ *   extraOpts, display, confScreen, monitor, device, outputClassOptions
  */
 
 void
@@ -79,6 +80,8 @@ xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts)
 pScrn->options = NULL;
 
 for (i = pScrn->numEntities - 1; i >= 0; i--) {
+xf86MergeOutputClassOptions(pScrn->entityList[i], >options);
+
 device = xf86GetDevFromEntity(pScrn->entityList[i],
   pScrn->entityInstanceList[i]);
 if (device && device->options) {
diff --git a/hw/xfree86/common/xf86platformBus.c 
b/hw/xfree86/common/xf86platformBus.c
index d1c2d1a..96816c5 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -311,6 +311,48 @@ xf86platformProbe(void)
 return 0;
 }
 
+void
+xf86MergeOutputClassOptions(int entityIndex, void **options)
+{
+const EntityPtr entity = xf86Entities[entityIndex];
+struct xf86_platform_device *dev = NULL;
+XF86ConfOutputClassPtr cl;
+XF86OptionPtr classopts;
+int i = 0;
+
+switch (entity->bus.type) {
+case BUS_PLATFORM:
+dev = entity->bus.id.plat;
+break;
+case BUS_PCI:
+for (i = 0; i < xf86_num_platform_devices; i++) {
+if (MATCH_PCI_DEVICES(xf86_platform_devices[i].pdev,
+  entity->bus.id.pci)) {
+dev = _platform_devices[i];
+break;
+}
+}
+break;
+default:
+xf86Msg(X_DEBUG, "xf86MergeOutputClassOptions unsupported bus type 
%d\n",
+entity->bus.type);
+}
+
+if (!dev)
+return;
+
+for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
+if (!OutputClassMatches(cl, dev) || !cl->option_lst)
+continue;
+
+xf86Msg(X_INFO, "Applying OutputClass \"%s\" options to %s\n",
+cl->identifier, dev->attribs->path);
+
+classopts = xf86optionListDup(cl->option_lst);
+*options = xf86optionListMerge(*options, classopts);
+}
+}
+
 static int
 xf86ClaimPlatformSlot(struct xf86_platform_device * d, DriverPtr drvp,
   int chipset, GDevPtr dev, Bool active)
diff --git a/hw/xfree86/common/xf86platformBus.h 
b/hw/xfree86/common/xf86platformBus.h
index 0f5c0ef..70d9ec8 100644
--- a/hw/xfree86/common/xf86platformBus.h
+++ b/hw/xfree86/common/xf86platformBus.h
@@ -42,6 +42,7 @@ struct xf86_platform_device {
 int xf86platformProbe(void);
 int xf86platformProbeDev(DriverPtr drvp);
 int xf86platformAddGPUDevices(DriverPtr drvp);
+void xf86MergeOutputClassOptions(int entityIndex, void **options);
 
 extern int xf86_num_platform_devices;
 extern struct xf86_platform_device *xf86_platform_devices;
@@ -161,6 +162,7 @@ extern void xf86platformPrimary(void);
 #else
 
 static inline int xf86platformAddGPUDevices(DriverPtr drvp) { return FALSE; }
+static inline void xf86MergeOutputClassOptions(int index, void **options) {}
 
 #endif
 
diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
index 3e596e4..990a3be 100644
--- a/hw/xfree86/man/xorg.conf.man
+++ b/hw/xfree86/man/xorg.conf.man
@@ -1286,6 +1286,16 @@ For example:
 Check the case-sensitive string
 .RI \*q matchdriver \*q
 against the kernel driver of the device.
+.PP
+When an output device has been matched to the
+.B OutputClass
+section, any
+.B Option
+entries are applied to the device. See the
+.B Device
+section below for a description of the remaining
+.B Option
+entries.
 .SH "DEVICE SECTION"
 The config file may have multiple
 .B Device
diff --git a/hw/xfree86/parser/OutputClass.c b/hw/xfree86/parser/OutputClass.c
index 8064e0c..f813ee6 100644
--- a/hw/xfree86/parser/OutputClass.c
+++ b/hw/xfree86/parser/OutputClass.c
@@ -36,6 +36,7 @@ static const xf86ConfigSymTabRec OutputClassTab[] = {
 {ENDSECTION, 

[PATCH xserver 0/6] xfree86: Extend OutputClass config sections

2016-12-12 Thread Hans de Goede
Hi All,

This patch series main goal (*) is to allow the nvidia binary driver
to install a xorg.conf snippet with the following contents:

Section "OutputClass"
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
Option "PrimaryGPU" "yes"
ModulePath "/usr/lib64/nvidia/xorg"
EndSection

This snippet has 2 purposes:

1) Make the xserver autoconfig code automatically set things up the
right way for the nvidia driver on optimus enabled laptops. This way
the nvidia driver will just work on such setups without the user needing
to write / use a laptop model specific xorg.conf, this is the main goal
of this series

2) Make the xserver add "/usr/lib64/nvidia/xorg" to the front of the
module search-path when the nvidia driver is in use. Before this patch-set
the nvidia driver would drop a config snippet which unconditionally
does this, causing the xserver to always load the nvidia glx module
instead of its own glx module.

Making the adding of "/usr/lib64/nvidia/xorg" conditional, fixes the
server using the wrong glx module when the nvidia kernel module did not
get loaded for some reason. This fixes e.g. gdm not working due to
broken glx support, requiring the user to reboot into text-only or
single user mode to fix things. Now we will atleast still give the
user a gui to e.g. go on a forum to ask for help.

Together with glvnd support for mesa this actually means that the
nouveau/modesetting + mesa user-space can be fully parallel installed with
the nvidia driver user-space and the xserver will just do the right thing
(depending on the loaded kernel module) and everything will just work. This
will also allow for easier switching between nouveau and the nvidia driver.

Regards,

Hans


*) I can imagine some other uses for it too, I've tried to keep this as
generic as possible.
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 4/6] xfree86: xf86platformProbe: split finding pci-info and setting primary GPU

2016-12-12 Thread Hans de Goede
This is a preparation patch for allowing an OutputClass section to
override the default primary GPU device selection.

Signed-off-by: Hans de Goede 
---
 hw/xfree86/common/xf86platformBus.c | 23 +++
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/hw/xfree86/common/xf86platformBus.c 
b/hw/xfree86/common/xf86platformBus.c
index 96816c5..fb4b6ea 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -146,16 +146,9 @@ platform_find_pci_info(struct xf86_platform_device *pd, 
char *busid)
 
 iter = pci_slot_match_iterator_create();
 info = pci_device_next(iter);
-if (info) {
+if (info)
 pd->pdev = info;
-pci_device_probe(info);
-if (pci_device_is_boot_vga(info)) {
-primaryBus.type = BUS_PLATFORM;
-primaryBus.id.plat = pd;
-}
-}
 pci_iterator_destroy(iter);
-
 }
 
 static Bool
@@ -308,6 +301,20 @@ xf86platformProbe(void)
 platform_find_pci_info(_platform_devices[i], busid);
 }
 }
+
+for (i = 0; i < xf86_num_platform_devices; i++) {
+struct xf86_platform_device *dev = _platform_devices[i];
+
+if (!dev->pdev)
+continue;
+
+pci_device_probe(dev->pdev);
+if (pci_device_is_boot_vga(dev->pdev)) {
+primaryBus.type = BUS_PLATFORM;
+primaryBus.id.plat = dev;
+}
+}
+
 return 0;
 }
 
-- 
2.9.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 2/6] xfree86: Make OutputClassMatches take a xf86_platform_device

2016-12-12 Thread Hans de Goede
Make OutputClassMatches directly take a xf86_platform_device as argument,
rather then an index into xf86_platform_devices. This makes things
easier for callers which already have a xf86_platform_device pointer.

Signed-off-by: Hans de Goede 
---
 hw/xfree86/common/xf86platformBus.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/xfree86/common/xf86platformBus.c 
b/hw/xfree86/common/xf86platformBus.c
index c8378a5..d1c2d1a 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -215,9 +215,10 @@ MatchToken(const char *value, struct xorg_list *patterns,
 }
 
 static Bool
-OutputClassMatches(const XF86ConfOutputClassPtr oclass, int index)
+OutputClassMatches(const XF86ConfOutputClassPtr oclass,
+   struct xf86_platform_device *dev)
 {
-char *driver = xf86_platform_odev_attributes(index)->driver;
+char *driver = dev->attribs->driver;
 
 if (!MatchToken(driver, >match_driver, strcmp))
 return FALSE;
@@ -235,7 +236,7 @@ xf86OutputClassDriverList(int index, char *matches[], int 
nmatches)
 return 0;
 
 for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
-if (OutputClassMatches(cl, index)) {
+if (OutputClassMatches(cl, _platform_devices[index])) {
 char *path = xf86_platform_odev_attributes(index)->path;
 
 xf86Msg(X_INFO, "Applying OutputClass \"%s\" to %s\n",
-- 
2.9.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 1/6] xfree86: Free devlist returned by xf86MatchDevice

2016-12-12 Thread Hans de Goede
xf86MatchDevice returns a dynamically allocated list of GDevPtr-s,
free this when we're done with it.

Signed-off-by: Hans de Goede 
---
 hw/xfree86/common/xf86platformBus.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/hw/xfree86/common/xf86platformBus.c 
b/hw/xfree86/common/xf86platformBus.c
index 42789ca..c8378a5 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -480,6 +480,8 @@ xf86platformProbeDev(DriverPtr drvp)
 isGPUDevice(devList[i]) ? 
PLATFORM_PROBE_GPU_SCREEN : 0);
 }
 
+free(devList);
+
 return foundScreen;
 }
 
@@ -506,6 +508,8 @@ xf86platformAddGPUDevices(DriverPtr drvp)
 }
 }
 
+free(devList);
+
 return foundScreen;
 }
 
-- 
2.9.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver] xinerama: Swap the response in RRXineramaWriteMonitor.

2016-12-12 Thread Michal Srb
diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c
index b6e9586..8f499df 100644
--- a/randr/rrxinerama.c
+++ b/randr/rrxinerama.c
@@ -260,6 +260,13 @@ RRXineramaWriteMonitor(ClientPtr client, RRMonitorPtr 
monitor)
 scratch.width = monitor->geometry.box.x2 - monitor->geometry.box.x1;
 scratch.height = monitor->geometry.box.y2 - monitor->geometry.box.y1;
 
+if (client->swapped) {
+swaps(_org);
+swaps(_org);
+swaps();
+swaps();
+}
+
 WriteToClient(client, sz_XineramaScreenInfo, );
 }
 

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel