Commit Graph

2622 Commits

Author SHA1 Message Date
Ander Conselvan de Oliveira
2908a3df0d compositor-drm: Support scan out of transformed buffers
If a client renders its buffers with the same transform as the output,
we can scan out them when fullscreen.
2012-11-27 11:30:04 -05:00
Ander Conselvan de Oliveira
012b4c78c9 compositor: Implement buffer transformation
Implement the wl_surface.set_buffer_transform request. This includes
tracking the double-buffered buffer transformation parameter and making
the gl renderer able to handle transformed buffers.
2012-11-27 11:29:31 -05:00
Pekka Paalanen
864c784b5c man: fill missing pieces to weston page
Config file, WAYLAND_SOCKET, XDG_CONFIG_HOME, segfault handler.

NOTE: This is a candidate for the stable branch
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-27 11:13:00 -05:00
Pekka Paalanen
424820f4bc man: add weston-drm page
Add some documentation about the DRM backend into its own man page, and
refer to it in weston(1).

Environment variable, that are reserved for backends, and currently used
only by the DRM backend, are moved to weston-drm page.

NOTE: This is a candidate for the stable branch
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-27 11:12:56 -05:00
Pekka Paalanen
326529f900 gl, rpi: consolidate print_egl_error_state()
Rename print_egl_error_state() to gl_renderer_print_egl_error_state()
and exports it.

Remove the copy of that function from the rpi backend, and call
the exported function instead.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-27 11:12:48 -05:00
Ander Conselvan de Oliveira
0a887728ea compositor: Move clearing of primary plane damage to the backends
Backends may move surfaces to different planes, in which case damage is
generated in the primary plane. This damage is usually passed to the
renderer, but in some cases the backend may decide to not render
anything (that's the case when drm compositor scans out a client
buffer). In that case the damage on the primary plane would be
discarded, leading to artifacts later.

This patch makes the backend's responsibility to clear the damage on
the primary plane, so that unrendered damage is kept for as long as
necessary.
2012-11-23 21:33:51 -05:00
Ander Conselvan de Oliveira
7e918da36f compositor-drm: Add debug binding for toggling sprites
While at it, consolidate all the bindings we already have into one
single function.
2012-11-23 21:31:18 -05:00
Ander Conselvan de Oliveira
180f42a382 compositor-drm: Add a debug binding for toggling usage of hw cursors 2012-11-21 11:44:17 -05:00
Ander Conselvan de Oliveira
434e8f3ae1 zoom: Don't update the zoom translation if zoom level is 0
On the first frame with zoom activated, the spring used for animation
will have a current value of zero. The translation calculated with that
value will be invalid (not a number). Using this value later leads to
having an invalid output matrix, so nothing is composited in the first
zoomed frame.

This problem is most evident when a sprite plane is being used. In that
case, enabling the zoom will cause the surface to be moved back to the
primary plane, but because of the bug described above, this surface
would not actually be rendered causing a quick flicker.
2012-11-21 11:40:39 -05:00
Scott Moreau
6655e00e03 simple-egl: Reset opaque region if not fullscreen.
If simple-egl is toggled fullscreen, the opqaue region is set for the surface
but never removed after exiting fullscreen. This patch resets the opaque region
to 0 if the surface is not fullscreen and -o was not passed. This fixes the
problem introduced sometime since d7f282b84e, when this was last fixed.
2012-11-19 17:23:59 -05:00
Pekka Paalanen
768117f90b window: make display_create_surface() shm-only
Nothing uses it to create EGL-surfaces outside of window.c. This makes
refactoring the EGL-based code easier, since we do not need to support
EGL-based Cairo surfaces without an associated struct window.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-19 16:00:01 -05:00
Pekka Paalanen
32127ca86d window: use different keys for different cairo privates
cairo_surface_t objects have a private set, either struct
shm_surface_data, or struct egl_window_surface_data. Use separate
private keys for each type to avoid mismatch.

This makes display_get_buffer_for_surface() safe, in that it won't
return garbage for an EGL-based cairo surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-19 15:55:28 -05:00
Pekka Paalanen
0c6a34378a window: merge struct surface_data into shm_surface_data
Struct surface_data was not really useful, and it definitely was not
used with EGL-based windows.

