Commit Graph

47 Commits

Author SHA1 Message Date
Derek Foreman
e516c3bb80 compositor-fbdev: give the output a name
If you have devices configured in seats with udev then the output names
are tested with string compare.  This fixes a potential crash on startup and
device insertion.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-18 16:04:43 +02:00
Pekka Paalanen
363aa7bc76 compositor: set presentation.presented flags
Change weston_output_finish_frame() signature so that backends are
required to set the flags, that will be reported on the Presentation
'presented' event. This is meant for output-wide feedback flags. Flags
that vary per wl_surface are subject for the following patch.

All start_repaint_loop functions use the special private flag
PRESENTATION_FEEDBACK_INVALID to mark, that this call of
weston_output_finish_frame() cannot trigger the 'presented' event. If it
does, we now hit an assert, and should then investigate why a fake update
triggered Presentation feedback.

DRM:

Page flip is always vsync'd, and always gets the completion timestamp
from the kernel which should correspond well to hardware. Completion is
triggered by the kernel/hardware.

Vblank handler is only used with the broken planes path, therefore do
not report VSYNC, because we cannot guarantee all the planes updated at
the same time. We cannot set the INVALID, because it would abort the
compositor if the broken planes path was ever used.  This is a hack that
will get fixed with nuclear pageflip support in the future.

fbdev:

No vsync, update done by copy, no completion event from hardware, and
completion time is totally fake.

headless:

No real output to update.

RDP:

Guessing that maybe no vsync, fake time, and copy make sense (pixels
sent over network). Also no event that the pixels have been shown?

RPI:

Presumably Dispmanx updates are vsync'd. We get a completion event from
the driver, but need to read the clock ourselves, so the completion time
is somewhat unreliable. Zero-copy flag not implemented though it would
be theoretically possible with EGL clients (zero-copy is a per-surface
flag anyway, so in this patch).

Wayland:

No information how the host compositor is doing updates, so make a safe
guess without assuming vsync or hardware completion event. While we do
get some timestamp from the host compositor, it is not the completion
time. Would need to hook to the Presentation extension of the host
compositor to get more accurate flags.

X11:

No idea about vsync, completion event, or copying. Also the timestamp is
a fake.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Acked-by: Mario Kleiner <mario.kleiner.de@gmail.com>
2015-01-20 17:13:05 -08:00
David Herrmann
2ecb84a20d logind: forward Active=true changes for non-DRM backends
Logind sends us a notification whenever the Active attribute of our session
changes. However, due to the way compositor-drm.c relies on the master DRM
device to be synced with the session, we used to delay Active=true
handling until the DRM device was up, too. See:

    commit aedc7732eb
    Author: David Herrmann <dh.herrmann@gmail.com>
    Date:   Sat Nov 30 11:25:45 2013 +0100

        logind: delay wakeup until DRM-device is resumed

However, the other compositor backends do not use DRM, so logind-util will
never get notified about any DRM device. Therefore, we have to forward the
Active=true change immediately.

