platform/upstream/weston.git
11 years agocompositor-drm: Allow scanning out of opaque ARGB surfaces
Ander Conselvan de Oliveira [Fri, 30 Nov 2012 15:34:22 +0000 (17:34 +0200)]
compositor-drm: Allow scanning out of opaque ARGB surfaces

11 years agoFix build warnings from image_loader
Pekka Paalanen [Fri, 30 Nov 2012 11:37:28 +0000 (13:37 +0200)]
Fix build warnings from image_loader

Fix the following build warnings, and the build failures due to the
warning fixes:

  CC     libshared_cairo_la-image-loader.lo
image-loader.c:369:1: warning: no previous prototype for 'load_image'

  CC     x11_backend_la-compositor-x11.lo
compositor-x11.c: In function 'x11_output_set_icon':
compositor-x11.c:396:2: warning: implicit declaration of function 'load_image'
compositor-x11.c:396:8: warning: assignment makes pointer from integer without a cast

  CC     wayland_backend_la-compositor-wayland.lo
compositor-wayland.c: In function 'create_border':
compositor-wayland.c:97:2: warning: implicit declaration of function 'load_image'
compositor-wayland.c:97:8: warning: assignment makes pointer from integer without a cast

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor: Fix rendering with shm transformed buffers
Ander Conselvan de Oliveira [Wed, 28 Nov 2012 15:10:26 +0000 (17:10 +0200)]
compositor: Fix rendering with shm transformed buffers

The implementation of buffer transformation didn't handle transformed
shm buffers properly. The partial texture upload was broken since the
damage is in surface coordinates that don't necessarily match the
buffer's coordinates. It also wouldn't handle the buffer stride
properly, resulting in incorrect rendering if it didn't match the
buffer's width.

The logic used for converting texture coordinates was generalized and
moved out of the renderer, since this conversion may be useful in other
places, such as the backends.

11 years agoFix a crash when opening two terminal windows and closing the first one.
Dima Ryazanov [Thu, 29 Nov 2012 08:27:09 +0000 (00:27 -0800)]
Fix a crash when opening two terminal windows and closing the first one.

To reproduce, launch the terminal, open a second window using Ctrl-Shift-N,
go back to the first window, and press Ctrl-D. The terminal's master FD gets
events even after being closed, causing terminal_destroy to be called twice
on the same object.

To fix this, I'm adding a function to stop watching an FD.

11 years agocompositor-x11: Link to libshared-cairo for icon loading helper
Kristian Høgsberg [Thu, 29 Nov 2012 22:00:33 +0000 (17:00 -0500)]
compositor-x11: Link to libshared-cairo for icon loading helper

The X11 backend needs the image loader helper to load the window
icon.

11 years agoconfigure.ac: Don't link weston to cairo or image libraries
Kristian Høgsberg [Thu, 29 Nov 2012 17:23:36 +0000 (12:23 -0500)]
configure.ac: Don't link weston to cairo or image libraries

We were pulling in cairo and the image loading libraries through libshared.
Split out libshared into a core libshared and a libshared-cairo that
pulls in the extra libraries.

11 years agoweston.ini: Introduce core section and remove type keys.
Scott Moreau [Tue, 27 Nov 2012 23:54:53 +0000 (16:54 -0700)]
weston.ini: Introduce core section and remove type keys.

Since a6813d288, there is no longer a "type" key in the [shell] config section.
Instead the code accepts a [core] section with a modules key, containing a
comma separated list of modules to load. This patch removes the type keys
and adds a core section in the example weston.ini config file.

11 years agoxwm: Fix xwm opaque region
Scott Moreau [Thu, 22 Nov 2012 22:35:13 +0000 (15:35 -0700)]
xwm: Fix xwm opaque region

Since surface.commit was introduced, opqaue regions are stored in a pending
variable that isn't used until surface.commit. Xwayland uses the surface opaque
region as a way to tell weston what region of the surface should be opaque.
However when this pending opaque region was introduced, xwm was not updated
and so we have the 'black = transparent' problem again. This patch fixes the
problem by having xwm use the pending opaque regions.

