This is a complete port of the headless backend that
uses the recently added output handling API for output
configuration.
- Output can be configured at runtime by passing the
necessary configuration parameters, which can be
filled in manually, obtained from the configuration
file or obtained from the command line using
previously added functionality. It is required that
the scale and transform values are set using the
previously added functionality.
- Output can be created at runtime using the output
API. The output creation only creates a pending
output, which needs to be configured the same way as
mentioned above.
After everything has been set, output needs to be
enabled manually using weston_output_enable().
Same as before, a single output is created at runtime
using the default configuration or a configuration
parsed from the command line. The no-outputs
functionality is also preserved, which means that no
output will be created initially, but more outputs can
be added at runtime using the output API.
New feature:
This patch also adds, as a bonus of using shared
functionality, support for setting options for outputs
created by this backend in the weston config file in
addition to setting them from the command line.
v2:
- Fix wet_configure_windowed_output_from_config() usage.
- Call headless_output_disable() explicitly from
headless_output_destroy().
v3:
- Add scale support to output width and height.
- Use scaled values in calls to various functions which
require width and height.
- Disallow calling headless_output_configure more than once.
- Remove unneeded checks for output->name == NULL as that
has been disallowed.
- Use weston_compositor_add_pending_output().
- Bump weston_headless_backend_config version to 2.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
This is a complete port of the fbdev backend that uses
the recently added output handling API for output
configuration.
It is required that the scale and transform values are
set using the previously added functionality.
After everything has been set, output needs to be
enabled manually using weston_output_enable().
v2:
- Use weston_compositor_add_pending_output().
- Bump weston_fbdev_backend_config version to 2.
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
This is a complete port of the DRM backend that uses
the recently added output handling API for output
configuration.
Output can be configured at runtime by passing the
necessary configuration parameters, which can be
filled in manually or obtained from the configuration
file using previously added functionality. It is
required that the scale and transform values are set
using the previously added functionality.
After everything has been set, output needs to be
enabled manually using weston_output_enable().
v2:
- Added missing drmModeFreeCrtc() to drm_output_enable()
cleanup list in case of failure.
- Split drm_backend_disable() into drm_backend_deinit()
to accomodate for changes in the first patch in the
series. Moved restoring original crtc to
drm_output_destroy().
v3:
- Moved origcrtc allocation to drm_output_set_mode().
- Swapped connector_get_current_mode() and
drm_output_add_mode() calls in drm_output_set_mode()
to match current weston.
- Moved crtc_allocator and connector_allocator update
from drm_output_enable() to create_output_for_connector()
to avoid problems when more than one monitor is connected
at startup and crtc allocator wasn't updated before
create_output_for_connector() was called second time,
resulting in one screen being turned off.
- Moved crtc_allocator and connector_allocator update from
drm_output_deinit() to drm_output_destroy(), as it
should not be called on drm_output_disable().
- Use weston_compositor_add_pending_output().
- Bump weston_drm_backend_config version to 2.
v4:
- Reset output->original_crtc to NULL if drm_output_set_mode()
fails.
- Remove unneeded log message when disabling an output when a
pageflip is pending.
- Document that create_output_for_connector() takes ownership
of the connector.
- Free the connector if create output conditionals are not met
in create_outputs() and update_outputs().
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This adds new plugin-specific API for configuring outputs
on "windowed" backends, such as X11, wayland/non-fullscreen
and even headless (although, it doesn't have any windows,
its configuration is very similar). It can be used from
compositors to configure pending outputs and should be used
with previously added weston_output_set_{scale,transform}
to properly configure an output before enabling it.
It also supports creating additional outputs on the mentioned
backends.
v2:
- Rename output-api.h to windowed-output-api.h.
- Rename output_configure() to output_set_size().
- Document return values.
v3:
- Fixed copyright.
- Noted that output name can't be NULL in
output_create().
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
This patch implements additional functionality that will be used
for configuring, enabling and disabling weston's outputs. Its
indended use is by the compositors or user programs that want to
be able to configure, enable or disable an output at any time. An
output can only be configured while it's disabled.
The compositor and backend specific functionality is required
for these functions to be useful, and those will come later in
this series.
All the new functions have been documented, so I'll avoid
describing them here.
v2:
- Minor documentation improvements.
- Rename output-initialized to output->enabled.
- Split weston_output_disable() further into
weston_compositor_remove_output().
- Rename weston_output_deinit() to weston_output_enable_undo().
- Make weston_output_disable() call two functions mentioned
above instead of calling weston_output_disable() directly.
This means that backend needs to take care of doing backend
specific disable in backend specific destroy function.
v3:
- Require output->name to be set before calling
weston_output_init_pending().
- Require output->destroying to be set before
calling weston_compositor_remove_output().
- Split weston_output_init_pending() into
weston_compositor_add_pending_output() so pending outputs
can be announced separately.
- Require output->disable() to be set in order for
weston_output_disable() to be usable.
- Fix output removing regression that happened when
weston_output_disable() was split.
- Minor documentation fix.
v4:
- Bump libweston version to 2 as this patch breaks the ABI.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
This uses the existing infrastructure for dealing with planar YUV buffers and only adds the
relevant yuv_format_descriptor to the table.
Reviewed-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
This silences two warnings:
clients/window.c:2450:20: warning: implicit conversion from enumeration
type 'enum wl_pointer_button_state' to different enumeration type 'enum
frame_button_state' [-Wenum-conversion]
button, state);
^~~~~
clients/window.c:2453:15: warning: implicit conversion from enumeration
type 'enum wl_pointer_button_state' to different enumeration type 'enum
frame_button_state' [-Wenum-conversion]
button, state);
^~~~~
Warning produced by Clang 3.8.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
If the transform on a view is only a translation we can trivially
set the opaque region for it so to optimize the rendering.
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
This prevents a segfault when unplugging an output when using pixman.
Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
When a client has registered idle inhibition on a surface, don't trigger
the fade-out animation on the output(s) the surface is displayed on.
But when the surface is destroyed or the inhibitor itself is destroyed
by client request, re-queue the fade out animation.
Adds a helper routine weston_output_inhibited_outputs() which returns a
mask of outputs that should inhibit screen idling.
Use this routine to check for inhibiting outputs for handling of idle
behaviors in core: In sleep mode, only halt repainting outputs that
don't have valid inhibits. Don't send these monitors DPMS off commands
either, if the system would otherwise be powering them down.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
v5: Drop unused view variable
Its usage is now limited to some dock-related helper, and the plugin
registry is a better fit for that kind of helper.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Invert the Y_INVERT flag for the EGL import fo dmabufs. This fixes
weston-simple-dmabuf-intel to show the same image on both GL-composited
and with direct scanout on a hardware plane. Before, the image would
y-flip when switching between these two cases. Now the orientation also
matches the color values written in simple-dmabuf-intel.c.
The GL-renderer uses the OpenGL convention of texture coordinates, where
the origin is at the bottom-left of an image. This can be observed in
texture_region() where the texcoords are inverted if y_invert is false,
since the surface coordinates have origin at top-left. Both wl_shm and
dmabuf buffers have origin at the top-left.
When wl_shm buffer is imported with glTexImage2D, it gets inverted
because glTexImage2D is defined to read in the bottom row first. The shm
data is top row first. This incidentally also means, that buffer pixel
0,0 ends up at texture coordinates 0,0. This is now inverted compared to
the GL coordinate convention, and therefore gl_renderer_attach_shm()
sets y_inverted to true. This causes texture_region() to NOT invert the
texcoords. Wayland surface coordinates have origin at top-left, hence
the double-inversion.
Dmabuf buffers also have the origin at top-left. However, they are
imported via EGL to GL, where they should get the GL oriented
coordinates but they do not. It is as if pixel 0,0 ends up at texcoords
0,0 - the same thing as with wl_shm buffers. Therefore we need to invert
the invert flag.
Too bad EGL_EXT_image_dma_buf_import does not seem to specify the image
orientation. The GL spec implied result seems to conflict with the
reality in Mesa 11.2.2.
I asked about this in the Mesa developer mailing list. The question with
no answers:
https://lists.freedesktop.org/archives/mesa-dev/2016-June/120249.html
and the thread I hijacked to get some answers:
https://lists.freedesktop.org/archives/mesa-dev/2016-June/120733.html
which culminated to the conclusion:
https://lists.freedesktop.org/archives/mesa-dev/2016-June/120955.html
that supports this patch.
simple-dmabuf-v4l is equally fixed to not add Y_INVERT. There is no
rational reason to have it, and removing is necessary together with the
GL-renderer change to keep the image the right way up. This has been
tested with VIVID.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
The "state" variable in x11_backend_deliver_button_event is basically the
same as (event->response_type == XCB_BUTTON_PRESS), thus update the code
to use the last one.
Signed-off-by: Benoit Gschwind <gschwind@gnu-log.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
The x11_backend_deliver_button_event can be called with any
xcb_generic_event. The assert check if the call is done with the
expected events.
Signed-off-by: Benoit Gschwind <gschwind@gnu-log.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Valgrind noticed that we send uninit data to drmModeAddFB2. While
the kernel should never read this (because of the plane format),
it's probably still nicer to zero the data before we send it.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
This way, the environment is correctly preserved for weston. Since
commit 636156d5f6, clearenv() is only
called when we open a new PAM session, so it makes sense to only use a
login shell in that case.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
libweston/gl-renderer.c: In function 'compress_bands':
libweston/gl-renderer.c:481:6: warning: 'merged' may be used
uninitialized in this function [-Wmaybe-uninitialized]
if (!merged) {
^
Warning produced by GCC 5.3 and 6.1, with -Og.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
There is a UTF-8 no-break space (U+A0, U8+C2A0) in the definition of
macro NSC_RESET in the case of 1.2.2 <= FreeRDP < 2.0.
This is causing build issues (\302 is 0xC2, \240 is 0xA0):
http://autobuild.buildroot.net/results/f49/f49a9cbb7bdc5d9e05dcf0a20bd83f059e234e74/build-end.log
Fix that by using a plain, boring space U+20.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
All the shell protocol details, Xwayland glue and popups (and their
grab) are now handled in libweston-desktop.
Fullscreen methods (for wl_shell) are removed for now.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Differential Revision: https://phabricator.freedesktop.org/D1209
libweston-desktop is an abstraction library for compositors wanting to
support desktop-like shells.
The API is designed from xdg_shell features, as it will eventually be
the recommended shell for modern applications to use.
In the future, adding new shell protocols support will be easier, as
limited to libweston-desktop.
The library versioning is the same as libweston. If one of them break
ABI compatibility, the other will too.
The compositor will only ever see toplevel surfaces (“windows”), with
all the other being internal implementation details.
Thus, popups and associated grabs are handled entirely in
libweston-desktop.
Xwayland special surfaces (override-redirect) are special-cased to a
dedicated layer, as the compositor should not know about them.
All the shell error checking is taken care of too, as well as some
specification rules (e.g. sizes constraint for maximized and fullscreen
surfaces).
All the compositor has to do is define a few callbacks in the interface
struct, and manage toplevel surfaces.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Differential Revision: https://phabricator.freedesktop.org/D1207
These are useful to implement grabs.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Differential Revision: https://phabricator.freedesktop.org/D1245
This fixes a crash in animation related code where weston
would crash in weston_view_animation_create when the
view had no output assigned.
This makes sure that animation gets created and released
immediately, so done and reset callbacks still get called
properly.
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
[Pekka: put a '{' on the right line.]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
When all outputs are gone, there are no current read/write
surfaces associated with a context. This makes the previously
created dummy surface current until an output gets attached
to avoid any potential crashes.
v2:
- Remove unnecessary objects
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
When all outputs are gone and views were created before they
were gone, such views would have no output object assigned and
nothing would assign it later. This makes sure all views are
set as dirty, so they can get an output assigned when an
output gets plugged in, if they didn't have any output assigned.
This change also works when a new output is added even if there already
are outputs in use. A view may be partly off-screen. If the new output
appears at a position where it overlaps an existing view, that view
should get updated.
It is enough to process only the main view_list, because views not on
that list are not shown for the moment and so do not need an immediate
update. Instead, they will get updated later as needed because making an
off-list view to go on-list inherently requires calling
weston_view_geometry_dirty().
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
[Pekka: addes commit msg paragrapha 2 and 3.]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This uses container_of instead of explicit cast to retrieve
backend and output objects from generic weston_backend and
weston_output pointers.
v2:
- Remove unneeded cast
- Remove unneeded line breaks
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This tightens up the strtol() error checking in several places where it
is used for parsing environment variables, and in the backlight
interface that is reading numbers from files under /sys/class/backlight.
All of these uses are expecting strings containing decimal numbers and
nothing else, so the error checking can all be tightened up and made
consistent with other strtol() calls.
This follows the error checking style used in Wayland
(c.f. wayland-client.c and scanner.c) and c.f. commit cbc05378.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This uses container_of instead of explicit cast to retrieve
backend and output objects from generic weston_backend and
weston_output pointers.
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This uses container_of instead of explicit cast to retrieve
backend and output objects from generic weston_backend and
weston_output pointers.
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This uses container_of instead of explicit cast to retrieve
backend and output objects from generic weston_backend and
weston_output pointers.
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This uses container_of instead of explicit cast to retrieve
backend and output objects from generic weston_backend and
weston_output pointers.
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
When there are no outputs left after a hotplug event, weston
will terminate. This isn't desired when trying to get weston
to work with zero outputs.
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Returning an error when there are no connectors results in
weston terminating after that. That's not expected when
trying to get weston to start with zero drm outputs.
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Renames forgotten in "libweston: use new versioning scheme".
Cc: Emil Velikov <emil.velikov@collabora.com>
Cc: Quentin Glidic <sardemff7+git@sardemff7.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Common practise it to provide the includes directly into Cflags, hence
the variable is not needed and we can remove it.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>