profile/ivi/weston-ivi-shell.git
11 years agoWeston: weston.ini.man page
Martin Minarik [Fri, 18 Jan 2013 17:44:29 +0000 (18:44 +0100)]
Weston: weston.ini.man page

changes:
 - launcher path, passing environment variables and parameter
 - indent modeline example

11 years agoclients: add global_remove handler stubs
Pekka Paalanen [Tue, 22 Jan 2013 12:53:55 +0000 (14:53 +0200)]
clients: add global_remove handler stubs

All the clients here were missing the global_remove handler. Because
window.c did not have it, weston-desktop-shell and weston-keyboard
segfaulted on compositor exit, as they received some
wl_registry.global_remove events.

Add more or less stub global_remove handlers, so that clients do not
crash on such events. Toytoolkit and all applications would need a lot
more code to properly handle the global object removal.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoweston-launch: Use "weston-launch" for --help instead of "weston".
Scott Moreau [Tue, 22 Jan 2013 06:40:59 +0000 (23:40 -0700)]
weston-launch: Use "weston-launch" for --help instead of "weston".

The output of weston-launch --help was "Usage: weston [args...] ...".
This changes it to read "Usage: weston-launch [args...] ...".

11 years agoconfigure: remove C++ support
Pekka Paalanen [Fri, 18 Jan 2013 10:11:10 +0000 (12:11 +0200)]
configure: remove C++ support

With the Android backend gone, there is no C++ code anymore. Remove
support for C++ in the build.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor: remove android backend
Pekka Paalanen [Fri, 18 Jan 2013 10:11:09 +0000 (12:11 +0200)]
compositor: remove android backend

The Android backend has been fairly unused, since we do not have
projects actively using it. It gets basic build testing as part of the
normal build, but runtime testing it takes a considerable effort, and so
I have not done that in a long time. The code is slowly rotting, and
with new emerging backends it starts to be a burden, since it cannot use
udev, but needs evdev.

Therefore to ease Weston going forward, remove the Android backend. If
someone misses it, it can still be found in the stable 1.0 branch, and
of course resurrected from git history if someone wants to put in the
effort and maintain it.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agotests: make signal other than ABRT a hard failure
Pekka Paalanen [Tue, 18 Dec 2012 15:30:16 +0000 (17:30 +0200)]
tests: make signal other than ABRT a hard failure

We handle FAIL_TEST tests by simply inverting the success flag. The
problem with this is, that if a FAIL_TEST fails by a SIGSEGV, it will be
interpreted as passed. However, no code should ever cause a SEGV, or any
other signal than ABRT. And even ABRT only in the case of an assert()
that is meant to fail. We would probably need more sophistication for the
FAIL_TEST cases.

For now, just interpret any other signal than ABRT as a hard failure,
regardless whether it is a TEST or FAIL_TEST. At least segfaults do not
cause false passes anymore.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoshell: remove remnants of screensaver surface list
Pekka Paalanen [Thu, 20 Dec 2012 12:02:13 +0000 (14:02 +0200)]
shell: remove remnants of screensaver surface list

The list became stale probably when the lock_layer was introduced. Now
one less (ab)user of weston_surface::link.

Also add a comment on screensaver_configure(), that it is (and has been)
broken for pre-started screensavers.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agogl-renderer: make EGL typedefs similar to EGL/egl.h when building without EGL support
Vasily Khoruzhick [Fri, 11 Jan 2013 10:50:45 +0000 (13:50 +0300)]
gl-renderer: make EGL typedefs similar to EGL/egl.h when building without EGL support

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
11 years agoshell: Don't lower fullscreen layer on activate
Jonas Ådahl [Tue, 15 Jan 2013 20:25:56 +0000 (21:25 +0100)]
shell: Don't lower fullscreen layer on activate

To be able to have a fullscreen surface on one output, and interact with
surfaces on another output, don't lower the fullscreen layer on
activate.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
11 years agoshell: Set input region of the black fullscreen surface
Jonas Ådahl [Tue, 15 Jan 2013 20:25:55 +0000 (21:25 +0100)]
shell: Set input region of the black fullscreen surface

The input region of the black surface placed under the fullscreen shell
surface did not have a specified input region. Because the initial input
region of a surface is infinity, no other surface on any other output
could get any focus.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
11 years agoxwayland/window-manager: Avoid doing work for unknown window
Rob Bradford [Thu, 10 Jan 2013 19:48:57 +0000 (19:48 +0000)]
xwayland/window-manager: Avoid doing work for unknown window