11 years agowindow: honour wl_buffer.release
Pekka Paalanen [Mon, 19 Nov 2012 15:16:02 +0000 (17:16 +0200)]
window: honour wl_buffer.release

Listen for wl_buffer.release events in the shm path, and if a previously
posted buffer is still held by the server, allocate another one. The
maximum of two should be enough, since there is no point for a server to
hold more than one buffer at a time.

Buffer allocation happens as needed instead of window creation time.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agowindow: fix tooltip text extents
Pekka Paalanen [Mon, 19 Nov 2012 15:16:01 +0000 (17:16 +0200)]
window: fix tooltip text extents

After the toysurface rewrite, windows do not have a valid Cairo surface
outside their repaint cycle, so tooltips are not getting their size
right.

Create a dummy Cairo surface only for querying text extents, so we do
not rely on any window surfaces of parent windows or otherwise.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agowindow: simplify window_create_surface
Pekka Paalanen [Mon, 19 Nov 2012 15:16:00 +0000 (17:16 +0200)]
window: simplify window_create_surface

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agowindow: convert shm path to toysurface
Pekka Paalanen [Mon, 19 Nov 2012 15:15:59 +0000 (17:15 +0200)]
window: convert shm path to toysurface

Implement shm_surface as a sub-class of toysurface, and unify the
toysurface call sites removing most buffer type specific branching.

Do not destroy and create a surface, if the size does not change.

The resizing optimization of shm surfaces is retained, but the pool is
moved from struct window to struct shm_surface, since it does not apply
to egl_window_surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agowindow: add toysurface abstraction and port EGL path
Pekka Paalanen [Mon, 19 Nov 2012 15:15:58 +0000 (17:15 +0200)]
window: add toysurface abstraction and port EGL path

We need more structure to the way we handle the backing storage in
toytoolkit, to make it possible to double-buffer the shm case properly.
The existing buffer handling is very complex with the three
different cases:
- EGLSurface backed Cairo surface with a window associated
- wl_shm backed Cairo surface with a window associated
- wl_shm backed Cairo surface without a window, as used by dnd.c

Introduce the toysurface abstraction, which defines the interface for
the both buffer handling cases that have a window associated. It also
means, that windows will not have a valid Cairo surface outside of their
repaint cycle.

Convert the EGLsurface case into toysurface for starters. For EGL-based
Cairo surfaces, the private data is no longer needed. Destroying
egl_window_surface will trigger the destruction of the cairo_surface_t,
not vice versa. This is possible because display_create_surface() is
shm-only.

The shm cases are left untouched.

As a side-effect, display_acquire_window_surface() and
display_release_window_surface() will no longer use the 'display'
argument. Instead, display will be the one inherited from the window.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoweston-simple-im: Add a few more compose sequences
Kristian Høgsberg [Tue, 27 Nov 2012 20:11:04 +0000 (15:11 -0500)]
weston-simple-im: Add a few more compose sequences

11 years agoweston-simple-im: Fold struct keyboard_input into struct simple_im
Kristian Høgsberg [Tue, 27 Nov 2012 19:28:19 +0000 (14:28 -0500)]
weston-simple-im: Fold struct keyboard_input into struct simple_im

11 years agoweston-simple-im: Fold keyboard_input_handle_keymap() into event handler
Kristian Høgsberg [Tue, 27 Nov 2012 19:21:34 +0000 (14:21 -0500)]
weston-simple-im: Fold keyboard_input_handle_keymap() into event handler

11 years agoweston-simple-im: Fold keyboard_input_handle_key() into event handler
Kristian Høgsberg [Tue, 27 Nov 2012 19:20:31 +0000 (14:20 -0500)]
weston-simple-im: Fold keyboard_input_handle_key() into event handler

11 years agoweston-simple-im: Fold keyboard_input_handle_modifiers into event handler
Kristian Høgsberg [Tue, 27 Nov 2012 19:18:40 +0000 (14:18 -0500)]
weston-simple-im: Fold keyboard_input_handle_modifiers into event handler

