Commit Graph

4162 Commits

Author SHA1 Message Date
Olivier Fourdan
17097e083b vidmode: rename DDX functions
To avoid confusion as to what belongs on the DDX and what not.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2016-02-29 16:28:59 -05:00
Olivier Fourdan
ddfb8c009a vidmode: move display mode definitions
To be able to reuse the VidMode extension in a non-hardware server, the
display mode definitions need to be accessible from DIX.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2016-02-29 16:28:57 -05:00
Olivier Fourdan
e29a64de66 vidmode: remove mode access from public API
The mode access functions (namely VidModeCreateMode(),
VidModeCopyMode(), VidModeGetModeValue() and VidModeSetModeValue()) are
used only in xf86VidMode code and do not need to be available anywhere
else.

Remove these functions from the public VidMode API and move them as
static where they are used.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2016-02-29 16:28:55 -05:00
Olivier Fourdan
b7962ade52 vidmode: use appropriate DisplayModePtr type
The API uses an untyped pointer (void *) where a DisplayModePtr is
expected.

Clean up the API to use the appropriate type, as DisplayModePtr is
really all that will be passed there.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2016-02-29 16:28:54 -05:00
Olivier Fourdan
12f714fd95 vidmode: remove VidModeGetMonitor()
VidModeGetMonitor() is used solely in ProcXF86VidModeGetMonitor() to
get a untyped monitor pointer that is passed back straight again to
VidModeGetMonitorValue().

This is actually useless as VidModeGetMonitorValue() could as well get
the monitor from the ScreenPtr just like VidModeGetMonitor() does.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2016-02-29 16:28:52 -05:00
Olivier Fourdan
f6f7e21133 vidmode: use ScreenPtr instead of screen index
New code passes ScreenPtr instead of the screen index.

Change the VidMode functions to take a ScreenPtr.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2016-02-29 16:28:50 -05:00
Olivier Fourdan
6e898ef080 vidmode: get rid of the CloseScreen wrapper
As we rely on dixRegisterPrivateKey() to allocate the memory for us that
will be free automatically, we do not need the CloseScreen wrapper
anymore.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2016-02-29 16:28:47 -05:00
Olivier Fourdan
341f3bccaf vidmode: use appropriate API
dixRegisterPrivateKey() can allocate memory that will be freed when the
screen is teared down.

No need to calloc() and free the memory ourself using a broken ref
counting method.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2016-02-29 16:28:37 -05:00
Chris Wilson
d888295457 dri2: Allow many blocked clients per-drawable
This patch was motivated by the need to fix the use-after-free in
dri2ClientWake, but in doing so removes an arbitrary restriction that
limits DRI2 to only blocking the first client on each drawable. In order
to fix the use-after-free, we need to avoid touching our privates in the
ClientSleep callback and so we want to only use that external list as
our means of controlling sleeps and wakeups. We thus have a list of
sleeping clients at our disposal and can manage multiple events and
sources.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-29 14:33:20 -05:00
Marc-Andre Lureau
5627708e5f dri2: add virtio-gpu pci ids
Add virtio-gpu legacy + 1.0 pci ids, allowing them to use
modesetting + glamor with dri2.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-02-22 13:48:49 -05:00
Daniel Stone
e957a2e5dd dix: Add hybrid full-size/empty-clip mode to SetRootClip
216bdbc735 removed the SetRootClip call in the XWayland output-hotplug
handler when running rootless (e.g. as a part of Weston/Mutter), since
the root window has no storage, so generating exposures will result in
writes to invalid memory.

Unfortunately, preventing the segfault also breaks sprite confinement.
SetRootClip updates winSize and borderSize for the root window, which
when combined with RRScreenSizeChanged calling ScreenRestructured,
generates a new sprite-confinment area to update it to the whole screen.

Removing this call results in the window geometry being reported
correctly, but winSize/borderSize never changing from their values at
startup, i.e. out of sync with the root window geometry / screen
information in the connection info / XRandR.

This patch introduces a hybrid mode, where we update winSize and
borderSize for the root window, enabling sprite confinement to work
correctly, but keep the clip emptied so exposures are never generated.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Tested-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-02-22 13:26:31 -05:00
Adam Jackson
eddf848c44 dri2: Use the work queue to manage client sleeps
In  commit e43abdce96
    Author: Chris Wilson <chris@chris-wilson.co.uk>
    Date:   Wed Feb 3 09:54:46 2016 +0000

        dri2: Unblock Clients on Drawable release

