platform/upstream/xorg-server.git
10 years agodix: fix pixmap leak on server reset
Brendan King [Thu, 24 Apr 2014 10:37:47 +0000 (11:37 +0100)]
dix: fix pixmap leak on server reset

The server is leaking a pixmap (created by CreateDefaultStipple()) on
reset. The leak is caused by some X Server graphics contexts not being
freed on reset by the machine independent cursor code in the server,
which in turn is caused by the cursor cleanup code
(miSpriteDeviceCursorCleanup()) not being called.

Ensures the DeviceCursorCleanup() function is called when the associated
input device is closed on server reset.

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agodix: reference the cursor just once in InitializeSprite()
Brendan King [Thu, 24 Apr 2014 10:37:46 +0000 (11:37 +0100)]
dix: reference the cursor just once in InitializeSprite()

The new current cursor was being referenced twice, resulting in a
memory leak when the current server generation ended.

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agofb: fix screen pixmap leak on server reset
Brendan King [Thu, 24 Apr 2014 10:37:45 +0000 (11:37 +0100)]
fb: fix screen pixmap leak on server reset

Call FreePixmap() instead of free() to destroy the screen pixmap in
fbCloseScreen().

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoxfree86: Report Present as a built-in module
Chris Wilson [Wed, 28 May 2014 07:14:00 +0000 (08:14 +0100)]
xfree86: Report Present as a built-in module

This is so that drivers can do a runtime check that Present is available,
similar to existing runtime checks performed by the drivers for DRI.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoxfree86: Report DRI3 as a built-in module
Chris Wilson [Wed, 28 May 2014 07:13:59 +0000 (08:13 +0100)]
xfree86: Report DRI3 as a built-in module

This is so that drivers can do a runtime check that DRI3 is available,
similar to existing runtime checks performed by the drivers for DRI and
DRI2.

v2: Only add DRI3 to the list if the module was actually built into the
server (Mark Kettenis).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mark Kettenis <mark.kettenis@xs4all.nl>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoMerge remote-tracking branch 'jturney/master'
Keith Packard [Mon, 2 Jun 2014 20:08:23 +0000 (13:08 -0700)]
Merge remote-tracking branch 'jturney/master'

10 years agoxtensa: add support for xtensa architecture
Max Filippov [Sun, 1 Jun 2014 21:17:31 +0000 (01:17 +0400)]
xtensa: add support for xtensa architecture

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoMerge remote-tracking branch 'jeremyhu/master'
Keith Packard [Mon, 2 Jun 2014 18:30:24 +0000 (11:30 -0700)]
Merge remote-tracking branch 'jeremyhu/master'

10 years agoxfree86: Add "modesetting" to list of fallback drivers
Søren Sandmann [Fri, 30 May 2014 20:50:35 +0000 (16:50 -0400)]
xfree86: Add "modesetting" to list of fallback drivers

To make X -configure work properly, the output of fixup_video_driver_list()
should be in order of preference. Otherwise, the config file may use
the incorrect driver for some devices.

In particular, the drivers that work for all (or many) devices need to be
last in the list. Since the modesetting driver works for many devices,
it needs to be considered a fallback driver.

Signed-off-by: Søren Sandmann <ssp@redhat.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoMerge remote-tracking branch 'whot/for-keith'
Keith Packard [Mon, 2 Jun 2014 18:22:48 +0000 (11:22 -0700)]
Merge remote-tracking branch 'whot/for-keith'

10 years agoFix overflow checking extension versions
Robert Ancell [Wed, 21 May 2014 22:43:52 +0000 (10:43 +1200)]
Fix overflow checking extension versions

The easiest way to check for the version of an extension is to send the maximum
possible version numbers in the QueryVersion request. The X server overflows on
these as it assumes you will send a reasonable version number.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoconfigure: Require sufficiently new wayland-client for xwayland ddx
Adam Jackson [Wed, 21 May 2014 13:22:49 +0000 (09:22 -0400)]
configure: Require sufficiently new wayland-client for xwayland ddx

The explicit release requests were added in 1.3.0, don't try to build
against older.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoconfigure: Restore DEFAULT_LOGDIR to xwin-config.h, it is used
Jon TURNEY [Sat, 5 Apr 2014 14:15:46 +0000 (15:15 +0100)]
configure: Restore DEFAULT_LOGDIR to xwin-config.h, it is used

Commit f37a46913489397d8628ffe578c8d4ed50b6ca72 removed this from
xwin-config.h.in for some reason, but it is used.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
10 years agohw/xwin: Update for __glXLastContext -> lastGLContext
Jon TURNEY [Sun, 27 Apr 2014 19:55:51 +0000 (20:55 +0100)]
hw/xwin: Update for __glXLastContext -> lastGLContext

Update for __glXLastContext -> lastGLContext.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
10 years agoXQuartz: Update logic to account for title bar on every display in Mavericks
Jeremy Huddleston Sequoia [Sun, 1 Jun 2014 00:45:02 +0000 (17:45 -0700)]
XQuartz: Update logic to account for title bar on every display in Mavericks

