Commit Graph

15127 Commits

Author SHA1 Message Date
Keith Packard
8c8f3567fe config: Use NotifyFd interface for udev
This uses the NotifyFd interface to monitor the udev file descriptor
rather than adding another block/wakeup handler

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-12-01 13:55:15 -05:00
Keith Packard
bf920b2390 config: Use NotifyFd for dbus interface
This uses the NotifyFd interface to monitor the dbus socket rather
than a block/wakeup handler.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-12-01 13:55:13 -05:00
Keith Packard
91ea0965dd dix: Move InitFonts up above screen initialization
Font initialization was split into two stages, the first was to set up
font privates with a call to ResetFontPrivateIndex, then much later
the call to InitFonts to set up all of the FPEs. Doing the full font
initialization before initializing the video drivers means that we can
move the call to ResetFontPrivateIndex inside InitFonts.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-12-01 13:55:11 -05:00
Keith Packard
4020aacd1f os: Implement support for NotifyFd X_NOTIFY_WRITE
This adds the ability to be notified when a file descriptor is
available for writing.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-12-01 13:55:07 -05:00
Keith Packard
0c41b7af4a os: Add NotifyFd interfaces
This provides a callback-based interface to monitor file
descriptors beyond the usual client and device interfaces.

Modules within the server using file descriptors for reading and/or
writing can call

    Bool SetNotifyFd(int fd, NotifyFdProcPtr notify_fd, int mask, void *data);

mask can be any combination of X_NOTIFY_READ and X_NOTIFY_WRITE.

When 'fd' becomes readable or writable, the notify_fd function will be
called with the 'fd', the ready conditions and 'data' values as arguments,

When the module no longer needs to monitor the fd, it will call

    void RemoveNotifyFd(int fd);

RemoveNotifyFd may be called from the notify function.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-12-01 13:55:03 -05:00
Keith Packard
e10ba9e4b5 Remove non-smart scheduler. Don't require setitimer.
This allows the server to call GetTimeInMillis() after each request is
processed to avoid needing setitimer. -dumbSched now turns off the
setitimer.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-12-01 13:54:54 -05:00
agoins
c7f4aef8f4 randr: Cleanup rrSetupPixmapSharing()
protopix is completely redundant with mscreenpix. Get rid of it.

We don't need rrScrPriv, so remove it.