we try to wake up any blocked clients at drawable destruction. But by
the time we get there, CloseDownConnection has already torn down state
that AttendClient wants to modify.

Using ClientSleep instead of IgnoreClient puts a wakeup function on a
workqueue, and the queue will be cleared for us in CloseDownClient
before (non-neverretain) resource teardown.

Tested-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-02-11 13:58:13 -05:00
Chris Wilson
e43abdce96 dri2: Unblock Clients on Drawable release
If the Window is destroyed by another client, such as the window
manager, the original client may be blocked by DRI2 awaiting a vblank
event. When this happens, DRI2DrawableGone forgets to unblock that
client and so the wait never completes.

Note Present/xshmfence is also suspectible to this race.

Testcase: dri2-race/manager
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2016-02-08 21:47:18 -05:00
Chris Wilson
b7d392931a dri2: Only invalidate the immediate Window upon SetWindowPixmap
All callers of SetWindowPixmap will themselves be traversing the Window
heirarchy updating the backing Pixmap of each child and so we can forgo
doing the identical traversal inside the DRI2SetWindowPixmap handler.

Reported-by: Loïc Yhuel <loic.yhuel@gmail.com>
Link: http://lists.x.org/archives/xorg-devel/2015-February/045638.html
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2016-02-08 17:07:32 -05:00
Adam Jackson
953b71270c xfree86: Build parser for DRI config file subsection unconditionally
This applies regardless of which DRI you're asking for. Worse, leaving
it out means breaking the config file syntax in a pointless way, since
non-DRI servers can safely just parse it and ignore it.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-01-28 09:01:08 -05:00
Adam Jackson
1a48a5863e xfree86: Remove ancient DRI build instructions
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-01-28 09:01:03 -05:00
Timo Aaltonen
50ca286d79 dri2: Sync i915_pci_ids.h and i965_pci_ids.h from mesa
Adds Skylake, Kabylake and Broxton allowing them to use
modesetting + glamor with dri2.

Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
2016-01-27 14:03:34 -05:00
Thomas Klausner
862cbf4c87 Fix build when XSERVER_PLATFORM_BUS is not defined.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
2016-01-06 10:10:14 -05:00
Alan Coopersmith
fe8562f531 modesetting should not reference gbm when it's not defined
Fixes build errors of:
present.c: In function 'ms_do_pageflip':
present.c:410:17: error: 'drmmode_bo' has no member named 'gbm'
     new_front_bo.gbm = glamor_gbm_bo_from_pixmap(screen, new_front);
                 ^