This also fixes a semantic mistake, where struct shm_surface_data was
put into cairo_surface_t private, but got out as struct surface_data
instead. Due to struct layout, however, this did not cause a real bug.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-19 15:55:26 -05:00
Pekka Paalanen
f86504c881 window: remove unused MULT macro
Leftovers from

commit f02a649a3c
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Mon Mar 12 01:05:25 2012 -0400

    Consolidate image loading code and move to shared/

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-19 15:55:24 -05:00
Pekka Paalanen
a8d4c84693 window: make window_flush() private
Not called from any client.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-19 15:55:17 -05:00
Pekka Paalanen
ce36f6dff4 window: make window_{create,set}_surface private
I do not think these are meant to be called by the applications
directly. Applications certainly do not have to call them.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-19 15:55:12 -05:00
Pekka Paalanen
99b705bb17 simple-shm: honour wl_buffer.release
Change simple-shm to properly process the wl_buffer.release event, and
not reuse a buffer until it is released by the server, as specified in
the protocol.

In case the server has not released the buffer, but signals that it has
been shown (frame callback), allocate a second buffer. Simple-shm will
now automatically do double-buffering if needed.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-19 15:55:09 -05:00
Ander Conselvan de Oliveira
edce9c295c simple-egl: Set the right size for the opaque region when fullscreen
window.window_size holds the size of the window in windowed mode. Use
window.geometry for setting the opaque region since that holds the
current size.
2012-11-16 19:24:09 -05:00
Ander Conselvan de Oliveira
b8fcca915b compositor: Move buffer damage fields from weston_output to gl-renderer
Move fields current_buffer and buffer_damage out of weston_output into
gl_output_state, since they are actually specific to the renderer.

Also bring back the previous_damage field so that the screenshooter
can get the damage for the previous frame in a renderer independent
way.
2012-11-16 19:00:03 -05:00
Ville Syrjälä
aa628d0a7c shell/zoom: Increment/decrement disable_planes only when zoom.active changes
disable_planes should only be incremented when zoom.active actually
toggles. Otherwise the counter will be incremented too many times,
and planes will no longer get used.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2012-11-16 18:39:30 -05:00
Ville Syrjälä
5a84f31514 compositor-drm: Don't use overlay when surface alpha != 1.0f
Assume that overlays can't handle alpha blending even with a constant
alpha factor.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2012-11-16 18:39:06 -05:00
Kristian Høgsberg
f0377dd3a7 wcap: Transform damage rectangles according to output tranform
https://bugs.freedesktop.org/show_bug.cgi?id=56697
2012-11-14 20:28:30 -05:00
Kristian Høgsberg
f3dfe716f3 tests: Remove last GLfloat use
With the EGL/GLES2 types out of compositor.h this now fails to compile.

