profile/ivi/weston-ivi-shell.git
12 years agocompositor: add weston_surface transformation doc
Pekka Paalanen [Tue, 7 Feb 2012 11:18:00 +0000 (13:18 +0200)]
compositor: add weston_surface transformation doc

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: fix transformed opaque surface repainting
Pekka Paalanen [Mon, 6 Feb 2012 14:26:57 +0000 (16:26 +0200)]
compositor: fix transformed opaque surface repainting

Computing the real maximal opaque screen aligned rectangle of a
transformed surface is hard. Let's drop the opaque optimisation
instead.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: q&d solution for surface drift
Pekka Paalanen [Mon, 6 Feb 2012 12:54:20 +0000 (14:54 +0200)]
compositor: q&d solution for surface drift

When a transformed (rotated) surface is continuously resized from its
top-left corner, its location will drift. This is due to accumulating
rounding errors in transforming an offset from surface-local to global
coordinates in surface_attach().

Diminish the drift down to unobservable level by changing the
weston_surface global position from integer to float.

The offset transformation is now done without rounding. To preserve the
precision, wl_shell::configure() interface must use floats, and so does
weston_surface_configure(), too.

The con of this patch is that it adds inconsistency to the surface
position coordinates: sometimes they are floats, sometimes integers.

12 years agocompositor: clear surface damage on draw
Pekka Paalanen [Mon, 6 Feb 2012 10:16:07 +0000 (12:16 +0200)]
compositor: clear surface damage on draw

Commit a0d6dc4f26c95ae08ffff7d5f1ee7c1f53bdf545 lost one line of code in
the refactoring, and so did not reset the surface damage on repaint
anymore. This causes damage to only accumulate, leading to a full
display redraw every cycle and hiding damage tracking issues.

Put the damage clear back.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: fix and simplify shader uniform handling
Pekka Paalanen [Thu, 2 Feb 2012 14:49:05 +0000 (16:49 +0200)]
compositor: fix and simplify shader uniform handling

The uniform location variables should be signed, according to the OpenGL
ES 2 specification. Moreover, GL_NONE, i.e. 0, is not an invalid nor
special location; it is actually used as a valid uniform location.

Change struct weston_shader uniform members to signed.

Stop using 0 for identifying a non-existing uniform, use -1 instead.
Furthermore, as the spec says a) glGetUniformLocation() will return -1
for non-active/existing uniforms, and b) glUniform*() function will
simply ignore all calls with location -1, we can simplify the code. We
don't have to avoid locating uniforms that don't exist, and we don't
need to test for them in weston_surface_draw() either.

Remove the micro-optimisation that avoids setting 'alpha' uniform if it
has not changed, in the name of simplification.

Unify shader creation by dropping init_solid_shader(), and calling
weston_shader_init() instead. The downside is that we compile the vertex
shader twice at startup now.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoconfigure: add libpng to client libs
Pekka Paalanen [Wed, 1 Feb 2012 09:31:31 +0000 (11:31 +0200)]
configure: add libpng to client libs

http://lists.freedesktop.org/archives/wayland-devel/2012-January/001975.html
reports a linking problem:

/usr/bin/ld: libtoytoolkit.a(cairo-util.o): undefined reference to
symbol 'png_set_filler@@PNG12_0'
/usr/bin/ld: note: 'png_set_filler@@PNG12_0' is defined in DSO
/usr/lib/i386-linux-gnu/libpng12.so.0 so try adding it to the linker command line
/usr/lib/i386-linux-gnu/libpng12.so.0: could not read symbols: Invalid
operation
collect2: ld returned 1 exit status
make[3]: [weston-terminal] Error 1 (ignored)

A similar problem is diagnosed here:
http://lists.fedoraproject.org/pipermail/devel/2010-March/133601.html

As some distros are shipping linkers, that do not resolve symbols from
implicitly linked libraries, check and link libpng explicitly.

Cc: nerdopolis <bluescreen_avenger@verizon.net>
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: Don't just update uniforms when we change shaders
Kristian Høgsberg [Tue, 31 Jan 2012 20:38:36 +0000 (15:38 -0500)]
compositor: Don't just update uniforms when we change shaders

The uniforms change from surface to surface or output to output, so always
set them.

12 years agowindow: Fold window_resize into idle_resize
Kristian Høgsberg [Tue, 31 Jan 2012 20:34:15 +0000 (15:34 -0500)]
window: Fold window_resize into idle_resize

12 years agowindow: Don't overwrite window->allocation until we've done the resize
Kristian Høgsberg [Tue, 31 Jan 2012 20:30:47 +0000 (15:30 -0500)]
window: Don't overwrite window->allocation until we've done the resize

This way we can actually detect whether or not a window resizes.

12 years agowindow: Dont take width and height in window constructor
Kristian Høgsberg [Tue, 31 Jan 2012 20:24:48 +0000 (15:24 -0500)]
window: Dont take width and height in window constructor

