Commit Graph

124 Commits

Author SHA1 Message Date
Sven Joachim
47387916fb Fix various spelling errors 2019-10-01 17:05:28 +00:00
Alexander Volkov
343ee7d075 Xephyr: Avoid calling xcb_shm_detach() twice
This call was forgotten to be removed in
90996f5909 in which
hostx_destroy_shm_segment() was introduced, which
itself does it.

Signed-off-by: Alexander Volkov <a.volkov@rusbitech.ru>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-02-20 11:05:59 -05:00
Alexander Volkov
93c16b0524 Xephyr: Call forgotten XShmDetach if can't mmap SHM segment
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-02-02 14:54:11 -05:00
Alexander Volkov
90996f5909 Xephyr: Prefer using MIT-SHM FD-passing when possible
This makes the shared memory visible only for the Xephyr
and the X server to which it is connected.

Signed-off-by: Alexander Volkov <a.volkov@rusbitech.ru>
Reviewed-by: Keith Packard <keithp@keithp.com>
2018-02-01 11:40:27 -05:00
Alexander Volkov
8a220bd83c Xephyr: Extract functions to create/delete shared memory segments
Signed-off-by: Alexander Volkov <a.volkov@rusbitech.ru>
Reviewed-by: Keith Packard <keithp@keithp.com>
2018-02-01 11:40:26 -05:00
Eric Anholt
190c2adf4a kdrive: Drop kdrive-config.h.
It had nothing left in it that was used but wasn't in dix-config.h.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2017-03-23 13:17:36 -04:00
Adam Jackson
83c4297d2c ephyr: Don't clobber bitsPerPixel when using glamor
This ends up passing 0 as the bpp argument to fb screen setup, which is
not really the best plan.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-03-17 15:14:21 -04:00
Olivier Fourdan
b0ce1d088a Xephyr: Check screen resources creation success
If the screen pixmap or the corresponding texture creation with glamor
fails, exit cleanly with an error message instead of segfaulting.

Fixes: https://bugzilla.redhat.com/1431633
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2017-03-15 15:36:52 -04:00
Keith Packard
2c91f3235a ephyr: Leave window unmapped for -glamor-skip-present [v2]
If we're never painting anything in the window, we probably don't need
to map it.

v2: Drop ephyr_glamor_gles2 from hostx.c

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-10-28 08:41:28 -07:00
Keith Packard
c17a417945 ephyr: Process queued X events before blocking [v2]
If we end up reading all pending X events in the course of other server
execution, then our notify FD callback won't get invoked and we won't
process them. Fix this by noting that there are queued events in the
block handler, setting the poll timeout to zero and queuing a work
proc to clear the event queue.

v2: use a work proc to clear the event queue rather than doing it in
    the block handler directly.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-06-20 11:55:15 -07:00
Keith Packard
f3248eba6e ephyr: Handle window resize when using glamor
Under glamor, we need to re-create the screen pixmap at the new size
so that we can ask glamor for the associated texture. Fortunately, we
can simply use ephyr_glamor_create_screen_resources to create the new
pixmap.

Because this is being done after the server has started, we need to
walk the window heirarchy and reset any windows pointing at the old
pixmap. I could easily be convinced that this TraverseTree should be
moved to miSetScreenPixmap.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-06-20 11:55:12 -07:00
Keith Packard
235d21670d ephyr: Don't configure window while responding to configure events
This leads to and endless sequence of window resizes.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-06-20 11:55:04 -07:00
Laércio de Sousa
9c88cb9b05 kdrive/ephyr: map host X server's keymap into Xephyr, if supported
Currently Xephyr doesn't inherit host X server's keymap, which
may lead to keymap mismatches when using a non-US keyboard in a
window inside Xephyr. This patch makes Xephyr change its keymap
to match host X server's one (unless XKB support is disabled),
using xcb-xkb to retrieve the needed XKB controls.
This implementation is analogous to Xnest one at commit 83fef4235.

Supersedes: https://patchwork.freedesktop.org/patch/67504

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
2016-03-01 11:00:34 -05:00
Adam Jackson
623ff251dd xephyr: Remove DRI1
This only worked if the backend server supported DRI1, which is
stunningly unlikely these days.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-01-28 09:01:12 -05:00
Keith Packard
58354fcf47 kdrive/ephyr: Use NotifyFd for XCB connection input [v2]
Eliminates polling every 20ms for device input.