present.c:412:22: error: 'drmmode_bo' has no member named 'gbm'
     if (!new_front_bo.gbm) {
                      ^
present.c: In function 'ms_present_check_flip':
present.c:536:36: error: 'drmmode_bo' has no member named 'gbm'
         if (drmmode_crtc->rotate_bo.gbm)
                                    ^
Introduced by commit 13c7d53d

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2016-01-05 13:23:56 -05:00
Peter Hutterer
f3593918a0 xfree86: move check for driver->PreInit up
No real change, but if the driver is broken and doesn't provide a PreInit
function, then we don't need to worry about logind.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2015-12-21 07:15:30 +10:00
Peter Hutterer
fc4fbe8224 xfree86: add NoMatchFoo directives for InputClass sections
InputClass sections use various MatchFoo directives to decide which device to
apply to. This usually works fine for specific snippets but has drawbacks for
snippets that apply more generally to a multitude of devices.

This patch adds a NoMatchFoo directive to negate a match, thus allowing
snippets that only apply if a given condition is not set. Specifically, this
allows for more flexible fallback driver matching, it is now possible to use a
snippet that says "assign driver foo, but only if driver bar wasn't already
assigned to it". For example:

Section "InputClass"
   Identifier "libinput for tablets"
   MatchIsTablet "true"
   NoMatchDriver "wacom"
   Driver "libinput"
EndSection

The above only assigns libinput to tablet devices if wacom isn't already
assigned to this device, making it possible to select a specific driver by
installing/uninstalling it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-12-18 11:56:46 +10:00
Peter Hutterer
eb671b804e xfree86: whitespace fix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-18 11:56:46 +10:00
Laércio de Sousa
718223d274 systemd-logind.c: don't parse VT settings for non-seat0 X servers
Since non-seat0 X servers no longer touch VTs, I believe these settings
are unnecessary.

Signed-off-by: Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-08 11:54:11 -05:00
Adam Jackson
2a52c06e23 x86emu: Squash a warning
Apologies, should have caught this one when applying the previous x86emu
patch.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-12-07 17:05:39 -05:00
Julian Pidancet
59b618227e x86emu: Correctly handle 0x66 prefix for some instructions
(Sorry for double posting)

I repost this patch because I havn't got any replies from maintainers
since I posted the initial patch back in March.

Some instructions are not emulated correctly by x86emu when they
are prefixed by the 0x66 opcode.
I've identified problems in the emulation of these intructions: ret,
enter, leave, iret and some forms of call.

Most of the time, the problem is that these instructions should push or
pop 32-bit values to/from the stack, instead of 16bit, when they are
prefixed by the 0x66 special opcode.

The SeaBIOS project aims to produce a complete legacy BIOS
implementation as well as a VGA option ROM, entirely written in C and
using the GCC compiler.

In 16bit code produced by the GCC compiler, the 0x66 prefix is used
almost everywhere. This patch is necessary to allow the SeaBIOS VGA
option ROM to function with Xorg when using the vesa driver.

SeaBIOS currently use postprocessing on the ROM assembly output to
replace the affected instruction with alternative unaffected instructions.
This is obviously not very elegant, and this fix in x86emu would be
more appropriate.

v2: - Decrement BP instead of EBP in accordance with the Intel Manual
    - Assign EIP instead of IP when poping the return address from the
    stack in 32-bit operand size mode in ret_far_IMM, ret_far, and iret
    - When poping EFLAGS from the stack in iret in 32-bit operand size
    mode, apply some mask to preserve Read-only flags.

v3: - Rebase

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
2015-12-07 14:49:36 -05:00
Dave Airlie
548a3d5fd6 modesetting: create entities for pci and old probe. (v2)
This moves the code from the platform case into
a common function, and calls that from the
other two.

v2: Emil convinced me we don't need to lookup pEnt
here, so let's not bother.

Reported-by: Mark Kettenis <mark.kettenis@xs4all.nl>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 11:20:26 +10:00
Dave Airlie
771016f070 modesetting: drop platform_dev pointer.
This isn't used anywhere, so no point storing it until we need it.

Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-12-07 11:20:26 +10:00
Arkadiusz Miśkiewicz
19b0249a5e Xorg.wrap: activate libdrm based detection for KMS drivers
Xorg.wrap includes code guarded with WITH_LIBDRM for detecting KMS drivers.
Unfortunately it is never activated since code missed to include file
which defines WITH_LIBDRM.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92894
Signed-off-by: Arkadiusz Miśkiewicz <arekm@maven.pl>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2015-12-03 11:05:37 -05:00
Adam Jackson
2e3d9623ae Revert "hw/xfree86: Use NotifyFd for device and other input fd wakeups"
Reported to break libinput:

http://lists.freedesktop.org/archives/xorg-devel/2015-December/048091.html

This reverts commit 1df07dc36c.
2015-12-02 10:42:36 -05:00
Keith Packard
1df07dc36c hw/xfree86: Use NotifyFd for device and other input fd wakeups
Remove code in xf86Wakeup for dealing with device and other input and
switch to using the new NotifyFd interface.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-12-01 13:56:13 -05:00
Keith Packard
8543d4d8bc modesetting: Use NotifyFd for drm event monitoring
Replace the block/wakeup handlers with a NotifyFd callback.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-12-01 13:55:25 -05:00
agoins
8d3f0e964e xf86: Bump ABI version to 21
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Alex Goins <agoins@nvidia.com>
2015-12-01 13:15:03 -05:00
Richard PALO
e6b106715f Replace 'sun' with '__sun'
Globally replace #ifdef and #if defined usage of 'sun' with '__sun'
such that strict ISO compiler modes such as -ansi or -std=c99 can be used.

Signed-off-by: Richard PALO <richard@NetBSD.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2015-11-30 11:51:22 -05:00
Adam Jackson
eb36924ead dix: Remove redundant ChangeWindowProperty
Use dixChangeWindowProperty(serverClient, ...) instead.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2015-11-30 10:24:53 -05:00
Peter Hutterer
71ba826901 xfree86: fix minor memory leak
xf86*StrOption returns a strdup

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-24 07:53:20 +10:00
Eric Anholt
9d2b76652f modesetting: No need to free the EGLImage just before freeing the pixmap.
DestroyPixmap handles that just fine.  This also lets us drop our use
of the manual image destruction function (Note that the radeon driver
still uses it in a similar fashion, though).

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-11-18 10:02:15 -08:00
Michael Stapelberg
a6cddb8c04 Also dump passive grabs on XF86LogGrabInfo
Signed-off-by: Michael Stapelberg <stapelberg@google.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-10 15:12:21 +10:00
Daniel Martin
7d1e478385 modesetting: Remove XF86_CRTC_VERSION checks
The ifdef checks for XF86_CRTC_VERSION >= 3/5 are remnants from the
out-of-tree driver. Within the tree, we can rely on:
    xf86Crtc.h:#define XF86_CRTC_VERSION 6

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-10-30 10:22:29 -04:00
Daniel Martin
45c83a266d modesetting: Free output_ids in drmmode_set_mode_major()
We calloc() output_ids. Let's free() it, too.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-10-30 10:22:29 -04:00
Daniel Martin
2674d42402 modesetting: Handle failures in setting a CRTC to a DRM mode properly
This fixes a bug where running the card out of PPLL's when hotplugging
another monitor would result in all of the displays going blank and
failing to work properly until X was restarted or the user switched to
another VT.

[Michel Dänzer: Pass errno instead of -ret to strerror()]
[Daniel Martin: Add \n to log message]

Picked from xf86-video-ati
    7186a87 Handle failures in setting a CRTC to a DRM mode properly

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-10-30 10:22:25 -04:00
Adam Jackson
250666586e vidmode: Drop the unused event code
As the code says, this is "far from complete".  So far, in fact, that
it's been basically untouched for twenty years (XFree86 3.1!).  As far
as I can tell it was never enabled in any XFree86 build, and certainly
has never been enabled since Xorg 7.0.

Also, K&R.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-10-30 10:07:53 -04:00
Alan Coopersmith
8fc295bde9 Xorg.man: update to reflect -nolisten tcp becoming default
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2015-10-28 14:16:20 -04:00
Alan Coopersmith
75157b7dbf Xorg.man: move XLOCAL details to X(7) man page instead
These settings affect clients, not server, so belong there, next to
the information about how to set $DISPLAY.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2015-10-28 14:16:06 -04:00
Adam Jackson
bb78c464f0 build: Remove stale miext/cw include paths
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-10-27 13:46:13 -04:00
Michel Dänzer
ac2f27f1a9 DRI2: Sync radeonsi_pci_ids.h from Mesa
Fixes DRI2 client driver name mapping for newer AMD GPUs with the
modesetting driver, allowing the DRI2 extension to initialize.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-10-27 10:47:25 -04:00
Adam Jackson
47b00fa4bf xfree86: Use same inb/outb asm code for i386 amd64 and ia64
This matches the GCCUSESGAS path from the old monolith build (where that
macro was actually set), and fixes the build on modern OSX.

Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-10-26 11:24:22 -04:00
Dave Airlie
c99fb550e0 xf86: don't add gpus from udev if autoAddGPU is set
At startup the server wasn't adding devices, but nothing
was blocking hotplug devices by the look of it.

bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91388
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-10-21 15:13:41 -04:00
Hans de Goede
2092f12a24 linux: Do not call FatalError from xf86CloseConsole
FatalError ends up calling xf86CloseConsole itself, so calling FatalError
from within xf86CloseConsole is not a good idea.

Make switch_to log errors using xf86Msg(X_WARNING, ...) and return success
(or failure).

This makes switch_to match the other error checking done in xf86CloseConsole
which all logs warnings and continues.

Add checking of the return value in xf86OpenConsole and call
FatalError there when switch_to fails, to preserve the error-handling
behavior of xf86OpenConsole.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1269210
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2015-10-21 10:35:51 -04:00
Samuel Thibault
113c0bb4fd hurd: fix xorg-wrapper build
hurd does not have any PATH_MAX limitation. misc.h provides a default value
which is fine here.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2015-10-19 17:17:15 -04:00
Julien Cristau
1d4aa67242 xorg-wrapper: when starting the server as root, reset its environment
When the server is privileged, we shouldn't be passing the user's
environment directly.

Clearing the environment is recommended by the libdbus maintainers, see
https://bugs.freedesktop.org/show_bug.cgi?id=52202

v2: rename envp to empty_envp (Jeremy)
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83849
Signed-off-by: Julien Cristau <jcristau@debian.org>
2015-10-19 12:18:17 -04:00