Always set this by scheduling an initial resize.

12 years agoflower: Dont allow resizing
Kristian Høgsberg [Tue, 31 Jan 2012 16:53:20 +0000 (11:53 -0500)]
flower: Dont allow resizing

12 years agoflower: Redraw flower on middle click, pop up window menu on right click
Kristian Høgsberg [Tue, 31 Jan 2012 14:54:04 +0000 (09:54 -0500)]
flower: Redraw flower on middle click, pop up window menu on right click

12 years agowindow: Make window frame menu available to client
Kristian Høgsberg [Tue, 31 Jan 2012 14:53:44 +0000 (09:53 -0500)]
window: Make window frame menu available to client

12 years agoconfigure: use --disable-tests, since default is enabled
Pekka Paalanen [Tue, 31 Jan 2012 14:35:19 +0000 (16:35 +0200)]
configure: use --disable-tests, since default is enabled

Add a nice help text, too.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoconfigure: toytoolkit GL apps depend on cairo-egl
Pekka Paalanen [Tue, 31 Jan 2012 14:35:18 +0000 (16:35 +0200)]
configure: toytoolkit GL apps depend on cairo-egl

Do not build toytoolkit applications that use GL, if Cairo-egl is not
available. These applications (which happen to be also the full GL
clients) do not work at all without Cairo-egl, and fail at runtime with
"unable to acquire window surface".

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: handle attach request in surface-local coordinates
Pekka Paalanen [Tue, 31 Jan 2012 10:04:54 +0000 (12:04 +0200)]
compositor: handle attach request in surface-local coordinates

The x, y offsets in attach request are in surface-local coordinates, as
that is the only coordinate system the clients know about. The offset
must be transformed to global coordinate system to be applied properly.

This approximately fixes the top-left resizing of transformed surfaces.
However, it suffers from drift due to accumulating rounding errors in
continuous resizing.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoshell: fix resize for transformed surfaces
Pekka Paalanen [Mon, 30 Jan 2012 14:19:47 +0000 (16:19 +0200)]
shell: fix resize for transformed surfaces

This fixes the resize pointer motion vs. surface size mismatch for
right/bottom direction resizes. Top/left resizes need further fixes in
surface motion.

Additionally there is some clean-up in weston_surface_resize() to
eliminate a failure path, and fixing the Weston resize binding's resize
direction heuristic to follow transformations.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoshell: fix move of transformed surfaces
Pekka Paalanen [Mon, 30 Jan 2012 12:16:34 +0000 (14:16 +0200)]
shell: fix move of transformed surfaces

In the stack of transformations, change the rotation to be applied
to the surface before the absolute positioning. Doing so avoids having
to undo and redo the absolute positioning, and we can simply use the
surface center in local coordinates as the origin.

This fixes the surface move. Before, the surface moved along the surface
local axis, but the user expects it to move along the global axis with
the pointer.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agotest: Fix out-of-tree builds
Kristian Høgsberg [Tue, 31 Jan 2012 00:15:04 +0000 (19:15 -0500)]
test: Fix out-of-tree builds

12 years agobuild: fix build of matrix test
Ander Conselvan de Oliveira [Mon, 30 Jan 2012 13:02:06 +0000 (15:02 +0200)]
build: fix build of matrix test

This test uses files from src/ so use COMPOSITOR_CFLAGS to find headers
in non-standard locations.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
12 years agoUpdate config files to reflect new terminal name, weston-terminal
Scott Moreau [Mon, 30 Jan 2012 14:05:14 +0000 (07:05 -0700)]
Update config files to reflect new terminal name, weston-terminal

krh: Updated to use /usr/bin/weston-terminal.

12 years agocompositor: Allow attaching null buffer
Kristian Høgsberg [Mon, 30 Jan 2012 14:10:14 +0000 (09:10 -0500)]
compositor: Allow attaching null buffer

Attaching a null buffer is allowed and takes the surface back to the
unattached state it starts in.

12 years agoImplement CONFIG_KEY_UNSIGNED_INTEGER
Scott Moreau [Fri, 27 Jan 2012 20:25:49 +0000 (13:25 -0700)]
Implement CONFIG_KEY_UNSIGNED_INTEGER

strtol() does not work when trying to assign 32 bits of data into a
regular signed int on 32 bit systems. Use corresponding strtoul()
instead.

12 years agoshell: Rotate relative to current rotation
Kristian Høgsberg [Fri, 27 Jan 2012 18:36:13 +0000 (13:36 -0500)]
shell: Rotate relative to current rotation

This avoids the surface jumping around when you start rotating it.

12 years agocompositor: Only set surface geometry through weston_surface_configure()
Kristian Høgsberg [Fri, 27 Jan 2012 16:58:31 +0000 (11:58 -0500)]
compositor: Only set surface geometry through weston_surface_configure()

There are too many things to keep track of now, so let's require going
through this.