In particular if the hash table lookup fails and returns NULL then that value
would be passed into weston_wm_window_schedule_repaint which does not accept a
NULL value.

11 years agobacklight: Avoid passing an invalid fd into close()
Rob Bradford [Thu, 10 Jan 2013 19:48:56 +0000 (19:48 +0000)]
backlight: Avoid passing an invalid fd into close()

11 years agoimage: Free allocated memory on error path
Rob Bradford [Thu, 10 Jan 2013 19:48:55 +0000 (19:48 +0000)]
image: Free allocated memory on error path

11 years agowindow: Free allocated memory on error path
Rob Bradford [Thu, 10 Jan 2013 19:48:54 +0000 (19:48 +0000)]
window: Free allocated memory on error path

11 years agotests/setbacklight: Close filedescriptor on return paths
Rob Bradford [Thu, 10 Jan 2013 19:48:53 +0000 (19:48 +0000)]
tests/setbacklight: Close filedescriptor on return paths

11 years agoscreenshooter: Free allocated memory where missing from some return paths
Rob Bradford [Thu, 10 Jan 2013 19:48:52 +0000 (19:48 +0000)]
screenshooter: Free allocated memory where missing from some return paths

11 years agogl: fix read-back format reporting in the log
Pekka Paalanen [Thu, 10 Jan 2013 14:50:42 +0000 (16:50 +0200)]
gl: fix read-back format reporting in the log

weston_compositor::read_format is in Pixman values now, so comparing to
a GL value does not work. Compare to the right value.

This fix affects only the log output of the GL renderer.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoconfigure.ac: Indent --disable-egl option correctly
Kristian Høgsberg [Wed, 9 Jan 2013 18:36:39 +0000 (13:36 -0500)]
configure.ac: Indent --disable-egl option correctly

11 years agoMake EGL/GLESv2 dependencies optional
Vasily Khoruzhick [Tue, 8 Jan 2013 16:09:02 +0000 (19:09 +0300)]
Make EGL/GLESv2 dependencies optional

Introduce --disable-egl switch for configure to disable
EGL/GLESv2 support.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
11 years agorenderer: introduce destroy callback
Vasily Khoruzhick [Tue, 8 Jan 2013 16:09:01 +0000 (19:09 +0300)]
renderer: introduce destroy callback

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
11 years agoAdd missing pixman-renderer.h to Makefile.am
Vasily Khoruzhick [Tue, 8 Jan 2013 16:09:00 +0000 (19:09 +0300)]
Add missing pixman-renderer.h to Makefile.am

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
11 years agoDocument --use-pixman option
Kristian Høgsberg [Mon, 7 Jan 2013 20:52:44 +0000 (15:52 -0500)]
Document --use-pixman option

11 years agowindow: Fall back to cairo image when cairo EGL isn't available
Kristian Høgsberg [Mon, 7 Jan 2013 20:47:14 +0000 (15:47 -0500)]
window: Fall back to cairo image when cairo EGL isn't available

11 years agocompositor-x11: rename use-shm to use-pixman
Vasily Khoruzhick [Mon, 7 Jan 2013 19:36:02 +0000 (22:36 +0300)]
compositor-x11: rename use-shm to use-pixman

So it could be reused with other backends and not be easily confused
with wl_shm

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
11 years agox11 backend: add option to use pixman renderer
Vasily Khoruzhick [Mon, 7 Jan 2013 17:39:50 +0000 (20:39 +0300)]
x11 backend: add option to use pixman renderer

When --use-shm is passed to weston and x11 backend is active,
it will use SHM surfaces with pixman renderer instead of EGL

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
11 years agoImplement pixman renderer
Vasily Khoruzhick [Mon, 7 Jan 2013 17:39:49 +0000 (20:39 +0300)]
Implement pixman renderer

This renderer could be used when there's no graphic accelerator available,
for example in (future) KMS and fbdev backends.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
11 years agoscreenshoter: add cases for x8r8g8b8 and x8b8g8r8 formats
Vasily Khoruzhick [Sun, 6 Jan 2013 09:12:41 +0000 (12:12 +0300)]
screenshoter: add cases for x8r8g8b8 and x8b8g8r8 formats