11 years agoweston-simple-im: Stop using toytoolkit
Kristian Høgsberg [Tue, 27 Nov 2012 19:07:22 +0000 (14:07 -0500)]
weston-simple-im: Stop using toytoolkit

Toytoolkit doesn't buy us anything in this case, we're not rendering or
handling regular input events.  Just talk directly to wl_display and
look up the 'input_method' global directly.

11 years agoweston-simple-im: Use serial number from incoming events
Kristian Høgsberg [Tue, 27 Nov 2012 18:57:27 +0000 (13:57 -0500)]
weston-simple-im: Use serial number from incoming events

The key events we pass through to the input_method_context has to have
a serial number that corresponds to the key event we got.  The struct display
serial is updated on pointer enter/leave and keyboard events, but not the
input method keyboard events.  So the display serial will never correspond
to the key event we're dealing with and we have to pass through the
serial we get from the key event.

11 years agoweston-simple-im: Create our own xkb_context
Kristian Høgsberg [Tue, 27 Nov 2012 18:47:16 +0000 (13:47 -0500)]
weston-simple-im: Create our own xkb_context

There's no need to use the struct display xkb_context, we can just create
out ow.  This reverts c31288daf1ac379c278a00c3291760ec2639eae7.

11 years agoclients: Move keyboard-utils.[ch] into weston-simple-im
Kristian Høgsberg [Tue, 27 Nov 2012 18:41:48 +0000 (13:41 -0500)]
clients: Move keyboard-utils.[ch] into weston-simple-im

This is the only user of this code, so just include it in the simple im
source.

11 years agonoop-renderer: Remove unused variable
Kristian Høgsberg [Tue, 27 Nov 2012 18:20:40 +0000 (13:20 -0500)]
noop-renderer: Remove unused variable

11 years agotext: Add simple compose input method
Jan Arne Petersen [Sun, 18 Nov 2012 18:06:50 +0000 (19:06 +0100)]
text: Add simple compose input method

Add an input method listening to hardware keyboard input and generating
compose text.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agoeditor: Add support for editing text using the keyboard
Rob Bradford [Sun, 18 Nov 2012 18:06:49 +0000 (19:06 +0100)]
editor: Add support for editing text using the keyboard

This simple change allows you to drive the editor using the keyboard
(supporting backspace and delete and left and right arrow keys.) The idea
behind this change is to allow the testing of the interoperation between a
virtual keyboard and real one.

Signed-off-by: Rob Bradford <rob@linux.intel.com>
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agowindow: Allow to get xkb context from display
Jan Arne Petersen [Sun, 18 Nov 2012 18:06:48 +0000 (19:06 +0100)]
window: Allow to get xkb context from display

Add display_get_xkb_context to get the xkb context from the display.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agowindow: Add utils for xkb keyboard input
Jan Arne Petersen [Sun, 18 Nov 2012 18:06:47 +0000 (19:06 +0100)]
window: Add utils for xkb keyboard input

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Add support for forwarding key events
Jan Arne Petersen [Sun, 18 Nov 2012 18:06:46 +0000 (19:06 +0100)]
text: Add support for forwarding key events

Allow an input method to forward (unfiltered) key and modifier events
from the hardware keyboard to the client.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Add support for grabbing the keyboard
Jan Arne Petersen [Sun, 18 Nov 2012 18:06:45 +0000 (19:06 +0100)]
text: Add support for grabbing the keyboard

Add support for requesting hardware input into an input method.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Send more information with keysym events
Jan Arne Petersen [Sun, 18 Nov 2012 18:06:44 +0000 (19:06 +0100)]
text: Send more information with keysym events

Send state and modifier from the demo keyboard with the keysym event and
take them into account in the editor example.

Add some helper functions to write and read a modifiers_map array.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Rename and extend text_model key event
Jan Arne Petersen [Sun, 18 Nov 2012 18:06:43 +0000 (19:06 +0100)]
text: Rename and extend text_model key event