12 years agocompositor: Link to libm
Kristian Høgsberg [Fri, 27 Jan 2012 16:57:28 +0000 (11:57 -0500)]
compositor: Link to libm

12 years agoMerge remote-tracking branch 'pq/transform-v1'
Kristian Høgsberg [Fri, 27 Jan 2012 16:42:18 +0000 (11:42 -0500)]
Merge remote-tracking branch 'pq/transform-v1'

12 years agodesktop-shell: print what failed on exec
Pekka Paalanen [Fri, 27 Jan 2012 07:50:02 +0000 (09:50 +0200)]
desktop-shell: print what failed on exec

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agowindow: fix resizing of windows backed by shm buffers
Ander Conselvan de Oliveira [Fri, 27 Jan 2012 15:17:39 +0000 (17:17 +0200)]
window: fix resizing of windows backed by shm buffers

When window_attach_surface() calls window_get_resize_dx_dy(),
window->resize_edges is cleared. However if there is already a pending
surface to be attached, the resize won't be done until the following
call to window_attach_surface(). In this next call, since resize_edges
is now zero, the top-left corner of the window will be unchanged. If
the user is resizing from the top or left border, this causes the
resize to happen in the wrong direction.

This patch changes window_attach_surface() to call
window_get_resize_dx_dy() only if an attach will actually happen.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
12 years agowindow: Handle data_device.selection events with offer=NULL
Kristian Høgsberg [Fri, 27 Jan 2012 16:04:18 +0000 (11:04 -0500)]
window: Handle data_device.selection events with offer=NULL

This happens when the current selection data_offer is removed.

12 years agoCollabora copyright updates
Pekka Paalanen [Fri, 27 Jan 2012 14:25:16 +0000 (16:25 +0200)]
Collabora copyright updates

which I forgot to add while working on these files.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: make overlap computation use the boundingbox
Pekka Paalanen [Fri, 27 Jan 2012 12:38:33 +0000 (14:38 +0200)]
compositor: make overlap computation use the boundingbox

This makes the overlap to account for surface transformations.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: use bounding box for damage regions
Pekka Paalanen [Thu, 26 Jan 2012 11:12:45 +0000 (13:12 +0200)]
compositor: use bounding box for damage regions

Change weston_surface_damage*() functions to use the full surface
bounding box or call surface_compute_bbox() to find the bounding box for
an arbitrary rectangle.

This should fix all rendering artifacts for non-opaque (i.e. ARGB)
transformed surfaces.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: weston_surface_assign_output() to use bounding box
Pekka Paalanen [Thu, 26 Jan 2012 09:34:16 +0000 (11:34 +0200)]
compositor: weston_surface_assign_output() to use bounding box

Use the bounding box to compute an approximation of which output
contains most of the surface.

Move the region32 init outside the loop, and fini it, too.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: weston_output_set_cursor() to use bounding box
Pekka Paalanen [Thu, 26 Jan 2012 09:31:01 +0000 (11:31 +0200)]
compositor: weston_output_set_cursor() to use bounding box

If we ever have transformed cursor surfaces, we would better use the
bounding box to check if it is on the given output.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: weston_surface_draw() to use bounding box
Pekka Paalanen [Thu, 26 Jan 2012 09:28:08 +0000 (11:28 +0200)]
compositor: weston_surface_draw() to use bounding box

Use the proper bounding box in clipping the surface repaint area. Fixes
excessive clipping for transformed surfaces.

Also don't leak the region32 on early return.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: move weston_surface::width,height into geometry
Pekka Paalanen [Wed, 25 Jan 2012 13:55:43 +0000 (15:55 +0200)]
compositor: move weston_surface::width,height into geometry

weston_surface::transform.boundingbox depends on width and height, and
therefore geometry.dirty flag, so move width and height into geometry.

Fix all users and check that the dirty flag is set.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: add weston_surface bounding box
Pekka Paalanen [Wed, 25 Jan 2012 13:17:40 +0000 (15:17 +0200)]
compositor: add weston_surface bounding box

Compute a surface bounding box, especially for transformed surfaces, for
which one cannot simply use x,y,width,height.

The bounding box depends on width and height, so these are now under the
geometry.dirty flag.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: fix zoom origin
Pekka Paalanen [Wed, 25 Jan 2012 12:45:18 +0000 (14:45 +0200)]
compositor: fix zoom origin

Now that we can insert a transformation before the surface position
translation, we can drop geometry.x,y from the zoom transformation. That
was just undoing and redoing the position translation.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor-drm: do not scan out transformed surfaces
Pekka Paalanen [Wed, 25 Jan 2012 12:33:33 +0000 (14:33 +0200)]
compositor-drm: do not scan out transformed surfaces

Not sure this check belongs here, but as the position checks are here
too, I added this. Just so we don't forget.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: move weston_surface::x,y into geometry
Pekka Paalanen [Wed, 25 Jan 2012 14:22:05 +0000 (16:22 +0200)]
compositor: move weston_surface::x,y into geometry