These formats are used by pixman renderer for framebuffer surface, without
this patch screenshoter produces empty image.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
11 years agoscreenshoter: don't use hardcoded bpp value
Vasily Khoruzhick [Sun, 6 Jan 2013 09:12:40 +0000 (12:12 +0300)]
screenshoter: don't use hardcoded bpp value

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
11 years agotests: Pass --backend so the test suite runs with the right modules
Kristian Høgsberg [Fri, 14 Dec 2012 21:19:43 +0000 (16:19 -0500)]
tests: Pass --backend so the test suite runs with the right modules

Without this we try to load the installed backends, which is nasty for
regular runs, and just doesn't work for make distcheck, which sets
prefix to $PWD/_inst.  This makes sure we load the right backend
and make distcheck pass.  Other modules (xwayland, shells etc) just don't
get loaded for distcheck and for make check we still try to load the
installed modules.

11 years agocompositor-drm: Reduce code duplication on drm_output_switch_mode()
Ander Conselvan de Oliveira [Fri, 14 Dec 2012 15:37:30 +0000 (13:37 -0200)]
compositor-drm: Reduce code duplication on drm_output_switch_mode()

Call drm_output_init_egl() instead of duplicating the gbm surface and
gl renderer state initialization code.

Note that this makes error handling a bit worse. Before, if we failed
to allocate a gbm surface we could still recover. Failing the renderer
state creation would lead to inconsisten state. Now we end up in
inconsistent state on both cases.

11 years agocompositor-drm: Move output gl state initialization to own function
Ander Conselvan de Oliveira [Fri, 14 Dec 2012 15:37:29 +0000 (13:37 -0200)]
compositor-drm: Move output gl state initialization to own function

11 years agocompositor-drm: Don't do a mode set on drm_output_switch_mode()
Ander Conselvan de Oliveira [Fri, 14 Dec 2012 15:37:28 +0000 (13:37 -0200)]
compositor-drm: Don't do a mode set on drm_output_switch_mode()

At this point, we reallocated the gbm surface, but we don't have an
fb with the right size to use. If we're going to a larger mode, the fb
would be too small and the mode set would fail. Besides, the repaint
logic will already do a mode set if necessary, so rely on that instead.

11 years agocompositor-drm: Fix a return value check in drm_output_switch_mode()
Ander Conselvan de Oliveira [Fri, 14 Dec 2012 15:37:27 +0000 (13:37 -0200)]
compositor-drm: Fix a return value check in drm_output_switch_mode()

gl_rederer_output_create() returns 0 on success, but drm compositor
would consider this a failure.

11 years agocompositor: Don't let pointers get outside of an output on mode switch
Ander Conselvan de Oliveira [Fri, 14 Dec 2012 15:37:26 +0000 (13:37 -0200)]
compositor: Don't let pointers get outside of an output on mode switch

When an output suffers a mode switch, it is possible that a pointer
was inside the old output area but falls outside of it with the new
size. In that case, move the cursor to the output's bottom-right
corner. Otherwise, there's a crash in clip_pointer_motion().

11 years agocompositor: Update output state after mode switch
Ander Conselvan de Oliveira [Fri, 14 Dec 2012 15:37:25 +0000 (13:37 -0200)]
compositor: Update output state after mode switch

After a mode switch, the output region and transformation matrix need
to be updated. The call to weston_output_move() would do the former but
not the latter, but calling that when the output remains in the same
coordinate doesn't make much sense. Instead, update this state and the
transformation matrix in weston_output_mode_switch().

11 years agotransformed: Add options for using debuging driver fullscreen method
Ander Conselvan de Oliveira [Fri, 14 Dec 2012 15:37:24 +0000 (13:37 -0200)]
transformed: Add options for using debuging driver fullscreen method

Add options for setting width, height and using the driver fullscreen
method.

11 years agowindow: Allow clients to choose the fullscreen method
Ander Conselvan de Oliveira [Fri, 14 Dec 2012 15:37:23 +0000 (13:37 -0200)]
window: Allow clients to choose the fullscreen method

11 years agoclients: Add screenshooter-client-protocol.h to screenshooter sources
Kristian Høgsberg [Fri, 14 Dec 2012 15:18:39 +0000 (10:18 -0500)]
clients: Add screenshooter-client-protocol.h to screenshooter sources

11 years agotests: remove test logs on 'make clean'
Pekka Paalanen [Thu, 13 Dec 2012 08:01:25 +0000 (10:01 +0200)]
tests: remove test logs on 'make clean'

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agotests: check wl_display_roundtrip() for errors
Pekka Paalanen [Wed, 12 Dec 2012 12:26:41 +0000 (14:26 +0200)]
tests: check wl_display_roundtrip() for errors