Rename the key event in text_model to keysym and add serial, time and
modifiers arguments. Add a modifiers_map event to transfer an array of
0-terminated modifier names, so that a mapping of modifiers to the
modifier bit mask is possible.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Start input method from configuration
Jan Arne Petersen [Sun, 18 Nov 2012 18:06:42 +0000 (19:06 +0100)]
text: Start input method from configuration

Start the input method specified in the weston.ini configuration file.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agoclients: Add a client that renders transformed buffers
Ander Conselvan de Oliveira [Tue, 27 Nov 2012 15:03:44 +0000 (17:03 +0200)]
clients: Add a client that renders transformed buffers

This new client, called transformed, renders a cross with the top part
red and the right green, with the same transform as the output the
surface is in.

This is based on simple-egl.

11 years agocompositor-drm: Support scan out of transformed buffers
Ander Conselvan de Oliveira [Tue, 27 Nov 2012 15:03:43 +0000 (17:03 +0200)]
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.

11 years agocompositor: Implement buffer transformation
Ander Conselvan de Oliveira [Tue, 27 Nov 2012 15:03:42 +0000 (17:03 +0200)]
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.

11 years agoman: fill missing pieces to weston page
Pekka Paalanen [Tue, 27 Nov 2012 14:54:09 +0000 (16:54 +0200)]
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>
11 years agoman: add weston-drm page
Pekka Paalanen [Tue, 27 Nov 2012 14:54:08 +0000 (16:54 +0200)]
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>
11 years agogl, rpi: consolidate print_egl_error_state()
Pekka Paalanen [Tue, 27 Nov 2012 10:25:25 +0000 (12:25 +0200)]
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>
11 years agocompositor: Move clearing of primary plane damage to the backends
Ander Conselvan de Oliveira [Thu, 22 Nov 2012 13:57:00 +0000 (15:57 +0200)]
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.

11 years agocompositor-drm: Add debug binding for toggling sprites
Ander Conselvan de Oliveira [Thu, 22 Nov 2012 13:56:59 +0000 (15:56 +0200)]
compositor-drm: Add debug binding for toggling sprites

While at it, consolidate all the bindings we already have into one
single function.

11 years agocompositor-drm: Add a debug binding for toggling usage of hw cursors
Ander Conselvan de Oliveira [Wed, 21 Nov 2012 13:11:37 +0000 (15:11 +0200)]
compositor-drm: Add a debug binding for toggling usage of hw cursors

11 years agozoom: Don't update the zoom translation if zoom level is 0
Ander Conselvan de Oliveira [Wed, 21 Nov 2012 13:11:36 +0000 (15:11 +0200)]
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.

11 years agosimple-egl: Reset opaque region if not fullscreen.
Scott Moreau [Mon, 19 Nov 2012 21:17:52 +0000 (14:17 -0700)]
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.

11 years agowindow: make display_create_surface() shm-only
Pekka Paalanen [Mon, 19 Nov 2012 15:15:57 +0000 (17:15 +0200)]
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>
11 years agowindow: use different keys for different cairo privates
Pekka Paalanen [Mon, 19 Nov 2012 13:32:51 +0000 (15:32 +0200)]
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>
11 years agowindow: merge struct surface_data into shm_surface_data
Pekka Paalanen [Mon, 19 Nov 2012 13:32:50 +0000 (15:32 +0200)]
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>
11 years agowindow: remove unused MULT macro
Pekka Paalanen [Mon, 19 Nov 2012 13:32:49 +0000 (15:32 +0200)]
window: remove unused MULT macro

Leftovers from

commit f02a649a3ce5735f5a20103fe6f1002b3a421501
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>
11 years agowindow: make window_flush() private
Pekka Paalanen [Mon, 19 Nov 2012 13:32:48 +0000 (15:32 +0200)]
window: make window_flush() private