[ajax: also squash an unused variable in RRCrtcDetachScanoutPixmap,
though it'll come back when the rest of this series lands]

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Alex Goins <agoins@nvidia.com>
2015-12-01 13:44:31 -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
agoins
7006b4e7ff randr: Factor out shared pixmap creation
The old version of rrCreateSharedPixmap(), in addition to actually creating
a shared pixmap with scanout, also set up pixmap tracking on the source
driver.

I will be needing to create multiple shared pixmaps for PRIME double
buffering, so factor the part that does shared pixmap creation into its own
function, the new rrCreateSharedPixmap(). Rename the old
rrCreateSharedPixmap() to rrSetupPixmapSharing(), a function that
replicates the old functionality of rrCreateSharedPixmap() using the new
rrCreateSharedPixmap().

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Alex Goins <agoins@nvidia.com>
2015-12-01 13:15:01 -05:00
agoins
cf5d6414e0 randr: Factor out shared pixmap destruction
Shared pixmap destruction is done by unrefing the master pixmap twice: once
for the original reference, and once for the reference implicitly added by
PixmapShareToSlave. Then, unrefing the slave pixmap once.

When I add PRIME double buffering and synchronization, I will need to do
this in multiple places. To avoid duplication of code and comments
explaining it everywhere, factor it out into its own function and use that
in place of where it was before.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Alex Goins <agoins@nvidia.com>
2015-12-01 13:14:51 -05:00
Olivier Fourdan
ab9837cc6a xwayland: Update screen size on output removal
When unplugging an output, it's still listed in xrandr and the size
of the root window still includes the removed output.

The RR output should be destroyed when its Wayland counterpart is
destroyed and the screen dimensions must be updated in both the done
and the destroy handlers.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92914
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
2015-12-01 12:26:19 -05:00
Jonas Ådahl
07941a50a5 xwayland: Always update the wl_pointer cursor on pointer focus
In Wayland, a client (in this case XWayland) should set the cursor
surface when it receives pointer focus. Not doing this will leave the
curser at whatever it was previously.

When running on XWayland, the X server will not be the entity that
controls what actual pointer cursor is displayed, and it wont be notified
about the pointer cursor changes done by the Wayland compositor. This
causes X11 clients running via XWayland to end up with incorrect pointer
cursors because the X server believes that, if the cursor was previously
set to the cursor C, if we receive Wayland pointer focus over window W
which also has the pointer cursor C, we do not need to update it. This
will cause us to end up with the wrong cursor if cursor C was not the
same one that was already set by the Wayland compositor.

This patch works around this by, when receiving pointer focus, getting
the private mipointer struct changing the "current sprite" pointer to
an invalid cursor in order to trigger the update path next time a cursor
is displayed by dix.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2015-12-01 12:14:03 -05:00
Olivier Fourdan
51a4399b94 xwayland: Do not set root clip when rootless
Otherwise the server may try to draw onto the root window when closing
down, but when running rootless the root window has no storage thus
causing a memory corruption.

Thanks to Adam Jackson <ajax@redhat.com> for helping tracking this down!

Reviewed-by: Adam Jackson <ajax@redhat.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93045
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Tested-by: Marek Chalupa <mchqwerty@gmail.com>
2015-11-30 12:03:57 -05:00
Marek Chalupa
5b2ca34132 xwayland: check if creating xwl_output succeeded
check return values of RR.*Create calls

v2. do not bail out if we don't have any output

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
2015-11-30 11:56:28 -05:00
Marek Chalupa
646ebea456 xwayland: fix memory leaks on error paths in xwl_realize_window
don't leak memory when realizing window fails

v2. take care of all memory allocation and return values,
    not just one leak

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
2015-11-30 11:56:28 -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
Egbert Eich
44d0fd435a kdrive/UnregisterFd: Fix off by one
The number of FDs has been decremented already, therefore the
number contained the index of the top one that is to me moved down.

This problem was introduced by:
  commit 1110b71e36
  Author: Chris Clayton <chris2553@googlemail.com>

    kdrive: fix build error on gcc 4.8 for out-of-bounds array access

The reason for the warning was likely a confused compiler.
Hoping to reduce the confusion by moving the decrement behind the end
if the copy loop.

Signed-off-by: Egbert Eich <eich@suse.de>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-30 11:48:08 -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
Adam Jackson
4affa75a90 xnest: Fix needless build dependency on xcb-util-keysyms
This was added in:

    commit 4301479508
    Author: Olivier Fourdan <ofourdan@redhat.com>
    Date:   Mon Jan 5 16:44:22 2015 +0100

        Synchronize capslock in Xnest and Xephyr

Which is fine if you're building both, but if you don't happen to have
xcb-util-keysyms' headers installed Xnest will configure as enabled but
fail to build.

Fortunately <X11/X.h> has a corresponding #define, so use that instead.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
2015-11-24 10:41:14 -05:00
Daniel Stone
fee0827a9a XWayland: Use FocusIn events for keyboard enter
wl_keyboard::enter is the equivalent of FocusIn + KeymapNotify: it
notifies us that the surface/window has now received the focus, and
provides us a set of keys which are currently down.

We should use these keys to update the current state, but not to send
any events to clients.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-24 11:36:36 +10:00
Daniel Stone
816015648f Input: Add focus-in event source
Add a new event source type for keypress events synthesised from focus
notifications (e.g. KeymapNotify from the parent server, when running
nested). This is used to keep the keys-down array in sync with the host
server's, without sending actual keypress events to clients.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-24 11:36:34 +10:00
Daniel Stone
c3788394e9 Input: Add DeviceEventSource enum
Add a flag to DeviceEvents, giving the source of the event. Currently
this only supports a 'normal' flag, but will be used later to add a
'focus-in' flag, noting events synthesised from key/button arrays on
focus-in notifications.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-24 11:36:32 +10:00
Daniel Stone
2e61901e46 XKB: Split filter execution into a separate function
Move the giant state machine which maps from a key action to actually
running the filters into a separate function, to be used when adding
KeyFocusIn.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Tested-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-24 11:36:26 +10: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
51984dddfc glamor: Delay making pixmaps shareable until we need to.
If a pixmap isn't getting exported as a dmabuf, then we don't need to
make an EGLImage/GBM bo for it.  This should reduce normal pixmap
allocation overhead, and also lets the driver choose non-scanout
formats which may be much higher performance.

On Raspberry Pi, where scanout isn't usable as a texture source, this
improves x11perf -copypixwin100 from about 4300/sec to 5780/sec under
xcompmgr -a, because we no longer need to upload our x11perf window to
a tiled temporary in order to render it to the screen.

v2: Just use pixmap->usage_hint instead of a new field.  Drop the
    changes that started storing gbm_bos in the pixmap priv due to
    lifetime issues.
v3: Fix a missing gbm_bo_destroy() on the pixmap-from-fd success path.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-11-18 10:04:44 -08:00
Eric Anholt
7cd495a888 glamor: Make glamor_get_name_from_bo static.
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
Eric Anholt
6be33fd044 glamor: Simplify DRI3 pixmap-from-fd, using GBM.
This GBM import path was introduced in 10.2, which we already require.

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
Eric Anholt
1b8f16d8e6 glamor: Use real types for glamor_egl's public gbm functions.
I think void * was just used to avoid needing to #include gbm.h, but
we can just forward-declare the structs and be fine.

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
Eric Anholt
f80758f32a glamor: Use the GBM function for getting an FD from a GBM BO.
We were rolling ioctl calls ourselves, when there's a nice interface
for it.

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
Eric Anholt
ff2850424c glamor: Hook up EGL DestroyPixmap through the normal wrap chain.
One less layering violation (EGL should call glamor, if anything, not
the other way around).

v2: Move glamor.c's DestroyPixmap wrapping up above the
    glamor_egl_screen_init() call, since glamor.c's DestroyPixmap
    needs to be the bottom of the stack (it calls fb directly and
    doesn't wrap).  Caught by Michel.

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
Eric Anholt
e91fd30049 glamor: Unexport glamor_destroy_textured_pixmap().
This is just a bit of the DestroyPixmap chain.

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
Eric Anholt
3dd202933f glamor: Remove glamor_egl_destroy_textured_pixmap().
The DestroyPixmap chain and CloseScreen chain all do pixmap teardown
already, and calling it manually would be redundant.

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
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
Eric Anholt
98a1993536 glamor: No need to glFlush before destroying a pixmap.
I assume this was a workaround for an old, broken, closed driver.  The
driver doesn't get to throw away rendering just because the rendering
context's shared-across-processes render target is getting freed from
the local address space.  If the rendering isn't to a shared render
target, then we *do* want to throw away the rendering to it.

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
Eric Anholt
9a5972801f glamor: Fix segfault in fallback picture uploading.
If the source/mask pixmap is a pixmap that doesn't have an FBO
attached, and it doesn't match the Render operation's size, then we'll
composite it to a CPU temporary (not sure why).  We would take the
PictFormatShort from the source Picture, make a pixmap of that depth,
and try to look up the PictFormat description from the depth and the
PictFormatShort.  However, the screen's PictFormats are only attached
to the screen's visuals' depths.  So, with an x2r10g10b10 short format
(depth 30), we wouldn't find the screen's PictFormat for it
(associated with depth 32).

Instead of trying to look up from the screen, just use the pFormat
that came from our source picture.  The only time we need to look up a
PictFormat when we're doing non-shader gradients, which we put in
a8r8g8b8.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-11-10 13:55:51 -08:00
Eric Anholt
e7aa4d3c74 glamor: Fix assert failures when fallback picture upload alloc fails.
If the glTexImage (or glTexSubImage) out-of-memories, error out
cleanly so that we can fall back to software.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-11-10 13:55:49 -08:00
Eric Anholt
ff8ef975df glamor: Fix rendering when core font texture allocation fails.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-11-10 13:55:47 -08:00
Eric Anholt
a6b05d10da glamor: Fix crashes when the glyph atlas allocation fails.
We already have a fallback path, so we just need to jump to it when we
hit the failure.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-11-10 13:55:44 -08:00
Eric Anholt
de959ec939 glamor: Handle GL_OUT_OF_MEMORY when allocating texture images.
The spec allows general undefined behavior when GL_OOM is thrown.  But
if the driver happens to throw the error at this point, it probably
means the pixmap was just too big, so we should delete that texture
and have this pixmap fall back to software.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-11-10 13:55:35 -08:00
Eric Anholt
74be466d40 glamor: Avoid GL errors from mapping with size == 0.
GL 4.5 / GLES 3.0 require throwing GL errors at map time, and Mesa
before that might throw errors accidentally if a malloc(0) call was
made to return the mapping.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Rob Clark <robdclark@gmail.com>
2015-11-10 13:50:09 -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
Adam Jackson
f2ceb683c2 Post-release version bump for 1.19
Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-11-09 16:22:12 -05:00
Adam Jackson
43fb888bd0 xserver 1.18.0
Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-11-09 16:00:26 -05:00
Axel Davy
2203735887 present: Fix Async swap logic
According to the spec, PresentOptionAsync should only
trigger a different behaviour when the target msc has been reached.

In this case if the driver is able to do async swaps, we use
them to avoid a screen copy.

When the target msc hasn't been reached yet, we want to use sync swaps.

v2: Fix indentation and simplify checks for Async flips

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-11-09 15:47:01 -05:00
Jammy Zhou
3f35909acb present: Execute right away if target_msc equals current_msc
It is according to the protocol:

"If 'options' contains PresentOptionAsync, and the 'target-msc'
is less than or equal to the current msc for 'window', then
the operation will be performed as soon as possible, not
necessarily waiting for the next vertical blank interval."

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
2015-11-09 15:46:48 -05: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
478efe285a Xserver.man: document more transports for -nolisten & -listen options
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2015-10-28 14:16:28 -04:00