weston_surface::transform.position depends on x,y, and therefore the
dirty flag, so move x and y into geometry.

Also add the missing dirty flags.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: make position a surface transformation
Pekka Paalanen [Wed, 25 Jan 2012 11:37:39 +0000 (13:37 +0200)]
compositor: make position a surface transformation

Put the surface translation (absolute position) into the surface
transformations list. This allows to set additional transformations
before and after the global translation.

Having the translation cached, changing the surface x,y now requires to
set the geometry.dirty flag.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: honour repaint regions with transformed surfaces
Pekka Paalanen [Tue, 24 Jan 2012 12:47:37 +0000 (14:47 +0200)]
compositor: honour repaint regions with transformed surfaces

Previously, if a surface was transformed, it repainted as a whole,
regardless of the computed repaint region. As damage regions determine
repaint regions and whether a surface is considered for drawing at all,
this lead to disappearing surfaces if all surfaces were considered
transformed. Also transparent transformed surfaces were redrawn without
the surfaces below being properly redrawn, leading to alpha-saturation.

Fix that by making texture_region() use the proper global-to-surface
coordinate transformation for texture coordinates. This makes it
possible to call texture_region() also for transformed surfaces.

As texture coordinates may now lie outside the valid texture image, the
fragment shader is modified to check the fragment texture coordinates.

The special path texture_transformed_surface() is no longer used and is
removed.

This change fixes many of the rendering artifacts related to transformed
surfaces.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: disable attrib arrays after use
Pekka Paalanen [Tue, 24 Jan 2012 13:53:35 +0000 (15:53 +0200)]
compositor: disable attrib arrays after use

Not strictly necessary right now, but nice to clean up.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: remove unused *_uniform members
Pekka Paalanen [Tue, 24 Jan 2012 12:50:14 +0000 (14:50 +0200)]
compositor: remove unused *_uniform members

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: rewrite draw and input coordinate transformations
Pekka Paalanen [Tue, 24 Jan 2012 07:59:29 +0000 (09:59 +0200)]
compositor: rewrite draw and input coordinate transformations

For unifying the coordinate system handling, introduce functions for
converting explicitly between the global and the surface local
coordinate systems.

Use these functions in the input path, replacing
weston_surface_transform().

In the draw path, rewrite transform_vertex() to take in surface local
coordinates.

As shell now uses the new functions, the rotation origin is properly
placed in the middle of the surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: restructure weston_surface::transform
Pekka Paalanen [Tue, 24 Jan 2012 07:53:37 +0000 (09:53 +0200)]
compositor: restructure weston_surface::transform

Separate mutable data and cached immutable data in struct
weston_surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: handle non-invertible surface transformations
Pekka Paalanen [Mon, 23 Jan 2012 08:02:47 +0000 (10:02 +0200)]
compositor: handle non-invertible surface transformations

Detect a non-invertible surface total transformation, disable it, and
warn about it.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoshell: add key binding for rotating a surface
Pekka Paalanen [Fri, 20 Jan 2012 14:48:25 +0000 (16:48 +0200)]
shell: add key binding for rotating a surface

Add the key binding Super+Alt+MouseLeftButton to start rotating a
surface by dragging. The rotation is removed, when the drag is near the
rotation origin.

Rotated surface are a stress test for input event coordinate
transformations, damage region tracking, draw transformations, and
window move and resize orientation.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: apply full transformation to input coordinates
Pekka Paalanen [Fri, 20 Jan 2012 12:24:25 +0000 (14:24 +0200)]
compositor: apply full transformation to input coordinates

When converting input coordinates from global to surface-local system,
apply the full inverse surface transformation instead of just
translation.

Move weston_surface_update_transform() implementation realier in the
file, no changes.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoclickdot: implement the purpose
Pekka Paalanen [Fri, 20 Jan 2012 11:04:56 +0000 (13:04 +0200)]
clickdot: implement the purpose

Remove all unneeded resizor features, and add the feature why clickdot
exists: put a visible marker to exactly where mouse was clicked.

This app can be used to check input coordinate transformations in a
compositor.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoclickdot: a copy of resizor
Pekka Paalanen [Fri, 20 Jan 2012 09:09:13 +0000 (11:09 +0200)]
clickdot: a copy of resizor

Start a new application clickdot as a copy of resizor, with the name
changed.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: simplify the matrix inversion API
Pekka Paalanen [Fri, 20 Jan 2012 08:47:57 +0000 (10:47 +0200)]
compositor: simplify the matrix inversion API

The compositor will likely do an order of magnitude less matrix
inversions than point transformations with an inverse, hence we do not
really need the optimised path for single-shot invert-and-transform.

Expose only the computing of the explicit inverse matrix in the API.