Add a macro that wraps wl_display_roundtrip() and check for errors. It
is a macro, so that the assert would show the relevant file and line
number.

This will also catch protocol errors, that would go unnoticed otherwise.

All roundtrips in tests are replaced with the check.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agotests: set client log handler
Pekka Paalanen [Wed, 12 Dec 2012 12:26:40 +0000 (14:26 +0200)]
tests: set client log handler

Otherwise we cannot normally see protocol errors etc. in the test
output.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoupdate git ignores
Pekka Paalanen [Wed, 12 Dec 2012 12:26:39 +0000 (14:26 +0200)]
update git ignores

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agotests: write logs to files
Pekka Paalanen [Wed, 12 Dec 2012 12:26:38 +0000 (14:26 +0200)]
tests: write logs to files

This cleans up the 'make check' output considerably. When all goes well,
you will only see the "PASS" line for each of $TESTS.

Weston logs into a separate file than stdout and stderr, so server logs
end up in one file per test, and other output to another file per test.

'make distclean' does not remove the tests/logs/ directory.

Also changes the weston-tests-env interpreter to bash, since I think &>
and ${1/.la/.so} might be bashisms.

11 years agotests: Convert remaining module tests to not use test-runner.c
Kristian Høgsberg [Wed, 12 Dec 2012 04:22:16 +0000 (23:22 -0500)]
tests: Convert remaining module tests to not use test-runner.c

The remaining module tests don't need to fork and talk to a test client,
so just convert them to regular modules and let them handle running their
tests themselves.  Then drop test-runner.[ch].

11 years agotests: Remove client-test test
Kristian Høgsberg [Wed, 12 Dec 2012 04:16:11 +0000 (23:16 -0500)]
tests: Remove client-test test

This test case is the last user of the test-client code and it only
tests launching the test-client.  In other words it's a minimal test
of the framework we're dropping, so just drop this test.

11 years agotests: Port text-test to new test framework
Kristian Høgsberg [Wed, 12 Dec 2012 04:03:56 +0000 (23:03 -0500)]
tests: Port text-test to new test framework

So much simpler this way and the test suite is now back too 100% pass.

11 years agotests: Drop yield() helper function
Kristian Høgsberg [Wed, 12 Dec 2012 03:17:35 +0000 (22:17 -0500)]
tests: Drop yield() helper function

Remaining use case was when we move the pointer.  This doesn't change
geometry so we can just use a wl_display_roundtrip() to make sure
we get the request to the server and receive the resulting events.

11 years agokeyboard-test: Use wl_display_roundtrip() instead of yield()
Kristian Høgsberg [Wed, 12 Dec 2012 03:00:50 +0000 (22:00 -0500)]
keyboard-test: Use wl_display_roundtrip() instead of yield()

As for button-test, a wl_display_roundtrip is sufficient here.  The
yield() between wl_test_activate_surface() and wl_test_send_key() is
also not needed, since the two requests will arrive at the server in
order, and will activate the surface first, then send a key event.

11 years agobutton-test: Use wl_display_roundtrip instead of yield()
Kristian Høgsberg [Wed, 12 Dec 2012 02:56:13 +0000 (21:56 -0500)]
button-test: Use wl_display_roundtrip instead of yield()

A round trip is sufficient here.  We need to make sure that the server
has received the wl_test request and that we've received the event
that the request triggers.  The wl_display_roundtrip() helper does
exactly that: it sends a wl_display.sync request, which will hit the
server after the wl_test requests and thus the wl_callback.done event
will come back after the server has seen all the previous requests and
after we've handled all preceeding event.

11 years agoweston-test-client-helper: Use a frame callback to flush surface geometry
Kristian Høgsberg [Wed, 12 Dec 2012 02:49:13 +0000 (21:49 -0500)]
weston-test-client-helper: Use a frame callback to flush surface geometry

When moving a test surface, use a frame callback to make sure the
surface has been moved and the geometry updated.  The compositor may
delay updating the transform matrices, but once we get the frame
callback we know the surface has been repainted and the geometry
updated.

11 years agotests: Convert button-test to new test extension
U. Artie Eoff [Fri, 7 Dec 2012 21:50:34 +0000 (13:50 -0800)]
tests: Convert button-test to new test extension

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

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
11 years agotests: Convert event-test to new test extension
U. Artie Eoff [Fri, 7 Dec 2012 21:50:33 +0000 (13:50 -0800)]
tests: Convert event-test to new test extension

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

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
11 years agotests: Convert keyboard-test to new test extension
U. Artie Eoff [Fri, 7 Dec 2012 21:50:32 +0000 (13:50 -0800)]
tests: Convert keyboard-test to new test extension