https://bugs.freedesktop.org/show_bug.cgi?id=57129
2012-11-14 14:42:51 -05:00
John Kåre Alsaker
779b52ac3a Rename gles2-renderer to gl-renderer. 2012-11-13 17:06:19 -05:00
John Kåre Alsaker
30d2b1fd4b Move EGL and GL includes to a gles2-renderer header. 2012-11-13 17:03:47 -05:00
John Kåre Alsaker
320711db0a Move weston_compositor GL and EGL state into gles2-renderer. 2012-11-13 17:03:33 -05:00
John Kåre Alsaker
75cc571839 Move weston_surface GL and EGL state into gles2-renderer. 2012-11-13 17:03:08 -05:00
John Kåre Alsaker
4068414a32 Moved shader state into gles2-renderer. 2012-11-13 17:02:38 -05:00
John Kåre Alsaker
d615980b6b gles2-renderer: Renaming some functions. 2012-11-13 17:02:14 -05:00
John Kåre Alsaker
878f44969d compositor: Move surface color state to gles2-renderer.
This moves the surface color state into gles2-renderer. To do this it
adds two new weston_renderer functions. create_surface to be able to
create per-surface renderer state, and surface_set_color to set the
color of a surface and changes it to a color surface.
2012-11-13 17:01:59 -05:00
John Kåre Alsaker
f9e710b57c screenshooter: Use the renderer function for reading out pixels
This also changes the compositor's read_format to a pixman format.
2012-11-13 17:01:02 -05:00
John Kåre Alsaker
a95b2d6d41 compositor: Add a renderer function to read out pixels 2012-11-13 17:00:06 -05:00
John Kåre Alsaker
4415450ef1 Move compositor-wayland border drawing into gles2-renderer. 2012-11-13 16:59:01 -05:00
John Kåre Alsaker
1b7ad160a3 Move EGLConfig, EGLContext and EGLDisplay fields into gles2-renderer.
This moves the EGLConfig, EGLContext and EGLDisplay fields into
gles2-renderer. It also moves EGLDisplay creation and EGLConfig
selection into gles2-renderer.
2012-11-13 16:56:28 -05:00
John Kåre Alsaker
94659274b4 Move weston_output EGL state into gles2-renderer.
This introduces callbacks for output creation and destruction for the
gles2-renderer. This enables the gles2-renderer to have per-output
state. EGL surface creation is now done by the output_create callback
and the EGL surface is stored in the new per-output gles2-renderer
state. On the first output_create call, the gles2-renderer will setup
it's GL context. This is because EGL requires a EGL surface to be able
to use the GL context.
2012-11-13 16:30:27 -05:00
Dima Ryazanov
ddf9bb3109 Fix a typo. 2012-11-13 15:56:05 -05:00
Ander Conselvan de Oliveira
8d360b47ad compositor-drm: Use drm_fbs for the sprite code too
This makes drm_fb_get_from_bo() use drmModeAddFB2() if possible so that
drm_output_prepare_overlay_surface() can use this instead of keeping
track of the fbs and buffers itself.
2012-11-09 12:00:58 -05:00
Ander Conselvan de Oliveira
af696af2bb compositor-drm: Don't schedule repaint on scanout buffer destroy handler
Let the compositor generic code decide what to do when the buffer goes
away. We still have a valid reference do the bo, so we can still show
the client contents until something else triggers a repaint.
2012-11-09 11:24:58 -05:00
Ander Conselvan de Oliveira
2f7a30b07e compositor-drm: Only request vblank events if needed
If the sprite is disabled and we're not enabling it on the next frame,
nothing is done in the vblank handler, so there's no need to ask for a
vblank event.
2012-11-09 11:13:44 -05:00
Ander Conselvan de Oliveira
3b2bd44d92 compositor-drm: Remove drm_disable_unused_sprites()
If a sprite is no longer used, it is disabled on the call to
drmModeSetPlane() when doing the output repaint, since its
pending_fb_id is 0.
2012-11-09 11:13:22 -05:00
Kristian Høgsberg
d6f09a75a7 compositor-x11: Improve fullscreen support
The old implementation didn't work because we set the minimum and maximum
sizes so that the WM can't resize us.  That makes the fullscreen protocol
not work.  Additionally we were requesting fullscreen after mapping, which
requires the more complicated (and potentially flickery) client message
approach.

Now we just set the _NET_WM_STATE before mapping and avoid setting
the size hints in case of fullscreen.  That's all good, but the problem
is that we now have to wait for configure notify before we know
what size our output will be.  For now we just block and pull events from
X until we get the size.

Ideally we would treat the map as an output hotplug event and just add the
output at that point, but we can't start up with no outputs present.
That may be worth fixing, but for now, the block-on-map is fine.
2012-11-09 11:12:23 -05:00
Pekka Paalanen
7fb46fbe95 rpi: Dispmanx elements as planes, completion callback
Dispmanx elements are like hardware overlays. Assign one weston_surface
to each overlay created, and the VideoCore will composite it on screen.
The maximum number of elements is configurable via the command line.
Specifying zero will disable the overlays (planes/elements) altogether,
and use only GLESv2 compositing.

You need an up-to-date Raspberry Pi firmware for:
- vc_dispmanx_resource_create(), that will also take stride. Otherwise
  surfaces ending up in elements may show up as corrupted.
- off-line compositing support. The on-line compositing of elements
  cannot handle too many elements. Look for the comments around
  DEFAULT_MAX_PLANES in the code.

Elements must be double-buffered to avoid tearing. Therefore two buffers
(Dispmanx resources) are allocated for each element. A command line
option is added to allow single-buffering instead to save memory, with
the risk of tearing.

The page flip timer is replaced with the Dispmanx update completion
callback. The callback is executed in a separate thread, therefore a
pipe is set up to integrate properly with Weston core.