v2: rename ephyrPoll to ephyrXcbNotify and fix the API so it can be
    used directly for SetNotifyFd. Thanks to Daniel Martin
    <consume.noise@gmail.com>

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Cc: Daniel Martin <consume.noise@gmail.com>
2015-12-01 13:55:20 -05:00
Ian Scott
a579e6ba77 Xephyr: Paint with subimage for non-Glamor & non-XSHM case
This improves the case for when we paint an area without SHM.
xcb_image_subimage() is used to create a subimage for the damaged area, which
is converted to native format if necessary.

Signed-off-by: Ian Scott <ian.scott@arteris.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-21 12:12:49 -04:00
Laércio de Sousa
a6c0564f7f ephyr: move host_has_extension() implementation to hostx.c
This is a trivial patch that moves host_has_extension() implementation
from ephyr.c to hostx.c so that it can be called by hostx.c internal
functions. Also rename function to hostx_has_extension() for consistency.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
2015-09-21 12:12:41 -04:00
Egbert Eich
910ddf8521 Xephyr: Fix broken image when endianess of client machine and host-Xserver differ
The image is created in the native byte order of the machine Xephyr is
rendered on however drawn in the image byte order of the Xephyr server.
Correct byte order in the xcb_image_t structure and convert to native
before updating the window.
If depths of Xephyr and host server differ this is already taken care of
by the depth conversion routine.
It is a terrible wase to always convert and transmit the entire image
no matter of the size of the damaged area. One should probably use
sub-images here. For now we leave this as an exercise.

Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-05-12 09:53:25 -07:00
Egbert Eich
c65eda5e66 Xephyr: Fix screen image draw for the non-Glamor & non-XHSM case
xcb_image_put() prints the entire image, therefore don't use an offset.

Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-05-12 09:50:37 -07:00
Egbert Eich
66212ca0d2 Xephyr: Fix compile when debugging is enabled
Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-05-12 09:50:26 -07:00
Egbert Eich
b536d56aef Xephyr: Print default server display number if none is specified
Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-05-12 09:50:04 -07:00
Alan Coopersmith
dc5acaa28a Convert hw/kdrive to new *allocarray functions
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-04-21 16:58:08 -07:00
Jon TURNEY
82634d2b69 ephyr: Avoid a segfault with 'DISPLAY= Xephyr -glamor'
ephyr_glamor_connect() returns NULL if we failed, but applying
xcb_connection_has_error() to NULL is not permitted.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Daniel Martin <consume.noise@gmail.com>
2015-03-24 12:43:34 -07:00
Keith Packard
697f8581e0 glamor: Eliminate GLAMOR_USE_SCREEN and GLAMOR_USE_PICTURE_SCREEN
Remove these defines as we start to remove support for non-standard
glamor layering as used by the intel driver.

v2: Rebase on the blockhandler change and the Xephyr init failure
    change (by anholt), fix stray NO_DRI3 addition to xwayland.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-03-24 12:01:39 -07:00
Olivier Fourdan
251a067993 ephyr: Fail if glamor is requested but not usable
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-03-24 12:01:38 -07:00
Michele Baldessari
924996c41c ephyr: Implement per-screen colormaps
Xephyr's pseudocolor emulation added in:

    commit 81a3b6fe27
    Author: Matthew Allum <breakfast@10.am>
    Date:   Mon Nov 8 22:39:47 2004 +0000

        Add support to Xephyr for lower depths than hosts

only tracks one global colormap for the whole (Xephyr) display.  Move
this to per-screen state so each screen's colormap can be correct.