This adds a weston-test-runner for the weston test extension and
some weston test client helper methods.

Converted keyboard-test to use the new test interface, runner,
and helper methods.

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

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
11 years agotests: Allow weston-tests-env to process different test types
U. Artie Eoff [Fri, 7 Dec 2012 21:50:31 +0000 (13:50 -0800)]
tests: Allow weston-tests-env to process different test types

The weston-tests-env script needs to be able to handle weston
test extension style tests as well as module style tests.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
11 years agotests: Rename weston-test to weston-tests-env
U. Artie Eoff [Fri, 7 Dec 2012 21:50:30 +0000 (13:50 -0800)]
tests: Rename weston-test to weston-tests-env

Renamed weston-test test environment script to weston-tests-env
to avoid ambiguity with weston-test.c (the weston test extension).

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
11 years agotests: Define and implement a test protocol extension.
U. Artie Eoff [Fri, 7 Dec 2012 21:50:29 +0000 (13:50 -0800)]
tests: Define and implement a test protocol extension.

The weston test extension, called weston-test.so, can be loaded
from the "modules" configuration option on the command line
or in the .ini file.

Clients can bind to the "wl_test" interface to interact with
the weston test extension.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
11 years agosimple-egl: Remove old obsolete fbo and color_rbo fields
Kristian Høgsberg [Tue, 11 Dec 2012 20:23:14 +0000 (15:23 -0500)]
simple-egl: Remove old obsolete fbo and color_rbo fields

Finally a commit that actually makes simple-egl simpler.

11 years agoLink matrix.c into weston again
Kristian Høgsberg [Fri, 7 Dec 2012 20:00:32 +0000 (15:00 -0500)]
Link matrix.c into weston again

We want to make sure that the matrix symbols are exported from weston and
that modules get them from there.  To do that, we pull matrix.[ch] out of
libshared and back into weston.  calibrator now also links to matrix.[ch]
and we add a IN_WESTON define to enable the WL_EXPORT macro when compiled
inside weston.

11 years agocompositor-drm: Dont pass ARGB format to addfb2 for primary fbs
Kristian Høgsberg [Fri, 7 Dec 2012 17:37:58 +0000 (12:37 -0500)]
compositor-drm: Dont pass ARGB format to addfb2 for primary fbs

Trying to create a ARGB framebuffer for scanout results in EINVAL when
trying to queue the pageflip.  This patch overrides the format we pass
to addfb2 in case of primary buffers like we do for sprites.

Since we always have to inspect and override the format, don't try to
look up the format in drm_fb_get_from_bo().  Instead return format from
drm_output_check_scanout_format().

Rename drm_surface_format_supported() to drm_output_check_sprite_format()
and make it follow the same convention.

We started scanning out ARGB surfaces in commit e920941032979d.

11 years agocompositor-drm: Use overlays for ARGB surfaces if they are opaque
Ander Conselvan de Oliveira [Fri, 7 Dec 2012 11:18:11 +0000 (13:18 +0200)]
compositor-drm: Use overlays for ARGB surfaces if they are opaque

Since the call to drmModeSetPlane() fails with EINVAL if the supplied
fb has an unsupported format (which is the case of ARGB8888), the fb
format needs to be overridden.

11 years agoshell: Remove confusing case fall-through
Rob Bradford [Thu, 6 Dec 2012 12:07:48 +0000 (12:07 +0000)]
shell: Remove confusing case fall-through

This avoids calling weston_surface_set_position twice on the same surface. The
second call has no effect in many cases because sx and sy
are usually zero on this path.

This change now means that any sx/sy values passed into ::attach will be
ignored on the first attach for popup surfaces. This similar to the behaviour
for other surface types.

11 years agoweston-launch: Add some error reporting for weston-launch
Rob Bradford [Wed, 5 Dec 2012 18:47:11 +0000 (18:47 +0000)]
weston-launch: Add some error reporting for weston-launch

This also avoids us passing (size_t)(-1 * sizeof(gid_t)) into malloc

11 years agocompositor: Cleanup if we can't find the symbol in the module
Rob Bradford [Wed, 5 Dec 2012 18:47:10 +0000 (18:47 +0000)]
compositor: Cleanup if we can't find the symbol in the module