However, the matrix inversion tests need access to the internal
functions. Designate a unit test build by #defining UNIT_TEST, and
export the internal functions in that case.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoupdate git ignores
Pekka Paalanen [Mon, 16 Jan 2012 13:38:17 +0000 (15:38 +0200)]
update git ignores

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agotests: add matrix-test
Pekka Paalanen [Mon, 16 Jan 2012 13:04:28 +0000 (15:04 +0200)]
tests: add matrix-test

Add a new directory tests/ for unit test applications. This directory
will be built only if --enable-tests is given to ./configure.

Add matrix-test application. It excercises especially the
weston_matrix_invert() and weston_matrix_inverse_transform() functions.
It has one test for correctness and precision, and other tests for
measuring the speed of various matrix operations.

For the record, the correctness test prints:

a random matrix:
   1.112418e-02   2.628150e+00   8.205844e+02  -1.147526e-04
   4.943677e-04  -1.117819e-04  -9.158849e-06   3.678122e-02
   7.915063e-03  -3.093254e-04  -4.376583e+02   3.424706e-02
  -2.504038e+02   2.481788e+03  -7.545445e+01   1.752909e-03

The matrix multiplied by its inverse, error:
   0.000000e+00  -0.000000e+00  -0.000000e+00  -0.000000e+00
   0.000000e+00   0.000000e+00   0.000000e+00   0.000000e+00
  -0.000000e+00  -0.000000e+00   0.000000e+00  -0.000000e+00
   0.000000e+00   0.000000e+00   0.000000e+00   0.000000e+00
max abs error: 0, original determinant 11595.2

Running a test loop for 10 seconds...
test fail, det: -0.00464805, error sup: inf
test fail, det: -0.0424053, error sup: 1.30787e-06
test fail, det: 5.15191, error sup: 1.15956e-06
tests: 6791767 ok, 1 not invertible but ok, 3 failed.
Total: 6791771 iterations.

These results are expected with the current precision thresholds in
src/matrix.c and tests/matrix-test.c. The random number generator is
seeded with a constant, so the random numbers should be the same on
every run. Machine speed and scheduling affect how many iterations are
run.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: implement inverse matrix transformation
Pekka Paalanen [Mon, 16 Jan 2012 12:27:00 +0000 (14:27 +0200)]
compositor: implement inverse matrix transformation

Implement 4x4 matrix inversion based on LU-decomposition with partial
pivoting.

Instead of simply computing the inverse matrix explicitly, introduce the
type struct weston_inverse_matrix for storing the LU-decomposition and
the permutation from pivoting. Using doubles, this struct has greater
precision than struct weston_matrix.

If you need only few (less than 5, presumably) multiplications with the
inverse matrix, is it cheaper to use weston_inverse_matrix, and not
compute the inverse matrix explicitly into a weston_matrix.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: drop inverse matrix from weston_transform
Pekka Paalanen [Thu, 12 Jan 2012 13:00:57 +0000 (15:00 +0200)]
compositor: drop inverse matrix from weston_transform

Remove the inverse matrix member from struct weston_transform. It is
easier (and probably faster, too) to create and store only forward
transformation matrices in a list, multiply them once, and then invert
the final matrix, rather than creating both forward and inverse
matrices, and multiplying both.

Add a stub for the 4x4 matrix inversion function.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: move matrix code to separate files
Pekka Paalanen [Thu, 12 Jan 2012 12:30:47 +0000 (14:30 +0200)]
compositor: move matrix code to separate files

Move matrix code to separate files to allow writing unit tests for it.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoutil: document matrices
Pekka Paalanen [Tue, 10 Jan 2012 13:40:18 +0000 (15:40 +0200)]
util: document matrices

Add comments explaining the matrix storage and multiplication, so that
no-one else needs to decipher them again.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: implement a stack of surface transformations
Pekka Paalanen [Fri, 6 Jan 2012 12:10:06 +0000 (14:10 +0200)]
compositor: implement a stack of surface transformations

Having at most one transformation object attached to a surface is not
enough anymore. If we have a surface that needs to be scaled to
fullscreen, and then we have the zoom animation, we already need two
transformations combined.

Implement support for multiple transformations by adding a transformation
list. The final transformation is the ordered composite of those in the
list. To avoid traversing the list every single time, add a dirty flag,
and cache the final transformation.

The existing transformation users (only zoom) are converted.

Note: surface drawing should honour all kinds of transformations, but
not damage region code nor input event translating code take
transformations into account, AFAICT. Therefore anything but translation
will probably behave badly until they are fixed.

Cc: Juan Zhao <juan.j.zhao@linux.intel.com>
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocairo-util: Don't anger png.h by including setjmp.h
Kristian Høgsberg [Thu, 26 Jan 2012 16:32:30 +0000 (11:32 -0500)]
cairo-util: Don't anger png.h by including setjmp.h

Older libpngs are a bit fussy about this, apparently.