[ajax: rebased to 1.17, cleaned up commit message]
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Michele Baldessari <michele@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-01-02 13:55:14 -08:00
Peter Hutterer
732fd7e571 Drop trailing whitespaces
sed -i "s/[ ]\+$//g" **/*.(c|h)

happy reviewing...
git diff -w is an empty diff.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-12 10:25:00 +10:00
Adam Jackson
670ee0757f ephyr: Properly implement hardware cursors (v3)
When dix hands us a new cursor we proxy it through to the host server;
since we keep the host XID on the cursor bits private we can switch
among them with just ChangeWindowAttributes.

v2:
Use xcb-renderutil for argb format lookup (Uli, Keith)
Fall back to core cursors for host RENDER < 0.5 (Keith)
Drop useless ephyrEnableCursor
Consistently create/destroy the cursor image GC on both paths
Treat null cursor from dix as invisible

v3:
Initialize the invisible cursor's image (Keith)

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-09-18 15:27:10 -07:00
Laércio de Sousa
3a51418b2d ephyr: set screen size & origin from host X server output's CRTC geometry
If a given output is passed via new -output option, Xephyr will query
host X server for its info. If the following conditions are met:

 a. RandR extension is enabled in host X server;
 b. supported RandR version in host X server is 1.2 or newer;
 c. the given output name is valid;
 d. the given output is connected;

then Xephyr will get output's CRTC geometry and use it to set its own
screen size and origin. It's just like starting Xephyr in fullscreen mode,
but restricted to the given output's CRTC geometry (fake "Zaphod mode").

This is the main feature needed for Xephyr-based single-card multiseat
setups where we don't have separate screens to start Xephyr in fullscreen
mode safely.

Signed-off-by: Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-08-21 20:14:55 -05:00
Laércio de Sousa
84b02469ef ephyr: enable screen window placement following kdrive -screen option extended syntax
With this patch, one can launch Xephyr with option "-screen WxH+X+Y"
to place its window origin at (X,Y). This patch relies on a previous
one that extends kdrive -screen option syntax to parse +X+Y substring
as expected.

If +X+Y is not passed in -screen argument string, let the WM place
the window for us, as before.

Signed-off-by: Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-08-21 20:14:55 -05:00
Eric Anholt
e310387f44 glamor: Remove always-true yInverted flag.
All users of glamor had the same value set, and it complicated things
for no reason.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-07-17 17:35:38 -07:00
Keith Packard
14d82a2bc3 ephyr: Deal with non-root visual for window
glx will sometimes select a non-root visual, deal with that by
creating a suitable colormap and using that instead of attempting to
use the default colormap.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-06-12 22:52:36 -07:00
Jon TURNEY
5870bd398d Fix ephyr build with --disable-glamor
See http://tinderbox.x.org/builds/2014-03-23-0010/logs/xserver/#build

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Tested-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2014-03-27 14:34:29 +00:00
Julien Cristau
7b2a517ba9 Xephyr: restore initial window resize lost in xcb conversion
The XResizeWindow call wasn't replaced by the xcb equivalent, so we
were no longer setting the initial window size, only wm size hints.

Regression from commit a2b73da "Xephyr: start converting hostx.c over to
xcb"

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

Signed-off-by: Julien Cristau <jcristau@debian.org>
Reported-by: Laércio de Sousa <lbsousajr@gmail.com>
Tested-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-03-26 22:34:32 -07:00
Keith Packard
82f91433e2 glamor: Get testing code using small FBOs working again
Glamor has a mode where pixmaps will be constructed from numerous
small FBOs. This allows testing of the tiled pixmap code without
needing to create huge pixmaps.

However, the render glyph code assumed that it could create a pixmap
large enough for the glyph atlas. Instead of attempting to fix that
(which would be disruptive and not helpful), I've added a new pixmap
creation usage, GLAMOR_CREATE_NO_LARGE which forces allocation of a
single large FBO.

Now that we have pixmaps with varying FBO sizes, I then went around
and fixed the few places using the global FBO max size and replaced
that with the per-pixmap FBO tiling sizes, which were already present
in each large pixmap.

Xephyr has been changed to pass GLAMOR_CREATE_NO_LARGE when it creates
the screen pixmap as it doesn't want to deal with tiling either.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-03-26 12:58:40 -07:00
Eric Anholt
12b2adaaeb glamor: Do glyph private init at screeninit time, and other stuff at CSR.
This hasn't actually been a problem, since the server hasn't allocated
any glyphs before our glyph private initialization during
CreateScreenResources.  But it's generally not X Server style to do
things this way.

Now that glamor itself drives both parts of glyphs setup, DDX drivers
no longer need to tell glamor to initialize glyphs.  We do retain the
old public symbol so they can keep running with no changes.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Markus Wick <markus@selfnet.de>
2014-03-17 14:30:45 -07:00
Eric Anholt
f31911ff8f xephyr: Don't forget to glViewport() before drawing the screen.
Fixes misrendering with cairogears.  I had noticed the failure while
trying to figure out what was going on with traps.  Cairogears was
apparently putting its results on the screen through putimage, which
is a texture upload, so the last GL drawing was done to the size of
the cairogears window, not the size of the xephyr screen.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-03-17 14:30:28 -07:00
Jon TURNEY
5350ae1d38 Fix xephyr build in --disable-glamor case
It broke after commit 9fe052d90c
"xephyr: Build support for rendering with glamor using a -glamor
option."

See http://tinderbox.x.org/builds/2014-03-07-0004/logs/xserver/#build

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-03-07 12:43:52 -08:00
Eric Anholt
9fe052d90c xephyr: Build support for rendering with glamor using a -glamor option.
v2: Avoid making the Ximage for the screen that we'll never use, and
    drive the screen pixmap creation for glamor ourselves.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com> (v1)
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-03-05 13:10:12 -08:00
Keith Packard
7915791bac kdrive/ephyr; Don't redeclare monitorResolution
It's already declared in globals.h

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-01-12 10:14:51 -08:00
Peter Hutterer
c8c5105c1d ephyr: xcb_connect returns an error, not NULL
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-11-14 13:34:10 +10:00
Søren Sandmann Pedersen
623c414765 ephyr: Ensure stride of private framebuffer is multiple of 4
The fb layer of X can't deal with strides that are not a multiple of
4, so when Xephyr allocates its own framebuffer it should make sure to
align it.

This fixes crashes and rendering corruption when Xephyr runs in a
depth that is different from the host X server and its screen size is
not a multiple of 4 / depth. (This is particularly easy to trigger if
you use the -resizeable option).

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Soren Sandmann <ssp@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-10-31 18:24:33 -07:00
Søren Sandmann Pedersen
97cf53cc2a ephyr: hostx_screen_init(): Fix bits_per_pixel and bytes_per_line
When the depth of the Xephyr server matches that of the host X server,
Xephyr simply uses the buffer associated with the XImage as its
framebuffer. In this case, it is correct to get the bits_per_pixel and
bytes_per_line values returned from hostx_screen_init() from the XImage.

However, when the depth doesn't match the host, Xephyr uses a private
framebuffer that is periodically copied to the XImage. In this case,
the returned values of bits_per_pixel and bytes_per_line should be
those of the private framebuffer, not those of the XImage.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Soren Sandmann <ssp@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-10-31 18:24:27 -07:00
Michele Baldessari
93a27b2dd0 Xephyr: restore cursor visibility
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=69388

Commit c100211034 (dix: only show the cursor
if a window defines one (#58398)) broke the default cursor behaviour in
Xephyr (unless run with -retro). Restore the default cursor visibility
so that '-retro' or '-host-cursor' are not needed to have a visible
cursor.

Signed-off-by: Michele Baldessari <michele@acksyn.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>

as of ba387cf21f "ephyr: Use host (HW) cursors
by default." this only applies if -sw-cursor is given on the cmdline.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-10-14 11:07:37 +10:00
Eric Anholt
5cc15e1c42 ephyr: Flush the X connection when updating the window title.
Otherwise when you're doing the ctrl-shift mouse grab thing, you
don't know what state you're in until the next rendering occurs.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2013-09-03 14:35:39 -07:00
Eric Anholt
ba387cf21f ephyr: Use host (HW) cursors by default.
Unless you're working on the sw cursor rendering code, you surely want
to have real hardware cursors.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2013-09-03 14:35:38 -07:00
Eric Anholt
0f5a2f13dc ephyr: Garbage collect some DOA host window clipping code.
Introduced in 7978272661 but never used.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2013-09-03 14:35:24 -07:00
Eric Anholt
46cf6bf569 ephyr: Move event processing into ephyr.c.
No more extra event structure to translate between hostx.c and
ephyr.c!

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2013-09-03 14:34:51 -07:00
Eric Anholt
847c856eff ephyr: Move the host screen info into the kdrive screen private.
We can include xcb bits from the same place as server headers, so
there's no need to hide them any more.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2013-09-03 14:34:48 -07:00
Eric Anholt
8dadc78e23 ephyr: Rename and use the proper type for what was host_screen->info.
Now that we can include server headers in talking to host X, we don't
need to hide any more.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2013-09-03 14:34:46 -07:00