11 years agobacklight: Revamp error handling code to not leak the directory
Rob Bradford [Wed, 5 Dec 2012 18:47:09 +0000 (18:47 +0000)]
backlight: Revamp error handling code to not leak the directory

To neatly free the directory pointer allocated by opendir(), adjust the error
handling paths to go through to the err label.

11 years agotty: Clean up completely if switching vt fails
Rob Bradford [Wed, 5 Dec 2012 18:47:08 +0000 (18:47 +0000)]
tty: Clean up completely if switching vt fails

The code under the "err" label closes the file descriptor and frees the
allocated memory.

11 years agoxwayland: Close fd opened for lockfile on error path
Rob Bradford [Wed, 5 Dec 2012 18:47:07 +0000 (18:47 +0000)]
xwayland: Close fd opened for lockfile on error path

11 years agobacklight: Remove unnecessary and confusing NULL checks
Rob Bradford [Wed, 5 Dec 2012 18:47:06 +0000 (18:47 +0000)]
backlight: Remove unnecessary and confusing NULL checks

At this point path must point to an allocated string since otherwise the
asprintf that makes the allocation would have failed and we would have
returned earlier.

11 years agocompositor: Avoid sending event for invalid point
Rob Bradford [Wed, 5 Dec 2012 18:47:05 +0000 (18:47 +0000)]
compositor: Avoid sending event for invalid point

Avoid sending a touch down event using uninitialised surface x/y co-ordinates.
Instead present a log message about this unexpected case.

11 years agoscreenshooter: Report an error if we fail to open the file
Rob Bradford [Wed, 5 Dec 2012 18:47:04 +0000 (18:47 +0000)]
screenshooter: Report an error if we fail to open the file

11 years agoscreenshooter: Abandon recording rather than use unitialised format
Rob Bradford [Wed, 5 Dec 2012 18:47:03 +0000 (18:47 +0000)]
screenshooter: Abandon recording rather than use unitialised format

Abandon the recording if the format is not known - this prevents the use of an
unitialised member is the header struct.

11 years agorpi: Don't assign planes for surfaces with transformed buffers
Ander Conselvan de Oliveira [Tue, 27 Nov 2012 15:34:52 +0000 (17:34 +0200)]
rpi: Don't assign planes for surfaces with transformed buffers

Reported-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor-drm: Support overlays with transformed buffers
Ander Conselvan de Oliveira [Wed, 5 Dec 2012 13:14:04 +0000 (15:14 +0200)]
compositor-drm: Support overlays with transformed buffers

Make overlays work when the client uses a buffer with the same
transformation as the output.

In order to calculate the destination rectangle, the same logic in
weston_surface_to_buffer_float() is needed, but with the output
dimensions instead. For that reason, this patch generalizes this
function into weston_transformed_{coord,rect} and moves it to util.c.
The surface functions are then implemented using those.

11 years agowindow: add a note about freeing shm buffers
Pekka Paalanen [Tue, 4 Dec 2012 14:01:16 +0000 (16:01 +0200)]
window: add a note about freeing shm buffers

After a client has been double-buffering, and then switches to
single-buffering, it should release the 2nd buffer. That never happens
in practice here, so just add a comment and a check in case it ever
occurs in the future.

If we implemented the releasing now, it would be difficult to test.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoclients: destroy wl_registry on exit
Pekka Paalanen [Tue, 4 Dec 2012 14:01:15 +0000 (16:01 +0200)]
clients: destroy wl_registry on exit

Plug an insignificant memory leak in demo programs that bother to clean
up at all.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor: move texture_damage into renderer private
Pekka Paalanen [Tue, 4 Dec 2012 13:58:16 +0000 (15:58 +0200)]
compositor: move texture_damage into renderer private

Only the gl_renderer uses this field.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor: move pitch into renderer private
Pekka Paalanen [Tue, 4 Dec 2012 13:58:15 +0000 (15:58 +0200)]
compositor: move pitch into renderer private

It is not used by anything but the gl-renderer.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor: add early wl_buffer.release
Pekka Paalanen [Tue, 4 Dec 2012 13:58:14 +0000 (15:58 +0200)]
compositor: add early wl_buffer.release

A client can reliably avoid allocating a second buffer per surface, if
the compositor sends the wl_buffer.release event before the frame
callback. To enable clients' single-buffering, release the wl_buffer
early if possible. Otherwise clients will double-buffer.