<rdar://problem/14205847>
http://xquartz.macosforge.org/trac/ticket/832

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
10 years agoXQuartz: Dead code removal (ENABLE_DEBUG_LOG)
Jeremy Huddleston Sequoia [Sun, 1 Jun 2014 00:22:51 +0000 (17:22 -0700)]
XQuartz: Dead code removal (ENABLE_DEBUG_LOG)

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
10 years agoXQuartz: Bump to 2.7.7
Jeremy Huddleston Sequoia [Sat, 31 May 2014 20:04:43 +0000 (13:04 -0700)]
XQuartz: Bump to 2.7.7

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
10 years agoman: drop specific mention of DontZap in -retro (#71113)
Peter Hutterer [Sat, 24 May 2014 10:05:53 +0000 (20:05 +1000)]
man: drop specific mention of DontZap in -retro (#71113)

DontZap off is the default anyway, don't mention it specifically to avoid
confusion

X.Org Bug 71113 <http://bugs.freedesktop.org/show_bug.cgi?id=71113>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoxfree86: fix wrong DontZap documentation (#71113)
Peter Hutterer [Sat, 24 May 2014 10:02:56 +0000 (20:02 +1000)]
xfree86: fix wrong DontZap documentation (#71113)

X.Org Bug 71113 <http://bugs.freedesktop.org/show_bug.cgi?id=71113>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoFix overflow checking extension versions
Robert Ancell [Wed, 21 May 2014 22:43:52 +0000 (10:43 +1200)]
Fix overflow checking extension versions

The easiest way to check for the version of an extension is to send the maximum
possible version numbers in the QueryVersion request. The X server overflows on
these as it assumes you will send a reasonable version number.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
10 years agoglx: Require at least one True/DirectColor visual
Adam Jackson [Thu, 27 Sep 2012 21:44:42 +0000 (17:44 -0400)]
glx: Require at least one True/DirectColor visual

Mesa no longer supports rendering to anything less.  GLX 1.2 requires
that the server advertise at least one GLX visual.  GLX 1.3 and 1.4 are
more subtle: they require at least one fbconfig capable of window
rendering, and _also_ require that window-capable fbconfigs have a
non-zero value for the GLX_VISUAL_ID.  In either case we should refuse
to init GLX if there's not at least one GL-capable visual on at least
one screen.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoXi: block SIGIOs while copying device classes around
Steven McDonald [Sun, 18 May 2014 11:42:08 +0000 (13:42 +0200)]
Xi: block SIGIOs while copying device classes around

I've been seeing sporadic (anywhere from once every few days to 3-4
times a day) crashes and freezes in X. The problematic behaviour isn't
always the same, but I chose a particular incident to debug, and found
that X was segfaulting in updateMotionHistory, on line 575 of
dix/getevents.c.

After some further investigation, I found that the bug was being
triggered when a SIGIO was received in DeepCopyPointerClasses, between
the AllocValuatorClass call (line 540) and updating the to->valuator
pointer (line 545). AllocValuatorClass calls realloc() on to->valuator,
so between these lines, it's not guaranteed to point to allocated
memory.

It seems the SIGIO handler is calling updateMotionHistory, which is
reading the memory pointed to by to->valuator and getting a wrong value
for last_motion, which updates buff to point to wildly the wrong place
and thus generates a segfault when a memcpy() is done into buff.

I am attaching a patch which I've been running on that machine for the
past three days, and haven't yet observed any more crashing or freezing
behaviour. The patch simply calls OsBlockSIGIO while
DeepCopyDeviceClasses is in progress, as the state of the X server's
device data structures is not guaranteed to be in a consistent state
during that time.

Debian bug#744303 <https://bugs.debian.org/744303>

Signed-off-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoos: automatically switch to sigsafe logging when needed
Peter Hutterer [Wed, 7 May 2014 23:39:36 +0000 (09:39 +1000)]
os: automatically switch to sigsafe logging when needed

If we're smart enough to warn, we should be smart enough to just pass it
through to the right function. Worst case we lose some formatting specifiers
which pnprintf will complain about anyway. And in most cases it won't matter.

This requires renaming pnprintf to vpnprintf and changing the size_t to int to
be compatible with Xvscnprintf. pnprintf is internal only, the others are
exported API so we can't change them as easily.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
10 years agoshadowfb: Fix initialization
Adam Jackson [Wed, 21 May 2014 13:23:19 +0000 (09:23 -0400)]
shadowfb: Fix initialization

This has to run at initial CreateWindow time, at CreateScreenResources
the root window doesn't actually exist yet.

Tested-by: Michael Thayer <michael.thayer@oracle.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Michael Thayer <michael.thayer@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoglxproxy: Fix memory leak on error path in CreateGLXPixmap (#50281) (v2)
Adam Jackson [Wed, 30 Apr 2014 17:49:06 +0000 (13:49 -0400)]
glxproxy: Fix memory leak on error path in CreateGLXPixmap (#50281) (v2)

v2: Fix another path spotted by keithp

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agodmx: Fix memory leak in dmxBELoadFont (#50281)
Adam Jackson [Wed, 30 Apr 2014 17:49:05 +0000 (13:49 -0400)]
dmx: Fix memory leak in dmxBELoadFont (#50281)

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agodri2: Fix detection of wrong prime_id in GetScreenPrime.
Michal Srb [Tue, 15 Apr 2014 15:54:35 +0000 (18:54 +0300)]
dri2: Fix detection of wrong prime_id in GetScreenPrime.

Checking the iterating variable ("slave") against null can not detect if the
xorg_list_for_each_entry finished without break being invoked - slave variable
will be always non-null. This caused segfault whenever someone tried to use
DRI_PRIME with incorrect id while having at least one render offloading slave
configured.

Restructurize the GetScreenPrime to work as expected.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoARC: Add support for ARC architecture
Alexey Brodkin [Thu, 1 May 2014 12:39:29 +0000 (15:39 +0300)]
ARC: Add support for ARC architecture

Xorg server could be built for and run on Synopsys DesignWare ARC cores.
These changes are required for successful building and execution of the server.

Both little-endian and big-endian flavors of ARC cores are supported.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Egbert Eich <eich@freedesktop.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoconfig: revert quirk for the Evoluent Vertical Mouse
Peter Hutterer [Wed, 14 May 2014 00:32:30 +0000 (10:32 +1000)]
config: revert quirk for the Evoluent Vertical Mouse

This quick makes the mouse behaviour more obvious (LMR buttons generate LMR
events) but goes against the manufacturer's intended defaults:

    Top button - left click.
    Wheel button - .middle click (e.g., for pan and rotate in CAD programs).
    Middle button - right click.
    Bottom button - back.
    Thumb button - forward.

from http://www.evoluent.com/vm3.html

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agorrcrtc: brackets are hard, lets go shopping.
Dave Airlie [Mon, 12 May 2014 21:55:04 +0000 (14:55 -0700)]
rrcrtc: brackets are hard, lets go shopping.

Slaving two outputs on a secondary GPU to a primary GPU testing
picked this up, in that we'd try to resize to the totally the
wrong thing, then as usual segfault in the rotation code.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
10 years agoglamor: Don't forget to check whether we can fall back in polysegment.
Eric Anholt [Tue, 6 May 2014 00:01:14 +0000 (17:01 -0700)]
glamor: Don't forget to check whether we can fall back in polysegment.

Part of the _nf contract is that glamor will only return FALSE if
glamor has checked that UXA can actually map the pixmaps (UXA only
allocates the BO itself in the screen pixmap and DRI2 cases, and can't
map it otherwise).  Fixes server segfaults zooming in and out of
libreoffice spreadsheets.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoxfree86: fix warnings after MatchSeat patch
Laércio de Sousa [Fri, 9 May 2014 12:09:16 +0000 (09:09 -0300)]
xfree86: fix warnings after MatchSeat patch

This patch fixes some compile warnings that arise after
commit 7070ebeebaca1b51f8a2801989120784a1c374ae
(xfree86: add new key MatchSeat to xorg.conf sections "Device", "Screen", and "ServerLayout")
available at git repository
git://people.freedesktop.org/~whot/xserver for-keith

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoglamor: Stop disabling asserts by default.
Eric Anholt [Thu, 8 May 2014 15:45:22 +0000 (08:45 -0700)]
glamor: Stop disabling asserts by default.

Disabling asserts is something the user gets to manage.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoXi: don't copy a DeviceEvent into an InternalEvent
Peter Hutterer [Tue, 29 Apr 2014 06:52:01 +0000 (16:52 +1000)]
Xi: don't copy a DeviceEvent into an InternalEvent

==26141== Invalid read of size 8
==26141==    at 0x58FAEA: DeliverEmulatedMotionEvent (exevents.c:1484)

An InternalEvent is bigger than a DeviceEvent, thus copying one to the other
reads past the allocated boundary. Shouldn't have any real effect since we
shouldn't access anything past the DeviceEvent boundary if the event type is
correct.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
10 years agomi: start calculating the sprite trace from the first child of root
Peter Hutterer [Wed, 30 Apr 2014 00:55:26 +0000 (10:55 +1000)]
mi: start calculating the sprite trace from the first child of root

Introduced in
73698d41e41ce76bef2d9a90b46ac0c24ae148dd "Make XYToWindow a screen function"

Moving the code into miwindow.c changed the start of the loop from
RootWindow()->firstChild to DeepestSpriteWindow(). This function is only
supposed to be called from miXYToWindow which resets spriteTraceGood to 1,
thus DeepestSpriteWindow() is always the root window anyway.
What got dropped was the firstChild as the first window to handle, so we may
end up with the root window twice in the sprite trace.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
10 years agoMerge commit 'who/for-keith'
Keith Packard [Thu, 8 May 2014 19:58:41 +0000 (12:58 -0700)]
Merge commit 'who/for-keith'

Skipping two unreviewed patches; will mark them reviewed and cherry pick

10 years agoglamor: Publish change_window_attributes and copy_window
Keith Packard [Fri, 25 Apr 2014 22:07:03 +0000 (15:07 -0700)]
glamor: Publish change_window_attributes and copy_window

Because uxa doesn't just use glamor directly, it keeps these two
functions from being wrapped so that they get called
automatically. Publishing these will allow uxa to call them directly.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglamor: Work around libXfont when it fails to use defaultChar
Keith Packard [Sat, 26 Apr 2014 03:25:56 +0000 (20:25 -0700)]
glamor: Work around libXfont when it fails to use defaultChar

GetGlyphs is supposed to always return the full list of characters
when there is a default character available. However, if an
application opens a 16-bit two dimensional font and then draws with
8-bit requests, the bitmapGetGlyphs function in libXfont versions up
through 1.4.7 will return zero glyphs if there is no 0th row.

While this is a bug in libXfont and should be fixed there, it's easy
to protect glamor from it by simply falling through to the case that
handles GetGlyphs failures for fonts without a default character.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglamor: Fix uxa-entry point for ImageText16
Keith Packard [Sat, 26 Apr 2014 06:38:35 +0000 (23:38 -0700)]
glamor: Fix uxa-entry point for ImageText16

Was interpreting the incoming chars as 8-bits instead of 16-bits,
resulting in the wrong characters being drawn.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agosystemd-logind: let the logind code decided whether to close an fd
Peter Hutterer [Fri, 2 May 2014 04:14:58 +0000 (14:14 +1000)]
systemd-logind: let the logind code decided whether to close an fd

We can only request one fd per device from systemd-logind. If a fd is re-used
by the same device, releasing the fd from one device doesn't mean we can close
it. The systemd code knows when it's really released, so let it close the fd.

Test case: xorg.conf section for an input device with hotplugging enabled.
evdev detects the duplicate and closes the hotplugged device, which closes the
fd. The other instance of evdev thinks the fd is still valid so now you're
playing a double lottery. First, which client(s) will get the evdev fd?
Second, which requests will be picked up by evdev and which ones will be
picked up by the client? You'll never know, but the fun is in finding out.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
10 years agohw/xfree86: Video Driver ABI version 18.0
Keith Packard [Wed, 30 Apr 2014 16:32:29 +0000 (09:32 -0700)]
hw/xfree86: Video Driver ABI version 18.0

With the change in the cursor interface in
4c3932620c29c91dfbbc8eb09c84efcaa7ec873e, we need to bump the video
driver ABI number to ensure that drivers are rebuilt to match the new
interface.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
10 years agoxfree86: add short description about MatchSeat key in xorg.conf man page
Laércio de Sousa [Thu, 3 Apr 2014 14:19:15 +0000 (11:19 -0300)]
xfree86: add short description about MatchSeat key in xorg.conf man page

Signed-off-by: Laércio de Sousa <lbsousajr@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoxfree86: add new key MatchSeat to xorg.conf sections "Device", "Screen", and "ServerL...
Oleg Samarin [Thu, 3 Apr 2014 14:19:14 +0000 (11:19 -0300)]
xfree86: add new key MatchSeat to xorg.conf sections "Device", "Screen", and "ServerLayout"

This patch introduces a new key MatchSeat in xorg.conf (also applies to
any .conf file in xorg.conf.d). It will allow targeting a given
"Device", "Screen", and/or "ServerLayout" section to a particular
seat only (specified by option "-seat" in X server command line),
so that other seats won't be affected.

Without this patch, one needs to write a separate xorg.conf.custom
file and pass it to X server via "-config" option, if one wants that
these settings only apply for the right seat. However, in some cases,
this solution is undesirable or even impossible (e.g. when using GDM,
which doesn't allow X server command line customization).

Example file (/etc/X11/xorg.conf.d/seat1.conf), which would be ignored
by X server unless it was started with "-seat seat1" option:

Section "Device"
    Identifier "card0"
    Driver "nvidia"
    Option "NoLogo" "True"
    MatchSeat "seat1"
EndSection

Signed-off-by: Oleg Samarin <osamarin68@gmail.com>
Signed-off-by: Laércio de Sousa <lbsousajr@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoxfree86: allow fallback to PCI bus probe for graphics devices on non-seat0 X servers...
Laércio de Sousa [Thu, 3 Apr 2014 14:19:13 +0000 (11:19 -0300)]
xfree86: allow fallback to PCI bus probe for graphics devices on non-seat0 X servers (#66851)

Currently non-seat0 X servers only probe platform bus for graphics devices,
which is OK for most KMS-compliant drivers. However, for non-KMS drivers
(like NVIDIA proprietary ones), graphics devices can't be reached
by platform bus probe, resulting in a "No devices detected" error.

This patch allows a fallback to PCI bus probe for non-seat0 X servers
in case no platform bus graphics device is found.

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

Signed-off-by: Laércio de Sousa <lbsousajr@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoos: Add -displayfd into -help text
Robert Ancell [Tue, 22 Apr 2014 20:19:35 +0000 (08:19 +1200)]
os: Add -displayfd into -help text

Add -displayfd into -help text. It was mentioned in the man page but seem to have been missed from the -help text.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoselinux: don't checkout for AVCs on select() EINTR
Ray Strode [Thu, 24 Apr 2014 17:38:29 +0000 (13:38 -0400)]
selinux: don't checkout for AVCs on select() EINTR

wakeup handlers are called even when select() returns EINTR,
and when they're called the passed fd set is undefined.

This commit fixes the selinux wakeup handler to avoid checking
for AVCs over the netlink socket spuriously.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Ray Strode <rstrode@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agodbus: don't dispatch dbus events on select() EINTR
Ray Strode [Thu, 24 Apr 2014 17:38:28 +0000 (13:38 -0400)]
dbus: don't dispatch dbus events on select() EINTR

wakeup handlers are called even when select() returns EINTR,
and when they're called the passed fd set is undefined.

This commit fixes the dbus wakeup handler to avoid dispatching
into dbus spuriously.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Ray Strode <rstrode@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoMerge remote-tracking branch 'whot/for-keith'
Keith Packard [Tue, 29 Apr 2014 16:37:37 +0000 (09:37 -0700)]
Merge remote-tracking branch 'whot/for-keith'

10 years agodix: remove a now-superfluous comment
Peter Hutterer [Sun, 27 Apr 2014 21:57:00 +0000 (07:57 +1000)]
dix: remove a now-superfluous comment

Obsolete since 93945b0a74aa8156a88f52b8ba77f1210042f396

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoinput: Remove invalid bug checks.
Michal Srb [Wed, 2 Apr 2014 14:14:05 +0000 (17:14 +0300)]
input: Remove invalid bug checks.

Commit 2f1aedcaed8fd99b823d451bf1fb02330c078f67 added several bug checks. Some
of them are not correct.

Checks in Init(Ptr|String|Bell|Led|Integer)FeedbackClassDeviceStruct verify
that no feedback struct was set yet, but that is not required. If any feedback
structs are already present, the function will chain them behind the new one.

Signed-off-by: Michal Srb <msrb@suse.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoxfree86: int10: Fix build on ARM
Thierry Reding [Wed, 12 Feb 2014 16:11:40 +0000 (17:11 +0100)]
xfree86: int10: Fix build on ARM

Commit 7353ec7cb6fc235b03e59e35425201429c83ee72 "xfree86: Switch int10
code to stdint types" uses designated initializers to setup the fields
of the X86EMU_pioFuncs.

This breaks compilation on ARM, since out{b,w,l}() are redefined using
the preprocessor and therefore cause the compiler to complain about
non-existent fields being assigned to.

It seems like the compiler.h header that contains these redefinitions
isn't actually needed in xf86x86emu.c, so the easiest "fix" is to not
include it.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
10 years agoint10: fix build error
Rob Clark [Thu, 3 Apr 2014 19:35:53 +0000 (15:35 -0400)]
int10: fix build error

Fixes:

  stub.c:66:1: error: conflicting types for 'xf86int10Addr'
  In file included from stub.c:14:0:
  xf86int10.h:72:53: note: previous declaration of 'xf86int10Addr' was here

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodefault to stub int10 implementation on arm
Rob Clark [Thu, 3 Apr 2014 18:54:02 +0000 (14:54 -0400)]
default to stub int10 implementation on arm

There should be no reason to need a real int10 implementation on arm,
and switching to stub is an easy way to fix:

  xf86x86emu.c: In function 'xf86Int10ExecSetup':
  xf86x86emu.c:56:9: error: unknown field 'xf_outb' specified in initializer
  xf86x86emu.c:57:9: error: unknown field 'xf_outw' specified in initializer
  xf86x86emu.c:58:9: error: unknown field 'xf_outl' specified in initializer

which is caused by the following in compiler.h:

  #define outb xf_outb
  #define outw xf_outw
  #define outl xf_outl

Signed-off-by: Rob Clark <robdclark@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
10 years agohw/xfree86: Restore API compatibility for cursor loading functions
Keith Packard [Fri, 25 Apr 2014 15:22:15 +0000 (08:22 -0700)]
hw/xfree86: Restore API compatibility for cursor loading functions

Create load_cursor_image_check, load_cursor_argb_check,
LoadCursorImageCheck and LoadCursorARGBCheck that can return failure
and use them in preference to the old unchecked variants.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Michael Thayer <michael.thayer@oracle.com>
10 years agoAdd a command line argument for disabling indirect GLX.
Eric Anholt [Wed, 23 Apr 2014 16:52:17 +0000 (09:52 -0700)]
Add a command line argument for disabling indirect GLX.

The attack surface for indirect GLX is huge, and it's of no use to
most people (if you get an indirect GL context, you're better served
by a immediate X error than actually trying to use an indirect GL
context and finding out that it doesn't support doing anything you
want, slowly).  This flag gives you a chance to disable indirect GLX
in environments where you just don't need it.

I put in both the '+' and '-' arguments right now, so that it's easy
to patch the value to change the default policy.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoglamor: Fallback to system memory when fail to allocate one big fbo.
Zhigang Gong [Wed, 23 Apr 2014 09:54:43 +0000 (18:54 +0900)]
glamor: Fallback to system memory when fail to allocate one big fbo.

Even when create a pixmap which smaller than the max_fbo_size,
it may fail due to some low level driver limitation. If that is
the case, we don't need to crash the xserver. We just need to
fallback to system memory.

See the related bug at:
https://bugs.freedesktop.org/show_bug.cgi?id=71190

Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Tested-by: Kai Wasserbach <kai@dev.carbon-project.org>
Tested-by: Erich Seifert <eseifert@error-reports.org>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
10 years agoglamor: Fix memory leak in _glamor_copy_n_to_n()
Michel Dänzer [Wed, 23 Apr 2014 09:54:42 +0000 (18:54 +0900)]
glamor: Fix memory leak in _glamor_copy_n_to_n()

It would leak the memory allocated for the region rects in some cases.
Found with valgrind.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
10 years agoglamor: Fix coordinates handling for composite source/mask pictures
Anthony Waters [Wed, 23 Apr 2014 09:54:41 +0000 (18:54 +0900)]
glamor: Fix coordinates handling for composite source/mask pictures

There were actually two issues with the original code I believe, the
first is that the call to glamor_convert_gradient_picture wasn't
properly referencing the coordinates of the source/mask pictures.  The
second, was that the updated references (x_temp/y_temp) were also
improperly set, they should always be 0 because the temp pictures are
new ones that start at (0, 0).  The reason it worked in certain cases
and it didn't in others (notably the tray icons) was due to the
numbers working out based on the call to glamor_composite.  In the
cases that it did work extent->x1 would equal x_dest and extent->y1
would equal y_dest, making it so what was actually passed into
glamor_convert_gradient_picture and the settings for x_temp/y_temp
were correct.  However, for the case when extent->x1 wouldn't equal
x_dest and extent->y1 wouldn't equal y_dest (for example with the tray
icons) then the wrong parameters get passed into
glamor_convert_gradient_picture and x_temp/y_temp are set improperly.

Fixes issues with tray icons not appearing properly in certain cases.

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

Signed-Off-by: Anthony Waters <awaters1@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
10 years agoglamor: Add glamor_transfer based glamor_get_image and glamor_put_image
Keith Packard [Mon, 17 Mar 2014 03:44:48 +0000 (20:44 -0700)]
glamor: Add glamor_transfer based glamor_get_image and glamor_put_image

These use the upload_boxes and download_boxes helpers to provide
reasonably efficient image transfer.

Fixes segfaults in Xephyr with x11perf -reps 1.

Performance improvements:

Improves -putimage10 by 548.218% +/- 88.601% (n=10).
Improves -putimage500 by 3.71014% +/- 1.5049% (n=10).
Improves -getimage10 by 8.37004% +/- 4.58274% (n=10).
No statistically significant difference on -getimage500 (n=10).

v2: Fix rebase failures, don't forget to check/prepare the gc in
    putimage fallbacks (changes by anholt).

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglamor: Wire alpha to 1 for pictures without alpha bits
Keith Packard [Tue, 22 Apr 2014 23:33:45 +0000 (16:33 -0700)]
glamor: Wire alpha to 1 for pictures without alpha bits

When sourcing a picture that has no alpha values, make sure any
texture fetches wire the alpha value to one. This ensures that bits
beyond the depth of the pixmap, or bits other than the RGB values
aren't used.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglx: If DRI2GetBuffers changes the GL context, call it again
Michel Dänzer [Mon, 21 Apr 2014 08:47:15 +0000 (17:47 +0900)]
glx: If DRI2GetBuffers changes the GL context, call it again

By changing the context, it may also invalidate the DRI2 buffer
information, so we need to get that again.

Fixes crashes due to use-after-free with LIBGL_ALWAYS_INDIRECT=1
glxgears and piglit.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglamor: Move a make_current before the first GL call entrypoint.
Eric Anholt [Fri, 18 Apr 2014 01:50:13 +0000 (18:50 -0700)]
glamor: Move a make_current before the first GL call entrypoint.

Fixes a usage of the wrong context with swrast GLX's GetImage entrypoint.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglamor: Do the same MakeCurrent(None) for GLX as we do for EGL.
Eric Anholt [Fri, 4 Apr 2014 06:03:46 +0000 (07:03 +0100)]
glamor: Do the same MakeCurrent(None) for GLX as we do for EGL.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglamor: Explain the weird EGL_NO_CONTEXT code.
Eric Anholt [Fri, 4 Apr 2014 06:03:31 +0000 (07:03 +0100)]
glamor: Explain the weird EGL_NO_CONTEXT code.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglamor: Replace glamor_get/put_context() with just glamor_make_current().
Eric Anholt [Sat, 15 Mar 2014 00:31:18 +0000 (17:31 -0700)]
glamor: Replace glamor_get/put_context() with just glamor_make_current().

Now that we have the DIX global state for the current context, we
don't need to track nesting to try to reduce MakeCurrent overhead.

v2: Fix a mistaken replacement of a put_context with make_current in
    glamor_fill_spans_gl() (caught by keithp).

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> (v1)
Reviewed-by: Adam Jackson <ajax@redhat.com> (v1)
10 years agoglamor: Stop unsetting the EGL context in put_context().
Eric Anholt [Sat, 15 Mar 2014 00:29:31 +0000 (17:29 -0700)]
glamor: Stop unsetting the EGL context in put_context().

This matches the Xephyr behavior.  Now that we know when to reset the
context in the presence of GLX, we don't need to try to keep our stuff
from being smashed by GLX.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglamor: Use lastGLContext to coordinate the context with GLX.
Eric Anholt [Sat, 15 Mar 2014 00:20:12 +0000 (17:20 -0700)]
glamor: Use lastGLContext to coordinate the context with GLX.

This gets us some more context changes that are needed to make sure
the two sides render to the right drawables and manipulate the right
objects.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglx: Make sure that DRI2/swrast calls haven't changed the GL context.
Eric Anholt [Wed, 9 Apr 2014 17:23:01 +0000 (10:23 -0700)]
glx: Make sure that DRI2/swrast calls haven't changed the GL context.

These functions are called from the GL driver, in some series of GL
calls by GLX.  If some server component (like glamor CreatePixmap for
GetBuffers()) changes the GL context on us, we need to set it back or
the later GL calls will land in the glamor context instead of the GLX
context.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglx: Refactor DRI2CopyRegion calls.
Eric Anholt [Wed, 9 Apr 2014 18:25:32 +0000 (11:25 -0700)]
glx: Refactor DRI2CopyRegion calls.

I needed to add some code to each one, so it's a good time to make a
helper func.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglx: Unconditionally clear lastGLContext on loseCurrent().
Eric Anholt [Fri, 18 Apr 2014 01:28:54 +0000 (18:28 -0700)]
glx: Unconditionally clear lastGLContext on loseCurrent().

This hook calls unbindContext in the DRI driver interface, which
unsets the dispatch table, regardless of whether the context argument
was the current one or not.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglx: Move GLX MakeCurrent lastGLContext updates next to makeCurrent().
Eric Anholt [Fri, 18 Apr 2014 01:23:51 +0000 (18:23 -0700)]
glx: Move GLX MakeCurrent lastGLContext updates next to makeCurrent().

We want to make sure that lastGLContext is set correctly during
makeCurrent, because we may have recursive GL context changes in the
DRI2 interfaces due to glamor.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglx: Move the GLX variable caching what GL context is current to dix.
Eric Anholt [Fri, 18 Apr 2014 01:18:49 +0000 (18:18 -0700)]
glx: Move the GLX variable caching what GL context is current to dix.

GLX is trying to track whether the context it wants is current, to
avoid the glFlush() (and the rest of the overhead) that occurs on all
MakeCurrent calls.  However, its cache can be incorrect now that
glamor exists.  This is a step toward getting glamor to coordinate
with GLX.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglamor: Fix a missing set of the GL context.
Eric Anholt [Wed, 16 Apr 2014 23:16:21 +0000 (16:16 -0700)]
glamor: Fix a missing set of the GL context.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
10 years agoglamor: Fix accelerated rendering of GTK's ARGB vs xBGR composites.
Eric Anholt [Mon, 21 Apr 2014 17:56:38 +0000 (10:56 -0700)]
glamor: Fix accelerated rendering of GTK's ARGB vs xBGR composites.

There is some complicated code to support tweaking the format as we
upload from a SHM pixmap (aka the GTK icon cache), but if we weren't
sourcing from a SHM pixmap we just forgot to check that the formats
matched at all.

We could potentially be a little more discerning here (xRGB source and
ARGB mask would be fine, for example), but this will all change with
texture views anyway, so just get the rendering working for 1.16
release.

Fixes the new rendercheck gtk_argb_xbgr test.

v2: Squash in keithp's fix for checking that we have a non-NULL
    pixmap, and reword the comment even more.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
10 years agoMake glamor build with --enable-debug.
Jamey Sharp [Fri, 18 Apr 2014 16:31:09 +0000 (09:31 -0700)]
Make glamor build with --enable-debug.

Bad anholt, no biscuit. Broken in commit
4c9a20072552c52b3763bd73e7a7e9b9cb8b4993.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoxfixes: Forbid manipulating clip for source-only pictures (#28968)
Adam Jackson [Thu, 10 Apr 2014 15:34:28 +0000 (11:34 -0400)]
xfixes: Forbid manipulating clip for source-only pictures (#28968)

Just throw BadPicture instead of crashing.  It's not currently a
meaningful thing to do anyway, RenderSetPictureRectangles would error if
you tried (which this patch changes to BadPicture as well for
consistency).  The problem with trying to do it is if the clip is
specified as a pixmap then we try to convert it to a region, and
->BitmapToRegion requires a ScreenPtr, and source-only pictures don't
have one.

I can imagine a use for client clip on source-only pictures, so if we
really wanted to allow this, probably the way forward is to always store
the clip as a region internally, and when setting the clip _from_ a
pixmap, look up BitmapToRegion relative to the pixmap not the picture.
But since clearly nobody can be relying on it working...

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoxf86RandR12: use correct gamma size when allocating gamma table
Dominik Behr [Wed, 2 Apr 2014 03:36:13 +0000 (20:36 -0700)]
xf86RandR12: use correct gamma size when allocating gamma table

When setting crtc->gamma_size to randr_crtc->gammaSize we should
use randr_crtc->gammaSize to allocate new gamma table in crtc.
Currently, if randr_crtc->gammaSize > crtc->gammaSize the subsequent
memcpy will overwrite memory beyond the end of gamma table.

Signed-off-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoos: Initialize the set of signals to be suppressed during our handler.
Eric Anholt [Fri, 4 Apr 2014 07:38:33 +0000 (08:38 +0100)]
os: Initialize the set of signals to be suppressed during our handler.

Fixes a valgrind complaint:

==8805== Syscall param rt_sigaction(act->sa_mask) points to uninitialised byte(s)
==8805==    at 0x5EB8315: __libc_sigaction (sigaction.c:66)
==8805==    by 0x5B13DA: busfault_init (busfault.c:145)
==8805==    by 0x5A60A2: OsInit (osinit.c:191)
==8805==    by 0x46EBA2: dix_main (main.c:163)

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoFix hw/xfree86/common/compiler.h for mips64
YunQiang Su [Sat, 12 Oct 2013 05:22:35 +0000 (13:22 +0800)]
Fix hw/xfree86/common/compiler.h for mips64

Mark mips64 as 64bit
Use long as PORT_SIZE

Signed-off-by: YunQiang Su <wzssyqa@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoxres: Fix size estimation for <8bpp pixmaps (#69057)
Adam Jackson [Thu, 10 Apr 2014 15:45:37 +0000 (11:45 -0400)]
xres: Fix size estimation for <8bpp pixmaps (#69057)

Just use floats, it's not like this is a performance path.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoshadowfb: Fix compilation errors
Keith Packard [Tue, 22 Apr 2014 04:38:28 +0000 (21:38 -0700)]
shadowfb: Fix compilation errors

Ok, that's embarassing -- I didn't even make sure Adam's patch
compiled. These are minimal fixes to make it build.

Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoshadowfb: Port to miext/damage (#31303, #65547)
Adam Jackson [Thu, 10 Apr 2014 17:42:42 +0000 (13:42 -0400)]
shadowfb: Port to miext/damage (#31303, #65547)

Somewhat shocking how much simpler this is, isn't it?  We no longer need
to wrap the screen or GC or Picture, because damage does it for us,
which is doubly great since the old shadowfb code didn't wrap _enough_
things (border updates and Render glyphs, at least).  The only real
difference now between this and shadow is a) shadow will let you track
arbitrary pixmaps, and b) shadow's update hook runs off the BlockHandler
whereas shadowfb is immediate.

Tested on nouveau.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agocomposite: Fix memory leak in compCopyWindow
Peter Harris [Thu, 17 Apr 2014 00:24:34 +0000 (20:24 -0400)]
composite: Fix memory leak in compCopyWindow

Signed-off-by: Peter Harris <pharris@opentext.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agodmxConfigCanvasUpdate: Delay dereference until after checking for NULL
Alan Coopersmith [Mon, 21 Apr 2014 22:18:45 +0000 (15:18 -0700)]
dmxConfigCanvasUpdate: Delay dereference until after checking for NULL

Flagged by cppcheck 1.64:
[hw/dmx/config/xdmxconfig.c:306] -> [hw/dmx/config/xdmxconfig.c:323]:
 (warning) Possible null pointer dereference: fs - otherwise
           it is redundant to check it against null.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agofb: Fix origin of source picture in fbGlyphs
Peter Harris [Fri, 11 Apr 2014 21:44:59 +0000 (17:44 -0400)]
fb: Fix origin of source picture in fbGlyphs

If a source picture doesn't repeat and a mask format is specified, the
incorrect calulation of the origin of the glyphs caused the glyphs to
not be drawn at all.

Noticed when running gtk-demo from RHEL 6.5 and selecting "Rotated
Text".

Signed-off-by: Peter Harris <pharris@opentext.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
/* Test for this bug

cc -std=c99 -o glyph glyph.c `pkg-config --cflags --libs xcb-render`

*/

// 16 x 16 pictfmt_a8 "glyph"
static const char glyph[] = {
    0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff,
    0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0,
    0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0, 0,
    0, 0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0,
    0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0xff, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0xff, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0, 0,
    0, 0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0, 0, 0,
    0, 0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0, 0,
    0, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0,
    0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff,
};

static struct {
    uint8_t len;
    uint8_t pad[3];
    uint16_t deltax, deltay;
    uint8_t glyph;
    uint8_t pad2[3];
} elt = { len:1, glyph:1, deltax:WIN_SIZE/2 - GLYPH_SIZE/2, deltay:WIN_SIZE/2 - GLYPH_SIZE/2 };

int main(int argc, char *argv[])
{
    int screen;
    xcb_connection_t *c = xcb_connect(NULL, &screen);
    if (!c || xcb_connection_has_error(c)) {
fprintf(stderr, "Cannot open default display \"%s\"\n", getenv("DISPLAY"));
return EXIT_FAILURE;
    }

    // Find root window and depth
    const xcb_setup_t *setup = xcb_get_setup(c);
    if (screen >= setup->roots_len)
screen = 0;
    xcb_screen_iterator_t si = xcb_setup_roots_iterator(setup);
    for (int i=0; i < screen; i++)
xcb_screen_next(&si);
    xcb_window_t root = si.data->root;
    uint8_t depth = si.data->root_depth;
    xcb_visualid_t visual = si.data->root_visual;

    // Find picture formats
    xcb_render_query_pict_formats_reply_t *qpf;
    qpf = xcb_render_query_pict_formats_reply(c, xcb_render_query_pict_formats(c), NULL);
    if (!qpf) {
fprintf(stderr, "Cannot query RENDER picture formats\n");
return EXIT_FAILURE;
    }
    xcb_render_pictformat_t fmt_a8 = 0;
    xcb_render_pictforminfo_iterator_t pfi =
        xcb_render_query_pict_formats_formats_iterator(qpf);
    for (int i = 0; i < xcb_render_query_pict_formats_formats_length(qpf); i++) {

        if (pfi.data->depth == 8 &&
                pfi.data->type == XCB_RENDER_PICT_TYPE_DIRECT &&
                pfi.data->direct.alpha_mask == 0xFF) {
            fmt_a8 = pfi.data->id;
            break;
        }
        xcb_render_pictforminfo_next(&pfi);
    }
    if (!fmt_a8) {
fprintf(stderr, "Cannot find a8 RENDER picture format\n");
return EXIT_FAILURE;
    }

    xcb_render_pictformat_t fmt_visual = 0;
    xcb_render_pictscreen_iterator_t psi =
        xcb_render_query_pict_formats_screens_iterator(qpf);
    for (int i = 0; i < xcb_render_query_pict_formats_screens_length(qpf); i++) {
        xcb_render_pictdepth_iterator_t pdi =
            xcb_render_pictscreen_depths_iterator(psi.data);
        for (int j = 0; i < xcb_render_pictscreen_depths_length(psi.data); i++) {
            xcb_render_pictvisual_iterator_t pvi =
                xcb_render_pictdepth_visuals_iterator(pdi.data);
            for (int k = 0; k < xcb_render_pictdepth_visuals_length(pdi.data); i++) {
                if (pvi.data->visual == visual) {
                    fmt_visual = pvi.data->format;
                    goto found_visual;
                }
                xcb_render_pictvisual_next(&pvi);
            }
            xcb_render_pictdepth_next(&pdi);
        }
        xcb_render_pictscreen_next(&psi);
    }
found_visual:
    if (!fmt_visual) {
fprintf(stderr, "Cannot find visual RENDER picture format\n");
return EXIT_FAILURE;
    }

    xcb_render_glyphset_t glyphset = xcb_generate_id(c);
    xcb_render_create_glyph_set(c, glyphset, fmt_a8);
    uint32_t glyph_ids[] = {1};
    xcb_render_add_glyphs(c, glyphset, 1, glyph_ids,
            &(xcb_render_glyphinfo_t){width:GLYPH_SIZE, height:GLYPH_SIZE}, sizeof(glyph), glyph);

    // Create window, pixmap, and gc
    xcb_window_t window = xcb_generate_id(c);
    uint32_t list[] = { si.data->black_pixel, XCB_EVENT_MASK_EXPOSURE };
    xcb_create_window(c, XCB_COPY_FROM_PARENT, window, root, 0, 0, WIN_SIZE, WIN_SIZE,
    0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT,
    XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK, list);
    xcb_map_window(c, window);
    xcb_render_picture_t winpic = xcb_generate_id(c);
    xcb_render_create_picture(c, winpic, window, fmt_visual, 0, NULL);

    xcb_pixmap_t pixmap = xcb_generate_id(c);
    xcb_create_pixmap(c, depth, pixmap, window, GLYPH_SIZE, GLYPH_SIZE);
    xcb_render_picture_t pixpic = xcb_generate_id(c);
    xcb_render_create_picture(c, pixpic, pixmap, fmt_visual, 0, NULL);
    xcb_render_fill_rectangles(c, XCB_RENDER_PICT_OP_SRC, pixpic,
            (xcb_render_color_t){green:0xFFFF, alpha:0xFFFF}, 1,
            &(xcb_rectangle_t){width:GLYPH_SIZE, height:GLYPH_SIZE} );

    xcb_flush(c);
    for (xcb_generic_event_t *ev = xcb_wait_for_event(c); ev; ev = xcb_wait_for_event(c)) {
int type = ev->response_type;
free(ev);
if (type == XCB_EXPOSE) {
            xcb_clear_area(c, 0, window, 0, 0, 0, 0);
            xcb_render_composite_glyphs_8(c, XCB_RENDER_PICT_OP_SRC, pixpic, winpic, fmt_a8,
                    glyphset, 0, 0, sizeof(elt), (uint8_t *)&elt);
            xcb_flush(c);
        }
    }

    return EXIT_SUCCESS;
}

10 years agoglamor: Add remaining header files to SOURCES
Michel Dänzer [Fri, 11 Apr 2014 02:01:51 +0000 (11:01 +0900)]
glamor: Add remaining header files to SOURCES

It wasn't possible to build glamor from tarballs.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64297#c9
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agodixfonts: Turn a missing directory ErrorF into a DebugF
Jasper St. Pierre [Mon, 21 Apr 2014 20:30:49 +0000 (16:30 -0400)]
dixfonts: Turn a missing directory ErrorF into a DebugF

On systems without these directories, we don't need to be complaining
loudly.

Reviewed-by: Kristian Hoegsberg <krh@bitplanet.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoMerge remote-tracking branch 'krh/xwayland-for-keithp'
Keith Packard [Mon, 21 Apr 2014 21:59:51 +0000 (14:59 -0700)]
Merge remote-tracking branch 'krh/xwayland-for-keithp'

10 years ago.gitignore: Add new autotools file 'test-driver'
Kristian Høgsberg [Tue, 25 Mar 2014 21:57:12 +0000 (14:57 -0700)]
.gitignore: Add new autotools file 'test-driver'

Automake 1.12 introduces a new parallel test framework that uses a shell
script helper and generates *.log and *.trs files.  Add to .gitignore.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoconfigure: require xproto 7.0.26 for pointer typedef removal
Julien Cristau [Mon, 14 Apr 2014 13:27:19 +0000 (15:27 +0200)]
configure: require xproto 7.0.26 for pointer typedef removal

Signed-off-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoconfigure: require fontsproto 2.1.3 for pointer typedef removal
Julien Cristau [Mon, 14 Apr 2014 13:27:18 +0000 (15:27 +0200)]
configure: require fontsproto 2.1.3 for pointer typedef removal

Signed-off-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agorandr: Implement RandR 1.4 request swapping
Robert Morell [Sat, 19 Apr 2014 01:29:44 +0000 (18:29 -0700)]
randr: Implement RandR 1.4 request swapping

The protocol handlers all have support for swapping variable data and
replies, but the top-level dispatch plumbing was missing.

Signed-off-by: Robert Morell <rmorell@nvidia.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agorandr: Fix size checks for SetProvider* reqs
Robert Morell [Sat, 19 Apr 2014 01:29:43 +0000 (18:29 -0700)]
randr: Fix size checks for SetProvider* reqs

Both xRRSetProviderOutputSourceReq and xRRSetProviderOffloadSinkReq are
fixed-size requests, so the length on the wire should match exactly.

Signed-off-by: Robert Morell <rmorell@nvidia.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agorandr: Fix crash for NULL swap dispatch procs
Robert Morell [Sat, 19 Apr 2014 01:29:42 +0000 (18:29 -0700)]
randr: Fix crash for NULL swap dispatch procs

The previous code was checking the wrong table for function pointers.

Signed-off-by: Robert Morell <rmorell@nvidia.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoxwayland: Remove left-over ErrorF logging
Kristian Høgsberg [Mon, 21 Apr 2014 18:14:51 +0000 (11:14 -0700)]
xwayland: Remove left-over ErrorF logging

Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoDRI2SwapBuffers: Fix uninitialized target SBC.
Jamey Sharp [Fri, 18 Apr 2014 19:22:19 +0000 (12:22 -0700)]
DRI2SwapBuffers: Fix uninitialized target SBC.

Fixes Piglit test "swapbuffersmsc-return swap_interval 0".

Ensure that *swap_target gets initialized on any 'return Success' path,
even if the swap request can't be completed by the driver and the server
falls back to a simple blit. That path can also be triggered by setting
swap_interval to 0, which disables sync to vertical retrace.

We originally found this bug because for some reason SDL2 automatically
sets swap_interval to 0, when we were trying to test OML_sync_control in
an SDL2 test application. We then discovered that the above-mentioned
Piglit test has been failing for the same reason since it was
introduced.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Theo Hill <Theo0x48@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoDRI2SwapBuffers: Don't reuse swap_target variable.
Jamey Sharp [Fri, 18 Apr 2014 19:22:18 +0000 (12:22 -0700)]
DRI2SwapBuffers: Don't reuse swap_target variable.

swap_target is an out-parameter that needs to be set to the value that
SBC will take on after this SwapBuffers request completes.

However, it was also being used as a temporary variable to hold the MSC
at which the SwapBuffers request got scheduled to occur. This confusion
makes it harder to reason about whether swap_target is being set
correctly for its out-parameter usage. (Hint: It isn't.)

For the latter use, it makes more sense to use the existing target_msc
variable, which already has the right value unless target_msc, divisor,
and remainder are all 0, in which case we can set it using swap_interval
as usual.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Theo Hill <Theo0x48@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
10 years agoconfigure.ac: Remove check for WAYLAND_SCANNER_RULES
Kristian Høgsberg [Tue, 8 Apr 2014 16:23:42 +0000 (09:23 -0700)]
configure.ac: Remove check for WAYLAND_SCANNER_RULES

This makes configure fail if the wayland autoconf macros aren't found.
We don't need the scanner for shm-only xwayland so just drop this line for
now.

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoxwayland: Build without xshmfence
Kristian Høgsberg [Tue, 8 Apr 2014 16:19:13 +0000 (09:19 -0700)]
xwayland: Build without xshmfence

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoxwayland: Build without GLX extension
Kristian Høgsberg [Tue, 8 Apr 2014 16:17:51 +0000 (09:17 -0700)]
xwayland: Build without GLX extension

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>