Not called from any client.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agowindow: make window_{create,set}_surface private
Pekka Paalanen [Mon, 19 Nov 2012 13:32:47 +0000 (15:32 +0200)]
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>
11 years agosimple-shm: honour wl_buffer.release
Pekka Paalanen [Mon, 19 Nov 2012 13:29:09 +0000 (15:29 +0200)]
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>
12 years agosimple-egl: Set the right size for the opaque region when fullscreen
Ander Conselvan de Oliveira [Fri, 7 Sep 2012 14:32:16 +0000 (17:32 +0300)]
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.

12 years agocompositor: Move buffer damage fields from weston_output to gl-renderer
Ander Conselvan de Oliveira [Fri, 16 Nov 2012 15:23:52 +0000 (17:23 +0200)]
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.

12 years agoshell/zoom: Increment/decrement disable_planes only when zoom.active changes
Ville Syrjälä [Fri, 16 Nov 2012 09:48:47 +0000 (11:48 +0200)]
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>
12 years agocompositor-drm: Don't use overlay when surface alpha != 1.0f
Ville Syrjälä [Fri, 16 Nov 2012 09:48:46 +0000 (11:48 +0200)]
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>
12 years agowcap: Transform damage rectangles according to output tranform
Kristian Høgsberg [Thu, 15 Nov 2012 01:28:30 +0000 (20:28 -0500)]
wcap: Transform damage rectangles according to output tranform

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

12 years agotests: Remove last GLfloat use
Kristian Høgsberg [Wed, 14 Nov 2012 19:42:51 +0000 (14:42 -0500)]
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

12 years agoRename gles2-renderer to gl-renderer.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:29 +0000 (19:10 +0100)]
Rename gles2-renderer to gl-renderer.

12 years agoMove EGL and GL includes to a gles2-renderer header.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:28 +0000 (19:10 +0100)]
Move EGL and GL includes to a gles2-renderer header.

12 years agoMove weston_compositor GL and EGL state into gles2-renderer.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:27 +0000 (19:10 +0100)]
Move weston_compositor GL and EGL state into gles2-renderer.

12 years agoMove weston_surface GL and EGL state into gles2-renderer.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:26 +0000 (19:10 +0100)]
Move weston_surface GL and EGL state into gles2-renderer.

12 years agoMoved shader state into gles2-renderer.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:25 +0000 (19:10 +0100)]
Moved shader state into gles2-renderer.

12 years agogles2-renderer: Renaming some functions.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:24 +0000 (19:10 +0100)]
gles2-renderer: Renaming some functions.

12 years agocompositor: Move surface color state to gles2-renderer.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:23 +0000 (19:10 +0100)]
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.

12 years agoscreenshooter: Use the renderer function for reading out pixels
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:22 +0000 (19:10 +0100)]
screenshooter: Use the renderer function for reading out pixels

This also changes the compositor's read_format to a pixman format.

12 years agocompositor: Add a renderer function to read out pixels
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:21 +0000 (19:10 +0100)]
compositor: Add a renderer function to read out pixels

12 years agoMove compositor-wayland border drawing into gles2-renderer.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:20 +0000 (19:10 +0100)]
Move compositor-wayland border drawing into gles2-renderer.

12 years agoMove EGLConfig, EGLContext and EGLDisplay fields into gles2-renderer.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:19 +0000 (19:10 +0100)]
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.

12 years agoMove weston_output EGL state into gles2-renderer.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:18 +0000 (19:10 +0100)]
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.

12 years agoFix a typo.
Dima Ryazanov [Sun, 11 Nov 2012 08:29:01 +0000 (00:29 -0800)]
Fix a typo.

12 years agocompositor-drm: Use drm_fbs for the sprite code too
Ander Conselvan de Oliveira [Fri, 9 Nov 2012 12:19:05 +0000 (14:19 +0200)]
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.

12 years agocompositor-drm: Don't schedule repaint on scanout buffer destroy handler
Ander Conselvan de Oliveira [Fri, 9 Nov 2012 12:19:04 +0000 (14:19 +0200)]
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.

12 years agocompositor-drm: Only request vblank events if needed
Ander Conselvan de Oliveira [Fri, 9 Nov 2012 12:19:03 +0000 (14:19 +0200)]
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.