Releasing early is not possible, if the backend needs the buffer for
migrating a surface to or from a non-primary weston_plane. In that case,
a new buffer must arrive, before the old can be released. Backends will
indicate this by setting weston_surface:keep_buffer to 1 in
assign_planes().

A proper buffer reference in the backends would be better than the
keep_buffer flag, but that would require a per-surface backend private.

The rpi and DRM backends are updated to set keep_buffer, other backends
do not support planes, so do not have to set it.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agogl: take, hold, and release a buffer reference
Pekka Paalanen [Tue, 4 Dec 2012 13:58:13 +0000 (15:58 +0200)]
gl: take, hold, and release a buffer reference

Instead of relying on the compositor core to keep the wl_buffer around
and unreleased, take a new reference to it in gl-renderer. This makes
sure in the future, that the gl-renderer always has the buffer at hand,
client misbehaviour excluded.

The reference is taken in the attach callback, and released in the
flush_damage callback after copy to texture, or when the next attach
callback with a different buffer occurs.

If the surface is not on the primary plane, the buffer is not released
in flush_damage. This ensures, that the buffer stays valid in case the
surface migrates to the primary plane later.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor: introduce weston_buffer_reference
Pekka Paalanen [Tue, 4 Dec 2012 13:58:12 +0000 (15:58 +0200)]
compositor: introduce weston_buffer_reference

The wl_buffer reference counting API has been inconsistent. You would
manually increment the refcount and register a destroy listener, as
opposed to calling weston_buffer_post_release(), which internally
decremented the refcount, and then removing a list item.

Replace both cases with a single function:
weston_buffer_reference(weston_buffer_reference *ref, wl_buffer *buffer)

Buffer is assigned to ref->buffer, while taking care of all the refcounting
and release posting. You take a reference by passing a non-NULL buffer, and
release a reference by passing NULL as buffer. The function uses an
internal wl_buffer destroy listener, so the pointer gets reset on
destruction automatically.

This is inspired by the pipe_resource_reference() of Mesa, and modified
by krh's suggestion to add struct weston_buffer_reference.

Additionally, when a surface gets destroyed, the associated wl_buffer
will send a release event. Often the buffer is already destroyed on
client side, so the event will be discarded by libwayland-client.

Compositor-drm.c is converted to use weston_buffer_reference.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor: do not flush shm buffer on destroy
Pekka Paalanen [Tue, 4 Dec 2012 13:58:11 +0000 (15:58 +0200)]
compositor: do not flush shm buffer on destroy

The protocol does not require us to flush_damage() on wl_buffer
destruction. In fact, by the time the server receives this request, the
client may have already clobbered the buffer's storage, so we could be
reading undefined data. Instead, just forget about the buffer. The
protocol already says, that a client must not destroy a buffer that is
being read by the server, or the window contents become undefined.

The practical reason for this change is that the following commit can
consolidate wl_buffer destruction listener handlers.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor: do not release if re-attaching buffer
Pekka Paalanen [Tue, 4 Dec 2012 13:58:10 +0000 (15:58 +0200)]
compositor: do not release if re-attaching buffer

If a client called wl_surface.attach with the same wl_buffer as
previously, the compositor would mistakenly send a release on that
buffer. This will cause problems only when clients start to properly use
the wl_buffer.release event.

Do not send wl_buffer.release if the same buffer is attached again.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoshell: Do not remove input panel layer when locked
Jan Arne Petersen [Mon, 3 Dec 2012 14:36:02 +0000 (15:36 +0100)]
shell: Do not remove input panel layer when locked

Do not remove the input panel layer from the layer list when the
shell is locked in hide_input_panels().

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

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agocompositor-drm: Load calibration values from udev
Rob Bradford [Mon, 3 Dec 2012 19:44:17 +0000 (19:44 +0000)]
compositor-drm: Load calibration values from udev

This allows the values to be associated with an specific input device using
udev rules.

11 years agoevdev: Apply calibration values to absolute events
Rob Bradford [Mon, 3 Dec 2012 19:44:16 +0000 (19:44 +0000)]
evdev: Apply calibration values to absolute events

Store a set of calibration values per device - these calibration values are
just applied to the absolute motion events.

11 years agoclients: Add a touchscreen calibration tool
Rob Bradford [Mon, 3 Dec 2012 19:44:15 +0000 (19:44 +0000)]
clients: Add a touchscreen calibration tool

This a basic calibration tool designed for "in factory" calibration of a touch
screen. The constants for the calibration functions:

x' = Ax + By + C and
y' = Dx + Ey + F

Are printed on stdout when the calibration is completed.

