Re: [Mesa-dev] [Intel-gfx] gitlab.fd.o financial situation and impact on services

2020-02-29 Thread Eric Anholt
On Fri, Feb 28, 2020 at 12:48 AM Dave Airlie  wrote:
>
> On Fri, 28 Feb 2020 at 18:18, Daniel Stone  wrote:
> >
> > On Fri, 28 Feb 2020 at 03:38, Dave Airlie  wrote:
> > > b) we probably need to take a large step back here.
> > >
> > > Look at this from a sponsor POV, why would I give X.org/fd.o
> > > sponsorship money that they are just giving straight to google to pay
> > > for hosting credits? Google are profiting in some minor way from these
> > > hosting credits being bought by us, and I assume we aren't getting any
> > > sort of discounts here. Having google sponsor the credits costs google
> > > substantially less than having any other company give us money to do
> > > it.
> >
> > The last I looked, Google GCP / Amazon AWS / Azure were all pretty
> > comparable in terms of what you get and what you pay for them.
> > Obviously providers like Packet and Digital Ocean who offer bare-metal
> > services are cheaper, but then you need to find someone who is going
> > to properly administer the various machines, install decent
> > monitoring, make sure that more storage is provisioned when we need
> > more storage (which is basically all the time), make sure that the
> > hardware is maintained in decent shape (pretty sure one of the fd.o
> > machines has had a drive in imminent-failure state for the last few
> > months), etc.
> >
> > Given the size of our service, that's a much better plan (IMO) than
> > relying on someone who a) isn't an admin by trade, b) has a million
> > other things to do, and c) hasn't wanted to do it for the past several
> > years. But as long as that's the resources we have, then we're paying
> > the cloud tradeoff, where we pay more money in exchange for fewer
> > problems.
>
> Admin for gitlab and CI is a full time role anyways. The system is
> definitely not self sustaining without time being put in by you and
> anholt still. If we have $75k to burn on credits, and it was diverted
> to just pay an admin to admin the real hw + gitlab/CI would that not
> be a better use of the money? I didn't know if we can afford $75k for
> an admin, but suddenly we can afford it for gitlab credits?

As I think about the time that I've spent at google in less than a
year on trying to keep the lights on for CI and optimize our
infrastructure in the current cloud environment, that's more than the
entire yearly budget you're talking about here.  Saying "let's just
pay for people to do more work instead of paying for full-service
cloud" is not a cost optimization.


> > Yes, we could federate everything back out so everyone runs their own
> > builds and executes those. Tinderbox did something really similar to
> > that IIRC; not sure if Buildbot does as well. Probably rules out
> > pre-merge testing, mind.
>
> Why? does gitlab not support the model? having builds done in parallel
> on runners closer to the test runners seems like it should be a thing.
> I guess artifact transfer would cost less then as a result.

Let's do some napkin math.  The biggest artifacts cost we have in Mesa
is probably meson-arm64/meson-arm (60MB zipped from meson-arm64,
downloaded by 4 freedreno and 6ish lava, about 100 pipelines/day,
makes ~1.8TB/month ($180 or so).  We could build a local storage next
to the lava dispatcher so that the artifacts didn't have to contain
the rootfs that came from the container (~2/3 of the insides of the
zip file), but that's another service to build and maintain.  Building
the drivers once locally and storing it would save downloading the
other ~1/3 of the inside of the zip file, but that requires a big
enough system to do builds in time.

I'm planning on doing a local filestore for google's lava lab, since I
need to be able to move our xml files off of the lava DUTs to get the
xml results we've become accustomed to, but this would not bubble up
to being a priority for my time if I wasn't doing it anyway.  If it
takes me a single day to set all this up (I estimate a couple of
weeks), that costs my employer a lot more than sponsoring the costs of
the inefficiencies of the system that has accumulated.
___
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: Repos to archive?

2018-11-20 Thread Eric Anholt
Alan Coopersmith  writes:

> While iterating over all the /xorg/ repos to update their READMEs
> (which I think I've now finished - let me know if you spot one I missed),
> I noticed a few more to consider archiving:

I agree with your reasoning for all of these.


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: Migrating x.org wiki to GitLab

2018-11-14 Thread Eric Anholt
Zach  writes:

> Hello X.Org Developers,
>
> I have been working on migrating the x.org/wiki/ to GitLab pages. The
> tracking issue is at
> https://gitlab.freedesktop.org/freedesktop/freedesktop/issues/80 and
> the current development branch is at
> https://gitlab.freedesktop.org/zachr/xorg-wiki/tree/hugo. You can see
> the pages rendered from ToT at
> https://zachr.pages.freedesktop.org/xorg-wiki/.
>
> As part of the migration process, I have converted the markdown flavor
> from ikiwiki to hugo using a custom script. Not everything in the old
> flavor can be replicated practically in the new flavor, so there will
> be junk in the converted pages, unfortunately. As we identify which of
> the approximately 1000 converted pages is actually seen by human eyes,
> we will fix the glitches.
>
> Additionally, I have designed a new theme which is aiming for
> accessibility and clarity. What you see on there isn't final, but is
> hopefully good enough.
>
> When the migration is done, the primary advantage will be much more
> streamlined edits by the community. Thanks to the hugo static site
> generator, editors will be able to render locally in under 1 second to
> verify that their change renders nicely. Getting their change
> published is a simple merge request, and then the site automatically
> gets rebuilt and published by GitLab. If all goes well, the entire
> process can be done in 5 minutes.
>
> Please let me know if you have any objections or questions about the 
> migration.

I'd love to see ikiwiki go away and have people be able to edit the wiki
inside gitlab (as well as work from a local clone).  Does your
conversion let people do things from a web ui, or do they have to do
offline generation to test things?


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 app/fonttosfnt] Mark vsprintf_alloc as printf-like function

2018-11-01 Thread Eric Anholt
Peter Hutterer  writes:

> Signed-off-by: Peter Hutterer 
> ---
> Review this quickly please, we have another release coming up in 9 years
> time and I don't want to miss the merge window.

Reviewed-by: Eric Anholt 


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] miext/damage: take care of the coordinate mode in damagePolyPoint

2018-09-21 Thread Eric Anholt
Cedric Roux  writes:

> The mode (CoordModeOrigin or CoordModePrevious) was not taken into
> account when computing the box. The result was a bad drawing of
> points in some situations (on my hardware/software configuration,
> calling XDrawString followed by XDrawPoints in the mode
> CoordModePrevious).
>
> Signed-off-by: Cedric Roux 

Thanks for the fix!  I wrote up a little testsuite for damage that we
can use to test these bugs in the future and made a MR for the whole
thing:

https://gitlab.freedesktop.org/xorg/xserver/merge_requests/23


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] glamor_egl: request GL2.1 when requesting Desktop GL context

2018-09-06 Thread Eric Anholt
Icenowy Zheng  writes:

> Some devices cannot support OpenGL 2.1, which is the minimum desktop GL
> version required by glamor. However, they may support OpenGL ES 2.0,
> which is the GLES version required by glamor. Usually in this situation
> the desktop GL version supported is 2.0 or 1.4.
>
> Currently, as no requirements are passed when creating desktop GL
> context, a OpenGL 1.4/2.0 context will be created, and glamor will
> arguing that the context is not suitable, although the GPU supports a
> suitable GLES context.
>
> Add version number 2.1 requirement when requesting non-core desktop GL
> context (core context has at least 3.1), so it will fall back to create
> GLES contexts when the version number requirement is not met.
>
> Tested on a Intel 945GMS integrated GPU, which supports GL 1.4 and GLES
> 2.0. Before applying this, it will fail to launch X server when no
> configuration is present because of glamor initialization failure, after
> applying glamor will start with GLES.

In commit:

commit 4218a1e066cf39bb980ebbc9f69536c85232da5c
Author: Olivier Fourdan 
Date:   Thu Feb 5 11:59:22 2015 +0100

glamor: check max native ALU instructions

a check was introduced on desktop GL to keep i915 from using glamor,
because it just falls back to swrast all the time.  Before enabling
glamor on i915 again after Mesa stopped exposing desktop 2.x on i915
(for similar reasons, but for chromium), we would want to diagnose those
and have some less-slow-paths for glamor on i915.


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

[PATCH xserver] glamor: Add support for exporting depth 16 pixmaps.

2018-09-04 Thread Eric Anholt
With a patch to mesa to expose rgb565 pbuffers even on a server with
only depth 24 and 32 visuals, fixes
dEQP-EGL.functional.render.single_context.gles2.rgb565_pbuffer.  Those
pbuffers (or at least something renderable with 565) are required by
the current CTS for GLES3, and having the server support DRI3 on those
pixmaps means that we can avoid having a different path for EGL
pbuffers compared to pixmaps.

Signed-off-by: Eric Anholt 
---
 glamor/glamor_egl.c | 22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index b33d8ef1598e..df278b1a1a02 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -280,18 +280,24 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap, Bool 
modifiers_ok)
 (modifiers_ok || !pixmap_priv->used_modifiers))
 return TRUE;
 
-if (pixmap->drawable.bitsPerPixel != 32) {
+switch (pixmap->drawable.depth) {
+case 30:
+format = GBM_FORMAT_ARGB2101010;
+break;
+case 32:
+case 24:
+format = GBM_FORMAT_ARGB;
+break;
+case 16:
+format = GBM_FORMAT_RGB565;
+break;
+default:
 xf86DrvMsg(scrn->scrnIndex, X_ERROR,
-   "Failed to make %dbpp pixmap exportable\n",
-   pixmap->drawable.bitsPerPixel);
+   "Failed to make %d depth, %dbpp pixmap exportable\n",
+   pixmap->drawable.depth, pixmap->drawable.bitsPerPixel);
 return FALSE;
 }
 
-if (pixmap->drawable.depth == 30)
-   format = GBM_FORMAT_ARGB2101010;
-else
-format = GBM_FORMAT_ARGB;
-
 #ifdef GBM_BO_WITH_MODIFIERS
 if (modifiers_ok && glamor_egl->dmabuf_capable) {
 uint32_t num_modifiers;
-- 
2.18.0

___
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] meson: Add an option to build XSELINUX.

2018-08-09 Thread Eric Anholt
Peter Hutterer  writes:

> On Thu, Aug 09, 2018 at 01:02:41PM -0700, Eric Anholt wrote:
>> Dependencies are ported from the automake build.
>> 
>> v2: Make it a tristate defaulting to 'auto'.  Use pkg-config for libaudit.
>> 
>> Signed-off-by: Eric Anholt 
>> ---
>>  meson.build   | 20 +---
>>  meson_options.txt |  2 ++
>>  2 files changed, 19 insertions(+), 3 deletions(-)
>> 
>> diff --git a/meson.build b/meson.build
>> index e7ce68a502c3..53cdbe2beb3d 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -442,9 +442,6 @@ elif get_option('mitshm') == 'true'
>>  build_mitshm = true
>>  endif
>>  
>> -# XXX: Allow configuration of these.
>> -build_xselinux = false
>> -
>>  m_dep = cc.find_library('m', required : false)
>>  dl_dep = cc.find_library('dl', required : false)
>>  
>> @@ -506,6 +503,23 @@ inc = include_directories(
>>  'xfixes',
>>  )
>>  
>> +build_xselinux = false
>> +if get_option('xselinux') != 'false'
>> +dep_selinux = dependency('libselinux', version: '>= 2.0.86',
>> + required: get_option('xselinux') == 'true')
>> +dep_audit = dependency('audit', required: get_option('xselinux') == 
>> 'true')
>> +if get_option('xselinux') == 'true'
>> +build_xselinux = true
>> +else
>
> you don't need the if here, if option(xselinux) is true, both deps will
> are required and cannot be anything but found() == true.
>
> but either way, Reviewed-by: Peter Hutterer 

I'm trying to make sure that build_xselinux is never set if the tristate
is set to false, but that we auto-select if we're in auto mode.


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 v2] meson: add option to disable selective werror

2018-08-09 Thread Eric Anholt
Matt Turner  writes:

> On Thu, Aug 9, 2018 at 1:03 PM, Eric Anholt  wrote:
>> "Marty E. Plummer"  writes:
>>
>>> Signed-off-by: Marty E. Plummer 
>>
>> We definitely want our -W flags.  Are you finding that one of the
>> -Werror ones is throwing errors for you?  If so, let's fix that for
>> everyone.
>
> -Werror is fine for developers, but for distros it's a huge pain.
>
> https://flameeyes.blog/2009/02/25/future-proof-your-code-dont-use-werror/
>
> With every new version of GCC, not only does the set of warnings on by
> default change but also its ability to detect warnings (i.e., the same
> -Wflag is now more effective). Upgrading GCC already causes lots of
> churn, and having to immediately deal with -Werror fall out just makes
> this more difficult.

I also happen to hate Werror, and I think the solution is to delete it
from meson.build for everyone, not introduce a flag to get the right
behavior.


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 v2] meson: add option to disable selective werror

2018-08-09 Thread Eric Anholt
"Marty E. Plummer"  writes:

> Signed-off-by: Marty E. Plummer 

We definitely want our -W flags.  Are you finding that one of the
-Werror ones is throwing errors for you?  If so, let's fix that for
everyone.


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

[PATCH xserver] meson: Add an option to build XSELINUX.

2018-08-09 Thread Eric Anholt
Dependencies are ported from the automake build.

v2: Make it a tristate defaulting to 'auto'.  Use pkg-config for libaudit.

Signed-off-by: Eric Anholt 
---
 meson.build   | 20 +---
 meson_options.txt |  2 ++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index e7ce68a502c3..53cdbe2beb3d 100644
--- a/meson.build
+++ b/meson.build
@@ -442,9 +442,6 @@ elif get_option('mitshm') == 'true'
 build_mitshm = true
 endif
 
-# XXX: Allow configuration of these.
-build_xselinux = false
-
 m_dep = cc.find_library('m', required : false)
 dl_dep = cc.find_library('dl', required : false)
 
@@ -506,6 +503,23 @@ inc = include_directories(
 'xfixes',
 )
 
+build_xselinux = false
+if get_option('xselinux') != 'false'
+dep_selinux = dependency('libselinux', version: '>= 2.0.86',
+required: get_option('xselinux') == 'true')
+dep_audit = dependency('audit', required: get_option('xselinux') == 'true')
+if get_option('xselinux') == 'true'
+build_xselinux = true
+else
+build_xselinux = dep_selinux.found() and dep_audit.found()
+endif
+
+if build_xselinux
+common_dep += dep_selinux
+common_dep += dep_audit
+endif
+endif
+
 glx_inc = include_directories('glx')
 
 top_srcdir_inc = include_directories('.')
diff --git a/meson_options.txt b/meson_options.txt
index 8c600f3986d8..3f02d5066448 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -80,6 +80,8 @@ option('xres', type: 'boolean', value: true,
description: 'XRes extension')
 option('xace', type: 'boolean', value: true,
description: 'X-ACE extension')
+option('xselinux', type: 'combo', choices: ['true', 'false', 'auto'], value: 
'auto',
+   description: 'XSELINUX extension')
 option('xinerama', type: 'boolean', value: true,
description: 'Xinerama extension')
 option('xcsecurity', type: 'boolean', value: false,
-- 
2.18.0

___
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 05/10] meson: Make xf86vidmodeproto mandatory.

2018-08-07 Thread Eric Anholt
This is silly to have optional based on detection of the protocol
headers, particularly now that we have a single protocol header repo
to install.

Signed-off-by: Eric Anholt 
---
 include/meson.build | 2 +-
 meson.build | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/meson.build b/include/meson.build
index 43d70d59440e..52fb837b9d12 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -204,7 +204,7 @@ conf_data.set('XCSECURITY', build_xsecurity)
 conf_data.set('XDMCP', xdmcp_dep.found())
 conf_data.set('XF86BIGFONT', build_xf86bigfont)
 conf_data.set('XF86DRI', build_dri1)
-conf_data.set('XF86VIDMODE', build_xf86vidmode)
+conf_data.set('XF86VIDMODE', 1)
 conf_data.set('XFIXES', '1')
 conf_data.set('XFreeXDGA', build_dga)
 conf_data.set('XINERAMA', build_xinerama)
diff --git a/meson.build b/meson.build
index cd1e4a58c2d7..ec79479d901b 100644
--- a/meson.build
+++ b/meson.build
@@ -81,7 +81,7 @@ dri2proto_dep = dependency('dri2proto', version: '>= 2.8', 
required: get_option(
 dri3proto_dep = dependency('dri3proto', version: '>= 1.2', required: 
get_option('dri3') == 'true')
 xineramaproto_dep = dependency('xineramaproto')
 xf86bigfontproto_dep = dependency('xf86bigfontproto', version: '>= 1.2.0')
-xf86vidmodeproto_dep = dependency('xf86vidmodeproto', version: '>= 2.2.99.1', 
required: false)
+xf86vidmodeproto_dep = dependency('xf86vidmodeproto', version: '>= 2.2.99.1')
 windowswmproto_dep = dependency('windowswmproto', required: false)
 applewmproto_dep = dependency('applewmproto', version: '>= 1.4', required: 
false)
 xshmfence_dep = dependency('xshmfence', version: '>= 1.1', required: false)
@@ -438,7 +438,6 @@ endif
 
 # XXX: Allow configuration of these.
 build_xselinux = false
-build_xf86vidmode = xf86vidmodeproto_dep.found()
 
 m_dep = cc.find_library('m', required : false)
 dl_dep = cc.find_library('dl', required : false)
-- 
2.18.0

___
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 02/10] meson: Add PIO access support for FreeBSD and NetBSD on Alpha.

2018-08-07 Thread Eric Anholt
Signed-off-by: Eric Anholt 
---
 hw/xfree86/os-support/meson.build | 11 ++-
 include/meson.build   |  3 ---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/hw/xfree86/os-support/meson.build 
b/hw/xfree86/os-support/meson.build
index 512bc8c1f951..49b138ed2dab 100644
--- a/hw/xfree86/os-support/meson.build
+++ b/hw/xfree86/os-support/meson.build
@@ -11,6 +11,9 @@ hdrs_xorg_os_support = [
 'xf86_OSproc.h'
 ]
 
+os_dep = []
+os_c_args = []
+
 if get_option('pciaccess')
 srcs_xorg_os_support += 'bus/Pci.c'
 if host_machine.system() != 'linux' and host_machine.system() != 'solaris'
@@ -108,6 +111,11 @@ elif host_machine.system().endswith('bsd')
 srcs_xorg_os_support += 'shared/ioperm_noop.c'
 elif host_machine.cpu_family() == 'alpha'
 srcs_xorg_os_support += 'bsd/alpha_video.c'
+if host_machine.system() == 'freebsd'
+os_dep += cc.find_library('io')
+elif host_machine.system() == 'netbsd'
+os_c_args += '-DUSE_ALPHA_PIO'
+endif
 endif
 
 if host_machine.system() == 'freebsd'
@@ -145,8 +153,9 @@ xorg_os_support = static_library('xorg_os_support',
 common_dep,
 dbus_dep,
 libdrm_dep,
+os_dep,
 ],
-c_args: xorg_c_args,
+c_args: xorg_c_args + os_c_args,
 )
 
 install_data(hdrs_xorg_os_support, install_dir: xorgsdkdir)
diff --git a/include/meson.build b/include/meson.build
index 678555692f6d..3548ac3c9b46 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -52,7 +52,6 @@ conf_data.set('_GNU_SOURCE', '1')
 # ifdef for openbsd?
 conf_data.set('HAS_APERTURE_DRV', host_machine.system() == 'openbsd')
 