12 years agocompositor-drm: Remove drm_disable_unused_sprites()
Ander Conselvan de Oliveira [Fri, 9 Nov 2012 12:19:02 +0000 (14:19 +0200)]
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.

12 years agocompositor-x11: Improve fullscreen support
Kristian Høgsberg [Fri, 9 Nov 2012 16:12:21 +0000 (11:12 -0500)]
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.

12 years agorpi: Dispmanx elements as planes, completion callback
Pekka Paalanen [Wed, 7 Nov 2012 10:25:15 +0000 (12:25 +0200)]
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>
12 years agorpi: a backend for Raspberry Pi
Pekka Paalanen [Wed, 7 Nov 2012 10:25:14 +0000 (12:25 +0200)]
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>
12 years agogles2: update texture only if needed
Pekka Paalanen [Wed, 7 Nov 2012 10:25:13 +0000 (12:25 +0200)]
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>
12 years agobuild: make default backend configurable
Pekka Paalanen [Wed, 7 Nov 2012 10:25:12 +0000 (12:25 +0200)]
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>
12 years agoshell: Remove the old repaint debug mode
Ander Conselvan de Oliveira [Thu, 8 Nov 2012 15:20:47 +0000 (17:20 +0200)]
shell: Remove the old repaint debug mode

This was obsoleted by fan repaint debug.

12 years agogles2: Add a debug binding for highlighting shaded content
Ander Conselvan de Oliveira [Thu, 8 Nov 2012 15:20:46 +0000 (17:20 +0200)]
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.

12 years agocompositor: Add debug key bindings infrastructure
Ander Conselvan de Oliveira [Thu, 8 Nov 2012 15:20:45 +0000 (17:20 +0200)]
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.

12 years agoAdd a headless backend
Ander Conselvan de Oliveira [Mon, 29 Oct 2012 16:19:24 +0000 (18:19 +0200)]
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.

12 years agokeyboard: Rename keyboard to weston-keyboard
Jan Arne Petersen [Mon, 5 Nov 2012 02:26:43 +0000 (03:26 +0100)]
keyboard: Rename keyboard to weston-keyboard

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
12 years agokeyboard: commit preedit before sending key events
Jan Arne Petersen [Mon, 5 Nov 2012 02:26:42 +0000 (03:26 +0100)]
keyboard: commit preedit before sending key events

Commit the current preedit text before sending control key events.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
12 years agoeditor: Remove preedit text on startup
Jan Arne Petersen [Mon, 5 Nov 2012 02:26:41 +0000 (03:26 +0100)]
editor: Remove preedit text on startup

There should not be preedit text when a text entry does not have focus.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
12 years agoeditor: Initalize editor struct with 0
Jan Arne Petersen [Mon, 5 Nov 2012 02:26:40 +0000 (03:26 +0100)]
editor: Initalize editor struct with 0

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
12 years agoeditor: Fix handling of UTF-8 text
Jan Arne Petersen [Mon, 5 Nov 2012 02:26:39 +0000 (03:26 +0100)]
editor: Fix handling of UTF-8 text

Fix display, cursor movement and text deletion for UTF-8 text.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
12 years agoTerminal: Handle keypad symbols
Daniel Stone [Wed, 7 Nov 2012 06:51:35 +0000 (17:51 +1100)]
Terminal: Handle keypad symbols

XKB provides keypad symbols in a separate namespace.  We don't care
about the distinction, so map them to normal symbols before starting
processing.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agosmoke: Remove unused offset member
Daniel Stone [Wed, 7 Nov 2012 06:51:36 +0000 (17:51 +1100)]
smoke: Remove unused offset member

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoshell: Do not insert input panel layer when locked
Jan Arne Petersen [Wed, 7 Nov 2012 14:32:54 +0000 (15:32 +0100)]
shell: Do not insert input panel layer when locked