11 years agoMove matrix.[ch] to shared
Rob Bradford [Mon, 3 Dec 2012 19:44:14 +0000 (19:44 +0000)]
Move matrix.[ch] to shared

This means it can be used for the calibration tool.

11 years agoevdev: Include the device capabilities in the debugging
Rob Bradford [Mon, 3 Dec 2012 19:44:13 +0000 (19:44 +0000)]
evdev: Include the device capabilities in the debugging

11 years agogl-renderer: Force call to glUseProgram() when activating debug binding
Ander Conselvan de Oliveira [Mon, 3 Dec 2012 15:08:11 +0000 (17:08 +0200)]
gl-renderer: Force call to glUseProgram() when activating debug binding

When redrawing surfaces, use_shader() checks if the desired shader is
already in use to avoid a call to glUseProgram(). However, once the
debug binding is activated, that same check would prevent the usage of
the recompiled shaders until something cause a different shader to be
passed to use_shader().

11 years agoxwayland: Staticize weston_wm_set_selection and read_and_dump_property
Tiago Vignatti [Fri, 30 Nov 2012 19:19:59 +0000 (17:19 -0200)]
xwayland: Staticize weston_wm_set_selection and read_and_dump_property

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
11 years agoxwayland: Remove useless structure
Tiago Vignatti [Fri, 30 Nov 2012 19:19:58 +0000 (17:19 -0200)]
xwayland: Remove useless structure

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
11 years agoxwm: Rename get_resources function
Tiago Vignatti [Fri, 30 Nov 2012 19:19:57 +0000 (17:19 -0200)]
xwm: Rename get_resources function

It's pure WM-related function, so use the same 'weston_wm_' prefix that others
in the same file are already using.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
11 years agoxwayland: Standardize 'wxs' for weston_xserver variables
Tiago Vignatti [Fri, 30 Nov 2012 19:19:56 +0000 (17:19 -0200)]
xwayland: Standardize 'wxs' for weston_xserver variables

It was already being used in most of launcher.c and window-manager.c, so let's
make a standard everywhere now.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
11 years agowindow: Add a widget default cursor convenience helper
Kristian Høgsberg [Fri, 30 Nov 2012 19:54:35 +0000 (14:54 -0500)]
window: Add a widget default cursor convenience helper

In a few cases, we set a motion handler just to be able to set a fixed
cursor.  This adds a default cursor helper that can be used in those cases.
In case of the 'transformed' test case, we also avoid a brief flicker
of the pointer cursor, which is set on enter when the move grab is lifted.

11 years agowindow: change boolean to flags in toysurface::prepare()
Pekka Paalanen [Fri, 30 Nov 2012 11:37:27 +0000 (13:37 +0200)]
window: change boolean to flags in toysurface::prepare()

Change the boolean parameter 'resize_hint' into a bitmask 'flags'.

Note, that this flags is very different to the other flags used in
creating the toysurface implementations. They do not make sense to mix
one way or the other. Prepare() cannot change the surface type, and
surface constructors do not care for dynamic hint flags.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoclients: Replace transformed with a toytoolkit implementation
Ander Conselvan de Oliveira [Fri, 30 Nov 2012 15:34:26 +0000 (17:34 +0200)]
clients: Replace transformed with a toytoolkit implementation

11 years agowindow: Add a way to retrieve a window's output transform
Ander Conselvan de Oliveira [Fri, 30 Nov 2012 15:34:25 +0000 (17:34 +0200)]
window: Add a way to retrieve a window's output transform

Add the output_get_transform() entry point and an output handler hook.

11 years agowindow: Let clients set buffer transformations
Ander Conselvan de Oliveira [Fri, 30 Nov 2012 15:34:24 +0000 (17:34 +0200)]
window: Let clients set buffer transformations

When a window's buffer transformation is set, its buffers are
reallocated with the appropriate size (i.e., with width and height
swapped in case of 90 or 270 degree rotation).

11 years agowindow: Honour opaque field for windows without a frame
Ander Conselvan de Oliveira [Fri, 30 Nov 2012 15:34:23 +0000 (17:34 +0200)]
window: Honour opaque field for windows without a frame

Since the opaque region was set in frame_resize_handler(), if a client
created a frameless window setting the toplevel widget as opaque would
have no effect.

This patch fixes this by moving the call wl_surface_set_opaque_region()
to idle_resize(), and changing the latter function to set the whole
window as opaque if its toplevel widget has the opaque flag set.

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>