-# XXX: USE_ALPHA_PIO and other bsd bits
 # XXX: FALLBACK_INPUT_DRIVER
 # XXX: BUNDLE_ID_PREFIX
 # XXX: HAVE_LIBDISPATCH
@@ -344,9 +343,7 @@ if host_machine.system() == 'freebsd' or 
host_machine.system() == 'dragonflybsd'
 if host_machine.cpu_family() == 'x86' or host_machine.cpu_family() == 
'x86_64'
 xorg_data.set('USE_DEV_IO', true)
 endif
-# XXX: Add link to libio on alpha
 elif host_machine.system() == 'netbsd'
-# XXX: USE_ALPHA_PIO
 # XXX: Add link to libi386
 if host_machine.cpu_family() == 'x86' or host_machine.cpu_family() == 
'x86_64'
 xorg_data.set('USE_I386_IOPL', true)
-- 
2.18.0

___
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 06/10] meson: Add an option to build XSELINUX.

2018-08-07 Thread Eric Anholt
Dependencies are ported from the automake build.  The only part I
skipped was making sure we can find libaudit.h.

Signed-off-by: Eric Anholt 
---
 meson.build   | 12 +---
 meson_options.txt |  2 ++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index ec79479d901b..8c21c646ab89 100644
--- a/meson.build
+++ b/meson.build
@@ -436,9 +436,6 @@ elif get_option('mitshm') == 'true'
 build_mitshm = true
 endif
 
-# XXX: Allow configuration of these.
-build_xselinux = false
-
 m_dep = cc.find_library('m', required : false)
 dl_dep = cc.find_library('dl', required : false)
 
@@ -499,6 +496,15 @@ inc = include_directories(
 'xfixes',
 )
 
+build_xselinux = get_option('xselinux')
+if build_xselinux
+if not build_xace
+error('cannot build XSELINUX extension without X-ACE')
+endif
+common_dep += dependency('libselinux', version: '>= 2.0.86')
+common_dep += cc.find_library('audit')
+endif
+
 glx_inc = include_directories('glx')
 
 top_srcdir_inc = include_directories('.')
diff --git a/meson_options.txt b/meson_options.txt
index 3453b8df5a2e..5560dd55e952 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -78,6 +78,8 @@ option('xres', type: 'boolean', value: true,
description: 'XRes extension')
 option('xace', type: 'boolean', value: true,
description: 'X-ACE extension')
+option('xselinux', type: 'boolean', value: true,
+   description: 'XSELINUX extension')
 option('xinerama', type: 'boolean', value: true,
description: 'Xinerama extension')
 option('xcsecurity', type: 'boolean', value: false,
-- 
2.18.0

___
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 07/10] meson: Make FALLBACK_INPUT_DRIVER configurable in meson.

2018-08-07 Thread Eric Anholt
This makes us match the featureset of autotools, and also fixes the
non-Linux default value to match.

Signed-off-by: Eric Anholt 
---
 hw/xfree86/common/meson.build | 14 +-
 include/meson.build   |  2 --
 meson_options.txt |  2 ++
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/hw/xfree86/common/meson.build b/hw/xfree86/common/meson.build
index 514999ff6ad2..3e617dc369f7 100644
--- a/hw/xfree86/common/meson.build
+++ b/hw/xfree86/common/meson.build
@@ -47,6 +47,15 @@ xorg_sdk_headers = [
 'xaarop.h',
 ]
 
+fallback_driver = get_option('fallback_input_driver')
+if fallback_driver == 'auto'
+if host_machine.system() == 'linux'
+fallback_driver = 'libinput'
+else
+fallback_driver = ''
+endif
+endif
+
 if build_dga
 srcs_xorg_common += 'xf86DGA.c'
 xorg_sdk_headers += 'dgaproc.h'
@@ -87,7 +96,10 @@ xorg_common = static_library('xorg_common',
 pciaccess_dep,
 libdrm_dep,
 ],
-c_args: xorg_c_args,
+c_args: [
+xorg_c_args,
+'-DFALLBACK_INPUT_DRIVER="@0@"'.format(fallback_driver)
+],
 )
 
 install_data(xorg_sdk_headers, install_dir: xorgsdkdir)
diff --git a/include/meson.build b/include/meson.build
index 52fb837b9d12..13ca1f8f8d34 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -52,7 +52,6 @@ conf_data.set('_GNU_SOURCE', '1')
 # ifdef for openbsd?
 conf_data.set('HAS_APERTURE_DRV', host_machine.system() == 'openbsd')
 
-# XXX: FALLBACK_INPUT_DRIVER
 # XXX: BUNDLE_ID_PREFIX
 conf_data.set_quoted('OSNAME', 'Linux') # XXX
 conf_data.set('HAVE_INPUTTHREAD', '1') # XXX
@@ -329,7 +328,6 @@ xorg_data.set_quoted('DEFAULT_XDG_DATA_HOME', 
'.local/share')
 xorg_data.set_quoted('DEFAULT_XDG_DATA_HOME_LOGDIR', 'xorg')
 xorg_data.set_quoted('DEFAULT_LOGDIR', log_dir)
 xorg_data.set_quoted('DEFAULT_LOGPREFIX', 'Xorg.')
-xorg_data.set_quoted('FALLBACK_INPUT_DRIVER', 'libinput')
 xorg_data.set_quoted('DEFAULT_MODULE_PATH', join_paths(get_option('prefix'), 
module_dir))
 xorg_data.set_quoted('DEFAULT_LIBRARY_PATH', join_paths(get_option('prefix'), 
get_option('libdir')))
 xorg_data.set_quoted('__XSERVERNAME__', 'Xorg')
diff --git a/meson_options.txt b/meson_options.txt
index 5560dd55e952..ed0c849aa305 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -40,6 +40,8 @@ option('xkb_default_layout', type: 'string', value: 'us')
 option('xkb_default_variant', type: 'string')
 option('xkb_default_options', type: 'string')
 
+option('fallback_input_driver', type: 'string', value: 'auto')
+
 option('vendor_name', type: 'string', value: 'The X.Org Foundation')
 option('vendor_name_short', type: 'string', value: 'X.Org')
 option('vendor_web', type: 'string', value: 'http://wiki.x.org')
-- 
2.18.0

___
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 04/10] meson: Add linking to x86 iopl libs on BSDs.

2018-08-07 Thread Eric Anholt
Ported from automake.

Signed-off-by: Eric Anholt 
---
 hw/xfree86/os-support/meson.build | 8 
 include/meson.build   | 2 --
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/os-support/meson.build 
b/hw/xfree86/os-support/meson.build
index 49b138ed2dab..65418b74a743 100644
--- a/hw/xfree86/os-support/meson.build
+++ b/hw/xfree86/os-support/meson.build
@@ -100,8 +100,16 @@ elif host_machine.system().endswith('bsd')
 
 if host_machine.cpu_family() == 'x86_64'
 srcs_xorg_os_support += 'bsd/i386_video.c'
+if host_machine.system() == 'netbsd'
+os_dep += cc.find_library('x86_64')
+elif host_machine.system() == 'openbsd'
+os_dep += cc.find_library('amd64')
+endif
 elif host_machine.cpu_family() == 'x86'
 srcs_xorg_os_support += 'bsd/i386_video.c'
+if host_machine.system() == 'netbsd' or host_machine.system() == 
'openbsd'
+os_dep += cc.find_library('i386')
+endif
 elif host_machine.cpu_family() == 'arm'
 srcs_xorg_os_support += 'bsd/arm_video.c'
 elif host_machine.cpu_family() == 'powerpc'
diff --git a/include/meson.build b/include/meson.build
index 43139fa97d15..43d70d59440e 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -343,12 +343,10 @@ if host_machine.system() == 'freebsd' or 
host_machine.system() == 'dragonflybsd'
 xorg_data.set('USE_DEV_IO', true)
 endif
 elif host_machine.system() == 'netbsd'
-# XXX: Add link to libi386
 if host_machine.cpu_family() == 'x86' or host_machine.cpu_family() == 
'x86_64'
 xorg_data.set('USE_I386_IOPL', true)
 endif
 elif host_machine.system() == 'openbsd'
-# XXX: Add link to libi386, libamd64
 if host_machine.cpu_family() == 'x86'
 xorg_data.set('USE_I386_IOPL', true)
 endif
-- 
2.18.0

___
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 01/10] meson, automake: Drop unused USESTDRES cflag setup.

2018-08-07 Thread Eric Anholt
Nothing in tree references the flag.

Signed-off-by: Eric Anholt 
---
 hw/xfree86/os-support/bsd/Makefile.am | 2 +-
 hw/xfree86/os-support/hurd/Makefile.am| 2 +-
 hw/xfree86/os-support/linux/Makefile.am   | 2 +-
 hw/xfree86/os-support/meson.build | 2 --
 hw/xfree86/os-support/solaris/Makefile.am | 2 +-
 5 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/hw/xfree86/os-support/bsd/Makefile.am 
b/hw/xfree86/os-support/bsd/Makefile.am
index 66ac838050bd..90d9e555f070 100644
--- a/hw/xfree86/os-support/bsd/Makefile.am
+++ b/hw/xfree86/os-support/bsd/Makefile.am
@@ -49,7 +49,7 @@ ARCH_SOURCES = \
 endif
 
 # FIXME: NetBSD Aperture defines (configure.ac)
-AM_CFLAGS = -DUSESTDRES $(XORG_CFLAGS) $(DIX_CFLAGS)
+AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS)
 
 AM_CPPFLAGS = $(XORG_INCS)
 
diff --git a/hw/xfree86/os-support/hurd/Makefile.am 
b/hw/xfree86/os-support/hurd/Makefile.am
index 38660544ad57..33857f459a0f 100644
--- a/hw/xfree86/os-support/hurd/Makefile.am
+++ b/hw/xfree86/os-support/hurd/Makefile.am
@@ -10,6 +10,6 @@ libhurd_la_SOURCES = hurd_bell.c hurd_init.c \
$(srcdir)/../shared/kmod_noop.c \
$(srcdir)/../shared/agp_noop.c
 
-AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(DIX_CFLAGS)
+AM_CFLAGS = -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(DIX_CFLAGS)
 
 AM_CPPFLAGS = $(XORG_INCS)
diff --git a/hw/xfree86/os-support/linux/Makefile.am 
b/hw/xfree86/os-support/linux/Makefile.am
index 9b4535b535b7..aa76a7b9286d 100644
--- a/hw/xfree86/os-support/linux/Makefile.am
+++ b/hw/xfree86/os-support/linux/Makefile.am
@@ -28,6 +28,6 @@ liblinux_la_SOURCES = linux.h lnx_init.c lnx_video.c \
  $(APM_SRCS) \
  $(LOGIND_SRCS)
 
-AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(DIX_CFLAGS) $(XORG_CFLAGS) 
$(PLATFORM_DEFINES)
+AM_CFLAGS = -DHAVE_SYSV_IPC $(DIX_CFLAGS) $(XORG_CFLAGS) $(PLATFORM_DEFINES)
 
 AM_CPPFLAGS = $(XORG_INCS) $(PLATFORM_INCLUDES) $(LIBDRM_CFLAGS)
diff --git a/hw/xfree86/os-support/meson.build 
b/hw/xfree86/os-support/meson.build
index fb282be82a36..512bc8c1f951 100644
--- a/hw/xfree86/os-support/meson.build
+++ b/hw/xfree86/os-support/meson.build
@@ -11,8 +11,6 @@ hdrs_xorg_os_support = [
 'xf86_OSproc.h'
 ]
 
-os_support_flags = ['-DUSESTDRES']
-
 if get_option('pciaccess')
 srcs_xorg_os_support += 'bus/Pci.c'
 if host_machine.system() != 'linux' and host_machine.system() != 'solaris'
diff --git a/hw/xfree86/os-support/solaris/Makefile.am 
b/hw/xfree86/os-support/solaris/Makefile.am
index e534bc8dc2c6..ae109ff09868 100644
--- a/hw/xfree86/os-support/solaris/Makefile.am
+++ b/hw/xfree86/os-support/solaris/Makefile.am
@@ -29,7 +29,7 @@ nodist_libsolaris_la_SOURCES = $(SOLARIS_INOUT_SRC)
 sdk_HEADERS =
 nodist_sdk_HEADERS = solaris-@SOLARIS_INOUT_ARCH@.il
 
-AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(DIX_CFLAGS)
+AM_CFLAGS = -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(DIX_CFLAGS)
 
 AM_CPPFLAGS = $(XORG_INCS) 
 
-- 
2.18.0

___
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 08/10] meson: Add missing setup of the NO_LOCAL_CLIENT_CRED define.

2018-08-07 Thread Eric Anholt
Ported from autotools.

Signed-off-by: Eric Anholt 
---
 include/meson.build | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/meson.build b/include/meson.build
index 13ca1f8f8d34..6d08b05733b8 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -45,7 +45,6 @@ if cc.sizeof('unsigned long') == 8
 endif
 
 conf_data.set('_GNU_SOURCE', '1')
-# XXX: NO_LOCAL_CLIENT_CRED
 
 # autoconf checks for /dev/xf86 here, but the test should be based on
 # the target, not the build system.  Could we get rid of this and just
@@ -173,6 +172,12 @@ if cc.has_header_symbol('sys/socket.h', 'SCM_RIGHTS')
   conf_data.set('XTRANS_SEND_FDS', '1')
 endif
 
+if not conf_data.get('HAVE_GETPEEREID') and not 
conf_data.get('HAVE_GETPEERUCRED')
+if not cc.has_header_symbol('sys/socket.h', 'SO_PEERCRED')
+conf_data.set('NO_LOCAL_CLIENT_CRED', 1)
+endif
+endif
+
 conf_data.set('TCPCONN', '1')
 conf_data.set('UNIXCONN', '1')
 conf_data.set('IPv6', build_ipv6)
-- 
2.18.0

___
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 00/10] meson build parity progress

2018-08-07 Thread Eric Anholt
Here's another series to get us closer to parity on the meson build.
You can see the things that I know of left to fix at:

https://gitlab.freedesktop.org/anholt/xserver/merge_requests/1

Eric Anholt (10):
  meson, automake: Drop unused USESTDRES cflag setup.
  meson: Add PIO access support for FreeBSD and NetBSD on Alpha.
  meson: Add HAVE_LIBDISPATCH define to xquartz build.
  meson: Add linking to x86 iopl libs on BSDs.
  meson: Make xf86vidmodeproto mandatory.
  meson: Add an option to build XSELINUX.
  meson: Make FALLBACK_INPUT_DRIVER configurable in meson.
  meson: Add missing setup of the NO_LOCAL_CLIENT_CRED define.
  meson: Get close to parity with autotools for CLIENTIDS tracking.
  meson: Add detection of libsystemd-daemon.

 hw/xfree86/common/meson.build | 14 +-
 hw/xfree86/os-support/bsd/Makefile.am |  2 +-
 hw/xfree86/os-support/hurd/Makefile.am|  2 +-
 hw/xfree86/os-support/linux/Makefile.am   |  2 +-
 hw/xfree86/os-support/meson.build | 19 +--
 hw/xfree86/os-support/solaris/Makefile.am |  2 +-
 hw/xquartz/meson.build| 20 +---
 include/meson.build   | 22 +-
 meson.build   | 22 +-
 meson_options.txt |  4 
 os/meson.build| 12 
 11 files changed, 89 insertions(+), 32 deletions(-)

-- 
2.18.0

___
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 03/10] meson: Add HAVE_LIBDISPATCH define to xquartz build.

2018-08-07 Thread Eric Anholt
Signed-off-by: Eric Anholt 
---
 hw/xquartz/meson.build | 20 +---
 include/meson.build|  1 -
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/hw/xquartz/meson.build b/hw/xquartz/meson.build
index f92fbc960145..ebb24132c3f7 100644
--- a/hw/xquartz/meson.build
+++ b/hw/xquartz/meson.build
@@ -17,6 +17,18 @@ srcs = [
 '../../mi/miinitext.c',
 ]
 
+xquartz_c_args = [
+'-DXFree86Server',
+# : BUILD_DATE
+'-DXSERVER_VERSION="' + meson_project.version() + '"',
+'-DINXQUARTZ',
+'-DUSE_NEW_CLUT',
+]
+
+if cc.has_function('dispatch_async')
+xquartz_c_args += '-DHAVE_LIBDISPATCH'
+endif
+
 executable(
 'Xquartz',
 srcs,
@@ -29,12 +41,6 @@ executable(
 libxserver_glx,
 libxserver_pseudoramix,
 ],
-c_args: [
-'-DXFree86Server',
-# : BUILD_DATE
-'-DXSERVER_VERSION="' + meson_project.version() + '"',
-'-DINXQUARTZ',
-'-DUSE_NEW_CLUT',
-],
+c_args: xquartz_c_args,
 install: true,
 )
diff --git a/include/meson.build b/include/meson.build
index 3548ac3c9b46..43139fa97d15 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -54,7 +54,6 @@ conf_data.set('HAS_APERTURE_DRV', host_machine.system() == 
'openbsd')
 
 # XXX: FALLBACK_INPUT_DRIVER
 # XXX: BUNDLE_ID_PREFIX
-# XXX: HAVE_LIBDISPATCH
 conf_data.set_quoted('OSNAME', 'Linux') # XXX
 conf_data.set('HAVE_INPUTTHREAD', '1') # XXX
 
-- 
2.18.0

___
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 09/10] meson: Get close to parity with autotools for CLIENTIDS tracking.

2018-08-07 Thread Eric Anholt
The client ID is only needed for XRes, and autotools build ignores the
--clientids= arg if xres is disabled.  We haven't made a meson option
for disabling tracking client ids (is it actually worth a build
option?), so just make this depend on xres.

Signed-off-by: Eric Anholt 
---
 include/meson.build |  2 --
 os/meson.build  | 12 
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/meson.build b/include/meson.build
index 6d08b05733b8..2c139e6b0651 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -182,8 +182,6 @@ conf_data.set('TCPCONN', '1')
 conf_data.set('UNIXCONN', '1')
 conf_data.set('IPv6', build_ipv6)
 
-conf_data.set('CLIENTIDS', '1') # XXX
-
 conf_data.set('BIGREQS', '1')
 conf_data.set('COMPOSITE', '1')
 conf_data.set('DAMAGE', '1')
diff --git a/os/meson.build b/os/meson.build
index 0e41f9c0208c..f6313807ab62 100644
--- a/os/meson.build
+++ b/os/meson.build
@@ -66,6 +66,16 @@ if get_option('secure-rpc')
 srcs_os += 'rpcauth.c'
 endif
 
+os_dep = []
+os_c_args = []
+if get_option('xres')
+# Only the XRes extension cares about the client ID.
+os_c_args += '-DCLIENTIDS'
+if host_machine.system() == 'openbsd'
+os_deps += cc.find_library('kvm')
+endif
+endif
+
 libxlibc = []
 if srcs_libc.length() > 0
 libxlibc = static_library('libxlibc',
@@ -85,7 +95,9 @@ libxserver_os = static_library('libxserver_os',
 dl_dep,
 sha1_dep,
 rpc_dep,
+os_dep,
 dependency('xau')
 ],
+c_args: os_c_args,
 link_with: libxlibc,
 )
-- 
2.18.0

___
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 10/10] meson: Add detection of libsystemd-daemon.

2018-08-07 Thread Eric Anholt
This enables Xtrans's systemd socket activation.

Signed-off-by: Eric Anholt 
---
 include/meson.build | 3 ++-
 meson.build | 7 +++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/meson.build b/include/meson.build