If not disabled, usually all surfaces are assigned into planes, and
nothing is composited in GLESv2. Planes do not support surface
transformations though, so compositing will automatically switch the
necessary surfaces to GLESv2 compositing as needed. Switching between
GLESv2 and elements may cause transient visual glitches and jerks.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-08 16:56:26 -05:00
Pekka Paalanen
e8de35c922 rpi: a backend for Raspberry Pi
Add a new backend for the Raspberry Pi.

This backend uses the DispmanX API to initialise the display, and create
an EGLSurface, so that GLESv2 rendering is shown on the "framebuffer".
No X server is involved. All compositing happens through GLESv2.

The created EGLSurface is specifically configured as buffer content
preserving, otherwise Weston wouuld show only the latest damage and
everything else was black. This may be sub-optimal, since we are not
alternating between two buffers, like the DRM backend is, and content
preserving may imply a fullscreen copy on each frame.

Page flips are not properly hooked up yet. The display update will
block, and we use a timer to call weston_output_finish_frame(), just
like the x11 backend does.

This backend handles the VT and tty just like the DRM backend does.
While VT switching works in theory, the display output seems to be
frozen while switched away from Weston. You can still switch back.

Seats and connectors cannot be explicitly specified, and multiple seats
are not expected.

Udev is used to find the input devices. Input devices are opened
directly, weston-launch is not supported at this time. You may need to
confirm that your pi user has access to input device nodes.

The Raspberry Pi backend is built by default. It can be build-tested
without the Raspberry Pi headers and libraries, because we provide stubs
in rpi-bcm-stubs.h, but such resulting binary is non-functional. If
using stubs, the backend is built but not installed.

VT and tty handling, and udev related code are pretty much copied from
the DRM backend, hence the copyrights. The rpi-bcm-stubs.h code is
copied from the headers on Raspberry Pi, including their copyright
notice, and modified.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-08 16:56:26 -05:00
Pekka Paalanen
bcdd579a58 gles2: update texture only if needed
When a surface is on a non-primary plane (overlay), we do not need to
keep the GL texture up-to-date, since we are not using it. Avoid calling
glTex(Sub)Image2D in that case, and accumulate the texture damage
separately.

This is especially useful for backends, that can put wl_shm buffers into
overlays.

The empty damage check has to be moved from surface_accumulate_damage()
into gles2_renderer_flush_damage(), because it really needs to check the
accumulated damage, not only the current damage. Otherwise, if a surface
migrates from a plane to the primary plane, and does not have new
damage, the texture would not be updated even for accumulated damage.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-08 16:56:26 -05:00
Pekka Paalanen
a51e6fa322 build: make default backend configurable
Instead of hardcoding drm-backend.so as the default if environment
presents neither Wayland nor X11, have a ./configure option to change
it. It still defaults to drm-backend.so, if not given.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-08 16:56:25 -05:00
Ander Conselvan de Oliveira
f97f811cf3 shell: Remove the old repaint debug mode
This was obsoleted by fan repaint debug.
2012-11-08 16:56:25 -05:00
Ander Conselvan de Oliveira
27508c2045 gles2: Add a debug binding for highlighting shaded content
Pressing mode-shift-space s will cause the fragment shaders to be
recompiled, adding a green tint to all composited content.
2012-11-08 16:56:25 -05:00
Ander Conselvan de Oliveira
c509d2b152 compositor: Add debug key bindings infrastructure
Add the concept of debug key bindings, that are bindings that activate
debug features in the compositor. The bindings are added to a list in
the compositor, but the triggering them is left to the shell.

On the shell side, a global debug key binding is added. When the user
presses mod-shift-space, the shell will invoke the debug bindings based
on the next key press.

This also converts the debug shortcuts for repaint debugging, fan
repaint debugging and the hide overlays shortcut in compositor-drm to
use the new infrastructure.
2012-11-08 16:56:25 -05:00
Ander Conselvan de Oliveira
11f8d403a8 Add a headless backend
Add a headless backend and a noop renderer, mainly for testing
purposes. Although no rendering is performed with this backend,
this allow some of the code paths inside Weston and shm clients
to be tested without any windowing system or any need for drm
access.
2012-11-08 16:56:25 -05:00
Jan Arne Petersen
1f1b39792b keyboard: Rename keyboard to weston-keyboard
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-08 14:27:37 -05:00