12 years agowindow: Don't crash when window with focus_widget is destroyed
Kristian Høgsberg [Thu, 26 Jan 2012 16:09:20 +0000 (11:09 -0500)]
window: Don't crash when window with focus_widget is destroyed

We would try to deliver a leave event to a widget in a destroyed window.

12 years agocompositor: Keep fade surface around while we're fading
Kristian Høgsberg [Thu, 26 Jan 2012 15:55:10 +0000 (10:55 -0500)]
compositor: Keep fade surface around while we're fading

This removes more special cases from weston_output_repaint() and we
avoid creating and destroying the surface for each animation frame.
We gain another special case in weston_compositor_top(), but that's
less of a problem, and we'll fix that later.

12 years agocompositor: Use weston_surface_create for creating solid color fade surface
Kristian Høgsberg [Thu, 26 Jan 2012 15:03:45 +0000 (10:03 -0500)]
compositor: Use weston_surface_create for creating solid color fade surface

12 years agocompositor: Create surfaces neutral, select shader later
Kristian Høgsberg [Thu, 26 Jan 2012 15:00:23 +0000 (10:00 -0500)]
compositor: Create surfaces neutral, select shader later

We only setup the shader and create the texture once we attach a buffer
or set a color.

12 years agocompositor: Drop unused saved_texture surface field
Kristian Høgsberg [Thu, 26 Jan 2012 14:28:42 +0000 (09:28 -0500)]
compositor: Drop unused saved_texture surface field

12 years agocompositor: Clear repaint_scheduled when an idle repaint is cancelled
Kristian Høgsberg [Thu, 26 Jan 2012 13:47:04 +0000 (08:47 -0500)]
compositor: Clear repaint_scheduled when an idle repaint is cancelled

We don't hit this case often, but if we did, the compositor would get stuck
thinking a repaint was already scheduled.

12 years agocompositor: Combine repaint and weston_output_repaint
Kristian Høgsberg [Thu, 26 Jan 2012 13:40:37 +0000 (08:40 -0500)]
compositor: Combine repaint and weston_output_repaint

Fewer repaint functions is better.

12 years agocompositor: Compute overlapped early and base hw cursor decision on that
Kristian Høgsberg [Thu, 26 Jan 2012 06:03:58 +0000 (01:03 -0500)]
compositor: Compute overlapped early and base hw cursor decision on that

12 years agocompositor: Move tracking of scanout buffers to compositor-drm
Kristian Høgsberg [Thu, 26 Jan 2012 05:11:01 +0000 (00:11 -0500)]
compositor: Move tracking of scanout buffers to compositor-drm

12 years agocompositor: Remove prepare_scanout_surface callout
Kristian Høgsberg [Thu, 26 Jan 2012 04:59:42 +0000 (23:59 -0500)]
compositor: Remove prepare_scanout_surface callout

For the drm backend, we just refactor setup_scanout_surface into
drm_output_prepare_scanout_surface and call it from drm_output_repaint.

12 years agocompositor: Pull prepare_render and present callouts into repaint
Kristian Høgsberg [Thu, 26 Jan 2012 04:47:45 +0000 (23:47 -0500)]
compositor: Pull prepare_render and present callouts into repaint

This dramatically simplifies the backend repaint abstractions and paves
the way for moving overlay and cursor setup into the backend.

12 years agocompositor: Move repaint loop into a backend function
Kristian Høgsberg [Thu, 26 Jan 2012 04:32:28 +0000 (23:32 -0500)]
compositor: Move repaint loop into a backend function

We've trimmed down the actual repaint loop to just iterating through the
surface list and calling weston_surface_draw(), so we push that to the
backend without too much code duplication.

12 years agocompositor: Insert the fade surface in the surface list
Kristian Høgsberg [Thu, 26 Jan 2012 04:16:29 +0000 (23:16 -0500)]
compositor: Insert the fade surface in the surface list

This lets us repaint it in the repaint loop instead of the fade_output()
special case.

12 years agocompositor: Move shader setup to weston_surface_draw()
Kristian Høgsberg [Thu, 26 Jan 2012 04:02:06 +0000 (23:02 -0500)]
compositor: Move shader setup to weston_surface_draw()

12 years agocompositor: Compute whether or not a surface is overlapped
Kristian Høgsberg [Thu, 26 Jan 2012 03:20:30 +0000 (22:20 -0500)]
compositor: Compute whether or not a surface is overlapped

12 years agocompositor: Remove special casing of fullscreen surfaces
Kristian Høgsberg [Thu, 26 Jan 2012 03:09:10 +0000 (22:09 -0500)]
compositor: Remove special casing of fullscreen surfaces

This was supposed to draw black borders around a fullscreen surface that
was smaller than the output.  We don't want to special case that in the
repaint loop, but may use a different shader or such.  And we want the
surface to have an opaque region that covers the output so that that
will eliminate overdraw of lower surfaces.

