.gitignore | 4 Makefile.am | 5 clients/.gitignore | 40 clients/Makefile.am | 177 +- clients/calibrator.c | 277 +++ clients/clickdot.c | 8 clients/cliptest.c | 8 clients/desktop-shell.c | 436 +++-- clients/dnd.c | 54 clients/editor.c | 1109 +++++++++---- clients/eventdemo.c | 6 clients/flower.c | 23 clients/fullscreen.c | 368 ++++ clients/gears.c | 5 clients/image.c | 7 clients/keyboard.c | 655 ++++++-- clients/multi-resource.c | 597 +++++++ clients/nested-client.c | 361 ++++ clients/nested.c | 627 +++++++ clients/resizor.c | 8 clients/screenshot.c | 37 clients/simple-egl.c | 120 + clients/simple-shm.c | 129 + clients/simple-touch.c | 21 clients/smoke.c | 26 clients/subsurfaces.c | 801 ++++++++++ clients/tablet-shell.c | 95 - clients/terminal.c | 221 ++ clients/transformed.c | 313 +++ clients/view.c | 10 clients/weston-info.c | 46 clients/weston-simple-im.c | 518 ++++++ clients/window.c | 2508 ++++++++++++++++++++++++------- clients/window.h | 151 + clients/wscreensaver.c | 6 configure.ac | 319 +++ debian/README.Debian | 18 debian/changelog | 77 debian/control | 17 debian/rules | 6 debian/source/format | 2 debian/weston.examples | 1 debian/weston.install | 14 debian/weston.lintian-overrides | 1 debian/weston.postinst | 42 man/.gitignore | 1 man/Makefile.am | 1 man/weston.ini.man | 43 man/weston.man | 8 protocol/Makefile.am | 2 protocol/desktop-shell.xml | 31 protocol/input-method.xml | 201 ++ protocol/subsurface.xml | 244 +++ protocol/text-cursor-position.xml | 11 protocol/text.xml | 339 +++- shared/Makefile.am | 3 shared/cairo-util.c | 33 shared/cairo-util.h | 3 shared/config-parser.c | 475 ++++- shared/config-parser.h | 59 shared/image-loader.c | 3 shared/matrix.c | 273 +++ shared/matrix.h | 82 + shared/option-parser.c | 7 shared/os-compatibility.c | 2 shared/zalloc.h | 42 src/.gitignore | 5 src/Makefile.am | 190 ++ src/android-framebuffer.cpp | 93 - src/android-framebuffer.h | 54 src/animation.c | 335 ++++ src/bindings.c | 295 +++ src/clipboard.c | 65 src/cms-colord.c | 554 ++++++ src/cms-helper.c | 132 + src/cms-helper.h | 72 src/cms-static.c | 113 + src/compositor-android.c | 510 ------ src/compositor-drm.c | 2122 ++++++++++++++------------ src/compositor-fbdev.c | 977 ++++++++++++ src/compositor-headless.c | 206 ++ src/compositor-rdp.c | 1093 +++++++++++++ src/compositor-rpi.c | 843 ++++++++++ src/compositor-wayland.c | 359 +--- src/compositor-x11.c | 907 +++++++---- src/compositor.c | 3041 +++++++++++++++++++++----------------- src/compositor.h | 678 ++++++-- src/data-device.c | 664 ++++++++ src/evdev-touchpad.c | 72 src/evdev.c | 358 ++-- src/evdev.h | 27 src/filter.c | 2 src/filter.h | 2 src/gl-renderer.c | 1865 +++++++++++++++++++++++ src/gl-renderer.h | 105 + src/gles2-renderer.c | 1307 ---------------- src/input.c | 1757 +++++++++++++++++++++ src/launcher-util.c | 317 +++ src/launcher-util.h | 19 src/libbacklight.c | 11 src/log.c | 40 src/matrix.c | 250 --- src/matrix.h | 64 src/noop-renderer.c | 98 + src/pixman-renderer.c | 753 +++++++++ src/pixman-renderer.h | 37 src/rpi-bcm-stubs.h | 314 +++ src/rpi-renderer.c | 1595 +++++++++++++++++++ src/rpi-renderer.h | 48 src/screenshooter.c | 219 +- src/shell.c | 2028 +++++++++++++++++-------- src/spring-tool.c | 66 src/tablet-shell.c | 108 - src/text-backend.c | 791 +++++++-- src/tty.c | 292 --- src/udev-seat.c | 375 ++++ src/udev-seat.h | 55 src/util.c | 521 ------ src/vaapi-recorder.c | 1155 ++++++++++++++ src/vaapi-recorder.h | 35 src/version.h.in | 37 src/vertex-clipping.c | 317 +++ src/vertex-clipping.h | 65 src/weston-egl-ext.h | 25 src/weston-launch.c | 421 +++-- src/weston-launch.h | 12 src/weston.pc.in | 11 src/xwayland/Makefile.am | 8 src/xwayland/dnd.c | 274 +++ src/xwayland/hash.c | 2 src/xwayland/launcher.c | 126 - src/xwayland/selection.c | 91 - src/xwayland/window-manager.c | 916 ++++++++--- src/xwayland/xwayland.h | 35 src/zoom.c | 49 tests/.gitignore | 8 tests/Makefile.am | 112 + tests/config-parser-test.c | 203 ++ tests/event-test.c | 69 tests/matrix-test.c | 2 tests/setbacklight.c | 2 tests/subsurface-test.c | 549 ++++++ tests/surface-global-test.c | 2 tests/surface-test.c | 2 tests/text-test.c | 139 + tests/vertex-clip-test.c | 219 ++ tests/weston-test-client-helper.c | 75 tests/weston-test-client-helper.h | 9 tests/weston-test-runner.c | 139 + tests/weston-test-runner.h | 52 tests/weston-test.c | 56 tests/weston-tests-env | 17 tests/xwayland-test.c | 142 + wayland-scanner.mk | 8 wcap/README | 2 wcap/main.c | 68 wcap/wcap-decode.c | 3 weston.ini | 65 158 files changed, 34660 insertions(+), 9803 deletions(-)
New commits: commit 8d28e4f512eb50474f401ae6ec7937321fe2f6e1 Author: Timo Aaltonen <tjaal...@ubuntu.com> Date: Thu Nov 7 18:22:40 2013 +0200 release to trusty diff --git a/debian/changelog b/debian/changelog index 1b8c7f5..0d8b138 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -weston (1.3.0-1ubuntu1) UNRELEASED; urgency=low +weston (1.3.0-1ubuntu1) trusty; urgency=low * rules, weston.install: Build using --with-cairo=image, since our cairo disabled the gl backend. Don't try to install the screensaver. commit 18bd54bace05b7d07b7d750a9c0b0e690c7b5ad3 Author: Timo Aaltonen <tjaal...@ubuntu.com> Date: Thu Nov 7 18:22:26 2013 +0200 rules, weston.install: Build using --with-cairo=image, since our cairo disabled the gl backend. Don't try to install the screensaver. diff --git a/debian/changelog b/debian/changelog index d8e69dd..1b8c7f5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +weston (1.3.0-1ubuntu1) UNRELEASED; urgency=low + + * rules, weston.install: Build using --with-cairo=image, since our cairo + disabled the gl backend. Don't try to install the screensaver. + + -- Timo Aaltonen <tjaal...@ubuntu.com> Thu, 07 Nov 2013 18:10:33 +0200 + weston (1.3.0-1) unstable; urgency=low [ Sven Joachim ] diff --git a/debian/rules b/debian/rules index 1a2030a..7d257e8 100755 --- a/debian/rules +++ b/debian/rules @@ -2,7 +2,7 @@ override_dh_auto_configure: dh_auto_configure -- --disable-libunwind --libexec=/usr/lib/weston \ - --with-cairo=gl + --with-cairo=image override_dh_auto_test: # the test suite does not 100% pass in headless mode diff --git a/debian/weston.install b/debian/weston.install index d3235e9..7aa3be1 100644 --- a/debian/weston.install +++ b/debian/weston.install @@ -7,7 +7,6 @@ usr/include/weston usr/lib/weston/weston-tablet-shell usr/lib/weston/weston-desktop-shell usr/lib/weston/weston-keyboard -usr/lib/weston/weston-screensaver usr/lib/weston/weston-screenshooter usr/lib/weston/weston-simple-im usr/lib/*/pkgconfig/weston.pc commit 93ae88b893ad12d67f369c6b601e014b13bddea2 Author: Héctor Orón Martínez <zu...@debian.org> Date: Fri Oct 11 13:03:47 2013 +0200 Release debian version 1.3.0-1 to unstable Signed-off-by: Héctor Orón Martínez <zu...@debian.org> diff --git a/debian/changelog b/debian/changelog index c17632a..d8e69dd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,6 @@ -weston (1.2.2-1) UNRELEASED; urgency=low +weston (1.3.0-1) unstable; urgency=low [ Sven Joachim ] - * New upstream release (Closes: #719144). * Bump libwayland-dev build-depends to (>= 1.2.0). [ Laurent Bigonville ] @@ -23,7 +22,12 @@ weston (1.2.2-1) UNRELEASED; urgency=low * rules: Explicitly enable cairo-gl so that weston-screensaver gets built. - -- Laurent Bigonville <bi...@debian.org> Sun, 11 Aug 2013 17:59:21 +0200 + [ Hector Oron ] + * New upstream release (1.3.0) (Closes: #719144). + * Add myself to Uploaders. + * Switch Debian source format to 3.0 quilt + + -- Hector Oron <zu...@debian.org> Fri, 11 Oct 2013 13:03:04 +0200 weston (1.1.1-1) experimental; urgency=low commit 78c8e8f35359ad8bd9298ffd64eb99e974ea8d23 Author: Héctor Orón Martínez <zu...@debian.org> Date: Fri Oct 11 13:04:45 2013 +0200 Drop leftover from merge Signed-off-by: Héctor Orón Martínez <zu...@debian.org> diff --git a/src/tty.c b/src/tty.c deleted file mode 100644 index 6002f36..0000000 --- a/src/tty.c +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright © 2010 Intel Corporation - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of the copyright holders not be used in - * advertising or publicity pertaining to distribution of the software - * without specific, written prior permission. The copyright holders make - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "config.h" - -#include <termios.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <fcntl.h> -#include <signal.h> -#include <linux/kd.h> -#include <linux/vt.h> -#include <linux/major.h> -#include <sys/ioctl.h> -#include <sys/types.h> -#include <sys/stat.h> - -#include "compositor.h" - -/* Introduced in 2.6.38 */ -#ifndef K_OFF -#define K_OFF 0x04 -#endif - -struct tty { - struct weston_compositor *compositor; - int fd; - struct termios terminal_attributes; - - struct wl_event_source *input_source; - struct wl_event_source *vt_source; - tty_vt_func_t vt_func; - int vt, starting_vt, has_vt; - int kb_mode; -}; - -static int vt_handler(int signal_number, void *data) -{ - struct tty *tty = data; - - if (tty->has_vt) { - tty->vt_func(tty->compositor, TTY_LEAVE_VT); - tty->has_vt = 0; - - ioctl(tty->fd, VT_RELDISP, 1); - } else { - ioctl(tty->fd, VT_RELDISP, VT_ACKACQ); - - tty->vt_func(tty->compositor, TTY_ENTER_VT); - tty->has_vt = 1; - } - - return 1; -} - -static int -on_tty_input(int fd, uint32_t mask, void *data) -{ - struct tty *tty = data; - - /* Ignore input to tty. We get keyboard events from evdev */ - tcflush(tty->fd, TCIFLUSH); - - return 1; -} - -static int -try_open_vt(struct tty *tty) -{ - int tty0, fd; - char filename[16]; - - tty0 = open("/dev/tty0", O_WRONLY | O_CLOEXEC); - if (tty0 < 0) { - weston_log("could not open tty0: %m\n"); - return -1; - } - - if (ioctl(tty0, VT_OPENQRY, &tty->vt) < 0 || tty->vt == -1) { - weston_log("could not open tty0: %m\n"); - close(tty0); - return -1; - } - - close(tty0); - snprintf(filename, sizeof filename, "/dev/tty%d", tty->vt); - weston_log("compositor: using new vt %s\n", filename); - fd = open(filename, O_RDWR | O_NOCTTY | O_CLOEXEC); - if (fd < 0) - return fd; - - return fd; -} - -int -tty_activate_vt(struct tty *tty, int vt) -{ - return ioctl(tty->fd, VT_ACTIVATE, vt); -} - -struct tty * -tty_create(struct weston_compositor *compositor, tty_vt_func_t vt_func, - int tty_nr) -{ - struct termios raw_attributes; - struct vt_mode mode = { 0 }; - int ret; - struct tty *tty; - struct wl_event_loop *loop; - struct stat buf; - char filename[16]; - struct vt_stat vts; - - tty = malloc(sizeof *tty); - if (tty == NULL) - return NULL; - - memset(tty, 0, sizeof *tty); - tty->compositor = compositor; - tty->vt_func = vt_func; - - tty->fd = weston_environment_get_fd("WESTON_TTY_FD"); - if (tty->fd < 0) - tty->fd = STDIN_FILENO; - - if (tty_nr > 0) { - snprintf(filename, sizeof filename, "/dev/tty%d", tty_nr); - weston_log("compositor: using %s\n", filename); - tty->fd = open(filename, O_RDWR | O_NOCTTY | O_CLOEXEC); - tty->vt = tty_nr; - } else if (fstat(tty->fd, &buf) == 0 && - major(buf.st_rdev) == TTY_MAJOR && - minor(buf.st_rdev) > 0) { - if (tty->fd == STDIN_FILENO) - tty->fd = fcntl(STDIN_FILENO, F_DUPFD_CLOEXEC, 0); - tty->vt = minor(buf.st_rdev); - } else { - /* Fall back to try opening a new VT. This typically - * requires root. */ - tty->fd = try_open_vt(tty); - } - - if (tty->fd <= 0) { - weston_log("failed to open tty: %m\n"); - free(tty); - return NULL; - } - - if (ioctl(tty->fd, VT_GETSTATE, &vts) == 0) - tty->starting_vt = vts.v_active; - else - tty->starting_vt = tty->vt; - - if (tty->starting_vt != tty->vt) { - if (ioctl(tty->fd, VT_ACTIVATE, tty->vt) < 0 || - ioctl(tty->fd, VT_WAITACTIVE, tty->vt) < 0) { - weston_log("failed to switch to new vt\n"); - goto err; - } - } - - if (tcgetattr(tty->fd, &tty->terminal_attributes) < 0) { - weston_log("could not get terminal attributes: %m\n"); - goto err; - } - - /* Ignore control characters and disable echo */ - raw_attributes = tty->terminal_attributes; - cfmakeraw(&raw_attributes); - - /* Fix up line endings to be normal (cfmakeraw hoses them) */ - raw_attributes.c_oflag |= OPOST | OCRNL; - - if (tcsetattr(tty->fd, TCSANOW, &raw_attributes) < 0) - weston_log("could not put terminal into raw mode: %m\n"); - - loop = wl_display_get_event_loop(compositor->wl_display); - - ioctl(tty->fd, KDGKBMODE, &tty->kb_mode); - ret = ioctl(tty->fd, KDSKBMODE, K_OFF); - if (ret) { - ret = ioctl(tty->fd, KDSKBMODE, K_RAW); - if (ret) { - weston_log("failed to set keyboard mode on tty: %m\n"); - goto err_attr; - } - - tty->input_source = wl_event_loop_add_fd(loop, tty->fd, - WL_EVENT_READABLE, - on_tty_input, tty); - if (!tty->input_source) - goto err_kdkbmode; - } - - ret = ioctl(tty->fd, KDSETMODE, KD_GRAPHICS); - if (ret) { - weston_log("failed to set KD_GRAPHICS mode on tty: %m\n"); - goto err_kdkbmode; - } - - tty->has_vt = 1; - mode.mode = VT_PROCESS; - mode.relsig = SIGUSR1; - mode.acqsig = SIGUSR1; - if (ioctl(tty->fd, VT_SETMODE, &mode) < 0) { - weston_log("failed to take control of vt handling\n"); - goto err_kdmode; - } - - tty->vt_source = - wl_event_loop_add_signal(loop, SIGUSR1, vt_handler, tty); - if (!tty->vt_source) - goto err_vtmode; - - return tty; - -err_vtmode: - ioctl(tty->fd, VT_SETMODE, &mode); - -err_kdmode: - ioctl(tty->fd, KDSETMODE, KD_TEXT); - -err_kdkbmode: - if (tty->input_source) - wl_event_source_remove(tty->input_source); - ioctl(tty->fd, KDSKBMODE, tty->kb_mode); - -err_attr: - tcsetattr(tty->fd, TCSANOW, &tty->terminal_attributes); - -err: - close(tty->fd); - free(tty); - return NULL; -} - -void tty_reset(struct tty *tty) -{ - struct vt_mode mode = { 0 }; - - if (ioctl(tty->fd, KDSKBMODE, tty->kb_mode)) - weston_log("failed to restore keyboard mode: %m\n"); - - if (ioctl(tty->fd, KDSETMODE, KD_TEXT)) - weston_log("failed to set KD_TEXT mode on tty: %m\n"); - - if (tcsetattr(tty->fd, TCSANOW, &tty->terminal_attributes) < 0) - weston_log("could not restore terminal to canonical mode\n"); - - mode.mode = VT_AUTO; - if (ioctl(tty->fd, VT_SETMODE, &mode) < 0) - weston_log("could not reset vt handling\n"); - - if (tty->has_vt && tty->vt != tty->starting_vt) { - ioctl(tty->fd, VT_ACTIVATE, tty->starting_vt); - ioctl(tty->fd, VT_WAITACTIVE, tty->starting_vt); - } -} - -void -tty_destroy(struct tty *tty) -{ - if (tty->input_source) - wl_event_source_remove(tty->input_source); - - wl_event_source_remove(tty->vt_source); - - tty_reset(tty); - - close(tty->fd); - - free(tty); -} commit 9e045fd804fb739f383ca9610ec1c0546ec178c8 Author: Héctor Orón Martínez <zu...@debian.org> Date: Fri Oct 11 12:59:04 2013 +0200 Switch to Debian source format 3.0 quilt Signed-off-by: Héctor Orón Martínez <zu...@debian.org> diff --git a/debian/source/format b/debian/source/format index d3827e7..163aaf8 100644 --- a/debian/source/format +++ b/debian/source/format @@ -1 +1 @@ -1.0 +3.0 (quilt) commit 8cd89055aa5b817ff272698f6d88acc0af8293aa Author: Héctor Orón Martínez <zu...@debian.org> Date: Fri Oct 11 12:58:45 2013 +0200 Add myself to Uploaders. Signed-off-by: Héctor Orón Martínez <zu...@debian.org> diff --git a/debian/control b/debian/control index 9bd3a84..52468ea 100644 --- a/debian/control +++ b/debian/control @@ -5,6 +5,7 @@ Maintainer: Debian X Strike Force <debian-x@lists.debian.org> Uploaders: Cyril Brulebois <k...@debian.org>, Mike Gabriel <sunwea...@debian.org>, + Héctor Orón Martínez <zu...@debian.org>, Build-Depends: debhelper (>= 9), quilt, commit 95659c03219b057d9d703b04cf89bc0329ce947a Author: Kristian Høgsberg <k...@bitplanet.net> Date: Wed Oct 9 16:20:50 2013 -0700 configure.ac: Bump version to 1.3 diff --git a/configure.ac b/configure.ac index 302075e..5abf65f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ m4_define([weston_major_version], [1]) -m4_define([weston_minor_version], [2]) -m4_define([weston_micro_version], [92]) +m4_define([weston_minor_version], [3]) +m4_define([weston_micro_version], [0]) m4_define([weston_version], [weston_major_version.weston_minor_version.weston_micro_version]) commit 6a11a8ab544d7fa186374ca5f26c2f403409f223 Author: Kristian Høgsberg <k...@bitplanet.net> Date: Wed Oct 9 15:17:01 2013 -0700 Revert "Resize the shell when the mode is switched" This breaks panel resizing as it doesn't account for output rotation. https://bugs.freedesktop.org/show_bug.cgi?id=70249 This reverts commit a356f7b1ef08fd9c2ad69cada89d68841e71a6bb. diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c index 1a5a94f..599c0a5 100644 --- a/clients/desktop-shell.c +++ b/clients/desktop-shell.c @@ -1160,13 +1160,6 @@ output_handle_mode(void *data, int height, int refresh) { - struct output *output = (struct output *)data; - - if (flags & WL_OUTPUT_MODE_CURRENT) { - window_schedule_resize(output->panel->window, width, 32); - window_schedule_resize(output->background->window, - width, height); - } } static void commit cb406f1afd560762f60c27f7a88fd9f65c15041f Author: Kristian Høgsberg <k...@bitplanet.net> Date: Wed Oct 9 10:54:03 2013 -0700 input: Don't send modifiers if client doesn't have a pointer resource This fixes an uninitialized serial error, were we could send out the modifier event even if the client didn't have a pointer resource. We send out the modifier event to let clients know the modifer mask when they receive a pointer button event. Thus, if the client doesn't have a pointer we don't need to send the modifier event. Additionally we would send out the modifier event with an uninitialized serial number. Finally, this commit restores the order of sending the modifier event before the enter, like it used to be. Not likely to be an issue, since the client will always receive the modifier event before any button event, but it's a little nicer to give the client the modifier events before it receives any pointer events. diff --git a/src/input.c b/src/input.c index 1313b52..a994fb9 100644 --- a/src/input.c +++ b/src/input.c @@ -489,6 +489,12 @@ weston_pointer_set_focus(struct weston_pointer *pointer, serial = wl_display_next_serial(display); + if (kbd && kbd->focus != pointer->focus) + send_modifiers_to_client_in_list(surface_client, + &kbd->resource_list, + serial, + kbd); + move_resources_for_client(focus_resource_list, &pointer->resource_list, surface_client); @@ -503,15 +509,6 @@ weston_pointer_set_focus(struct weston_pointer *pointer, pointer->focus_serial = serial; } - if (kbd && surface && surface->resource && kbd->focus != pointer->focus) { - struct wl_client *surface_client = - wl_resource_get_client(surface->resource); - send_modifiers_to_client_in_list(surface_client, - &kbd->resource_list, - serial, - kbd); - } - pointer->focus = surface; wl_signal_emit(&pointer->focus_signal, pointer); } commit b4659eb15959091ab8bab8e20ed66233d39922fa Author: Tomeu Vizoso <to...@tomeuvizoso.net> Date: Mon Oct 7 11:02:20 2013 +0200 rpi: Add support for EGL buffers The EGL implementation on the RPi allocates a front and a back DispmanX resources for each EGLSurface, which we composite along the others. diff --git a/src/rpi-bcm-stubs.h b/src/rpi-bcm-stubs.h index d3ffd4b..703cd77 100644 --- a/src/rpi-bcm-stubs.h +++ b/src/rpi-bcm-stubs.h @@ -296,6 +296,13 @@ vc_dispmanx_snapshot(DISPMANX_DISPLAY_HANDLE_T display, return -1; } +struct wl_resource; +static inline DISPMANX_RESOURCE_HANDLE_T +vc_dispmanx_get_handle_from_wl_buffer(struct wl_resource *_buffer) +{ + return DISPMANX_NO_HANDLE; +} + /* from /opt/vc/include/EGL/eglplatform.h */ typedef struct { diff --git a/src/rpi-renderer.c b/src/rpi-renderer.c index 3ba5fc4..6b39e8c 100644 --- a/src/rpi-renderer.c +++ b/src/rpi-renderer.c @@ -35,6 +35,12 @@ #include "compositor.h" #include "rpi-renderer.h" +#ifdef ENABLE_EGL +#include <EGL/egl.h> +#include <EGL/eglext.h> +#include "weston-egl-ext.h" +#endif + /* * Dispmanx API offers alpha-blended overlays for hardware compositing. * The final composite consists of dispmanx elements, and their contents: @@ -84,6 +90,17 @@ struct rpi_resource { struct rpir_output; +struct rpir_egl_buffer { + struct weston_buffer_reference buffer_ref; + DISPMANX_RESOURCE_HANDLE_T resource_handle; +}; + +enum buffer_type { + BUFFER_TYPE_NULL, + BUFFER_TYPE_SHM, + BUFFER_TYPE_EGL +}; + struct rpir_surface { struct weston_surface *surface; @@ -102,7 +119,12 @@ struct rpir_surface { struct rpi_resource *back; pixman_region32_t prev_damage; + struct rpir_egl_buffer *egl_front; + struct rpir_egl_buffer *egl_back; + struct rpir_egl_buffer *egl_old_front; + struct weston_buffer_reference buffer_ref; + enum buffer_type buffer_type; }; struct rpir_output { @@ -125,6 +147,15 @@ struct rpi_renderer { struct weston_renderer base; int single_buffer; + +#ifdef ENABLE_EGL + EGLDisplay egl_display; + + PFNEGLBINDWAYLANDDISPLAYWL bind_display; + PFNEGLUNBINDWAYLANDDISPLAYWL unbind_display; + PFNEGLQUERYWAYLANDBUFFERWL query_buffer; +#endif + int has_bind_display; }; static inline struct rpir_surface * @@ -335,6 +366,7 @@ rpir_surface_create(struct rpi_renderer *renderer) surface->back = &surface->resources[0]; else surface->back = &surface->resources[1]; + surface->buffer_type = BUFFER_TYPE_NULL; pixman_region32_init(&surface->prev_damage); @@ -354,6 +386,24 @@ rpir_surface_destroy(struct rpir_surface *surface) rpi_resource_release(&surface->resources[1]); DBG("rpir_surface %p destroyed (%u)\n", surface, surface->handle); + if (surface->egl_back != NULL) { + weston_buffer_reference(&surface->egl_back->buffer_ref, NULL); + free(surface->egl_back); + surface->egl_back = NULL; + } + + if (surface->egl_front != NULL) { + weston_buffer_reference(&surface->egl_front->buffer_ref, NULL); + free(surface->egl_front); + surface->egl_front = NULL; + } + + if (surface->egl_old_front != NULL) { + weston_buffer_reference(&surface->egl_old_front->buffer_ref, NULL); + free(surface->egl_old_front); + surface->egl_old_front = NULL; + } + free(surface); } @@ -472,8 +522,16 @@ rpir_surface_compute_rects(struct rpir_surface *surface, src_x = 0 << 16; src_y = 0 << 16; - src_width = surface->front->width << 16; - src_height = surface->front->height << 16; + + if (surface->buffer_type == BUFFER_TYPE_EGL) { + struct weston_buffer *buffer = surface->egl_front->buffer_ref.buffer; + + src_width = buffer->width << 16; + src_height = buffer->height << 16; + } else { + src_width = surface->front->width << 16; + src_height = surface->front->height << 16; + } weston_matrix_multiply(&matrix, &output->matrix); @@ -647,6 +705,10 @@ rpir_surface_compute_rects(struct rpir_surface *surface, return -1; } + /* EGL buffers will be upside-down related to what DispmanX expects */ + if (surface->buffer_type == BUFFER_TYPE_EGL) + flipt ^= TRANSFORM_VFLIP; + vc_dispmanx_rect_set(src_rect, src_x, src_y, src_width, src_height); vc_dispmanx_rect_set(dst_rect, dst_x, dst_y, dst_width, dst_height); *flipmask = flipt; @@ -681,6 +743,22 @@ vc_image2dispmanx_transform(VC_IMAGE_TRANSFORM_T t) } } + +static DISPMANX_RESOURCE_HANDLE_T +rpir_surface_get_resource(struct rpir_surface *surface) +{ + switch (surface->buffer_type) { + case BUFFER_TYPE_SHM: + case BUFFER_TYPE_NULL: + return surface->front->handle; + case BUFFER_TYPE_EGL: + if (surface->egl_front != NULL) + return surface->egl_front->resource_handle; + default: + return DISPMANX_NO_HANDLE; + } +} + static int rpir_surface_dmx_add(struct rpir_surface *surface, struct rpir_output *output, DISPMANX_UPDATE_HANDLE_T update, int layer) @@ -700,6 +778,13 @@ rpir_surface_dmx_add(struct rpir_surface *surface, struct rpir_output *output, VC_RECT_T src_rect; VC_IMAGE_TRANSFORM_T flipmask; int ret; + DISPMANX_RESOURCE_HANDLE_T resource_handle; + + resource_handle = rpir_surface_get_resource(surface); + if (resource_handle == DISPMANX_NO_HANDLE) { + weston_log("%s: no buffer yet, aborting\n", __func__); + return 0; + } ret = rpir_surface_compute_rects(surface, &src_rect, &dst_rect, &flipmask); @@ -711,17 +796,14 @@ rpir_surface_dmx_add(struct rpir_surface *surface, struct rpir_output *output, output->display, layer, &dst_rect, - surface->front->handle, + resource_handle, &src_rect, DISPMANX_PROTECTION_NONE, &alphasetup, NULL /* clamp */, vc_image2dispmanx_transform(flipmask)); - DBG("rpir_surface %p add %u, alpha %f\n", surface, surface->handle, - surface->surface->alpha); - - if (surface->handle == DISPMANX_NO_HANDLE) - return -1; + DBG("rpir_surface %p add %u, alpha %f resource %d\n", surface, + surface->handle, surface->surface->alpha, resource_handle); return 1; } @@ -758,6 +840,20 @@ rpir_surface_dmx_move(struct rpir_surface *surface, /* XXX: return early, if all attributes stay the same */ + if (surface->buffer_type == BUFFER_TYPE_EGL) { + DISPMANX_RESOURCE_HANDLE_T resource_handle; + + resource_handle = rpir_surface_get_resource(surface); + if (resource_handle == DISPMANX_NO_HANDLE) { + weston_log("%s: no buffer yet, aborting\n", __func__); + return 0; + } + + vc_dispmanx_element_change_source(update, + surface->handle, + resource_handle); + } + ret = rpir_surface_compute_rects(surface, &src_rect, &dst_rect, &flipmask); if (ret < 0) @@ -835,8 +931,31 @@ rpir_surface_update(struct rpir_surface *surface, struct rpir_output *output, int ret; int obscured; - if (need_swap) - rpir_surface_swap_pointers(surface); + if (surface->buffer_type == BUFFER_TYPE_EGL) { + if (surface->egl_back != NULL) { + assert(surface->egl_old_front == NULL); + surface->egl_old_front = surface->egl_front; + surface->egl_front = surface->egl_back; + surface->egl_back = NULL; + } + if (surface->egl_front->buffer_ref.buffer == NULL) { + weston_log("warning: client unreffed current front buffer\n"); + + wl_list_remove(&surface->link); + if (surface->handle == DISPMANX_NO_HANDLE) { + wl_list_init(&surface->link); + } else { + rpir_surface_dmx_remove(surface, update); + wl_list_insert(&output->surface_cleanup_list, + &surface->link); + } + + goto out; + } + } else { + if (need_swap) + rpir_surface_swap_pointers(surface); + } obscured = is_surface_not_visible(surface->surface); if (obscured) { @@ -1133,40 +1252,72 @@ static void rpi_renderer_attach(struct weston_surface *base, struct weston_buffer *buffer) { /* Called every time a client commits an attach. */ - static int warned; struct rpir_surface *surface = to_rpir_surface(base); assert(surface); if (!surface) return; - if (buffer && !wl_shm_buffer_get(buffer->resource) && !warned) { - weston_log("Error: non-wl_shm buffers not supported.\n"); - warned = 1; - return; + if (surface->buffer_type == BUFFER_TYPE_SHM) { + if (!surface->single_buffer) + /* XXX: need to check if in middle of update */ + rpi_resource_release(surface->back); -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/e1vesnv-0001dm...@vasks.debian.org