index 2c139e6b0651..9a7547c4708a 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -72,7 +72,8 @@ elif cc.compiles('''
 endif
 
 conf_data.set('HAVE_LIBBSD', libbsd_dep.found())
-# XXX: HAVE_SYSTEMD_DAEMON
+# Note: this symbol is used by libXtrans.
+conf_data.set('HAVE_SYSTEMD_DAEMON', libsystemd_daemon_dep.found())
 conf_data.set('CONFIG_UDEV', build_udev)
 conf_data.set('CONFIG_UDEV_KMS', build_udev)
 conf_data.set('HAVE_DBUS', build_dbus)
diff --git a/meson.build b/meson.build
index 8c21c646ab89..5275373bd3b4 100644
--- a/meson.build
+++ b/meson.build
@@ -96,6 +96,12 @@ nettle_dep = dependency('nettle')
 dbus_required = get_option('systemd_logind') == 'true'
 dbus_dep = dependency('dbus-1', version: '>= 1.0', required: dbus_required)
 
+# libsystemd-daemon was moved into libsystemd in version 209
+libsystemd_daemon_dep = dependency('libsystemd', version: '>= 209', required: 
false)
+if not libsystemd_daemon_dep.found()
+libsystemd_daemon_dep = dependency('libsystemd-daemon', required: false)
+endif
+
 build_hashtable = false
 
 # Resolve default values of some options
@@ -452,6 +458,7 @@ common_dep = [
 xcmiscproto_dep,
 bigreqsproto_dep,
 xtrans_dep,
+libsystemd_daemon_dep,
 
 videoproto_dep,
 compositeproto_dep,
-- 
2.18.0

___
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 6/6] meson: Automatically detect HAVE_PTHREAD_SETNAME_NP

2018-08-02 Thread Eric Anholt
Adam Jackson  writes:

> On Thu, 2018-08-02 at 15:22 +1000, Peter Hutterer wrote:
>> On Wed, Aug 01, 2018 at 01:49:54PM -0700, Eric Anholt wrote:
>> > Signed-off-by: Eric Anholt 
>> 
>> series Reviewed-by: Peter Hutterer 
>
> 4/6 doesn't go too far enough, but this all looks good. Merged, thanks:

I had the same feeling, but wanted to focus on build system parity work.


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

[PATCH xserver 4/6] xorg: Remove the XF86PM define.

2018-08-01 Thread Eric Anholt
We already have pm_noop.c being built most of the time for the
no-OS-PM case, so just switch to always using it.

Signed-off-by: Eric Anholt 
---
 configure.ac  | 8 
 hw/xfree86/common/xf86Events.c| 6 --
 hw/xfree86/common/xf86Init.c  | 8 
 hw/xfree86/os-support/meson.build | 3 +++
 include/meson.build   | 1 -
 include/xorg-config.h.in  | 3 ---
 include/xorg-config.h.meson.in| 3 ---
 7 files changed, 3 insertions(+), 29 deletions(-)

diff --git a/configure.ac b/configure.ac
index e0ebc78a1c73..350c89a3bf40 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1915,9 +1915,6 @@ if test "x$XORG" = xyes; then
esac
dnl APM header
AC_CHECK_HEADERS([linux/apm_bios.h], 
[linux_apm=$enable_linux_apm])
-   if test "x$linux_apm" = xyes -o "x$linux_acpi" = xyes; then
-   AC_DEFINE(XF86PM, 1, [Support APM/ACPI power management 
in the server])
-   fi
;;
  freebsd* | kfreebsd*-gnu | dragonfly*)
XORG_OS_SUBDIR="bsd"
@@ -1926,15 +1923,10 @@ if test "x$XORG" = xyes; then
XORG_OS_SUBDIR="bsd"
;;
  openbsd*)
-   if test "x$ac_cv_BSD_APM" = xyes \
-   -o "x$ac_cv_BSD_KQUEUE_APM" = xyes; then
-   XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
-   fi
XORG_OS_SUBDIR="bsd"
;;
  solaris*)
XORG_OS_SUBDIR="solaris"
-   XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
AC_CHECK_HEADERS([sys/kd.h])
AC_CHECK_HEADERS([sys/vt.h], [solaris_vt=yes], [solaris_vt=no])
# Check for minimum supported release
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 8a800bd8fd09..455a0eccbd96 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -86,9 +86,7 @@
 #include "xf86platformBus.h"
 #include "systemd-logind.h"
 
-#ifdef XF86PM
 extern void (*xf86OSPMClose) (void);
-#endif
 
 static void xf86VTSwitch(void);
 
@@ -396,11 +394,9 @@ xf86VTLeave(void)
 if (!xf86VTSwitchAway())
 goto switch_failed;
 
-#ifdef XF86PM
 if (xf86OSPMClose)
 xf86OSPMClose();
 xf86OSPMClose = NULL;
-#endif
 
 for (i = 0; i < xf86NumScreens; i++) {
 /*
@@ -456,9 +452,7 @@ xf86VTEnter(void)
 if (!xf86VTSwitchTo())
 return;
 
-#ifdef XF86PM
 xf86OSPMClose = xf86OSPMOpen();
-#endif
 
 if (xorgHWAccess)
 xf86EnableIO();
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 3c5cc7097c49..8773a47e863f 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -92,9 +92,7 @@
 #endif
 #include 
 
-#ifdef XF86PM
 void (*xf86OSPMClose) (void) = NULL;
-#endif
 static Bool xorgHWOpenConsole = FALSE;
 
 /* Common pixmap formats */
@@ -397,9 +395,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
 }
 }
 
-#ifdef XF86PM
 xf86OSPMClose = xf86OSPMOpen();
-#endif
 
 xf86ExtensionInit();
 
@@ -626,7 +622,6 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
 if (xorgHWOpenConsole)
 xf86OpenConsole();
 
-#ifdef XF86PM
 /*
should we reopen it here? We need to deal with an already opened
device. We could leave this to the OS layer. For now we simply
@@ -636,7 +631,6 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
 xf86OSPMClose();
 if ((xf86OSPMClose = xf86OSPMOpen()) != NULL)
 xf86MsgVerb(X_INFO, 3, "APM registered successfully\n");
-#endif
 
 /* Make sure full I/O access is enabled */
 if (xorgHWAccess)
@@ -878,11 +872,9 @@ ddxGiveUp(enum ExitCode error)
 
 xf86VGAarbiterFini();
 
-#ifdef XF86PM
 if (xf86OSPMClose)
 xf86OSPMClose();
 xf86OSPMClose = NULL;
-#endif
 
 for (i = 0; i < xf86NumScreens; i++) {
 /*
diff --git a/hw/xfree86/os-support/meson.build 
b/hw/xfree86/os-support/meson.build
index b6e5c975d609..0e021dbe17c9 100644
--- a/hw/xfree86/os-support/meson.build
+++ b/hw/xfree86/os-support/meson.build
@@ -45,6 +45,8 @@ if host_machine.system() == 'linux'
 if build_acpi
 srcs_xorg_os_support += 'linux/lnx_acpi.c'
 endif
+else
+srcs_xorg_os_support += 'shared/pm_noop.c'
 endif
 
 elif host_machine.system() == 'solaris'
@@ -83,6 +85,7 @@ elif host_machine.system().endswith('bsd')
 'bsd/bsd_VTsw.c',
 'bsd/bsd_bell.c',
 'bsd/bsd_init.c',
+'shared/pm_noop.c',
 ]
 
 # XXX: APM
diff --git a/include/meson.build b/include/meson.build
index 81a48af9642e..6ed7cc6ca997 100644
--- a/include/meson

[PATCH xserver 5/6] meson: Try to hook up BSD APM build configuration.

2018-08-01 Thread Eric Anholt
I don't have a BSD to test on, but this should do the same as what
autotools did.

Signed-off-by: Eric Anholt 
---
 hw/xfree86/os-support/meson.build | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/os-support/meson.build 
b/hw/xfree86/os-support/meson.build
index 0e021dbe17c9..fb282be82a36 100644
--- a/hw/xfree86/os-support/meson.build
+++ b/hw/xfree86/os-support/meson.build
@@ -85,10 +85,17 @@ elif host_machine.system().endswith('bsd')
 'bsd/bsd_VTsw.c',
 'bsd/bsd_bell.c',
 'bsd/bsd_init.c',
-'shared/pm_noop.c',
 ]
 
-# XXX: APM
+if cc.has_header('machine/apmvar.h')
+if cc.has_header('sys/event.h')
+srcs_xorg_os_support += 'bsd/bsd_kqueue_apm.c'
+else
+srcs_xorg_os_support += 'bsd/bsd_apm.c'
+endif
+else
+srcs_xorg_os_support += 'shared/pm_noop.c'
+endif
 
 if host_machine.cpu_family() == 'x86_64'
 srcs_xorg_os_support += 'bsd/i386_video.c'
-- 
2.18.0

___
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] meson: Automatically detect HAVE_PTHREAD_SETNAME_NP

2018-08-01 Thread Eric Anholt
Signed-off-by: Eric Anholt 
---
 include/meson.build | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/include/meson.build b/include/meson.build
index 6ed7cc6ca997..678555692f6d 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -58,7 +58,23 @@ conf_data.set('HAS_APERTURE_DRV', host_machine.system() == 
'openbsd')
 # XXX: HAVE_LIBDISPATCH
 conf_data.set_quoted('OSNAME', 'Linux') # XXX
 conf_data.set('HAVE_INPUTTHREAD', '1') # XXX
-conf_data.set('HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID', '1') # XXX
+
+if cc.compiles('''
+#define _GNU_SOURCE 1
+#include 
+void foo(int bar) { pthread_setname_np(pthread_self(), "example"); }
+''',
+name: 'pthread_setname_np(tid, name)')
+conf_data.set('HAVE_PTHREAD_SETNAME_NP_WITH_TID', 1)
+elif cc.compiles('''
+#define _GNU_SOURCE 1
+#include 
+void foo(int bar) { pthread_setname_np("example"); }
+''',
+name: 'pthread_setname_np(name)')
+conf_data.set('HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID', 1)
+endif
+
 conf_data.set('HAVE_LIBBSD', libbsd_dep.found())
 # XXX: HAVE_SYSTEMD_DAEMON
 conf_data.set('CONFIG_UDEV', build_udev)
-- 
2.18.0

___
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] meson: Automatically detect support for XTRANS_SEND_FDs.

2018-08-01 Thread Eric Anholt
The SCM_RIGHTS flag seems to be the thing that xtrans depends on, and
meson makes the check easy without needing a build option.

Signed-off-by: Eric Anholt 
---
 include/meson.build | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/meson.build b/include/meson.build
index dfca3c3407fa..9682827dd5e9 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -156,8 +156,10 @@ conf_data.set('_XITYPEDEF_POINTER', '1')
 conf_data.set('LISTEN_TCP', get_option('listen_tcp'))
 conf_data.set('LISTEN_UNIX', get_option('listen_unix'))
 conf_data.set('LISTEN_LOCAL', get_option('listen_local'))
-# XXX: Configurable?
-conf_data.set('XTRANS_SEND_FDS', '1')
+
+if cc.has_header_symbol('sys/socket.h', 'SCM_RIGHTS')
+  conf_data.set('XTRANS_SEND_FDS', '1')
+endif
 
 conf_data.set('TCPCONN', '1')
 conf_data.set('UNIXCONN', '1')
-- 
2.18.0

___
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 3/6] automake,meson: Remove HAVE_LIBUDEV define.

2018-08-01 Thread Eric Anholt
CONFIG_UDEV and CONFIG_UDEV_KMS are the actual defines that are used
in the C code.

Signed-off-by: Eric Anholt 
---
 configure.ac| 1 -
 include/meson.build | 1 -
 2 files changed, 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7d5cb0d4d0ed..e0ebc78a1c73 100644
--- a/configure.ac
+++ b/configure.ac
@@ -859,7 +859,6 @@ fi
 PKG_CHECK_MODULES(UDEV, $LIBUDEV, [HAVE_LIBUDEV=yes], [HAVE_LIBUDEV=no])
 if test "x$CONFIG_UDEV" = xauto; then
CONFIG_UDEV="$HAVE_LIBUDEV"
-   AC_DEFINE(HAVE_LIBUDEV, 1, [Define to 1 if libudev is available.])
 fi
 AM_CONDITIONAL(CONFIG_UDEV, [test "x$CONFIG_UDEV" = xyes])
 if test "x$CONFIG_UDEV" = xyes; then
diff --git a/include/meson.build b/include/meson.build
index 9682827dd5e9..81a48af9642e 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -61,7 +61,6 @@ conf_data.set('HAVE_INPUTTHREAD', '1') # XXX
 conf_data.set('HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID', '1') # XXX
 conf_data.set('HAVE_LIBBSD', libbsd_dep.found())
 # XXX: HAVE_SYSTEMD_DAEMON
-# XXX: HAVE_LIBUDEV
 conf_data.set('CONFIG_UDEV', build_udev)
 conf_data.set('CONFIG_UDEV_KMS', build_udev)
 conf_data.set('HAVE_DBUS', build_dbus)
-- 
2.18.0

___
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] meson: Remove XXX for libconfig in kdrive.

2018-08-01 Thread Eric Anholt
This is already included in ephyr (the only kdrive server left)

Signed-off-by: Eric Anholt 
---
 hw/kdrive/src/meson.build | 2 --
 1 file changed, 2 deletions(-)

diff --git a/hw/kdrive/src/meson.build b/hw/kdrive/src/meson.build
index 06bc34e04460..f57040745605 100644
--- a/hw/kdrive/src/meson.build
+++ b/hw/kdrive/src/meson.build
@@ -11,8 +11,6 @@ if build_xv
 srcs_kdrive += 'kxv.c'
 endif
 
-#XXX: libconfig
-
 kdrive = static_library('kdrive',
 srcs_kdrive,
 include_directories: inc,
-- 
2.18.0

___
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 modular] xorg.modules: Update to use meson for the xserver.

2018-08-01 Thread Eric Anholt
I'm proposing a patch to delete autotools, so try to make sure jhbuild
keeps working.
---
 xorg.modules | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xorg.modules b/xorg.modules
index 3db392aa358d..638e88daefa4 100644
--- a/xorg.modules
+++ b/xorg.modules
@@ -1571,7 +1571,7 @@
   
 
   
-  
+  
 
 
@@ -1598,7 +1598,7 @@
   
   
 
-  
+  
 
   
   
-- 
2.18.0

___
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: gitlab migration

2018-06-08 Thread Eric Anholt
Adam Jackson  writes:

> I'd like us to start moving repos and bug tracking into gitlab.
> Hopefully everyone's aware that gitlab exists and why fdo projects are
> migrating to it. If not, the thread about Mesa's migration provides
> some useful background:
>
> https://lists.x.org/archives/mesa-dev/2018-May/195634.html
>
> This should be mostly mechanical, except for moving some of the older
> junk into the archive and deciding which drivers _not_ to move yet (I
> imagine intel has some of its processes hooked up to bz, for example).
>
> As far as contribution model, I'd personally prefer to stop using
> mailing lists, and for most of the X components I expect that's
> probably an improvement, because most components do not have especially
> active maintenance and it's currently very easy for patches to get lost
> in the mailing list history. Conversely for the server it can be
> difficult to keep track of a patch series' approval state. Again, not
> solely my decision to make, so I'd like to hear some rough consensus on
> how to proceed. Anyone with strong opinions, please do speak up.

I, for one, would love to see xserver use a MR-based contribution
process.  Every once in a while I go to review some old patches I had
personally marked as still to be reviewed, and find they're already
merged.  I'm sure the reverse is happening, too.

For our libraries with less active maintainership, MRs that stay open
until they're actually handled should be an even bigger win.

I'm also *really* interested in a merge process that runs through the
server's automated tests before the code hits master.  I know that won't
be day 1, but gitlab is progress toward that.


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: glamor_init: clamp GLSL to 120 if platform doesn't have instanced arrays

2018-05-16 Thread Eric Anholt
"Lukas F. Hartmann" <lu...@mntmn.com> writes:

> Hi,
>
> I upgraded Xwayland and the assorted libraries from git masters today,
> and noticed that glamor wouldn't work anymore on i.MX6/etnaviv. The
> error was:
>
> No provider of glVertexAttribDivisor found.  Requires one of:
> Desktop OpenGL 3.3
> OpenGL ES 3.0
> GL extension "GL_ANGLE_instanced_arrays"
> GL extension "GL_ARB_instanced_arrays"
> GL extension "GL_EXT_instanced_arrays"
> GL extension "GL_NV_instanced_arrays"
>
> The problem is that etnaviv offers GLSL 140 on GL 2.1 and glamor
> rendering assumes that glVertexAttribDivisor() is always available on
> GLSL>=130, which is not the case here. Forcing GLSL 120 makes glamor
> work fine again on this platform. After chatting with ajax in
> #xorg-devel, the following solution was proposed.

In Mesa we've decided in the past to not expose GLSL >= 1.30 on GL 2.x,
because you can't use most of the new functionality of GLSL 1.30 without
GL 3.x's APIs.

However, it would be awfully nice for glamor if Mesa drivers *could*
expose 1.30 on GL2 (if you've got integer textures, you could do
glamor_font.c's accelerated core text rendering, for example), so I'm
tempted to take the patch for now so we can start working toward that.

Reviewed-by: Eric Anholt <e...@anholt.net>

but I'll give others a chance to offer input on this.


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

[PATCH xserver 3/6] dri3: Switch get_drawable_modifiers to using stdint.

2018-05-07 Thread Eric Anholt
We were mixing stdint and CARD* types, causing compiler warnings on
32-bit.  Just switch over to stdint, which is what we'd like the server
to be using long term, anyway.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 dri3/dri3.h| 6 +++---
 dri3/dri3_screen.c | 4 ++--
 glamor/glamor.c| 4 ++--
 glamor/glamor.h| 8 
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/dri3/dri3.h b/dri3/dri3.h
index fc76908e1878..db3f9cd23ca6 100644
--- a/dri3/dri3.h
+++ b/dri3/dri3.h
@@ -80,9 +80,9 @@ typedef int (*dri3_get_modifiers_proc) (ScreenPtr screen,
 CARD64 **modifiers);
 
 typedef int (*dri3_get_drawable_modifiers_proc) (DrawablePtr draw,
- CARD32 format,
- CARD32 *num_modifiers,
- CARD64 **modifiers);
+ uint32_t format,
+ uint32_t *num_modifiers,
+ uint64_t **modifiers);
 
 typedef struct dri3_screen_info {
 uint32_tversion;
diff --git a/dri3/dri3_screen.c b/dri3/dri3_screen.c
index 59abe6ed9082..80db961308a5 100644
--- a/dri3/dri3_screen.c
+++ b/dri3/dri3_screen.c
@@ -224,8 +224,8 @@ dri3_get_supported_modifiers(ScreenPtr screen, DrawablePtr 
drawable,
 const dri3_screen_info_rec *info = ds->info;
 int i, j;
 int ret;
-CARD32  num_drawable_mods;
-CARD64 *drawable_mods;
+uint32_tnum_drawable_mods;
+uint64_t   *drawable_mods;
 CARD64 *intersect_mods = NULL;
 CARD64 *screen_mods = NULL;
 CARD32  format;
diff --git a/glamor/glamor.c b/glamor/glamor.c
index acc7de9403ac..86935ed98697 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -803,8 +803,8 @@ glamor_set_drawable_modifiers_func(ScreenPtr screen,
 }
 
 _X_EXPORT Bool
-glamor_get_drawable_modifiers(DrawablePtr draw, CARD32 format,
-  CARD32 *num_modifiers, uint64_t **modifiers)
+glamor_get_drawable_modifiers(DrawablePtr draw, uint32_t format,
+  uint32_t *num_modifiers, uint64_t **modifiers)
 {
 struct glamor_screen_private *glamor_priv =
 glamor_get_screen_private(draw->pScreen);
diff --git a/glamor/glamor.h b/glamor/glamor.h
index 5d065909936e..b3c6d22b4c24 100644
--- a/glamor/glamor.h
+++ b/glamor/glamor.h
@@ -61,8 +61,8 @@ typedef enum glamor_pixmap_type {
 } glamor_pixmap_type_t;
 
 typedef Bool (*GetDrawableModifiersFuncPtr) (DrawablePtr draw,
- CARD32 format,
- CARD32 *num_modifiers,
+ uint32_t format,
+ uint32_t *num_modifiers,
  uint64_t **modifiers);
 
 #define GLAMOR_EGL_EXTERNAL_BUFFER 3
@@ -323,8 +323,8 @@ extern _X_EXPORT Bool glamor_get_modifiers(ScreenPtr screen,
uint64_t **modifiers);
 
 extern _X_EXPORT Bool glamor_get_drawable_modifiers(DrawablePtr draw,
-CARD32 format,
-CARD32 *num_modifiers,
+uint32_t format,
+uint32_t *num_modifiers,
 uint64_t **modifiers);
 
 extern _X_EXPORT void glamor_set_drawable_modifiers_func(ScreenPtr screen,
-- 
2.17.0

___
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] randr: Fix a compiler warning on 32-bit.

2018-05-07 Thread Eric Anholt
Signed-off-by: Eric Anholt <e...@anholt.net>
---
 randr/rrprovider.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/randr/rrprovider.c b/randr/rrprovider.c
index e4bc2bf6a786..c430f74770c2 100644
--- a/randr/rrprovider.c
+++ b/randr/rrprovider.c
@@ -276,7 +276,7 @@ RRInitPrimeSyncProps(ScreenPtr pScreen)
 Atom syncProp = MakeAtom(syncStr, strlen(syncStr), TRUE);
 
 int defaultVal = TRUE;
-int validVals[2] = {FALSE, TRUE};
+INT32 validVals[2] = {FALSE, TRUE};
 
 int i;
 for (i = 0; i < pScrPriv->numOutputs; i++) {
-- 
2.17.0

___
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 5/6] dri3: Switch fds_from_pixmap to stdint types.

2018-05-07 Thread Eric Anholt
Again, this was causing 32-bit build warnings due to mixing CARD* and
stdint.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 dri3/dri3.h|  6 +++---
 dri3/dri3_priv.h   |  4 ++--
 dri3/dri3_screen.c | 10 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/dri3/dri3.h b/dri3/dri3.h
index 30433dc4f50b..02d3b03eecf0 100644
--- a/dri3/dri3.h
+++ b/dri3/dri3.h
@@ -66,9 +66,9 @@ typedef int (*dri3_fd_from_pixmap_proc) (ScreenPtr screen,
 typedef int (*dri3_fds_from_pixmap_proc) (ScreenPtr screen,
   PixmapPtr pixmap,
   int *fds,
-  CARD32 *strides,
-  CARD32 *offsets,
-  CARD64 *modifier);
+  uint32_t *strides,
+  uint32_t *offsets,
+  uint64_t *modifier);
 
 typedef int (*dri3_get_formats_proc) (ScreenPtr screen,
   CARD32 *num_formats,
diff --git a/dri3/dri3_priv.h b/dri3/dri3_priv.h
index 168b87cbb4b3..b087a9529e07 100644
--- a/dri3/dri3_priv.h
+++ b/dri3/dri3_priv.h
@@ -90,8 +90,8 @@ dri3_fd_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 
*size);
 
 int
 dri3_fds_from_pixmap(PixmapPtr pixmap, int *fds,
- CARD32 *strides, CARD32 *offsets,
- CARD64 *modifier);
+ uint32_t *strides, uint32_t *offsets,
+ uint64_t *modifier);
 
 int
 dri3_get_supported_modifiers(ScreenPtr screen, DrawablePtr drawable,
diff --git a/dri3/dri3_screen.c b/dri3/dri3_screen.c
index a900f261da46..b98259753780 100644
--- a/dri3/dri3_screen.c
+++ b/dri3/dri3_screen.c
@@ -82,8 +82,8 @@ dri3_pixmap_from_fds(PixmapPtr *ppixmap, ScreenPtr screen,
 
 int
 dri3_fds_from_pixmap(PixmapPtr pixmap, int *fds,
- CARD32 *strides, CARD32 *offsets,
- CARD64 *modifier)
+ uint32_t *strides, uint32_t *offsets,
+ uint64_t *modifier)
 {
 ScreenPtr   screen = pixmap->drawable.pScreen;
 dri3_screen_priv_ptrds = dri3_screen_priv(screen);
@@ -118,9 +118,9 @@ dri3_fd_from_pixmap(PixmapPtr pixmap, CARD16 *stride, 
CARD32 *size)
 ScreenPtr   screen = pixmap->drawable.pScreen;
 dri3_screen_priv_ptrds = dri3_screen_priv(screen);
 const dri3_screen_info_rec  *info = ds->info;
-CARD32  strides[4];
-CARD32  offsets[4];
-CARD64  modifier;
+uint32_tstrides[4];
+uint32_toffsets[4];
+uint64_tmodifier;
 int fds[4];
 int num_fds;
 
-- 
2.17.0

___
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] xwayland: Fix a 32-bit build warning.

2018-05-07 Thread Eric Anholt
Signed-off-by: Eric Anholt <e...@anholt.net>
---
 hw/xwayland/xwayland.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index f7e2ce931258..87d9ba22c22f 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -975,7 +975,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
 else if (strcmp(argv[i], "-listen") == 0) {
 if (xwl_screen->listen_fd_count ==
 ARRAY_SIZE(xwl_screen->listen_fds))
-FatalError("Too many -listen arguments given, max is %ld\n",
+FatalError("Too many -listen arguments given, max is %zu\n",
ARRAY_SIZE(xwl_screen->listen_fds));
 
 xwl_screen->listen_fds[xwl_screen->listen_fd_count++] =
-- 
2.17.0

___
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] dix: Fix a warning about GetTimeInMillis return value in XFont2.

2018-05-07 Thread Eric Anholt
Signed-off-by: Eric Anholt <e...@anholt.net>
---
 dix/dixfonts.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index cca92ed2791c..0ea8678bbe03 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -2015,6 +2015,11 @@ _remove_fs_handlers(FontPathElementPtr fpe, 
FontBlockHandlerProcPtr block_handle
 RemoveFontWakeup(fpe);
 }
 
+static uint32_t wrap_time_in_millis(void)
+{
+return GetTimeInMillis();
+}
+
 static const xfont2_client_funcs_rec xfont2_client_funcs = {
 .version = XFONT2_CLIENT_FUNCS_VERSION,
 .client_auth_generation = _client_auth_generation,
@@ -2025,7 +2030,7 @@ static const xfont2_client_funcs_rec xfont2_client_funcs 
= {
 .get_client_resolutions = get_client_resolutions,
 .get_default_point_size = get_default_point_size,
 .get_new_font_client_id = get_new_font_client_id,
-.get_time_in_millis = GetTimeInMillis,
+.get_time_in_millis = wrap_time_in_millis,
 .init_fs_handlers = _init_fs_handlers,
 .register_fpe_funcs = register_fpe_funcs,
 .remove_fs_handlers = _remove_fs_handlers,
-- 
2.17.0

___
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] dri3: Switch get_modifiers to using stdint.

2018-05-07 Thread Eric Anholt
We were mixing stdint and CARD* types, causing compiler warnings on
32-bit.  Just switch over to stdint, which is what we'd like the server
to be using long term, anyway.
---
 dri3/dri3.h   | 6 +++---
 dri3/dri3_screen.c| 4 ++--
 glamor/glamor.h   | 4 ++--
 glamor/glamor_egl.c   | 4 ++--
 hw/xwayland/xwayland-glamor-gbm.c | 4 ++--
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/dri3/dri3.h b/dri3/dri3.h
index db3f9cd23ca6..30433dc4f50b 100644
--- a/dri3/dri3.h
+++ b/dri3/dri3.h
@@ -75,9 +75,9 @@ typedef int (*dri3_get_formats_proc) (ScreenPtr screen,
   CARD32 **formats);
 
 typedef int (*dri3_get_modifiers_proc) (ScreenPtr screen,
-CARD32 format,
-CARD32 *num_modifiers,
-CARD64 **modifiers);
+uint32_t format,
+uint32_t *num_modifiers,
+uint64_t **modifiers);
 
 typedef int (*dri3_get_drawable_modifiers_proc) (DrawablePtr draw,
  uint32_t format,
diff --git a/dri3/dri3_screen.c b/dri3/dri3_screen.c
index 80db961308a5..a900f261da46 100644
--- a/dri3/dri3_screen.c
+++ b/dri3/dri3_screen.c
@@ -160,8 +160,8 @@ cache_formats_and_modifiers(ScreenPtr screen)
 const dri3_screen_info_rec *info = ds->info;
 CARD32  num_formats;
 CARD32 *formats;
-CARD32  num_modifiers;
-CARD64 *modifiers;
+uint32_tnum_modifiers;
+uint64_t   *modifiers;
 int i;
 
 if (ds->formats_cached)
diff --git a/glamor/glamor.h b/glamor/glamor.h
index b3c6d22b4c24..06e11506f2ad 100644
--- a/glamor/glamor.h
+++ b/glamor/glamor.h
@@ -318,8 +318,8 @@ extern _X_EXPORT Bool glamor_get_formats(ScreenPtr screen,
  CARD32 **formats);
 
 extern _X_EXPORT Bool glamor_get_modifiers(ScreenPtr screen,
-   CARD32 format,
-   CARD32 *num_modifiers,
+   uint32_t format,
+   uint32_t *num_modifiers,
uint64_t **modifiers);
 
 extern _X_EXPORT Bool glamor_get_drawable_modifiers(DrawablePtr draw,
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index c38b02e2b8a6..123e9f28d496 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -629,8 +629,8 @@ glamor_get_formats(ScreenPtr screen,
 }
 
 _X_EXPORT Bool
-glamor_get_modifiers(ScreenPtr screen, CARD32 format,
- CARD32 *num_modifiers, uint64_t **modifiers)
+glamor_get_modifiers(ScreenPtr screen, uint32_t format,
+ uint32_t *num_modifiers, uint64_t **modifiers)
 {
 #ifdef GLAMOR_HAS_EGL_QUERY_DMABUF
 struct glamor_egl_screen_private *glamor_egl;
diff --git a/hw/xwayland/xwayland-glamor-gbm.c 
b/hw/xwayland/xwayland-glamor-gbm.c
index 4f7062599d04..29325adacb10 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -546,8 +546,8 @@ glamor_get_formats(ScreenPtr screen,
 }
 
 _X_EXPORT Bool
-glamor_get_modifiers(ScreenPtr screen, CARD32 format,
- CARD32 *num_modifiers, uint64_t **modifiers)
+glamor_get_modifiers(ScreenPtr screen, uint32_t format,
+ uint32_t *num_modifiers, uint64_t **modifiers)
 {
 struct xwl_screen *xwl_screen = xwl_screen_get(screen);
 struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen);
-- 
2.17.0

___
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] glx: Fix attribute handling for GLX_TEXTURE_FORMAT_EXT

2018-05-01 Thread Eric Anholt
Adam Jackson  writes:

> On Mon, 2018-04-02 at 14:52 -0400, Adam Jackson wrote:
>
>> @@ -1737,6 +1740,9 @@ __glXDisp_BindTexImageEXT(__GLXclientState * cl, 
>> GLbyte * pc)
>>DixReadAccess, , ))
>>  return error;
>>  
>> +if (pGlxDraw->format == GLX_TEXTURE_FORMAT_NONE_EXT)
>> +return BadMatch;
>> +
>>  if (!context->bindTexImage)
>>  return __glXError(GLXUnsupportedPrivateRequest);
>> 
>
> The conditional added here is correct in a specification sense, but the
> behavior change would be subtle. As it stands you can do
> glXBindTexImage on _any_ GLX pixmap, even one created without a
> texture-target attribute; due to accident of how various conditionals
> are written it looks like such pixmaps would implicitly be treated as
> RGBA. I'm not aware of any apps that do that and I don't think they
> would work on non-Mesa drivers, but we could instead set a default
> texture target derived from (the number of alpha bits of) the requested
> fbconfig and it would probably do the right thing.

Hmm, I don't see any required default value for GLX_TEXTURE_FORMAT in
the spec.  I'm also concerned that we're going to break some backwards
compat here, so your alpha bits plan sounds pretty decent.

Also, you need to bump the attributes by 2, not 1, when adding a new
attribute to output. :)


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 7/7] modesetting: Allow a DRM fd to be passed through XF86_VIDEO_MODESETTING_FD

2018-02-23 Thread Eric Anholt
Keith Packard  writes:

> This lets an application open a suitable DRM device and pass the file
> descriptor to the mode setting driver through an environment variable.
>
> There's a companion application, xlease, which creates a DRM master by
> leasing an output from another X server. That is available at
>
>   git clone git://people.freedesktop.org/~keithp/xlease
>
> Signed-off-by: Keith Packard 
> ---
>  hw/xfree86/drivers/modesetting/driver.c | 29 -
>  hw/xfree86/drivers/modesetting/driver.h |  1 +
>  2 files changed, 29 insertions(+), 1 deletion(-)
>
> diff --git a/hw/xfree86/drivers/modesetting/driver.c 
> b/hw/xfree86/drivers/modesetting/driver.c
> index 577559ea6..074872e97 100644
> --- a/hw/xfree86/drivers/modesetting/driver.c
> +++ b/hw/xfree86/drivers/modesetting/driver.c
> @@ -194,11 +194,28 @@ modesettingEntPtr ms_ent_priv(ScrnInfoPtr scrn)
>  return pPriv->ptr;
>  }
>  
> +static int
> +get_passed_fd(void)
> +{
> +char *fdstr = getenv("XF86_VIDEO_MODESETTING_FD");

Any security concerns with a suid xserver here?


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 5/5] glamor: Enable composite acceleration for rgb10 formats.

2018-02-09 Thread Eric Anholt
Mario Kleiner  writes:

> argb2101010 and xrgb2101010. Seems to work fine,
> but not sure if because of dumb luck or because
> it is meant to be. (Re)viewer discretion advised!
>
> Tested on KDE Plasma-5 with XRender based composite
> acceleration backend. Much smoother and faster.
>
> Signed-off-by: Mario Kleiner 
> ---
>  glamor/glamor_render.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
> index 7a96c82..659537f 100644
> --- a/glamor/glamor_render.c
> +++ b/glamor/glamor_render.c
> @@ -773,6 +773,8 @@ static Bool
>  glamor_render_format_is_supported(PictFormatShort format)
>  {
>  switch (format) {
> +case PICT_a2r10g10b10:
> +case PICT_x2r10g10b10:

I don't think you can include a2r10g10b10 here.  A pixmap that you've
attached that pictformat to must be depth 32, which will have been
created as an  GL texture.  Doing composite on that when asked for
2101010 formatwill end up referencing the wrong bits in the color
channels.  I think if you ran rendercheck, it would throw errors about
this.

Other than that, patch 2-5 get my reviewed-by, except that we should
stack the glamor fixes before enabling the feature in the modesetting
driver.


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 1/7] miinitext: General cleanup (v2)

2018-01-21 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> This really just wants to be the list of disable booleans and
> initialization functions, and nothing else. Stop including the protocol
> headers from extinit.h, remove a stray mention of xgl, and move an
> XInput declaration to a better place.
>
> v2: A bunch of drivers assume they'll get the DPMS tokens implicitly,
> so add it to globals.h.

Patch 1-2, 5-6 are:

Reviewed-by: Eric Anholt <e...@anholt.net>

For patch 3-4, I'm happy with you and Kyle just coming to agreement on
the details of it.

I haven't figured out enough of GLX to get patch 7 yet.


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 1/2] meson: Enable SUN-DES-1 auth code

2018-01-18 Thread Eric Anholt
Jon Turney  writes:

> On 08/01/2018 20:50, Adam Jackson wrote:
>> ---
>>   include/meson.build | 1 +
>>   meson_options.txt   | 1 +
>>   os/meson.build  | 4 
>>   3 files changed, 6 insertions(+)
>
> After this, I needed something like the attached.

I'm curious, why tirpc instead of rpcsvc like xtrans did before?


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] meson.build: Fix hw/xwin build when dependencies are installed in a non-default location

2018-01-18 Thread Eric Anholt
Jon Turney <jon.tur...@dronecode.org.uk> writes:

> Signed-off-by: Jon Turney <jon.tur...@dronecode.org.uk>

Reviewed-by: Eric Anholt <e...@anholt.net>


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] x86emu: Teach the debug code about varargs

2018-01-16 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> With -Wformat-nonliteral and a debug build you'd get yelled at here:
>
> ../hw/xfree86/x86emu/x86emu/debug.h:188:9: warning: format not a string 
> literal, argument types not checked [-Wformat-nonliteral]
>
> To fix this, rewrite the printf code to actually use varargs and the
> appropriate format attribute. All callers of DECODE_PRINTF() pass a
> string with no % specifiers, so we pass that as the argument to
> printf("%s"). For DECODE_PRINTF2() we just pass the args through.
>
> Signed-off-by: Adam Jackson <a...@redhat.com>

Reviewed-by: Eric Anholt <e...@anholt.net>


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 1/2] meson: Enable SUN-DES-1 auth code

2018-01-16 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> Signed-off-by: Adam Jackson <a...@redhat.com>

These two are:

Reviewed-by: Eric Anholt <e...@anholt.net>


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] modesetting: Use seq instead of msc in ms_queue_vblank failure path

2018-01-16 Thread Eric Anholt
Keith Packard <kei...@keithp.com> writes:

> When the call to queue a vblank event fails, we need to clean up by
> removing the user-space queue entry. That is indexed by the local
> sequence number, not by the kernel vblank count. The call in this
> case was just passing the wrong value.
>
> Signed-off-by: Keith Packard <kei...@keithp.com>

Reviewed-by: Eric Anholt <e...@anholt.net>


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] glamor: Rename var in glamor_xv, SAMPLE is GLSL keyword

2018-01-03 Thread Eric Anholt
Corentin Rossignon  writes:

> From: Corentin Rossignon 
>
> This fix issue with gnome-shell and playing video using xv
>
> Signed-off-by: Corentin Rossignon 
> Bugzilla: https://bugs.freedesktop.org/104405

This is weird -- sample is only a keyword in late versions of GLSL, and
we shouldn't be requesting a late version of GLSL (#version exists so
that the language can evolve without breaking old shaders!)  What driver
was doing this?


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 2/2] glx: Enable GLX_ARB_create_context_no_error

2017-12-14 Thread Eric Anholt
Adam Jackson  writes:

> This is mostly for the client library's convenience, if this extension
> is listed then it can know the attribute won't be rejected. Note that we
> don't _do_ anything with this attribute, meaning indirect contexts will
> not be no-error. That's fine, we don't want to introduce undefined
> behavior into a potentially privileged process anyway.

I agree, but don't we need to accept GLX_CONTEXT_OPENGL_NO_ERROR_ARB and
drop it on the floor instead of falling through to createcontext.c's:

default:
if (!req->isDirect)
return BadValue;
break;


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 1/2] glx: Stop printing messages about what GLX extensions we enable

2017-12-14 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> glxinfo already exists, use it.

Yes, please.

Reviewed-by: Eric Anholt <e...@anholt.net>


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: Another protocol repository merge attempt

2017-12-14 Thread Eric Anholt
Keith Packard  writes:

> [ Unknown signature status ]
>
> The idea of merging all of our X protocol repositories came up again,
> and Adam Jackson asked if I wanted to wait for this before merging my
> randr lease/non-desktop changes.
>
> Not really? But, I'm still interested in a merge of the protocol
> repositories; we've got way too many, and they're mostly tiny.
>
> Ok, so I gave another run at this, with a slightly different goal. I
> want to avoid renaming files as that makes history tracking a bit harder
> to manage. So, what I did was find all of the filenames which are
> duplicated between repositories. It's a short list:
>
> .gitignore
> AUTHORS
> autogen.sh
> configure.ac
> COPYING
> docbook.am
> Makefile.am
> README
> specs/Makefile.am
> specs/.gitignore
>
> Then I generated some scripts that would merge in a repo, move the
> (potentially) conflicting files to a directory named after the source
> repo and commit that move.
>
> Another script to merge the Makefile.am contents and I've got a
> repository which installs all of the header files at least. It doesn't
> build the docs for anything, and in fact all of the docs are mashed into
> a 'specs' sub-directory
>
> I don't know if this is more or less useful than the earlier plan which
> placed each extension in a sub-directory; I'm good either way, I just
> want to finish this up and get back to more interesting work.
>
> Take a look and let me know what you think.
>
> git clone git://people.freedesktop.org/~keithp/mergeproto
>
> This was less than an hours work; if the consensus is 'yuck', you won't
> hurt my feelings at all.

I like that it's just commits and merges instead of filter-branch.  I
think it would make more sense if the headers matched the structure they
are installed into, but that could be a thing we could move later.
Similarly, the Makefile.am is gross, but if it's autogenerated then it's
also pretty believable and easy to fix up by hand later.


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] test: Fix build dependency for bigreq test

2017-12-11 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> libxcb-xinput isn't a thing in whichever Ubuntu it is that Travis is
> using. The test is already optional, make it more so.

We should probably be including current xcb in the docker image.  This
seems correct, though:

Reviewed-by: Eric Anholt <e...@anholt.net>


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 3/3] glx: Implement GLX_EXT_no_config_context (v2)

2017-11-16 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> Only enabled for the DRI backends at the moment. In principle WGL/CGL
> could support this - it's sort of implied by GL 3.0 support - but in
> practice I don't know that it would actually work.
>
> This is currently a draft extension, under review at:
>
> https://github.com/KhronosGroup/OpenGL-Registry/pull/102
>
> v2: Require that the two screen numbers match, per v4 of spec.

Once the spec is accepted, 2-3 are:

Reviewed-by: Eric Anholt <e...@anholt.net>


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 1/3] glx: Fix glXQueryContext for GLX_FBCONFIG_ID and GLX_RENDER_TYPE (v2)

2017-11-16 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> Just never filled in, oops. Seems to have gone unnoticed because
> normally glXQueryContext simply returns the values filled in by the
> client library when the context was created. The only path by which you
> normally get to a GLXQueryContext request is glXImportContext, and then
> only if the context is already indirect.
>
> However, that's a statement about Mesa's libGL (and anything else that
> inherited that bit of the SGI SI more or less intact). Nothing prevents
> a mischeivous client from issuing that request of a direct context, and
> if they did we'd be in trouble because we never bothered to preserve the
> associated fbconfig in the context state, so we'd crash looking up
> GLX_VISUAL_ID_EXT. So let's fix that too.
>
> v2: Fixed missing preservation of the config in DRI2 (Eric Anholt)

This one had my

Reviewed-by: Eric Anholt <e...@anholt.net>


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] glamor: Drop the non-VAO rendering path

2017-11-14 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> GLES spells this extension as GL_OES_vertex_array_object, but it is
> functionally equivalent to the GL_ARB version. Mesa has supported both
> since 9.0, let's go ahead and require it.

Excellent.  Now to just start using VAOs as they're actually
intended

Reviewed-by: Eric Anholt <e...@anholt.net>


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] configure.ac: unconditionally enable kdrive

2017-11-02 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> On Wed, 2017-11-01 at 21:50 -0700, Matt Turner wrote:
>> On Tue, Oct 24, 2017 at 10:27 AM, Matt Turner <matts...@gmail.com>
>> wrote:
>> > Reviewed-by: Matt Turner <matts...@gmail.com>
>> 
>> Please merge. :)
>
> Full disclosure: the reason I haven't is because it exposed that my
> test setup was failing to build Xephyr (for exactly the reason the
> patch fixes), and that glamor was now failing xts. I am quite sure it
> worked in 1.19 at the time, but building 1.19 [1] now was also failing
> xts, which points the finger at llvmpipe since it rules out any change
> in glamor as the culprit.
>
> I'd already worked around one such regression with llvmpipe [2] but
> this one has eluded me. Eric Anholt had written a script to run the
> test on a hardware-backed Xephyr, but didn't think we could integrate
> it with make check.
>
> I'd like to start doing that, though. In this order:
>
> 1) Add the script
> 2) Add it to make check, guarded by [ -z "$DISPLAY" ]
> 3) Apply this kdrive patch (assuming it passes on my hardware!)
>
> I think that preserves the greatest amount of bisectable history
> without introducing any known-broken tree states. It also means we'd be
> testing something more like what people actually run; the set of people
> using glamor backed by llvmpipe I suspect is zero, it's uniformly
> slower than fb.
>
> Sound reasonable?

My reasoning behind using llvmpipe only for make test was because it
meant that we'd all be running the same driver for make check.  My fear
was that if we use the HW drivers, it means that I check in some glamor
code that works on my driver, and keithp on his different gen of intel
(or somebody's radeon, or whatever) tries to run make check and the
build breaks because of some GL driver bug.

Now, it would be great if that meant that we were all making sure that
all of our personal GL drivers work for glamor.  Given that I haven't
even debugged the llvmpipe fails in all this time, I'm skeptical of that
working out, and instead we'd have people just ignoring the glamor tests
even more.

So, mixed feelings.  I think it's worth a try, and it might be good for
us in the end because the shorter test runtime on HW drivers makes it so
that we actually consistently run the tests and do the debug work.


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

[PATCH xserver] xkb: Print the xkbcomp path being executed when we fail to compile.

2017-10-31 Thread Eric Anholt
I don't know how many times I've had a broken server due to a bad
directory to xkbcomp, and only finding the whole path has shown me
where I went wrong.
---
 xkb/ddxLoad.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index f71815aa814b..bbe39524557a 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -191,8 +191,10 @@ RunXkbComp(xkbcomp_buffer_callback callback, void 
*userdata)
 #endif
 return xnfstrdup(keymap);
 }
-else
-LogMessage(X_ERROR, "Error compiling keymap (%s)\n", keymap);
+else {
+LogMessage(X_ERROR, "Error compiling keymap (%s) executing '%s'\n",
+   keymap, buf);
+}
 #ifdef WIN32
 /* remove the temporary file */
 unlink(tmpname);
-- 
2.15.0

___
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 v4 xserver] test: Add a test for the overflow bug in bigreqs.

2017-10-30 Thread Eric Anholt
Peter Hutterer <peter.hutte...@who-t.net> writes:

> From: Eric Anholt <e...@anholt.net>
>
> The failing struct comes from the python test written by Michal Srb
> <m...@suse.com>.
>
> v2: Use a drawable (root window) and gc, so that PolyLines hopefully
> actually tries processing things.  However, the request seems to
> process successfully so the poll() just stalls out.  However, this
> does let us distinguish between detecting the bigrequests error
> and not, at least.
> v3: Clean up the description of what we expect the poll() call to do.
> v4: change to use XISelectEvents
>
> Signed-off-by: Eric Anholt <e...@anholt.net>
> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
> ---
> Couldn't get v3 to crash here, even after changing to PolyRectangle. But I
> found an easy to trigger test in XI2 - we know the server replies with
> BadValue for a zero num_masks argument. So if we send a bigreq with a
> num_masks 0 and a length 0, we can just check whether we get killed (good)
> or a BadValue (bad). It doesn't test for specific memory overflows or
> crashes, but based on the assumption that we shouldn't look at *any* BigReq
> of size 0, this seems to be sufficient.

Your changes look good to me.  Want to push?


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 1/3] glamor: Unconditionalize GLAMOR_GRADIENT_SHADER

2017-10-25 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> Effectively always true anyway.

All 3:

Reviewed-by: Eric Anholt <e...@anholt.net>


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] glamor: Use GL_MESA_tile_raster_order for overlapping blits.

2017-10-13 Thread Eric Anholt
Keith Packard <kei...@keithp.com> writes:

> [ Unknown signature status ]
> Eric Anholt <e...@anholt.net> writes:
>
>>> Looks like you're also requiring nv_texture_barrier to use the new
>>> extension?
>>
>> texture_barrier is an explicit requirement of the new extension (it's
>> how get caches flushed between different overlapping blits).
>
> Makes sense to me. No other concerns from me, this is
>
> Reviewed-by: Keith Packard <kei...@keithp.com>

Thanks!  I've updated the stats (copywinwin500 is much more
representative than 100) and pushed.


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] glamor: Use GL_MESA_tile_raster_order for overlapping blits.

2017-10-11 Thread Eric Anholt
Keith Packard <kei...@keithp.com> writes:

> [ Unknown signature status ]
> Eric Anholt <e...@anholt.net> writes:
>
>> +/* Include the enums here for the moment, to keep from needing to bump 
>> epoxy. */
>> +#ifndef GL_TILE_RASTER_ORDER_FIXED_MESA
>> +#define GL_TILE_RASTER_ORDER_FIXED_MESA  0x8BB8
>> +#define GL_TILE_RASTER_ORDER_INCREASING_X_MESA   0x8BB9
>> +#define GL_TILE_RASTER_ORDER_INCREASING_Y_MESA   0x8BBA
>> +#endif
>
> Yuck, but whatever.
>> @@ -611,34 +633,36 @@ glamor_copy_needs_temp(DrawablePtr src,
>>  if (!glamor_priv->has_nv_texture_barrier)
>>  return TRUE;
>
> Looks like you're also requiring nv_texture_barrier to use the new
> extension?

texture_barrier is an explicit requirement of the new extension (it's
how get caches flushed between different overlapping blits).


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

[PATCH xserver] glamor: Use GL_MESA_tile_raster_order for overlapping blits.

2017-10-10 Thread Eric Anholt
Improves Raspberry Pi 3 x11perf -copywinwin100 from ~4700/sec to
~5130/sec.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 glamor/glamor.c  |  2 ++
 glamor/glamor_copy.c | 74 ++--
 glamor/glamor_priv.h |  1 +
 3 files changed, 52 insertions(+), 25 deletions(-)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index 91236e29ce67..d06934595713 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -601,6 +601,8 @@ glamor_init(ScreenPtr screen, unsigned int flags)
 epoxy_has_gl_extension("GL_EXT_map_buffer_range");
 glamor_priv->has_buffer_storage =
 epoxy_has_gl_extension("GL_ARB_buffer_storage");
+glamor_priv->has_mesa_tile_raster_order =
+epoxy_has_gl_extension("GL_MESA_tile_raster_order");
 glamor_priv->has_nv_texture_barrier =
 epoxy_has_gl_extension("GL_NV_texture_barrier");
 glamor_priv->has_unpack_subimage =
diff --git a/glamor/glamor_copy.c b/glamor/glamor_copy.c
index cbaf06dddcd9..bd4a0e20f250 100644
--- a/glamor/glamor_copy.c
+++ b/glamor/glamor_copy.c
@@ -317,6 +317,13 @@ bail:
 return FALSE;
 }
 
+/* Include the enums here for the moment, to keep from needing to bump epoxy. 
*/
+#ifndef GL_TILE_RASTER_ORDER_FIXED_MESA
+#define GL_TILE_RASTER_ORDER_FIXED_MESA  0x8BB8
+#define GL_TILE_RASTER_ORDER_INCREASING_X_MESA   0x8BB9
+#define GL_TILE_RASTER_ORDER_INCREASING_Y_MESA   0x8BBA
+#endif
+
 /*
  * Copy from GPU to GPU by using the source
  * as a texture and painting that into the destination
@@ -388,6 +395,18 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
 
 v = glamor_get_vbo_space(dst->pScreen, nbox * 8 * sizeof (int16_t), 
_offset);
 
+if (src_pixmap == dst_pixmap && glamor_priv->has_mesa_tile_raster_order) {
+glEnable(GL_TILE_RASTER_ORDER_FIXED_MESA);
+if (dx >= 0)
+glEnable(GL_TILE_RASTER_ORDER_INCREASING_X_MESA);
+else
+glDisable(GL_TILE_RASTER_ORDER_INCREASING_X_MESA);
+if (dy >= 0)
+glEnable(GL_TILE_RASTER_ORDER_INCREASING_Y_MESA);
+else
+glDisable(GL_TILE_RASTER_ORDER_INCREASING_Y_MESA);
+}
+
 glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
 glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE,
   2 * sizeof (GLshort), vbo_offset);
@@ -451,6 +470,9 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
 ret = TRUE;
 
 bail_ctx:
+if (src_pixmap == dst_pixmap && glamor_priv->has_mesa_tile_raster_order) {
+glDisable(GL_TILE_RASTER_ORDER_FIXED_MESA);
+}
 glDisable(GL_SCISSOR_TEST);
 glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
 
@@ -611,34 +633,36 @@ glamor_copy_needs_temp(DrawablePtr src,
 if (!glamor_priv->has_nv_texture_barrier)
 return TRUE;
 
-glamor_get_drawable_deltas(src, src_pixmap, _off_x, _off_y);
-glamor_get_drawable_deltas(dst, dst_pixmap, _off_x, _off_y);
-
-bounds = box[0];
-for (n = 1; n < nbox; n++) {
-bounds.x1 = min(bounds.x1, box[n].x1);
-bounds.y1 = min(bounds.y1, box[n].y1);
+if (!glamor_priv->has_mesa_tile_raster_order) {
+glamor_get_drawable_deltas(src, src_pixmap, _off_x, _off_y);
+glamor_get_drawable_deltas(dst, dst_pixmap, _off_x, _off_y);
 
-bounds.x2 = max(bounds.x2, box[n].x2);
-bounds.y2 = max(bounds.y2, box[n].y2);
-}
+bounds = box[0];
+for (n = 1; n < nbox; n++) {
+bounds.x1 = min(bounds.x1, box[n].x1);
+bounds.y1 = min(bounds.y1, box[n].y1);
 
-/* Check to see if the pixmap-relative boxes overlap in both X and Y,
- * in which case we can't rely on NV_texture_barrier and must
- * make a temporary copy
- *
- *  dst.x1 < src.x2 &&
- *  src.x1 < dst.x2 &&
- *
- *  dst.y1 < src.y2 &&
- *  src.y1 < dst.y2
- */
-if (bounds.x1 + dst_off_x  < bounds.x2 + dx + src_off_x &&
-bounds.x1 + dx + src_off_x < bounds.x2 + dst_off_x &&
+bounds.x2 = max(bounds.x2, box[n].x2);
+bounds.y2 = max(bounds.y2, box[n].y2);
+}
 
-bounds.y1 + dst_off_y  < bounds.y2 + dy + src_off_y &&
-bounds.y1 + dy + src_off_y < bounds.y2 + dst_off_y) {
-return TRUE;
+/* Check to see if the pixmap-relative boxes overlap in both X and Y,
+ * in which case we can't rely on NV_texture_barrier and must
+ * make a temporary copy
+ *
+ *  dst.x1 < src.x2 &&
+ *  src.x1 < dst.x2 &&
+ *
+ *  dst.y1 < src.y2 &&
+ *  src.y1 < dst.y2
+ */
+if (bounds.x1 + dst_of

Re: [PATCH] os: Make sure big requests have sufficient length.

2017-10-09 Thread Eric Anholt
Peter Hutterer <peter.hutte...@who-t.net> writes:

> On Mon, Sep 25, 2017 at 12:55:47PM -0700, Eric Anholt wrote:
>> Michal Srb <m...@suse.com> writes:
>> 
>> > On neděle 24. září 2017 0:20:07 CEST Eric Anholt wrote:
>> >> Michal Srb <m...@suse.com> writes:
>> >> > Here is a script that can be used to crash X server using a broken big
>> >> > request for PolyLine. It connects to DISPLAY=:1 and doesn't support
>> >> > authentication. Look inside the script for more details.
>> >> > 
>> >> > Other requests could be used to crash X server in similar way, for 
>> >> > example
>> >> > SetFontPath.
>> >> 
>> >> I noticed this still in my mailbox.  I tried writing an mergeable unit
>> >> test for it at:
>> >> 
>> >> https://github.com/anholt/xserver/commit/d0e9d732750aa8eb7eeb33adce321f1dfee
>> >> f265d
>> >> 
>> >> but it doesn't manage to crash the server because I can't set the endian
>> >> mode using xcb (and xcb, sensibly, doesn't let me get an fd without
>> >> doing connection setup on it).
>> >> 
>> >> I don't know much about the codepath with the bug, but hopefully this
>> >> sparks some discussion.
>> >
>> > Hi,
>> >
>> > I think in your test case the underflow of the request length still 
>> > happens, 
>> > but it doesn't crash because nobody tries to access the data. It ends 
>> > inside 
>> > ProcPolyLine because the Drawable and the GC are not valid.
>> >
>> > In my test case the client was big endian, so it crashed inside SProcPoly 
>> > trying to swap the (incorrectly) huge request.
>> >
>> > I think if you supply valid Drawable and GC, you should get crash even 
>> > with 
>> > little endian.
>> 
>> I tried creating a gc against the root window and doing the drawing
>> there, but the request seems to process successfully.  bigreq branch
>> updated with that code.
>
> Following the path in the code, michal's patch is
> Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net> though fixing the
> typos in the commit message would be good :)
>
> I think for the unit test you have to invert your approach. If you're
> supplying a zero-length big req then you should expect the server to
> complain. If it processes your request, then something is wrong.

I tried the updated testcase and that didn't crash for me, either.  My
v2 (which I've now sent out) testcase times out in 30 seconds without
the fix and passes with the fix.  I'd love your review if you like that
as a solution.


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

[PATCH xserver] test: Add a test for the overflow bug in bigreqs.

2017-10-09 Thread Eric Anholt
The failing struct comes from the python test written by Michal Srb
<m...@suse.com>.

v2: Use a drawable (root window) and gc, so that PolyLines hopefully
actually tries processing things.  However, the request seems to
process successfully so the poll() just stalls out.  However, this
does let us distinguish between detecting the bigrequests error
and not, at least.
v3: Clean up the description of what we expect the poll() call to do.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 test/bigreq/meson.build  |  8 +
 test/bigreq/request-length.c | 71 
 test/meson.build |  1 +
 3 files changed, 80 insertions(+)
 create mode 100644 test/bigreq/meson.build
 create mode 100644 test/bigreq/request-length.c

diff --git a/test/bigreq/meson.build b/test/bigreq/meson.build
new file mode 100644
index ..9462ede31dca
--- /dev/null
+++ b/test/bigreq/meson.build
@@ -0,0 +1,8 @@
+xcb_dep = dependency('xcb', required: false)
+
+if get_option('xvfb')
+if xcb_dep.found()
+requestlength = executable('request-length', 'request-length.c', 
dependencies: xcb_dep)
+test('request-length', simple_xinit, args: [requestlength, '--', 
xvfb_server])
+endif
+endif
diff --git a/test/bigreq/request-length.c b/test/bigreq/request-length.c
new file mode 100644
index ..82d712e0624d
--- /dev/null
+++ b/test/bigreq/request-length.c
@@ -0,0 +1,71 @@
+/*
+ * Copyright © 2017 Broadcom
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int main(int argc, char **argv)
+{
+xcb_connection_t *c = xcb_connect(NULL, NULL);
+xcb_screen_t *screen = xcb_setup_roots_iterator(xcb_get_setup(c)).data;
+xcb_gcontext_t gc = xcb_generate_id(c);
+int fd = xcb_get_file_descriptor(c);
+struct {
+uint8_t reqtype;
+uint8_t coordmode;
+uint16_t length;
+uint32_t length_bigreq;
+uint32_t drawable;
+uint32_t gc;
+} polyline_req = {
+.reqtype = XCB_POLY_LINE,
+.drawable = screen->root,
+.gc = gc,
+
+/* This is the value that triggers the bug. */
+.length_bigreq = 0,
+};
+
+xcb_create_gc(c, gc, screen->root, 0, NULL);
+
+free(xcb_big_requests_enable_reply(c, xcb_big_requests_enable(c), NULL));
+
+/* Manually write out the bad request.  XCB can't help us here.*/
+write(fd, _req, sizeof(polyline_req));
+
+/* Block until the server has processed our mess and throws an
+ * error.  If it never throws an error, then it probably did
+ * things wrong (either a crash, or "successfully" processing our
+ * broken request).
+ */
+struct pollfd pfd = {
+.fd = fd,
+.events = POLLIN,
+};
+poll(, 1, -1);
+
+return 0;
+}
diff --git a/test/meson.build b/test/meson.build
index 3e482d6f19cd..d413e9da5323 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -23,4 +23,5 @@ if get_option('xvfb')
 endif
 endif
 
+subdir('bigreq')
 subdir('sync')
-- 
2.14.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

Re: [PATCH xserver 4/6] meson: Default to gnu99

2017-09-28 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> We don't really require all of C99, but enough that it's not worth
> bothering with the distinction, especially if your toolchain is new
> enough that meson is a thing for you. We could do strict C99 if we
> really insisted on spelling it __typeof__, but who wants that? Nobody,
> that's who.
>
> Signed-off-by: Adam Jackson <a...@redhat.com>

Patch 1-4 are:

Reviewed-by: Eric Anholt <e...@anholt.net>


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] xfree86: Hush some warnings when Xv is disabled

2017-09-25 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> Spotted by Appveyor:
>
> xf86Crtc.c:3281:1: warning: ‘xf86_crtc_box_area’ defined but not used 
> [-Wunused-function]
>  xf86_crtc_box_area(BoxPtr box)
>  ^~
> xf86Crtc.c:3268:1: warning: ‘x86_crtc_box’ defined but not used 
> [-Wunused-function]
>  x86_crtc_box(xf86CrtcPtr crtc, BoxPtr crtc_box)
>  ^~~~
> xf86Crtc.c:3256:1: warning: ‘x86_crtc_box_intersect’ defined but not used 
> [-Wunused-function]
>  x86_crtc_box_intersect(BoxPtr dest, BoxPtr a, BoxPtr b)
>  ^~

Mesa has started using their _X_UNUSED equivalent for stuff like this,
so that things are compiled either way but DCEed without complaint when
the caller is disabled.  However, this is also a correct cleanup, so:

Reviewed-by: Eric Anholt <e...@anholt.net>


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] os: Make sure big requests have sufficient length.

2017-09-25 Thread Eric Anholt
Michal Srb <m...@suse.com> writes:

> On neděle 24. září 2017 0:20:07 CEST Eric Anholt wrote:
>> Michal Srb <m...@suse.com> writes:
>> > Here is a script that can be used to crash X server using a broken big
>> > request for PolyLine. It connects to DISPLAY=:1 and doesn't support
>> > authentication. Look inside the script for more details.
>> > 
>> > Other requests could be used to crash X server in similar way, for example
>> > SetFontPath.
>> 
>> I noticed this still in my mailbox.  I tried writing an mergeable unit
>> test for it at:
>> 
>> https://github.com/anholt/xserver/commit/d0e9d732750aa8eb7eeb33adce321f1dfee
>> f265d
>> 
>> but it doesn't manage to crash the server because I can't set the endian
>> mode using xcb (and xcb, sensibly, doesn't let me get an fd without
>> doing connection setup on it).
>> 
>> I don't know much about the codepath with the bug, but hopefully this
>> sparks some discussion.
>
> Hi,
>
> I think in your test case the underflow of the request length still happens, 
> but it doesn't crash because nobody tries to access the data. It ends inside 
> ProcPolyLine because the Drawable and the GC are not valid.
>
> In my test case the client was big endian, so it crashed inside SProcPoly 
> trying to swap the (incorrectly) huge request.
>
> I think if you supply valid Drawable and GC, you should get crash even with 
> little endian.

I tried creating a gc against the root window and doing the drawing
there, but the request seems to process successfully.  bigreq branch
updated with that code.


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] os: Make sure big requests have sufficient length.

2017-09-24 Thread Eric Anholt
Michal Srb  writes:

> Here is a script that can be used to crash X server using a broken big 
> request 
> for PolyLine. It connects to DISPLAY=:1 and doesn't support authentication. 
> Look inside the script for more details.
>
> Other requests could be used to crash X server in similar way, for example 
> SetFontPath.

I noticed this still in my mailbox.  I tried writing an mergeable unit
test for it at:

https://github.com/anholt/xserver/commit/d0e9d732750aa8eb7eeb33adce321f1dfeef265d

but it doesn't manage to crash the server because I can't set the endian
mode using xcb (and xcb, sensibly, doesn't let me get an fd without
doing connection setup on it).

I don't know much about the codepath with the bug, but hopefully this
sparks some discussion.


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] travis: Also build on OSX

2017-09-24 Thread Eric Anholt
Jon Turney  writes:

> Signed-off-by: Jon Turney 

Thanks for doing this!  I'll want to convert it to meson some day, but
it'll be a lot easier now that we have travis in place.

remote: I: patch #178342 updated using rev 
c30eca688781deb06b25a6a08297cb855aeb6ed2.
remote: I: patch #178352 updated using rev 
0b00440678fa22c1c1ca4a292b67db3ab8676969.
remote: I: 2 patch(es) updated to state Accepted.
To git+ssh://git.freedesktop.org/git/xorg/xserver
   2c2e1b6f5775..0b00440678fa  HEAD -> master


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] meson: Make it possible to build for 32-bit targets

2017-09-24 Thread Eric Anholt
Jon Turney  writes:

> Setting glx_align64 to '' gives a null string in the arguments list passed
> to the compiler.  This is taken as an input filename, leading to:
>
> "cc: error: : No such file or directory"
>
> Instead, assign an empty list to glx_align64, which gets flattened to
> nothing in the arguments list.
>
> Signed-off-by: Jon Turney 

Reviewed and pushed.  Thanks!


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 2/2] glx: Implement GLX_EXT_no_config_context

2017-09-21 Thread Eric Anholt
Adam Jackson  writes:

> Only enabled for the DRI backends at the moment. In principle WGL/CGL
> could support this - it's sort of implied by GL 3.0 support - but in
> practice I don't know that it would actually work.
>
> This is currently a draft extension, under review at:
>
> https://github.com/KhronosGroup/OpenGL-Registry/pull/102
>
> Signed-off-by: Adam Jackson 

Seems pretty reasonable.  The only thing that seems wacky to me is using
the GLX_SCREEN attribute instead of the screen value in the request.


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 1/2] glx: Fix glXQueryContext for GLX_FBCONFIG_ID and GLX_RENDER_TYPE

2017-09-21 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> Just never filled in, oops. Seems to have gone unnoticed because
> normally glXQueryContext simply returns the values filled in by the
> client library when the context was created. The only path by which you
> normally get to a GLXQueryContext request is glXImportContext, and then
> only if the context is already indirect.
>
> However, that's a statement about Mesa's libGL (and anything else that
> inherited that bit of the SGI SI more or less intact). Nothing prevents
> a mischeivous client from issuing that request of a direct context, and
> if they did we'd be in trouble because we never bothered to preserve the
> associated fbconfig in the context state, so we'd crash looking up
> GLX_VISUAL_ID_EXT. So let's fix that too.

Looks like you missed the .config update in glxdri2.c?

This code is weird -- QueryContext and QueryContextInfoEXT are both
returning the same values, and the existing values we were giving were
only for QCIE.  This seems to be OK because the proto is the same for
both, and the glX call must be picking the attributes it cares about out
of the reply.  So, with the glxdri2.c fixed,

Reviewed-by: Eric Anholt <e...@anholt.net>


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 2/2] meson: Use dependency version_compare()

2017-09-20 Thread Eric Anholt
Daniel Stone <dani...@collabora.com> writes:

> We can check the version on an existing dependency, rather than spinning
> up pkg-config again just to check the right version.
>
> Signed-off-by: Daniel Stone <dani...@collabora.com>
> ---
>  include/meson.build | 7 +++
>  meson.build | 3 ---
>  2 files changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/include/meson.build b/include/meson.build
> index 05ef76930..5eefc5f07 100644
> --- a/include/meson.build
> +++ b/include/meson.build
> @@ -72,13 +72,12 @@ conf_data.set_quoted('SHMDIR', '/tmp')
>  conf_data.set('HAVE_XSHMFENCE', xshmfence_dep.found())
>  conf_data.set('WITH_LIBDRM', libdrm_dep.found())
>  conf_data.set('GLAMOR_HAS_DRM_NAME_FROM_FD_2',
> -  dependency('libdrm', version: '>= 2.4.74', required: 
> false).found())
> +  libdrm_dep.found() and 
> libdrm_dep.version().version_compare('>= 2.4.74'))

nirbheek says there's a meson patch to be merged soon that handles the
caching of pkg-config outputs automatically so you don't need to do this
dep.found() and dep.version().version_compare() dance.  That said,
you've reduced the build system complexity with the rest of this patch,
so:

Reviewed-by: Eric Anholt <e...@anholt.net>


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 1/2] Build: Use dri3proto/libdrm CFLAGS

2017-09-20 Thread Eric Anholt
Daniel Stone <dani...@collabora.com> writes:

> Make sure we get the CFLAGS required for building DRI3 into the
> command line.
>
> Signed-off-by: Daniel Stone <dani...@collabora.com>

Reviewed-by: Eric Anholt <e...@anholt.net>


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

[PATCH xserver 2/6] meson: Add Xvfb and Xephyr-glamor testing.

2017-09-18 Thread Eric Anholt
The Xvfb tests are passing and Xephyr-glamor is failing for me, but it
fails identically on autotools.  It's disabled on Travis for now
because the >10 minutes of silence during testing times out the entire
build.

v2: Fix the disable on travis.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 meson.build  |  1 +
 test/meson.build | 24 
 test/scripts/xephyr-glamor-piglit.sh |  7 +++
 test/scripts/xvfb-piglit.sh  |  7 +++
 4 files changed, 39 insertions(+)
 create mode 100644 test/meson.build

diff --git a/meson.build b/meson.build
index 3efec0def027..ea2a01520eaa 100644
--- a/meson.build
+++ b/meson.build
@@ -426,3 +426,4 @@ libxserver = [
 libxserver += libxserver_dri3
 
 subdir('hw')
+subdir('test')
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index ..b71d7e24909d
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,24 @@
+simple_xinit = executable(
+'simple-xinit',
+'simple-xinit.c',
+include_directories: inc,
+)
+
+piglit_env = environment()
+piglit_env.set('XSERVER_DIR', meson.source_root())
+piglit_env.set('XSERVER_BUILDDIR', meson.build_root())
+
+if get_option('xvfb')
+test('xvfb-piglit', find_program('scripts/xvfb-piglit.sh'),
+env: piglit_env,
+timeout: 1200,
+)
+
+if get_option('xephyr') and build_glamor
+test('xephyr-glamor',
+find_program('scripts/xephyr-glamor-piglit.sh'),
+env: piglit_env,
+timeout: 1200,
+)
+endif
+endif
diff --git a/test/scripts/xephyr-glamor-piglit.sh 
b/test/scripts/xephyr-glamor-piglit.sh
index 51d42c313643..c16fdc4f36ac 100755
--- a/test/scripts/xephyr-glamor-piglit.sh
+++ b/test/scripts/xephyr-glamor-piglit.sh
@@ -1,3 +1,10 @@
+#!/bin/sh
+
+# this times out on Travis, because the tests take too long.
+if test "x$TRAVIS_BUILD_DIR" != "x"; then
+exit 77
+fi
+
 # Start a Xephyr server using glamor.  Since the test environment is
 # headless, we start an Xvfb first to host the Xephyr.
 export PIGLIT_RESULTS_DIR=$XSERVER_BUILDDIR/test/piglit-results/xephyr-glamor
diff --git a/test/scripts/xvfb-piglit.sh b/test/scripts/xvfb-piglit.sh
index 763599ef4ce9..ae9f4662eb60 100755
--- a/test/scripts/xvfb-piglit.sh
+++ b/test/scripts/xvfb-piglit.sh
@@ -1,3 +1,10 @@
+#!/bin/sh
+
+# this times out on Travis, because the tests take too long.
+if test "x$TRAVIS_BUILD_DIR" != "x"; then
+exit 77
+fi
+
 export SERVER_COMMAND="$XSERVER_BUILDDIR/hw/vfb/Xvfb \
 -noreset \
 -screen scrn 1280x1024x24"
-- 
2.14.1

___
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] test: Add basic SYNC tests.

2017-09-18 Thread Eric Anholt
I couldn't find any, and I was modifying the implementation, so I had
to write some.  I would like the test to end with a "make sure there
weren't any stray unchecked errors", but I didn't figure out how to do
that.

v2: Extend sync tests to cover alarm delta and waitvalue changes.

Signed-off-by: Eric Anholt <e...@anholt.net>
Reviewed-by: Keith Packard <kei...@keithp.com>
---
 hw/vfb/meson.build|   2 +-
 test/meson.build  |   2 +
 test/sync/meson.build |   9 ++
 test/sync/sync.c  | 304 ++
 4 files changed, 316 insertions(+), 1 deletion(-)
 create mode 100644 test/sync/meson.build
 create mode 100644 test/sync/sync.c

diff --git a/hw/vfb/meson.build b/hw/vfb/meson.build
index 6566b45907f1..89acdfacd371 100644
--- a/hw/vfb/meson.build
+++ b/hw/vfb/meson.build
@@ -4,7 +4,7 @@ srcs = [
 '../../mi/miinitext.c',
 ]
 
-executable(
+xvfb_server = executable(
 'Xvfb',
 srcs,
 include_directories: inc,
diff --git a/test/meson.build b/test/meson.build
index b71d7e24909d..3e482d6f19cd 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -22,3 +22,5 @@ if get_option('xvfb')
 )
 endif
 endif
+
+subdir('sync')
diff --git a/test/sync/meson.build b/test/sync/meson.build
new file mode 100644
index ..dfae75b1ed53
--- /dev/null
+++ b/test/sync/meson.build
@@ -0,0 +1,9 @@
+xcb_dep = dependency('xcb', required: false)
+xcb_sync_dep = dependency('xcb-sync', required: false)
+
+if get_option('xvfb')
+if xcb_dep.found() and xcb_sync_dep.found()
+sync = executable('sync', 'sync.c', dependencies: [xcb_dep, 
xcb_sync_dep])
+test('sync', simple_xinit, args: [sync, '--', xvfb_server])
+endif
+endif
diff --git a/test/sync/sync.c b/test/sync/sync.c
new file mode 100644
index ..f25d3fa3774a
--- /dev/null
+++ b/test/sync/sync.c
@@ -0,0 +1,304 @@
+/*
+ * Copyright © 2017 Broadcom
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+static const int64_t some_values[] = {
+0,
+1,
+-1,
+LLONG_MAX,
+LLONG_MIN,
+};
+
+static int64_t
+pack_sync_value(xcb_sync_int64_t val)
+{
+return ((int64_t)val.hi << 32) | val.lo;
+}
+
+static int64_t
+counter_value(struct xcb_connection_t *c,
+  xcb_sync_query_counter_cookie_t cookie)
+{
+xcb_sync_query_counter_reply_t *reply =
+xcb_sync_query_counter_reply(c, cookie, NULL);
+int64_t value = pack_sync_value(reply->counter_value);
+
+free(reply);
+return value;
+}
+
+static xcb_sync_int64_t
+sync_value(int64_t value)
+{
+xcb_sync_int64_t v = {
+.hi = value >> 32,
+.lo = value,
+};
+
+return v;
+}
+
+/* Initializes counters with a bunch of interesting values and makes
+ * sure it comes back the same.
+ */
+static void
+test_create_counter(xcb_connection_t *c)
+{
+xcb_sync_query_counter_cookie_t queries[ARRAY_SIZE(some_values)];
+
+for (int i = 0; i < ARRAY_SIZE(some_values); i++) {
+xcb_sync_counter_t counter = xcb_generate_id(c);
+xcb_sync_create_counter(c, counter, sync_value(some_values[i]));
+queries[i] = xcb_sync_query_counter_unchecked(c, counter);
+}
+
+for (int i = 0; i < ARRAY_SIZE(some_values); i++) {
+int64_t value = counter_value(c, queries[i]);
+
+if (value != some_values[i]) {
+fprintf(stderr, "Creating counter with %lld returned %lld\n",
+(long long)some_values[i],
+(long long)value);
+exit(1);
+}
+}
+}
+
+/* Set a single counter to a bunch of interesting values and make sure
+ * it comes the same.
+ */
+static void
+test_set_counter(xcb_connection_t *c)
+{
+xcb_sync_cou

[PATCH xserver 1/6] meson: Move Xvfb build under an option.

2017-09-18 Thread Eric Anholt
Autotools also had it as an option.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 hw/meson.build| 4 +++-
 meson_options.txt | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/meson.build b/hw/meson.build
index c0d2db3f5c85..96c1559c348b 100644
--- a/hw/meson.build
+++ b/hw/meson.build
@@ -6,7 +6,9 @@ if get_option('dmx')
 subdir('dmx')
 endif
 
-subdir('vfb')
+if get_option('xvfb')
+subdir('vfb')
+endif
 
 if build_xnest
 subdir('xnest')
diff --git a/meson_options.txt b/meson_options.txt
index fc66f9f08e35..b1ee6ccc5b39 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -10,6 +10,8 @@ option('xnest', type: 'combo', choices: ['yes', 'no', 
'auto'], value: 'auto',
description: 'Enable Xnest nested X server')
 option('dmx', type: 'boolean', value: false,
description: 'Enable DMX nested X server')
+option('xvfb', type: 'boolean', value: true,
+   description: 'Enable Xvfb X server')
 option('xwin', type: 'combo', choices: ['yes', 'no', 'auto'], value: 'auto',
description: 'Enable XWin X server')
 
-- 
2.14.1

___
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] sync: Clean up a bit of header formatting.

2017-09-18 Thread Eric Anholt
Signed-off-by: Eric Anholt <e...@anholt.net>
Reviewed-by: Keith Packard <kei...@keithp.com>
---
 miext/sync/misyncstr.h | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/miext/sync/misyncstr.h b/miext/sync/misyncstr.h
index 084ca4c82d9d..2eab2aa576b4 100644
--- a/miext/sync/misyncstr.h
+++ b/miext/sync/misyncstr.h
@@ -49,7 +49,7 @@ typedef struct _SyncObject {
 typedef struct _SyncCounter {
 SyncObject sync;/* Common sync object data */
 int64_t value;  /* counter value */
-struct _SysCounterInfo *pSysCounterInfo;/* NULL if not a system 
counter */
+struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */
 } SyncCounter;
 
 struct _SyncFence {
@@ -66,13 +66,10 @@ struct _SyncTrigger {
 unsigned int value_type;/* Absolute or Relative */
 unsigned int test_type; /* transition or Comparision type */
 int64_t test_value; /* trigger event threshold value */
-Bool (*CheckTrigger) (struct _SyncTrigger * /*pTrigger */ ,
-  int64_t/*newval */
-);
-void (*TriggerFired) (struct _SyncTrigger * /*pTrigger */
-);
-void (*CounterDestroyed) (struct _SyncTrigger * /*pTrigger */
-);
+Bool (*CheckTrigger)(struct _SyncTrigger *pTrigger,
+ int64_t newval);
+void (*TriggerFired)(struct _SyncTrigger *pTrigger);
+void (*CounterDestroyed)(struct _SyncTrigger *pTrigger);
 };
 
 typedef struct _SyncTriggerList {
-- 
2.14.1

___
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 3/6] test: Return error from simple-xinit if the client crashes.

2017-09-18 Thread Eric Anholt
I want to be able to call client tests with simple-xinit, so assertion
failures should be an error.

v2: Clean up identical returns.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 test/simple-xinit.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/simple-xinit.c b/test/simple-xinit.c
index 89189a609c19..1fc31be269a3 100644
--- a/test/simple-xinit.c
+++ b/test/simple-xinit.c
@@ -133,6 +133,9 @@ start_client(char *const *client_args, int display)
 return 1;
 }
 
+if (!WIFEXITED(wstatus))
+return 1;
+
 return WEXITSTATUS(wstatus);
 } else {
 execvp(client_args[0], client_args);
-- 
2.14.1

___
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 RESEND xserver 0/6] sync int64 series resend

2017-09-18 Thread Eric Anholt
I've squashed in the fixes and I'm resending, since some of the early
patches never got reviewed.  I suspect they got lost in all the noise
about casting.  Still passes the tests locally and on Travis.

Eric Anholt (6):
  meson: Move Xvfb build under an option.
  meson: Add Xvfb and Xephyr-glamor testing.
  test: Return error from simple-xinit if the client crashes.
  test: Add basic SYNC tests.
  sync: Convert from "CARD64" to int64_t.
  sync: Clean up a bit of header formatting.

 Xext/sync.c  | 302 --
 Xext/syncsrv.h   |  23 ++-
 hw/meson.build   |   4 +-
 hw/vfb/meson.build   |   2 +-
 include/misc.h   |  29 
 meson.build  |   1 +
 meson_options.txt|   2 +
 miext/sync/misync.c  |   5 +-
 miext/sync/misyncstr.h   |  22 ++-
 present/present_fence.c  |   2 +-
 test/meson.build |  26 +++
 test/scripts/xephyr-glamor-piglit.sh |   7 +
 test/scripts/xvfb-piglit.sh  |   7 +
 test/simple-xinit.c  |   3 +
 test/sync/meson.build|   9 ++
 test/sync/sync.c | 304 +++
 16 files changed, 557 insertions(+), 191 deletions(-)
 create mode 100644 test/meson.build
 create mode 100644 test/sync/meson.build
 create mode 100644 test/sync/sync.c

-- 
2.14.1

___
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 5/6] sync: Convert from "CARD64" to int64_t.

2017-09-18 Thread Eric Anholt
The extension was using the name CARD64 to represent 64-bit values,
with a #define from CARD64 to XSyncValue, a struct with a pair of
32-bit values representing a signed 64-bit value.  This interfered
with protocol headers using CARD64 to try to actually store a
uint64_t.  Now that stdint.h exists, let's just use that here,
instead.

v2: Fix alarm delta changes.
v3: Do the potentially overflowing math as uint and convert to int
afterward, out of C spec paranoia.

Signed-off-by: Eric Anholt <e...@anholt.net>
Reviewed-by: Keith Packard <kei...@keithp.com>
---
 Xext/sync.c | 302 +++-
 Xext/syncsrv.h  |  23 ++--
 include/misc.h  |  29 +
 miext/sync/misync.c |   5 +-
 miext/sync/misyncstr.h  |  11 +-
 present/present_fence.c |   2 +-
 6 files changed, 190 insertions(+), 182 deletions(-)

diff --git a/Xext/sync.c b/Xext/sync.c
index a8db0ec22371..822c205a7a24 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -237,7 +237,7 @@ SyncAddTriggerToSyncObject(SyncTrigger * pTrigger)
  */
 
 static Bool
-SyncCheckTriggerPositiveComparison(SyncTrigger * pTrigger, CARD64 oldval)
+SyncCheckTriggerPositiveComparison(SyncTrigger * pTrigger, int64_t oldval)
 {
 SyncCounter *pCounter;
 
@@ -248,12 +248,11 @@ SyncCheckTriggerPositiveComparison(SyncTrigger * 
pTrigger, CARD64 oldval)
 
 pCounter = (SyncCounter *) pTrigger->pSync;
 
-return (pCounter == NULL ||
-XSyncValueGreaterOrEqual(pCounter->value, pTrigger->test_value));
+return pCounter == NULL || pCounter->value >= pTrigger->test_value;
 }
 
 static Bool
-SyncCheckTriggerNegativeComparison(SyncTrigger * pTrigger, CARD64 oldval)
+SyncCheckTriggerNegativeComparison(SyncTrigger * pTrigger, int64_t oldval)
 {
 SyncCounter *pCounter;
 
@@ -264,12 +263,11 @@ SyncCheckTriggerNegativeComparison(SyncTrigger * 
pTrigger, CARD64 oldval)
 
 pCounter = (SyncCounter *) pTrigger->pSync;
 
-return (pCounter == NULL ||
-XSyncValueLessOrEqual(pCounter->value, pTrigger->test_value));
+return pCounter == NULL || pCounter->value <= pTrigger->test_value;
 }
 
 static Bool
-SyncCheckTriggerPositiveTransition(SyncTrigger * pTrigger, CARD64 oldval)
+SyncCheckTriggerPositiveTransition(SyncTrigger * pTrigger, int64_t oldval)
 {
 SyncCounter *pCounter;
 
@@ -281,12 +279,12 @@ SyncCheckTriggerPositiveTransition(SyncTrigger * 
pTrigger, CARD64 oldval)
 pCounter = (SyncCounter *) pTrigger->pSync;
 
 return (pCounter == NULL ||
-(XSyncValueLessThan(oldval, pTrigger->test_value) &&
- XSyncValueGreaterOrEqual(pCounter->value, pTrigger->test_value)));
+(oldval < pTrigger->test_value &&
+ pCounter->value >= pTrigger->test_value));
 }
 
 static Bool
-SyncCheckTriggerNegativeTransition(SyncTrigger * pTrigger, CARD64 oldval)
+SyncCheckTriggerNegativeTransition(SyncTrigger * pTrigger, int64_t oldval)
 {
 SyncCounter *pCounter;
 
@@ -298,12 +296,12 @@ SyncCheckTriggerNegativeTransition(SyncTrigger * 
pTrigger, CARD64 oldval)
 pCounter = (SyncCounter *) pTrigger->pSync;
 
 return (pCounter == NULL ||
-(XSyncValueGreaterThan(oldval, pTrigger->test_value) &&
- XSyncValueLessOrEqual(pCounter->value, pTrigger->test_value)));
+(oldval > pTrigger->test_value &&
+ pCounter->value <= pTrigger->test_value));
 }
 
 static Bool
-SyncCheckTriggerFence(SyncTrigger * pTrigger, CARD64 unused)
+SyncCheckTriggerFence(SyncTrigger * pTrigger, int64_t unused)
 {
 SyncFence *pFence = (SyncFence *) pTrigger->pSync;
 
@@ -389,16 +387,15 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, 
XID syncObject,
 if (pTrigger->value_type == XSyncAbsolute)
 pTrigger->test_value = pTrigger->wait_value;
 else {  /* relative */
-
 Bool overflow;
 
 if (pCounter == NULL)
 return BadMatch;
 
-XSyncValueAdd(>test_value, pCounter->value,
-  pTrigger->wait_value, );
+overflow = checked_int64_add(>test_value,
+ pCounter->value, 
pTrigger->wait_value);
 if (overflow) {
-client->errorValue = XSyncValueHigh32(pTrigger->wait_value);
+client->errorValue = pTrigger->wait_value >> 32;
 return BadValue;
 }
 }
@@ -441,15 +438,15 @@ SyncSendAlarmNotifyEvents(SyncAlarm * pAlarm)
 .type = SyncEventBase + XSyncAlarmNotify,
 .kind = XSyncAlarmNotify,
 .alarm = pAlarm->alarm_id,
-.alarm_value_hi = XSyncValueHigh32(pTrigger->test_value),
-.alarm_value_lo = XSyncValueLow32(pTrigger->test_value),
+.alarm_value_

Re: [PATCH libpciaccess] linux: support 32 bit PCI domains (v3)

2017-09-18 Thread Eric Anholt
Adam Jackson <a...@redhat.com> writes:

> From: Stephen Hemminger <step...@networkplumber.org>
>
> The PCI domain may be larger than 16 bits on Microsoft Azure and other
> virtual environments. PCI busses reported by ACPI are limited to 16
> bits, but in Azure the domain value for pass through devices is
> intentionally larger than 16 bits to avoid clashing with local devices.
> This is needed to support pass through of GPU devices.
>
> v3: (ajax)
> Update FreeBSD and Solaris backends to preserve the full 32-bit domain
> number, since on those OSes it stands a chance of working already.
> Update NetBSD and OpenBSD backends to initialize domain_16 compatibly
> with older libpciaccess; neither backend appears to support more than a
> handful of domains to begin with though. Trivially update the generic
> x86 backend for source compatibility, though it still only supports one
> domain and will never be better.
>
> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=101744
> Signed-off-by: Stephen Hemminger <sthem...@microsoft.com>

Reviewed-by: Eric Anholt <e...@anholt.net>


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] glx: remove unused systemTimeExtension

2017-09-08 Thread Eric Anholt
Emil Velikov <emil.l.veli...@gmail.com> writes:

> On 23 August 2017 at 18:08, Eric Anholt <e...@anholt.net> wrote:
>> Emil Velikov <emil.l.veli...@gmail.com> writes:
>>
>>> Not even a single DRI2/DRISW driver in mesa ever used this. Appears to be a
>>> dri1 artefact copy/pasted in the dri2/drisw codebase.
>>
>> Agreed that it seems to be only DRI1 drivers that used it.
>>
>> Reviewed-by: Eric Anholt <e...@anholt.net>
>
> Thank you Eric.
>
> Do you have access to push the commit, or it's up-to Adam/others to do that?

Pushed now.


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 libpciaccess] linux: support 32 bit PCI domains (v2)

2017-09-08 Thread Eric Anholt
Adam Jackson  writes:

> From: Stephen Hemminger 
>
> The PCI domain may be larger than 16 bits on Microsoft Azure and other
> virtual environments. PCI busses reported by ACPI are limited to 16
> bits, but in Azure the domain value for pass through devices is
> intentionally larger than 16 bits to avoid clashing with local devices.
> This is needed to support pass through of GPU devices.
>
> v2: (ajax)
> Rename fields as domain_{16,32} to force consumers to adapt when built
> against the new library. Update FreeBSD and Solaris backends to preserve
> the full 32-bit domain number, since on those OSes it stands a chance of
> working already. Update NetBSD and OpenBSD backends to initialize
> domain_16 compatibly with older libpciaccess; neither backend appears to
> support more than a handful of domains to begin with though. Trivially
> update the generic x86 backend for source compatibility, though it still
> only supports one domain and will never be better.

I like extending of the struct and keeping the old field around, but
breaking source compatibility seems like unnecessary pain to me.  Could
we keep the first field "domain_16" and name the new one "domain"?


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] squash! sync: Convert from "CARD64" to int64_t. (v2)

2017-09-05 Thread Eric Anholt
Pekka Paalanen <ppaala...@gmail.com> writes:

> [ Unknown signature status ]
> On Fri,  1 Sep 2017 11:55:15 -0700
> Eric Anholt <e...@anholt.net> wrote:
>
>> ---
>> 
>> Pekka - that link didn't help, because we still need a correct
>> "result" value.  I don't believe that the compiler could break uint ->
>> int conversions with the high bit, but here's the patch I think we
>> would need for that.  I still think v1 is the better version.
>
> Hi,
>
> sorry, but I'm confused. What is the correct "result" value in case of
> an overflow?

The 2s complement addition/subtraction result.

>>  include/misc.h | 21 +++--
>>  1 file changed, 15 insertions(+), 6 deletions(-)
>> 
>> diff --git a/include/misc.h b/include/misc.h
>> index 0feeaebc7c1a..fc1a55dac343 100644
>> --- a/include/misc.h
>> +++ b/include/misc.h
>> @@ -327,13 +327,21 @@ bswap_32(uint32_t x)
>>  static inline Bool
>>  checked_int64_add(int64_t *out, int64_t a, int64_t b)
>>  {
>> -int64_t result = a + b;
>> +/* Note that overflow behavior with signed ints in C is undefined,
>> + * and the compiler might optimize our check away if we do so.  In
>> + * the discussion about it, people raised the concern that even
>> + * casting from uint to int would be undefined, so we stick with
>> + * all of our math in uint and memcpy the result, out of extreme
>> + * paranoia.
>> + */
>> +uint64_t result = (uint64_t)a + (uint64_t)b;
>>  /* signed addition overflows if operands have the same sign, and
>>   * the sign of the result doesn't match the sign of the inputs.
>>   */
>> -Bool overflow = (a < 0) == (b < 0) && (a < 0) != (result < 0);
>> +Bool result_negative = (result & (1ull << 63)) != 0;
>> +Bool overflow = (a < 0) == (b < 0) && (a < 0) != result_negative;
>>  
>> -*out = result;
>> +memcpy(out, , sizeof(result));
>
> You might hate the memcpy() and so do I, but better ideas seem scarce.
>
> One might be a union { int64_t; uint64_t; } for the "casting".
>
> Another would be to write the code any way you please, but add a test
> that ensures the possibly-not-guaranteed behaviour you rely on is
> actually there and correct.
>
> This is more of a learning experience for me as well, than already
> knowing what's a good way.

I already wrote the unit test, it's in patch 5 that we're replying to.


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] configure.ac: Make BUILD_{DATE, TIME} respect SOURCE_DATE_EPOCH if set

2017-09-01 Thread Eric Anholt
Chris Lamb  writes:

> Hi xorg-devel,
>
> Whilst working on the Reproducible Builds effort [0], we noticed
> that xorg-server could not be built reproducibly.

I tried applying the patch today, but it broke the build by changing the
format.  I fixed it up, propagated it over to the meson build, and sent
out a series with the accumulated fixes.


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

[PATCH xserver 4/4] meson: Move the BUILD_DATE/TIME setup to configure time.

2017-09-01 Thread Eric Anholt
By having it as a custom_target with build_always, every "ninja -C
build" would rebuild Xorg for the new date/time, even if the rest of
Xorg didn't change.

We could build the rest of Xorg into a static lib, and regenerate
date/time when the static lib changes and link that into a final Xorg,
but BUILD_DATE/TIME is such a dubious feature (compared to including a
git sha, which is easy with meson) it doesn't seem worth the build
time cost.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 hw/xfree86/common/meson.build | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/hw/xfree86/common/meson.build b/hw/xfree86/common/meson.build
index 6ed3f51242c3..e734b3ce29d2 100644
--- a/hw/xfree86/common/meson.build
+++ b/hw/xfree86/common/meson.build
@@ -65,11 +65,9 @@ if get_option('pciaccess')
 srcs_xorg_common += ['xf86pciBus.c', 'xf86VGAarbiter.c']
 endif
 
-srcs_xorg_common += custom_target(
-'xf86Build.h',
+srcs_xorg_common += configure_file(
 output: 'xf86Build.h',
-command: [join_paths(meson.current_source_dir(), 'xf86Build.sh'), 
'@OUTPUT@'],
-build_always: true,
+command: ['sh', join_paths(meson.current_source_dir(), 'xf86Build.sh'), 
'@OUTPUT@'],
 )
 
 srcs_xorg_common += custom_target(
-- 
2.14.1

___
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 3/4] meson: Include BUILD_DATE in the meson xf86Build.h.

2017-09-01 Thread Eric Anholt
Due to a typo, I only had BUILD_TIME present.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 hw/xfree86/common/xf86Build.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/xfree86/common/xf86Build.sh b/hw/xfree86/common/xf86Build.sh
index e1b14cec5a85..5f859a5d8dba 100755
--- a/hw/xfree86/common/xf86Build.sh
+++ b/hw/xfree86/common/xf86Build.sh
@@ -10,4 +10,4 @@ fi
 
 output=$1
 echo "#define BUILD_DATE $BUILD_DATE" > $output
-echo "#define BUILD_TIME $BUILD_TIME" > $output
+echo "#define BUILD_TIME $BUILD_TIME" >> $output
-- 
2.14.1

___
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/4] configure.ac: Make BUILD_{DATE, TIME} respect SOURCE_DATE_EPOCH if set

2017-09-01 Thread Eric Anholt
From: Chris Lamb <la...@debian.org>

Whilst working on the Reproducible Builds effort [0], we noticed that
xorg-server could not be built reproducibly. One reason is because it
embeds a "current" build and date time.

This should be compatible with both GNU and BSD date(1).

 [0] https://reproducible-builds.org/

v2: Fix change in Y-M-D format that broke the build.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 configure.ac | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index eee1257a96ed..f13a54ab9dbf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2402,9 +2402,15 @@ AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix])
 AC_DEFINE_DIR(SYSCONFDIR, sysconfdir, [sysconfdir])
 
 AC_SUBST([RELEASE_DATE])
-BUILD_DATE="`date +'%Y%m%d'`"
+DATE_FMT="%Y%m%d"
+TIME_FMT="1%H%M%S"
+BUILD_DATE="`date "+$DATE_FMT"`"
+BUILD_TIME="`date "+$TIME_FMT"`"
+if test "x$SOURCE_DATE_EPOCH" != "x"; then
+   BUILD_DATE="`date -u -d "@$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null 
|| date -u -r "$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || date -u 
"+$DATE_FMT"`"
+   BUILD_TIME="`date -u -d "@$SOURCE_DATE_EPOCH" "+$TIME_FMT" 2>/dev/null 
|| date -u -r "$SOURCE_DATE_EPOCH" "+$TIME_FMT" 2>/dev/null || date -u 
"+$TIME_FMT"`"
+fi
 AC_SUBST([BUILD_DATE])
-BUILD_TIME="`date +'1%H%M%S'`"
 AC_SUBST([BUILD_TIME])
 
 DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"
-- 
2.14.1

___
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/4] meson: Respect SOURCE_DATE_EPOCH for reproducible builds.

2017-09-01 Thread Eric Anholt
This just copies over Chris Lamb's code from autotools.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 hw/xfree86/common/xf86Build.sh | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/common/xf86Build.sh b/hw/xfree86/common/xf86Build.sh
index ae4a5513248b..e1b14cec5a85 100755
--- a/hw/xfree86/common/xf86Build.sh
+++ b/hw/xfree86/common/xf86Build.sh
@@ -1,5 +1,12 @@
-BUILD_DATE=`date +'%Y%m%d'`
-BUILD_TIME=`date +'1%H%M%S'`
+DATE_FMT="%Y%m%d"
+TIME_FMT="1%H%M%S"
+
+BUILD_DATE="`date "+$DATE_FMT"`"
+BUILD_TIME="`date "+$TIME_FMT"`"
+if test "x$SOURCE_DATE_EPOCH" != "x"; then
+   BUILD_DATE="`date -u -d "@$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null 
|| date -u -r "$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || date -u 
"+$DATE_FMT"`"
+   BUILD_TIME="`date -u -d "@$SOURCE_DATE_EPOCH" "+$TIME_FMT" 2>/dev/null 
|| date -u -r "$SOURCE_DATE_EPOCH" "+$TIME_FMT" 2>/dev/null || date -u 
"+$TIME_FMT"`"
+fi
 
 output=$1
 echo "#define BUILD_DATE $BUILD_DATE" > $output
-- 
2.14.1

___
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] squash! sync: Convert from "CARD64" to int64_t. (v2)

2017-09-01 Thread Eric Anholt
---

Pekka - that link didn't help, because we still need a correct
"result" value.  I don't believe that the compiler could break uint ->
int conversions with the high bit, but here's the patch I think we
would need for that.  I still think v1 is the better version.

 include/misc.h | 21 +++--
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/include/misc.h b/include/misc.h
index 0feeaebc7c1a..fc1a55dac343 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -327,13 +327,21 @@ bswap_32(uint32_t x)
 static inline Bool
 checked_int64_add(int64_t *out, int64_t a, int64_t b)
 {
-int64_t result = a + b;
+/* Note that overflow behavior with signed ints in C is undefined,
+ * and the compiler might optimize our check away if we do so.  In
+ * the discussion about it, people raised the concern that even
+ * casting from uint to int would be undefined, so we stick with
+ * all of our math in uint and memcpy the result, out of extreme
+ * paranoia.
+ */
+uint64_t result = (uint64_t)a + (uint64_t)b;
 /* signed addition overflows if operands have the same sign, and
  * the sign of the result doesn't match the sign of the inputs.
  */
-Bool overflow = (a < 0) == (b < 0) && (a < 0) != (result < 0);
+Bool result_negative = (result & (1ull << 63)) != 0;
+Bool overflow = (a < 0) == (b < 0) && (a < 0) != result_negative;
 
-*out = result;
+memcpy(out, , sizeof(result));
 
 return overflow;
 }
@@ -341,10 +349,11 @@ checked_int64_add(int64_t *out, int64_t a, int64_t b)
 static inline Bool
 checked_int64_subtract(int64_t *out, int64_t a, int64_t b)
 {
-int64_t result = a - b;
-Bool overflow = (a < 0) != (b < 0) && (a < 0) != (result < 0);
+uint64_t result = (uint64_t)a - (uint64_t)b;
+Bool result_negative = (result & (1ull << 63)) != 0;
+Bool overflow = (a < 0) != (b < 0) && (a < 0) != result_negative;
 
-*out = result;
+memcpy(out, , sizeof(result));
 
 return overflow;
 }
-- 
2.14.1

___
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] squash! sync: Convert from "CARD64" to int64_t.

2017-08-24 Thread Eric Anholt
---

We pass the overflow unit tests both before and after this change, but
this should be safer.

 include/misc.h | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/misc.h b/include/misc.h
index 0feeaebc7c1a..9d0e422e36b4 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -327,7 +327,11 @@ bswap_32(uint32_t x)
 static inline Bool
 checked_int64_add(int64_t *out, int64_t a, int64_t b)
 {
-int64_t result = a + b;
+/* Do the potentially overflowing math as uint64_t, as signed
+ * integers in C are undefined on overflow (and the compiler may
+ * optimize out our overflow check below, otherwise)
+ */
+int64_t result = (uint64_t)a + (uint64_t)b;
 /* signed addition overflows if operands have the same sign, and
  * the sign of the result doesn't match the sign of the inputs.
  */
@@ -341,7 +345,7 @@ checked_int64_add(int64_t *out, int64_t a, int64_t b)
 static inline Bool
 checked_int64_subtract(int64_t *out, int64_t a, int64_t b)
 {
-int64_t result = a - b;
+int64_t result = (uint64_t)a - (uint64_t)b;
 Bool overflow = (a < 0) != (b < 0) && (a < 0) != (result < 0);
 
 *out = result;
-- 
2.14.1

___
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/7 v2] test: Return error from simple-xinit if the client crashes.

2017-08-23 Thread Eric Anholt
I want to be able to call client tests with simple-xinit, so assertion
failures should be an error.

v2: Clean up identical returns.

Signed-off-by: Eric Anholt <e...@anholt.net>
---

This, and patch 2 and 3 need review, then I think we're ready.

 test/simple-xinit.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/simple-xinit.c b/test/simple-xinit.c
index 89189a609c19..1fc31be269a3 100644
--- a/test/simple-xinit.c
+++ b/test/simple-xinit.c
@@ -133,6 +133,9 @@ start_client(char *const *client_args, int display)
 return 1;
 }
 
+if (!WIFEXITED(wstatus))
+return 1;
+
 return WEXITSTATUS(wstatus);
 } else {
 execvp(client_args[0], client_args);
-- 
2.14.1

___
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 5.5/7] test: Extend sync tests to cover alarm delta and waitvalue changes.

2017-08-23 Thread Eric Anholt
Eric Anholt <e...@anholt.net> writes:

> This would be squashed into the other tests.
>
> Signed-off-by: Eric Anholt <e...@anholt.net>

Bah.  I accidentally globbed the wrong set.


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] glx: remove unused systemTimeExtension

2017-08-23 Thread Eric Anholt
Emil Velikov <emil.l.veli...@gmail.com> writes:

> Not even a single DRI2/DRISW driver in mesa ever used this. Appears to be a
> dri1 artefact copy/pasted in the dri2/drisw codebase.

Agreed that it seems to be only DRI1 drivers that used it.

Reviewed-by: Eric Anholt <e...@anholt.net>


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

[PATCH xserver 6/7 v2] sync: Convert from "CARD64" to int64_t.

2017-08-23 Thread Eric Anholt
The extension was using the name CARD64 to represent 64-bit values,
with a #define from CARD64 to XSyncValue, a struct with a pair of
32-bit values representing a signed 64-bit value.  This interfered
with protocol headers using CARD64 to try to actually store a
uint64_t.  Now that stdint.h exists, let's just use that here,
instead.

v2: Fix alarm delta changes.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 Xext/sync.c | 302 +++-
 Xext/syncsrv.h  |  23 ++--
 include/misc.h  |  25 
 miext/sync/misync.c |   5 +-
 miext/sync/misyncstr.h  |  11 +-
 present/present_fence.c |   2 +-
 6 files changed, 186 insertions(+), 182 deletions(-)

diff --git a/Xext/sync.c b/Xext/sync.c
index a8db0ec22371..822c205a7a24 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -237,7 +237,7 @@ SyncAddTriggerToSyncObject(SyncTrigger * pTrigger)
  */
 
 static Bool
-SyncCheckTriggerPositiveComparison(SyncTrigger * pTrigger, CARD64 oldval)
+SyncCheckTriggerPositiveComparison(SyncTrigger * pTrigger, int64_t oldval)
 {
 SyncCounter *pCounter;
 
@@ -248,12 +248,11 @@ SyncCheckTriggerPositiveComparison(SyncTrigger * 
pTrigger, CARD64 oldval)
 
 pCounter = (SyncCounter *) pTrigger->pSync;
 
-return (pCounter == NULL ||
-XSyncValueGreaterOrEqual(pCounter->value, pTrigger->test_value));
+return pCounter == NULL || pCounter->value >= pTrigger->test_value;
 }
 
 static Bool
-SyncCheckTriggerNegativeComparison(SyncTrigger * pTrigger, CARD64 oldval)
+SyncCheckTriggerNegativeComparison(SyncTrigger * pTrigger, int64_t oldval)
 {
 SyncCounter *pCounter;
 
@@ -264,12 +263,11 @@ SyncCheckTriggerNegativeComparison(SyncTrigger * 
pTrigger, CARD64 oldval)
 
 pCounter = (SyncCounter *) pTrigger->pSync;
 
-return (pCounter == NULL ||
-XSyncValueLessOrEqual(pCounter->value, pTrigger->test_value));
+return pCounter == NULL || pCounter->value <= pTrigger->test_value;
 }
 
 static Bool
-SyncCheckTriggerPositiveTransition(SyncTrigger * pTrigger, CARD64 oldval)
+SyncCheckTriggerPositiveTransition(SyncTrigger * pTrigger, int64_t oldval)
 {
 SyncCounter *pCounter;
 
@@ -281,12 +279,12 @@ SyncCheckTriggerPositiveTransition(SyncTrigger * 
pTrigger, CARD64 oldval)
 pCounter = (SyncCounter *) pTrigger->pSync;
 
 return (pCounter == NULL ||
-(XSyncValueLessThan(oldval, pTrigger->test_value) &&
- XSyncValueGreaterOrEqual(pCounter->value, pTrigger->test_value)));
+(oldval < pTrigger->test_value &&
+ pCounter->value >= pTrigger->test_value));
 }
 
 static Bool
-SyncCheckTriggerNegativeTransition(SyncTrigger * pTrigger, CARD64 oldval)
+SyncCheckTriggerNegativeTransition(SyncTrigger * pTrigger, int64_t oldval)
 {
 SyncCounter *pCounter;
 
@@ -298,12 +296,12 @@ SyncCheckTriggerNegativeTransition(SyncTrigger * 
pTrigger, CARD64 oldval)
 pCounter = (SyncCounter *) pTrigger->pSync;
 
 return (pCounter == NULL ||
-(XSyncValueGreaterThan(oldval, pTrigger->test_value) &&
- XSyncValueLessOrEqual(pCounter->value, pTrigger->test_value)));
+(oldval > pTrigger->test_value &&
+ pCounter->value <= pTrigger->test_value));
 }
 
 static Bool
-SyncCheckTriggerFence(SyncTrigger * pTrigger, CARD64 unused)
+SyncCheckTriggerFence(SyncTrigger * pTrigger, int64_t unused)
 {
 SyncFence *pFence = (SyncFence *) pTrigger->pSync;
 
@@ -389,16 +387,15 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, 
XID syncObject,
 if (pTrigger->value_type == XSyncAbsolute)
 pTrigger->test_value = pTrigger->wait_value;
 else {  /* relative */
-
 Bool overflow;
 
 if (pCounter == NULL)
 return BadMatch;
 
-XSyncValueAdd(>test_value, pCounter->value,
-  pTrigger->wait_value, );
+overflow = checked_int64_add(>test_value,
+ pCounter->value, 
pTrigger->wait_value);
 if (overflow) {
-client->errorValue = XSyncValueHigh32(pTrigger->wait_value);
+client->errorValue = pTrigger->wait_value >> 32;
 return BadValue;
 }
 }
@@ -441,15 +438,15 @@ SyncSendAlarmNotifyEvents(SyncAlarm * pAlarm)
 .type = SyncEventBase + XSyncAlarmNotify,
 .kind = XSyncAlarmNotify,
 .alarm = pAlarm->alarm_id,
-.alarm_value_hi = XSyncValueHigh32(pTrigger->test_value),
-.alarm_value_lo = XSyncValueLow32(pTrigger->test_value),
+.alarm_value_hi = pTrigger->test_value >> 32,
+.alarm_value_lo = pTrigger->test_value,
 .time = currentTime.milliseconds,
 .state = pAlarm->state
  

[PATCH xserver 5.5/7] test: Extend sync tests to cover alarm delta and waitvalue changes.

2017-08-23 Thread Eric Anholt
This would be squashed into the other tests.

Signed-off-by: Eric Anholt <e...@anholt.net>
---
 test/sync/sync.c | 71 ++--
 1 file changed, 69 insertions(+), 2 deletions(-)

diff --git a/test/sync/sync.c b/test/sync/sync.c
index c39774246841..f25d3fa3774a 100644
--- a/test/sync/sync.c
+++ b/test/sync/sync.c
@@ -38,13 +38,18 @@ static const int64_t some_values[] = {
 };
 
 static int64_t
+pack_sync_value(xcb_sync_int64_t val)
+{
+return ((int64_t)val.hi << 32) | val.lo;
+}
+
+static int64_t
 counter_value(struct xcb_connection_t *c,
   xcb_sync_query_counter_cookie_t cookie)
 {
 xcb_sync_query_counter_reply_t *reply =
 xcb_sync_query_counter_reply(c, cookie, NULL);
-int64_t value = (((int64_t)reply->counter_value.hi << 32) |
- reply->counter_value.lo);
+int64_t value = pack_sync_value(reply->counter_value);
 
 free(reply);
 return value;
@@ -216,6 +221,66 @@ test_change_counter_overflow(xcb_connection_t *c)
 }
 }
 
+static void
+test_change_alarm_value(xcb_connection_t *c)
+{
+xcb_sync_alarm_t alarm = xcb_generate_id(c);
+xcb_sync_query_alarm_cookie_t queries[ARRAY_SIZE(some_values)];
+
+xcb_sync_create_alarm(c, alarm, 0, NULL);
+
+for (int i = 0; i < ARRAY_SIZE(some_values); i++) {
+uint32_t values[] = { some_values[i] >> 32, some_values[i] };
+
+xcb_sync_change_alarm(c, alarm, XCB_SYNC_CA_VALUE, values);
+queries[i] = xcb_sync_query_alarm_unchecked(c, alarm);
+}
+
+for (int i = 0; i < ARRAY_SIZE(some_values); i++) {
+xcb_sync_query_alarm_reply_t *reply =
+xcb_sync_query_alarm_reply(c, queries[i], NULL);
+int64_t value = pack_sync_value(reply->trigger.wait_value);
+
+if (value != some_values[i]) {
+fprintf(stderr, "Setting alarm value to %lld returned %lld\n",
+(long long)some_values[i],
+(long long)value);
+exit(1);
+}
+free(reply);
+}
+}
+
+static void
+test_change_alarm_delta(xcb_connection_t *c)
+{
+xcb_sync_alarm_t alarm = xcb_generate_id(c);
+xcb_sync_query_alarm_cookie_t queries[ARRAY_SIZE(some_values)];
+
+xcb_sync_create_alarm(c, alarm, 0, NULL);
+
+for (int i = 0; i < ARRAY_SIZE(some_values); i++) {
+uint32_t values[] = { some_values[i] >> 32, some_values[i] };
+
+xcb_sync_change_alarm(c, alarm, XCB_SYNC_CA_DELTA, values);
+queries[i] = xcb_sync_query_alarm_unchecked(c, alarm);
+}
+
+for (int i = 0; i < ARRAY_SIZE(some_values); i++) {
+xcb_sync_query_alarm_reply_t *reply =
+xcb_sync_query_alarm_reply(c, queries[i], NULL);
+int64_t value = pack_sync_value(reply->delta);
+
+if (value != some_values[i]) {
+fprintf(stderr, "Setting alarm delta to %lld returned %lld\n",
+(long long)some_values[i],
+(long long)value);
+exit(1);
+}
+free(reply);
+}
+}
+
 int main(int argc, char **argv)
 {
 int screen;
@@ -231,6 +296,8 @@ int main(int argc, char **argv)
 test_set_counter(c);
 test_change_counter_basic(c);
 test_change_counter_overflow(c);
+test_change_alarm_value(c);
+test_change_alarm_delta(c);
 
 xcb_disconnect(c);
 exit(0);
-- 
2.13.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

Re: [PATCH xserver v2] meson: Fix epoll detection

2017-08-14 Thread Eric Anholt
Peter Harris  writes:

> The epoll code depends on epoll_create1, not epoll_create.

Reviewed and pushed.  Thanks!


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 2/3] glamor: Scissor CopyArea to the bounds of the drawing.

2017-08-14 Thread Eric Anholt
Mark Marshall <markmarshal...@gmail.com> writes:

> On 1 August 2017 at 22:59, Eric Anholt <e...@anholt.net> wrote:
>> Like the previous fix to rectangles, this reduces the area drawn on
>> tiled renderers by letting the CPU-side tile setup know what tiles
>> might be drawn at all.
>>
>> Surprisingly, it improves x11perf -copypixwin1 -repeat 1 -reps 1
>> on i965 by 2.93185% +/- 1.5561% (n=90).
>>
>> Signed-off-by: Eric Anholt <e...@anholt.net>
>> ---
>>  glamor/glamor_copy.c  | 27 +++
>>  glamor/glamor_utils.h |  9 +
>>  2 files changed, 32 insertions(+), 4 deletions(-)
>>
>> diff --git a/glamor/glamor_copy.c b/glamor/glamor_copy.c
>> index f7d6eb163fac..3296b7b1bf75 100644
>> --- a/glamor/glamor_copy.c
>> +++ b/glamor/glamor_copy.c
>> @@ -351,6 +351,7 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
>>  const glamor_facet *copy_facet;
>>  int n;
>>  Bool ret = FALSE;
>> +BoxRec bounds = glamor_no_rendering_bounds();
>>
>>  glamor_make_current(glamor_priv);
>>
>> @@ -391,11 +392,20 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
>>  glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE,
>>2 * sizeof (GLshort), vbo_offset);
>>
>> +if (nbox < 100) {
>> +bounds = glamor_start_rendering_bounds();
>> +for (int i = 0; i < nbox; i++)
>> +glamor_bounds_union_box(, [i]);
>> +}
>> +
>>  for (n = 0; n < nbox; n++) {
>>  v[0] = box->x1; v[1] = box->y1;
>>  v[2] = box->x1; v[3] = box->y2;
>>  v[4] = box->x2; v[5] = box->y2;
>>  v[6] = box->x2; v[7] = box->y1;
>> +
>> +glamor_bounds_union_box(, box);
>> +
>
> I'm only looking at the diff, but aren't you doing
> glamor_bounds_union_box twice in the n < 100 case, and in the n >= 100
> case I guess it does nothing anyway, apart from waste cycles?

Thanks, that was leftover debug code.


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] meson: Fix epoll detection

2017-08-14 Thread Eric Anholt
Peter Harris  writes:

> On 2017-08-11 5:50 AM, Peter Hutterer wrote:
>> On Tue, Aug 08, 2017 at 11:16:13AM -0400, Peter Harris wrote:
>>> The epoll code depends on epoll_create1, not epoll_create.
>>>
>>> The trinary " ? 1 : false" is used because HAVE_EPOLL_CREATE1 is tested
>>> with #if instead of #ifdef.
>> 
>> might be worth using conf_data.set10(...) then? that should write out 0/1
>> correctly.
>
> ".set10" writes 1 or 0, whereas "? 1 : false" writes 1 or #undef, which
> more closely matches what autoconf does.
>
> I'm fine with .set10 if you don't mind a little divergence. Or I could
> change #if HAVE_EPOLL_CREATE1 to #ifdef HAVE_EPOLL_CREATE1 to match
> (most of) the rest of the server instead, if you prefer.

I like that -- it's what I did to our other #ifs for meson.


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

  1   2   3   4   5   6   7   8   9   10   >