12 years agocompositor: Do the per surface clip region math in weston_surface_draw()
Kristian Høgsberg [Thu, 26 Jan 2012 03:02:00 +0000 (22:02 -0500)]
compositor: Do the per surface clip region math in weston_surface_draw()

12 years agocompositor: Assign surface damage before setting up scanout buffers
Kristian Høgsberg [Thu, 26 Jan 2012 02:48:26 +0000 (21:48 -0500)]
compositor: Assign surface damage before setting up scanout buffers

12 years agodesktop-shell: Build in sensible defaults
Kristian Høgsberg [Wed, 25 Jan 2012 21:57:11 +0000 (16:57 -0500)]
desktop-shell: Build in sensible defaults

This adds a default background pattern and a terminal launcher in case
we don't have a config file.

12 years agodesktop-shell: Support tiling of background images
Kristian Høgsberg [Wed, 25 Jan 2012 21:34:36 +0000 (16:34 -0500)]
desktop-shell: Support tiling of background images

12 years agocairo-util: Add png loader and image type sniffing
Kristian Høgsberg [Wed, 25 Jan 2012 20:43:48 +0000 (15:43 -0500)]
cairo-util: Add png loader and image type sniffing

12 years agodesktop-shell: Fall back to solid color if there's no background image
Kristian Høgsberg [Wed, 25 Jan 2012 19:55:33 +0000 (14:55 -0500)]
desktop-shell: Fall back to solid color if there's no background image

12 years agocairo-util: Return NULL instead of exit() on jpeg load failure
Kristian Høgsberg [Wed, 25 Jan 2012 19:54:26 +0000 (14:54 -0500)]
cairo-util: Return NULL instead of exit() on jpeg load failure

12 years agoInstall terminal as weston-terminal
Kristian Høgsberg [Wed, 25 Jan 2012 19:02:05 +0000 (14:02 -0500)]
Install terminal as weston-terminal

12 years agoRevert "weston: Drop priviledges early, and seteuid when needed"
Kristian Høgsberg [Tue, 24 Jan 2012 17:37:17 +0000 (12:37 -0500)]
Revert "weston: Drop priviledges early, and seteuid when needed"

This reverts commit fc6ccb868fa735ee9c6592806f381aa1262bf0b2.

We still need root permissions for drmDrop/SetMaster.  Without
integration with ConsoleKit or systemd we also don't have access
to /dev/dri/cardX in the case where we open a new VT.

12 years agoweston: Drop priviledges early, and seteuid when needed
Benjamin Franzke [Tue, 24 Jan 2012 15:37:15 +0000 (16:37 +0100)]
weston: Drop priviledges early, and seteuid when needed

12 years agosetuid: Operate relative to $(DESTDIR)
Benjamin Franzke [Tue, 24 Jan 2012 09:29:44 +0000 (10:29 +0100)]
setuid: Operate relative to $(DESTDIR)

12 years agowindow: Fix sending button events when there's no grab
Neil Roberts [Mon, 23 Jan 2012 19:11:18 +0000 (19:11 +0000)]
window: Fix sending button events when there's no grab

The code which sends the button events was checking whether there is a
focus widget with a button handler but then always sending the button
event to the grab widget. If the grab widget is different from the
focus widget at this point then it will check the wrong widget for a
button handler and potentially crash. It is also possible for there to
be no grab widget here in the following situation:

1. Press and hold down the left mouse button
2. Press and hold down the right mouse button
3. Release the left mouse button
4. Release the right mouse button

In this case the grab will be released at step 3 because the code only
keeps track of the grab for one button. Then it will try to send the
release event for the right mouse button to a NULL widget so it will
crash.

12 years agoevdev: fix uninitialised pointer value
Tiago Vignatti [Fri, 20 Jan 2012 16:47:46 +0000 (18:47 +0200)]
evdev: fix uninitialised pointer value

==30224== Conditional jump or move depends on uninitialised value(s)
==30224==    at 0x40EE3A0: evdev_flush_motion (evdev.c:284)
==30224==    by 0x40EE6DC: evdev_input_device_data (evdev.c:352)
==30224==    by 0x4034710: wl_event_source_fd_dispatch (event-loop.c:76)
==30224==    by 0x4035171: wl_event_loop_dispatch (event-loop.c:462)
==30224==    by 0x4032F76: wl_display_run (wayland-server.c:785)
==30224==    by 0x8050972: main (compositor.c:2183)

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agogears: Make window transparent
Kristian Høgsberg [Thu, 19 Jan 2012 19:05:21 +0000 (14:05 -0500)]
gears: Make window transparent

We need this for the window decorations.

12 years agowindow: Use CAIRO_OPERATOR_OVER for rendering the menu
Kristian Høgsberg [Thu, 19 Jan 2012 18:54:09 +0000 (13:54 -0500)]
window: Use CAIRO_OPERATOR_OVER for rendering the menu