Do not try to insert the input panel layer in the layer list when the
shell is locked in show_input_panels(). The layer will already be
insrted in resume_desktop() anyways.

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

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
12 years agocompositor: Use pixman_region32_intersect_rect() instead of temp region
Kristian Høgsberg [Thu, 8 Nov 2012 16:36:02 +0000 (11:36 -0500)]
compositor: Use pixman_region32_intersect_rect() instead of temp region

We avoid reusing 'opaque' and don't leak the region.

12 years agoReset pending surface delta x and y on commit
Daniel Stone [Wed, 7 Nov 2012 06:51:44 +0000 (17:51 +1100)]
Reset pending surface delta x and y on commit

The following sequence:
wl_surface::attach(s, b, 1, 2)
wl_surface::commit(s)
wl_surface::commit(s)
would actually result in the surface getting moved by (2,4) as the
pending attach delta wasn't reset on commit, only by another attach.

This only shows up on single-buffered surfaces.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoClip surface damage to the surface area
Daniel Stone [Wed, 7 Nov 2012 06:51:43 +0000 (17:51 +1100)]
Clip surface damage to the surface area

Otherwise glTexSubImage2D will reject our co-ordinates as being out of
bounds.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoSHM: Don't flush damage when there is none
Daniel Stone [Wed, 7 Nov 2012 06:51:42 +0000 (17:51 +1100)]
SHM: Don't flush damage when there is none

Every single frame, we were calling the flush_damage handler in the
renderer.  For GLES2 with subimage, this wasn't too bad as we'd never
call glTexSubImage2D, but without it, we'd upload the entire frame
through glTexImage2D every time.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agoClients: Don't set the cursor when we have no pointer
Daniel Stone [Wed, 7 Nov 2012 06:51:39 +0000 (17:51 +1100)]
Clients: Don't set the cursor when we have no pointer

Avoids a segfault whenever we get a key event, and try to set the
cursor, dereferencing a NULL input->pointer.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
12 years agowindow.c: Move misplaced break to where it belongs
Kristian Høgsberg [Tue, 6 Nov 2012 01:20:53 +0000 (20:20 -0500)]
window.c: Move misplaced break to where it belongs

The break statement wasn't copy and pasted along with the rest of the code
causing menu item before it ("Move to workspace below") to fall through to
the fullscreen case.

12 years agocompositor-drm: Always disable sprites for now
Kristian Høgsberg [Fri, 2 Nov 2012 14:14:40 +0000 (10:14 -0400)]
compositor-drm: Always disable sprites for now

Until the nuclear pageflip work lands in KMS, we can't use sprites
reliably.

12 years agocompositor-x11: verify that detectable repeat was really set
Ran Benita [Wed, 31 Oct 2012 18:14:58 +0000 (20:14 +0200)]
compositor-x11: verify that detectable repeat was really set

Since the XKB says that support for detectable repeat is in fact
optional:
http://www.x.org/releases/current/doc/kbproto/xkbproto.html#Querying_and_Changing_Per_Client_Flags
we might as well be good citizens and check that it was really set. With
the X server this would never happen, though.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agocompositor-x11: properly initialize XKB extension
Ran Benita [Wed, 31 Oct 2012 18:14:57 +0000 (20:14 +0200)]
compositor-x11: properly initialize XKB extension

In order to use XKB capabilities (as we do), the client must issue an
XkbUseExtension request:
http://www.x.org/releases/current/doc/kbproto/xkbproto.html#Initializing_the_X_Keyboard_Extension

The reason this succeeds currently is that XOpenDisplay from Xlib does
this for us. But it is better not to rely on that, but do it explicitly
in XCB with the rest of the XKB init sequence.

Signed-off-by: Ran Benita <ran234@gmail.com>
12 years agocompositor-x11: free or discard XCB generic_error's
Ran Benita [Wed, 31 Oct 2012 18:14:56 +0000 (20:14 +0200)]
compositor-x11: free or discard XCB generic_error's

Where we don't look at the error details, pass NULL to the 'error'
argument and test using the reply return value instead.
Where we do need it, remember to free it.

Signed-off-by: Ran Benita <ran234@gmail.com>