This commit fixes logind-util to take sync_drm as argument. If it is true,
we do DRM-device synchronisation, otherwise we don't.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=86889
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Tested-by: nerdopolis <bluescreen_avenger@verizon.net>
2015-01-16 18:34:10 -08:00
nerdopolis
3894670cbd fbdev: Remove unnecessary semicolon
[daniels: removed extraneous changes]
2014-12-03 15:53:03 +00:00
Bryce Harrington
de16d89306 Use zalloc instead of calloc(1, ...)
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
2014-11-28 16:13:13 +02:00
Bryce Harrington
bff3472e2e Setting members to 0/NULL after a zalloc or calloc is redundant
calloc (and zalloc) set the allocated memory to 0, so there's really no
need to do it manually.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
[Pekka: dropped the src/evdev.c hunk.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-28 16:10:04 +02:00
Peter Hutterer
823ad33ef3 compositor: Drop legacy backends in favor of libinput
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-26 13:47:42 +02:00
Pekka Paalanen
b5eedade36 compositor: set and use the presentation clock everywhere
Add presentation clock setters that verify the given clock actually
works. Offer an automatic choice of a software fallback clock, when a
backend has to always use clock_gettime() to approximate the
presentation time.

The DRM backend already queried the DRM about the clock id, just let the
DRM backend set the presentation clock from that.

For all other backends which do not get a timestamp from the driver,
call the software clock setter to choose a suitable clock.

Report the chosen clock via presentation.clock_id event to clients.

In finish_frame(), upgrade the argument from uint32_t milliseconds to
struct timespec which can accurately hold the presentation clock values.
This will be needed when weston_output_finish_frame() starts to send out
presentation_feedback.presented events.

While at it, replace gettimeofday() calls with clock_gettime() using the
chosen presentation clock, so we manufacture presentation timestamps
from the presentation clock when the gfx drivers cannot give us a proper
timestamp.

Rpi patch is more verbose due to not having the compositor pointer
available in rpi_flippipe_update_complete(). Explicitly carry the clock
id with flippipe so it is available in the thread.

Changes in v4:

* rpi debug build fix

v4 Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v3 Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
2014-09-30 11:37:02 +03:00
Jonas Ådahl
e0de3c2418 Add libinput based input device backend
While disable by default, passing --enable-libinput-backend to
./configure switches the input backend in weston's drm, fbdev and rpi
compositing backends to use libinput instead of udev-seat.c, evdev.c and
friends.

When enabled, weston now also depends on libinput >= 0.1.0.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-03-12 14:55:22 -07:00
Jonas Ådahl
0feb32e2f0 udev-seat: Make udev_input own its own udev object reference
No functional changes; API simplification in preparation for multiple
input backends.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-03-12 14:55:18 -07:00
Neil Roberts
77c1a5b7dc Add support for having different GBM formats for different outputs
The gbm-format configuration option can now be specified per-output as
well as in the core config section. If it is not specified it will
default to the format specified in the core section. The
EGL_MESA_configless_context extension is required for this to work. If
this extension is available it will create a context without an
EGLConfig and then it will potentially use a different EGLConfig for
each output.

The gl-renderer interface has been changed so that it takes the EGL
attributes and visual ID in the create_output function as well as in
the create function.
2014-03-12 14:44:02 -07:00
Ander Conselvan de Oliveira
18536764b4 compositor: Destroy renderer in weston_compositor_shutdown()
Currently we destroy the renderer before the outputs are destroyed, but
that sometimes leads to an error since a reference to the renderer is
necessary in order to destroy a gl_renderer_output.

Since destroying the renderer is common among all backends, just move
that call into weston_compositor_shutdown() immediately after the
outputs being destroyed.
2013-12-22 13:45:29 -08:00
Ander Conselvan de Oliveira
f749fc3782 compositor: Remove output from list in weston_output_destroy()
When destroying ouputs, they would sometimes be removed before the call
to weston_output_destory() and sometimes after, depending on the
backend. Now the output is remove withing that function so the behavior
is standard across all backends.
2013-12-16 16:19:46 -08:00
Ander Conselvan de Oliveira
6b16214fb9 pixman-renderer, gl-renderer: Destroy debug bindings on clean up
Also make sure backends destroy the renderers before shutting down the
compositor to avoid a double call to weston_binding_destroy().

This is a step towards making renderers switchable during runtime.
2013-10-25 12:17:51 -07:00
Kristian Høgsberg
10ddd97ecf compositor: Remove redundant and not well-defined focus field
It was never clear what this field really did.
2013-10-22 12:40:54 -07:00
David Herrmann
1edf44ce26 compositor: finish frame if redraw fails
If we are about to finish a frame, but a redraw is pending and we let the
compositor redraw, we need to check for errors. If the redraw fails and
the backend cannot schedule a page-flip, we need to finish the frame,
anyway.

All backends except DRM use a timer to schedule frames. Hence, they cannot
fail. But for DRM, we need to be able to handle drmModePageFlip() failures
in case access got revoked.

This fixes a bug where logind+drm caused keyboard input to be missed as we
didn't reenable it after a failed page-flip during deactivation.
2013-10-22 12:24:56 -07:00
David Herrmann
cc5b2ed2b8 launcher: add logind backend
Instead of connecting to weston-launch from launcher-util, we now try to
connect to logind first. If logind provides session-devices, we use them.
If not, we fall back to the old weston-launch facility.
2013-10-21 16:23:58 -07:00
David Herrmann
1641d14b82 fbdev: open launcher only once
We currently call launcher_connect() twice, which is redundant and
amazingly works (ugh?). Fix this and connect only once to the launcher.
2013-10-15 09:12:55 -07:00
Ander Conselvan de Oliveira
97f2952bca gl-renderer: Build as a loadable module
The time spent loading EGL and GLES libraries from disk can be a
considerable hit in some embedded use cases. If Weston is compiled
with EGL support, the binary will depend on those libraries, even if
a software renderer is in use.

This patch splits the GL renderer into a separate loadable module,
and moves the dependency on EGL and GLES to it. The backends still
need the EGL headers for the native types and EGLint. The function
load_module() is renamed to weston_load_module() and exported, so
that it can be used by the backends.

The gl renderer interface is changed so that there is only one symbol
that needs to be dlsym()'d. This symbol contains pointers to all the
functions and data necessary to interact with the renderer. As a side
effect, this change simplifies gl-renderer.h a great deal.
2013-10-14 15:02:20 -07:00
Kristian Høgsberg
8ac6a2da07 compositor-fbdev: Fix a fd leak in the fbdev backend
fbdev_frame_buffer_map() closes the fb fd, so we have to close it
manually in case we're using the hybris renderer (ie !pixman).
2013-10-10 16:50:18 -07:00
Kristian Høgsberg
6ff3ff57aa launcher: Add back support for specifying VT to run on
This is only available when running weston directly as root typically for
ssh logins.  It's a somewhat destructive option, as it will take over any
existing VT completely, unless there's already an display server running
there.

https://bugs.freedesktop.org/show_bug.cgi?id=69731
2013-10-02 11:47:28 -07:00
Hardening
57388e44e5 Notify clients on mode_switch()
This patch implements the notification of clients during mode_switch.
As discussed on IRC, clients are notified of mode_switch only when the
"native" mode is changed and activated. That means that if the native
mode is changed and the compositor had activated a temporary mode for
a fullscreen surface, the clients will be notified only when the native
mode is restored.
The scaling factor is treated the same way as modes.
2013-09-21 11:40:21 -07:00
Hardening
ff39efa5c0 Rename current, origin, scale, origin_scale
This patch renames that fields to have consistent names.
2013-09-21 11:40:17 -07:00
Kristian Høgsberg
3f4958755d launcher: Move rest of tty object into struct weston_launcher
The struct weston_launcher object will now either handle tty and vt switching
details in-process (when running weston directly as root) or talk to
the weston-launch process.
2013-09-18 23:00:17 -07:00
Kristian Høgsberg
61741a293c compositor: Generalize VT switching as a session_signal
Instead of a callback from the tty module, we now have a compositor level
signal that fires when our session is activated or deactivated.
2013-09-18 11:14:14 -07:00
Kristian Høgsberg
05ad1e4e8a launcher: Collect launcher state in new struct weston_launcher
We're going to add a bit more launcher state, so start out by creating
a new struct weston_launcher we can track it in.
2013-09-18 11:14:14 -07:00
Adrian Negreanu
4aa756dc7a add libhybris support
it uses the Android fbdev HAL[1] (through libhybris[2])
and the libhybris implementation of wayland-egl.

Configure flags:
 cairo:
   --enable-glesv2=yes  --enable-egl=yes
 weston:
   --with-cairo-glesv2 --enable-fbdev-compositor
 hybris:
   --enable-wayland --enable-arch=x86
   --with-android-headers=<android-headers> --enable-alinker=jb

The android headers are extracted from an AOSP tree,
using hybris/utils/extract-headers.sh

[1]:
https://github.com/android/platform_hardware_libhardware/blob/master/include/hardware/fb.h

[2]: https://github.com/libhybris/libhybris

Signed-off-by: Adrian Negreanu <adrian.m.negreanu@intel.com>
2013-09-11 11:54:11 -07:00
Marc Chalain
ffbddff89a fbdev: Support of TrueColor and Directcolor of video hardware
backend check the type of the framebuffer and accept DirectColor and TrueColor
I use a "switch case" to implement other cases in the future.
2013-09-11 11:20:26 -07:00
Adrian Negreanu
c838423b5e compositor: Setup weston-launch sock in fbdev
weston_launcher_open() was failing with:
    recvmsg: Socket operation on non-socket

Signed-off-by: Adrian Negreanu <adrian.m.negreanu@intel.com>
2013-08-08 22:01:42 -07:00
Bryce Harrington
c814c58adc Drop extraneous duplicate header includes
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-08-06 17:02:22 -07:00
Rob Bradford
581b3fd779 compositor-fbdev: Close fd used for re-enabling if that fails
The device will be opened again in fbdev_output_create().
2013-07-30 11:04:29 -07:00
Rob Bradford
f8ef42feae compositor-fbdev: Avoid dereferencing a pointer in freed memory
fbdev_output_destroy will free the memory passed into in and since we
want to pass the device name into fbdev_output_create we need to save
this to an intermediate value
2013-07-30 11:04:11 -07:00
Daniel Stone
c228e23b05 configure.ac: Enable AC_USE_SYSTEM_EXTENSIONS
AC_USE_SYSTEM_EXTENSIONS enables _XOPEN_SOURCE, _GNU_SOURCE and similar
macros to expose the largest extent of functionality supported by the
underlying system.  This is required since these macros are often
limiting rather than merely additive, e.g. _XOPEN_SOURCE will actually
on some systems hide declarations which are not part of the X/Open spec.

Since this goes into config.h rather than the command line, ensure all
source is consistently including config.h before anything else,
including system libraries.  This doesn't need to be guarded by a
HAVE_CONFIG_H ifdef, which was only ever a hangover from the X.Org
modular transition.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>

[pq: rebased and converted more files]
2013-06-05 01:16:34 -04:00
Rob Bradford
2387fde095 compositor-fbdev: Rename seat variable to seat_id to clarify purpose 2013-06-05 00:24:10 -04:00
Rob Bradford
f165f18439 compositor-fbdev: Remove unused fbdev_seat code
The fbdev compositor uses the commons seat handling code with the drm
compositor.
2013-06-05 00:23:59 -04:00
Rob Bradford
d355b80172 udev-seat: Make the udev_input structure an embedded structure
And as a result of this stop iterating through the compositor seat list
(of one item) and instead access the udev_input structure directly.

This enables a refactoring to pull out the weston_seat into a separate
structure permitting multiple seats.
2013-06-05 00:23:29 -04:00
Rob Bradford
d27b99d950 udev-seat: Rename udev_seat to udev_input
This is a pure rename of the structure, functions and local variables in
preparation of the separation of the seat from the other udev input
handling.
2013-06-05 00:20:02 -04:00
Kristian Høgsberg
14e438c8a2 compositor: Parse config file in main(), only keep weston config object
Now that all backends and modules have been converted to the new
config parser API, we don't have to keep the fd around.
2013-05-26 21:48:14 -04:00
Alexander Larsson
4ea9552d05 compositor: Support output/buffer scaling
If you specify e.g. scale=2 in weston.ini an output section for the
X11 backend we automatically upscale all normal surfaces by this
amount. Additionally we respect a buffer_scale set on the buffer to
mean that the buffer is already in a scaled form.

This works with both the gl and the pixman renderer. The non-X
backends compile and work, but don't support changing the output
scale (they do downscale as needed due to buffer_scale though).

This also sends the new "scale" and "done" events on wl_output,
making clients aware of the scale.
2013-05-22 16:19:42 -04:00
Ossama Othman
a50e6e4c50 config-parser: Honor XDG_CONFIG_DIRS
This set of changes adds support for searching for a given config file
in the directories listed in $XDG_CONFIG_DIRS if it wasn't found in
$XDG_CONFIG_HOME or ~/.config.  This allows packages to install custom
config files in /etc/xdg/weston, for example, thus allowing them to
avoid dealing with home directories.

To avoid a TOCTOU race the config file is actually open()ed during the
search.  Its file descriptor is returned and stored in the compositor
for later use when performing subsequent config file parses.

Signed-off-by: Ossama Othman <ossama.othman@intel.com>
2013-05-14 14:36:37 -04:00
Kristian Høgsberg
e314875d00 input: Merge wl_seat into weston_seat 2013-05-07 09:07:43 -04:00
Jonas Ådahl
e5a1225bc4 Make backends always specify output repaint time
Most backends relies on gettimeofday(2) for output repaint timestamps
but this is not a requirement. Before this patch repaints coming from
idle_repaint() always used gettimeofday(2) for timestamps. For backends
not using that time source this could cause large jumps between
timestamps.

To fix this, timestamps needs to always come from the backend. This
means that the backend needs to always be responsible of starting the
repaint loop in case that the repaint cannot start immediately.

The drm backend implementation is from the patch by Ander Conselvan de
Oliveira found here:
http://lists.freedesktop.org/archives/wayland-devel/2013-February/007393.html

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-04-08 14:24:03 -04:00
Philipp Brüschweiler
57edf7f49e compositor: add WESTON_COMPOSITOR_OFFSCREEN state
This state is used when the user switches the vt. It turns of rendering
and frame events, but doesn't set the DPMS state to off.

As a part of this change, also turn off the idle timer when entering
the SLEEPING or OFFSCREEN states, which fixes
https://bugs.freedesktop.org/show_bug.cgi?id=61910 (rpi backend
untested).
2013-03-29 14:05:27 -04:00
Kristian Høgsberg
4172f668e7 Pass argc pointer to parse_options()
This lets us keep argc up to date as the backend picks out arguments
from the argv array.
2013-02-20 15:27:49 -05:00
Kristian Høgsberg
8764466c6b udev-seat: Simplfy enable/disable interface a bit
We always call enable_udev_monitor and add_devices together and always
disable_udev_monitor and remove_devices together.  Let's just have one
entry point for enable and one for disable.
2013-02-18 16:50:19 -05:00
Kristian Høgsberg
7e597f22d5 compositor-fbdev: Use udev_seat
Let's share the udev input device discovery code.
2013-02-18 16:35:38 -05:00
Philip Withnall
4f49917ec5 fbdev: Add an fbdev compositor backend using pixman and evdev
Add a frame buffer backend using pixman to render to fbdev.
This has been tested against nouveaufb but nothing else. Much of the code
came straight from the rpi backend (and copyright has been attributed
accordingly).

The behaviour of this backend on less modern frame buffers has yet to be
tested.

The refresh rate is calculated from the frame buffer's metadata. Every frame
is finished in synchrony with the refresh rate.

Frame buffer devices are currently specified on the command line (or using
the default of /dev/fb0); udev could be used in future to enumerate them.

pixman is used for compositing, and a suitable pixman format is built from
the frame buffer's metadata. This doesn't support the full range of
frame buffer formats, but does support varying BPPs of RGBA and ARGB. That
should be enough for now.

The following are not currently supported:
 • FOURCC
 • Non-packed formats (interleaved, planes, etc.)
 • Non-true-colour formats (monochrome, greyscale, etc.)
 • Big-endian formats (with component MSBs on the right)
 • Non-RGBA and non-ARGB formats

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2013-02-07 20:49:22 -05:00