We forgot to switch back from CAIRO_OPERATOR_SOURCE, which is broken,
but also hits a broken fallback in cairo-gl.

12 years agoconfigure: Add --enable-setuid-install
Kristian Høgsberg [Thu, 19 Jan 2012 18:32:17 +0000 (13:32 -0500)]
configure: Add --enable-setuid-install

This adds support for installing the compositor setuid.

12 years agocompositor: initialise segv_action.sa_mask
Pekka Paalanen [Thu, 19 Jan 2012 14:48:37 +0000 (16:48 +0200)]
compositor: initialise segv_action.sa_mask

Valgrind complained sa_mask member is not initialised, fix that.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agodesktop-shell: don't crash on menu
Pekka Paalanen [Thu, 19 Jan 2012 14:40:28 +0000 (16:40 +0200)]
desktop-shell: don't crash on menu

Add dummy menu callback function, so we don't crash after every time
someone opens the menu.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoshell: deal with weston_compositor_pick_surface() = NULL
Pekka Paalanen [Thu, 19 Jan 2012 14:25:40 +0000 (16:25 +0200)]
shell: deal with weston_compositor_pick_surface() = NULL

I could crash Weston by trying to open another menu from a panel while
one menu from it was already showing.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff40a9872 in popup_grab_focus (grab=0x761968, time=4130706528, surface=0x0, x=-227, y=15) at shell.c:440
440 if (surface->resource.client == client) {
(gdb) bt
 0  0x00007ffff40a9872 in popup_grab_focus (grab=0x761968, time=4130706528, surface=0x0, x=-227, y=15) at shell.c:440
 1  0x0000000000406977 in weston_device_repick (device=0x70b4e0, time=4130706528) at compositor.c:360
 2  0x0000000000406a36 in weston_compositor_repick (compositor=0x619960) at compositor.c:382
 3  0x0000000000406ac8 in destroy_surface (resource=0x6fc6f0) at compositor.c:397
 4  0x00007ffff7bd33d8 in destroy_resource (element=0x6fc6f0, data=0x7fffffffd9fc) at wayland-server.c:355
 5  0x00007ffff7bd8d98 in for_each_helper (entries=0x757808, func=0x7ffff7bd332c <destroy_resource>, data=0x7fffffffd9fc)
    at wayland-util.c:264
 6  0x00007ffff7bd8dd4 in wl_map_for_each (map=0x757808, func=0x7ffff7bd332c <destroy_resource>, data=0x7fffffffd9fc)
    at wayland-util.c:270
 7  0x00007ffff7bd34dc in wl_client_destroy (client=0x7577d0) at wayland-server.c:385
 8  0x00007ffff7bd2e36 in wl_client_connection_data (fd=17, mask=1, data=0x7577d0) at wayland-server.c:187
 9  0x00007ffff7bd5bde in wl_event_source_fd_dispatch (source=0x74cda0, ep=0x7fffffffdae0) at event-loop.c:76
 10 0x00007ffff7bd665b in wl_event_loop_dispatch (loop=0x618900, timeout=-1) at event-loop.c:462
 11 0x00007ffff7bd42a9 in wl_display_run (display=0x6188b0) at wayland-server.c:785
 12 0x000000000040b1e1 in main (argc=1, argv=0x7fffffffdef8) at compositor.c:2182

Modify popup_grab_focus() to deal with a NULL surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agowindow: menu leak fixes
Pekka Paalanen [Thu, 19 Jan 2012 13:17:59 +0000 (15:17 +0200)]
window: menu leak fixes

When a menu self-destructs, free also the widget and struct menu.

As menus are self-destructing, it does not make sense to store the
window pointer, since we cannot clear it automatically. Therefore,
rename window_create_menu() to window_show_menu() that does not return
the window pointer. It also calls window_schedule_redraw() internally.

Fixes Valgrind reported memory leaks.

The alternative would be to explicitly destroy the menu in application's
menu callback.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoresizor: free the widget on destroy
Pekka Paalanen [Thu, 19 Jan 2012 12:21:35 +0000 (14:21 +0200)]
resizor: free the widget on destroy

Plugs a memory leak.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agowindow: remove pointers to widget on destroy
Pekka Paalanen [Thu, 19 Jan 2012 11:51:38 +0000 (13:51 +0200)]
window: remove pointers to widget on destroy

Input devices may hold a pointer to the widget being destroyed. Reset
such pointers in widget_destroy().

This fixes a use-after-free in window_destroy(), if an application
destroys its widgets before the window.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agowindow: destroy frame in window_destroy()
Pekka Paalanen [Thu, 19 Jan 2012 11:33:50 +0000 (13:33 +0200)]
window: destroy frame in window_destroy()

Fix a memory leak reported by Valgrind, by destroying the window
decorations widget, if it exists.

All widget pointers returned from toytoolkit to the application should
be destroyed by the application explicitly.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>