[PATCH weston 1/2 v5] simple-dmabuf-drm: nv12: properly fill Y plane
We want 0..255 values, not 0..254. Signed-off-by: Emilio Pozuelo Monfort --- No changes in this version. clients/simple-dmabuf-drm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c index bd0f9224..5bc5323e 100644 --- a/clients/simple-dmabuf-drm.c +++ b/clients/simple-dmabuf-drm.c @@ -347,7 +347,7 @@ fill_content(struct buffer *my_buf, uint64_t modifier) for (y = 0; y < my_buf->height * 2/3; y++) { pix8 = my_buf->mmap + y * my_buf->stride; for (x = 0; x < my_buf->width; x++) - *pix8++ = x % 0xff; + *pix8++ = x % 256; } /* second plane (CbCr) is half the size of Y plane (last 1/3 of the buffer) */ -- 2.18.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 2/2] simple-dmabuf-drm: use GBM generic calls
No need to write libdrm driver specific code for each supported driver, we can just let GBM call the right one for us now. Signed-off-by: Emilio Pozuelo Monfort --- Some improvements from Daniel (thanks!). I also added missing error messages, formatting fixes and a logic error in your improvements that caused NV12 to abort if create_bo was working fine. No changes to XRGB, so that's likely to still fail for you. I suspect a bug in mesa's i965 code, I can look at that separately. Cheers, Emilio clients/simple-dmabuf-drm.c | 444 ++-- configure.ac| 2 +- 2 files changed, 122 insertions(+), 324 deletions(-) diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c index 5bc5323e..5cbd2bb1 100644 --- a/clients/simple-dmabuf-drm.c +++ b/clients/simple-dmabuf-drm.c @@ -41,21 +41,11 @@ #include #include -#include - -#ifdef HAVE_LIBDRM_INTEL -#include -#include -#endif -#ifdef HAVE_LIBDRM_FREEDRENO -#include -#endif -#ifdef HAVE_LIBDRM_ETNAVIV -#include -#endif +#include #include #include +#include "shared/helpers.h" #include "shared/zalloc.h" #include "xdg-shell-unstable-v6-client-protocol.h" #include "fullscreen-shell-unstable-v1-client-protocol.h" @@ -65,14 +55,10 @@ #define DRM_FORMAT_MOD_LINEAR 0 #endif -struct buffer; - /* Possible options that affect the displayed image */ #define OPT_Y_INVERTED 1 /* contents has y axis inverted */ #define OPT_IMMEDIATE 2 /* create wl_buffer immediately */ -#define ALIGN(v, a) ((v + a - 1) & ~(a - 1)) - struct display { struct wl_display *display; struct wl_registry *registry; @@ -86,46 +72,24 @@ struct display { int req_dmabuf_immediate; }; -struct drm_device { - int fd; - char *name; - - int (*alloc_bo)(struct buffer *buf); - void (*free_bo)(struct buffer *buf); - int (*export_bo_to_prime)(struct buffer *buf); - int (*map_bo)(struct buffer *buf); - void (*unmap_bo)(struct buffer *buf); - void (*device_destroy)(struct buffer *buf); -}; - struct buffer { struct wl_buffer *buffer; int busy; - struct drm_device *dev; int drm_fd; + struct gbm_device *dev; + struct gbm_bo *bo; + struct gbm_bo *bo2; -#ifdef HAVE_LIBDRM_INTEL - drm_intel_bufmgr *bufmgr; - drm_intel_bo *intel_bo; -#endif /* HAVE_LIBDRM_INTEL */ -#if HAVE_LIBDRM_FREEDRENO - struct fd_device *fd_dev; - struct fd_bo *fd_bo; -#endif /* HAVE_LIBDRM_FREEDRENO */ -#if HAVE_LIBDRM_ETNAVIV - struct etna_device *etna_dev; - struct etna_bo *etna_bo; -#endif /* HAVE_LIBDRM_ETNAVIV */ - - uint32_t gem_handle; int dmabuf_fd; - uint8_t *mmap; + int dmabuf_fd2; + void *mmap; + void *mmap2; int width; int height; - int bpp; - unsigned long stride; + uint32_t stride; + uint32_t stride2; int format; }; @@ -161,170 +125,6 @@ static const struct wl_buffer_listener buffer_listener = { buffer_release }; - -#ifdef HAVE_LIBDRM_INTEL -static int -intel_alloc_bo(struct buffer *my_buf) -{ - /* XXX: try different tiling modes for testing FB modifiers. */ - uint32_t tiling = I915_TILING_NONE; - - assert(my_buf->bufmgr); - - my_buf->intel_bo = drm_intel_bo_alloc_tiled(my_buf->bufmgr, "test", - my_buf->width, my_buf->height, - (my_buf->bpp / 8), , - _buf->stride, 0); - - printf("buffer allocated w %d, h %d, stride %lu, size %lu\n", - my_buf->width, my_buf->height, my_buf->stride, my_buf->intel_bo->size); - - if (!my_buf->intel_bo) - return 0; - - if (tiling != I915_TILING_NONE) - return 0; - - return 1; -} - -static void -intel_free_bo(struct buffer *my_buf) -{ - drm_intel_bo_unreference(my_buf->intel_bo); -} - -static int -intel_map_bo(struct buffer *my_buf) -{ - if (drm_intel_gem_bo_map_gtt(my_buf->intel_bo) != 0) - return 0; - - my_buf->mmap = my_buf->intel_bo->virtual; - - return 1; -} - -static int -intel_bo_export_to_prime(struct buffer *buffer) -{ - return drm_intel_bo_gem_export_to_prime(buffer->intel_bo, >dmabuf_fd); -} - -static void -intel_unmap_bo(struct buffer *my_buf) -{ - drm_intel_gem_bo_unmap_gtt(my_buf->intel_bo); -} - -static void -intel_device_destroy(struct buffer *my_buf) -{ - drm_intel_bufmgr_destroy(my_buf->bufmgr); -} - -#endif /* HAVE_LIBDRM_INTEL */ -#ifdef HAVE_LIBDRM_FREEDRENO - -static int -fd_alloc_bo(struct buffer *buf) -{ - int flags = DRM_FREEDRENO_GEM_CACHE_WCOMBINE; - int size; - - buf->fd_dev = fd_devic
Re: [PATCH weston 3/4] simple-dmabuf-drm: use GBM generic calls
On 11/07/18 13:55, Daniel Stone wrote: > Hi Emilio, > > On Wed, 11 Jul 2018 at 12:53, Emilio Pozuelo Monfort > wrote: >> As for NV12 support: I tried to make gbm support that in >> backends/dri/gbm_dri.c by adding a mapping to gbm_dri_visuals_table >> from GBM_FORMAT_NV12 to __DRI_IMAGE_FOURCC_NV12 or DRM_FORMAT_NV12, >> but that didn't work. I'm not sure what we can do here. Does anybody >> who know the stack better have any pointers? > > There is no native NV12 support, apart form some special-case handling > when using them as textures. For NV12, you would want to create two > separate BOs - one with GBM_FORMAT_R8 (luma/Y), and one with > GBM_FORMAT_RG88 (chroma/UV), and fill those like you would fill the > two planes of a native NV12 surface. They can then be combined and > sent to the compositor as two planes of a single NV12 image. Aha, thanks! v4 now has working NV12 support. Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 3/3 v4] simple-dmabuf-drm: use GBM generic calls
No need to write libdrm driver specific code for each supported driver, we can just let GBM call the right one for us now. Signed-off-by: Emilio Pozuelo Monfort --- v4: now with working NV12, (thanks Daniel!). clients/simple-dmabuf-drm.c | 411 configure.ac| 2 +- 2 files changed, 90 insertions(+), 323 deletions(-) diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c index 4f1da878..198d88e8 100644 --- a/clients/simple-dmabuf-drm.c +++ b/clients/simple-dmabuf-drm.c @@ -41,21 +41,11 @@ #include #include -#include - -#ifdef HAVE_LIBDRM_INTEL -#include -#include -#endif -#ifdef HAVE_LIBDRM_FREEDRENO -#include -#endif -#ifdef HAVE_LIBDRM_ETNAVIV -#include -#endif +#include #include #include +#include "shared/helpers.h" #include "shared/zalloc.h" #include "xdg-shell-unstable-v6-client-protocol.h" #include "fullscreen-shell-unstable-v1-client-protocol.h" @@ -65,14 +55,10 @@ #define DRM_FORMAT_MOD_LINEAR 0 #endif -struct buffer; - /* Possible options that affect the displayed image */ #define OPT_Y_INVERTED 1 /* contents has y axis inverted */ #define OPT_IMMEDIATE 2 /* create wl_buffer immediately */ -#define ALIGN(v, a) ((v + a - 1) & ~(a - 1)) - struct display { struct wl_display *display; struct wl_registry *registry; @@ -86,46 +72,24 @@ struct display { int req_dmabuf_immediate; }; -struct drm_device { - int fd; - char *name; - - int (*alloc_bo)(struct buffer *buf); - void (*free_bo)(struct buffer *buf); - int (*export_bo_to_prime)(struct buffer *buf); - int (*map_bo)(struct buffer *buf); - void (*unmap_bo)(struct buffer *buf); - void (*device_destroy)(struct buffer *buf); -}; - struct buffer { struct wl_buffer *buffer; int busy; - struct drm_device *dev; int drm_fd; + struct gbm_device *dev; + struct gbm_bo *bo; + struct gbm_bo *bo2; -#ifdef HAVE_LIBDRM_INTEL - drm_intel_bufmgr *bufmgr; - drm_intel_bo *intel_bo; -#endif /* HAVE_LIBDRM_INTEL */ -#if HAVE_LIBDRM_FREEDRENO - struct fd_device *fd_dev; - struct fd_bo *fd_bo; -#endif /* HAVE_LIBDRM_FREEDRENO */ -#if HAVE_LIBDRM_ETNAVIV - struct etna_device *etna_dev; - struct etna_bo *etna_bo; -#endif /* HAVE_LIBDRM_ETNAVIV */ - - uint32_t gem_handle; int dmabuf_fd; - uint8_t *mmap; + int dmabuf_fd2; + void *mmap; + void *mmap2; int width; int height; - int bpp; - unsigned long stride; + uint32_t stride; + uint32_t stride2; int format; }; @@ -161,170 +125,6 @@ static const struct wl_buffer_listener buffer_listener = { buffer_release }; - -#ifdef HAVE_LIBDRM_INTEL -static int -intel_alloc_bo(struct buffer *my_buf) -{ - /* XXX: try different tiling modes for testing FB modifiers. */ - uint32_t tiling = I915_TILING_NONE; - - assert(my_buf->bufmgr); - - my_buf->intel_bo = drm_intel_bo_alloc_tiled(my_buf->bufmgr, "test", - my_buf->width, my_buf->height, - (my_buf->bpp / 8), , - _buf->stride, 0); - - printf("buffer allocated w %d, h %d, stride %lu, size %lu\n", - my_buf->width, my_buf->height, my_buf->stride, my_buf->intel_bo->size); - - if (!my_buf->intel_bo) - return 0; - - if (tiling != I915_TILING_NONE) - return 0; - - return 1; -} - -static void -intel_free_bo(struct buffer *my_buf) -{ - drm_intel_bo_unreference(my_buf->intel_bo); -} - -static int -intel_map_bo(struct buffer *my_buf) -{ - if (drm_intel_gem_bo_map_gtt(my_buf->intel_bo) != 0) - return 0; - - my_buf->mmap = my_buf->intel_bo->virtual; - - return 1; -} - -static int -intel_bo_export_to_prime(struct buffer *buffer) -{ - return drm_intel_bo_gem_export_to_prime(buffer->intel_bo, >dmabuf_fd); -} - -static void -intel_unmap_bo(struct buffer *my_buf) -{ - drm_intel_gem_bo_unmap_gtt(my_buf->intel_bo); -} - -static void -intel_device_destroy(struct buffer *my_buf) -{ - drm_intel_bufmgr_destroy(my_buf->bufmgr); -} - -#endif /* HAVE_LIBDRM_INTEL */ -#ifdef HAVE_LIBDRM_FREEDRENO - -static int -fd_alloc_bo(struct buffer *buf) -{ - int flags = DRM_FREEDRENO_GEM_CACHE_WCOMBINE; - int size; - - buf->fd_dev = fd_device_new(buf->drm_fd); - buf->stride = ALIGN(buf->width, 32) * buf->bpp / 8; - size = buf->stride * buf->height; - buf->fd_dev = fd_device_new(buf->drm_fd); - buf->fd_bo = fd_bo_new(buf->fd_dev, size, flags); - - if (!buf->fd_bo) -
[PATCH weston v4] simple-dmabuf-drm: nv12: properly fill Y plane
We want 0..255 values, not 0..254. Signed-off-by: Emilio Pozuelo Monfort --- New patch. clients/simple-dmabuf-drm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c index 4f88f12e..198d88e8 100644 --- a/clients/simple-dmabuf-drm.c +++ b/clients/simple-dmabuf-drm.c @@ -147,7 +147,7 @@ fill_content(struct buffer *my_buf, uint64_t modifier) for (y = 0; y < my_buf->height; y++) { pix8 = my_buf->mmap + y * my_buf->stride; for (x = 0; x < my_buf->width; x++) - *pix8++ = x % 0xff; + *pix8++ = x % 256; } /* second plane (CbCr) is half the size of Y */ for (y = 0; y < my_buf->height; y++) { -- 2.18.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 1/3 v4] simple-dmabuf-drm: require zwp_linux_dmabuf_v1 v3
We effectively require it as we don't react to dmabuf_format, only to dmabuf_modifiers, so there's a chance we may not get the supported formats information at all. Signed-off-by: Emilio Pozuelo Monfort --- v4: No changes here. clients/simple-dmabuf-drm.c | 12 +--- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c index fcab30e5..1c8b6f36 100644 --- a/clients/simple-dmabuf-drm.c +++ b/clients/simple-dmabuf-drm.c @@ -85,7 +85,6 @@ struct display { int nv12_format_found; uint64_t nv12_modifier; int req_dmabuf_immediate; - int req_dmabuf_modifiers; }; struct drm_device { @@ -821,16 +820,8 @@ registry_handle_global(void *data, struct wl_registry *registry, d->fshell = wl_registry_bind(registry, id, _fullscreen_shell_v1_interface, 1); } else if (strcmp(interface, "zwp_linux_dmabuf_v1") == 0) { - int ver; - if (d->req_dmabuf_modifiers) - ver = 3; - else if (d->req_dmabuf_immediate) - ver = 2; - else - ver = 1; d->dmabuf = wl_registry_bind(registry, -id, _linux_dmabuf_v1_interface, -ver); +id, _linux_dmabuf_v1_interface, 3); zwp_linux_dmabuf_v1_add_listener(d->dmabuf, _listener, d); } } @@ -861,7 +852,6 @@ create_display(int opts, int format) assert(display->display); display->req_dmabuf_immediate = opts & OPT_IMMEDIATE; - display->req_dmabuf_modifiers = (format == DRM_FORMAT_NV12); /* * hard code format if the platform egl doesn't support format -- 2.18.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 3/4] simple-dmabuf-drm: use GBM generic calls
No need to write libdrm driver specific code for each supported driver, we can just let GBM call the right one for us now. Signed-off-by: Emilio Pozuelo Monfort --- v2: we now pass the correct modifier to fill_content and zwp_linux_buffer_params_v1_add(). Added a new note since I'm not sure if we should call gbm_bo_create_with_modifiers() and pass the NV12 modifier that we know we support. As for NV12 support: I tried to make gbm support that in backends/dri/gbm_dri.c by adding a mapping to gbm_dri_visuals_table from GBM_FORMAT_NV12 to __DRI_IMAGE_FOURCC_NV12 or DRM_FORMAT_NV12, but that didn't work. I'm not sure what we can do here. Does anybody who know the stack better have any pointers? clients/simple-dmabuf-drm.c | 324 configure.ac| 2 +- 2 files changed, 30 insertions(+), 296 deletions(-) diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c index 4f1da878..1d452183 100644 --- a/clients/simple-dmabuf-drm.c +++ b/clients/simple-dmabuf-drm.c @@ -41,18 +41,7 @@ #include #include -#include - -#ifdef HAVE_LIBDRM_INTEL -#include -#include -#endif -#ifdef HAVE_LIBDRM_FREEDRENO -#include -#endif -#ifdef HAVE_LIBDRM_ETNAVIV -#include -#endif +#include #include #include @@ -65,14 +54,10 @@ #define DRM_FORMAT_MOD_LINEAR 0 #endif -struct buffer; - /* Possible options that affect the displayed image */ #define OPT_Y_INVERTED 1 /* contents has y axis inverted */ #define OPT_IMMEDIATE 2 /* create wl_buffer immediately */ -#define ALIGN(v, a) ((v + a - 1) & ~(a - 1)) - struct display { struct wl_display *display; struct wl_registry *registry; @@ -86,46 +71,22 @@ struct display { int req_dmabuf_immediate; }; -struct drm_device { - int fd; - char *name; - - int (*alloc_bo)(struct buffer *buf); - void (*free_bo)(struct buffer *buf); - int (*export_bo_to_prime)(struct buffer *buf); - int (*map_bo)(struct buffer *buf); - void (*unmap_bo)(struct buffer *buf); - void (*device_destroy)(struct buffer *buf); -}; - struct buffer { struct wl_buffer *buffer; int busy; - struct drm_device *dev; int drm_fd; - -#ifdef HAVE_LIBDRM_INTEL - drm_intel_bufmgr *bufmgr; - drm_intel_bo *intel_bo; -#endif /* HAVE_LIBDRM_INTEL */ -#if HAVE_LIBDRM_FREEDRENO - struct fd_device *fd_dev; - struct fd_bo *fd_bo; -#endif /* HAVE_LIBDRM_FREEDRENO */ -#if HAVE_LIBDRM_ETNAVIV - struct etna_device *etna_dev; - struct etna_bo *etna_bo; -#endif /* HAVE_LIBDRM_ETNAVIV */ + struct gbm_device *dev; + struct gbm_bo *bo; uint32_t gem_handle; int dmabuf_fd; - uint8_t *mmap; + void *mmap; int width; int height; int bpp; - unsigned long stride; + uint32_t stride; int format; }; @@ -161,170 +122,6 @@ static const struct wl_buffer_listener buffer_listener = { buffer_release }; - -#ifdef HAVE_LIBDRM_INTEL -static int -intel_alloc_bo(struct buffer *my_buf) -{ - /* XXX: try different tiling modes for testing FB modifiers. */ - uint32_t tiling = I915_TILING_NONE; - - assert(my_buf->bufmgr); - - my_buf->intel_bo = drm_intel_bo_alloc_tiled(my_buf->bufmgr, "test", - my_buf->width, my_buf->height, - (my_buf->bpp / 8), , - _buf->stride, 0); - - printf("buffer allocated w %d, h %d, stride %lu, size %lu\n", - my_buf->width, my_buf->height, my_buf->stride, my_buf->intel_bo->size); - - if (!my_buf->intel_bo) - return 0; - - if (tiling != I915_TILING_NONE) - return 0; - - return 1; -} - -static void -intel_free_bo(struct buffer *my_buf) -{ - drm_intel_bo_unreference(my_buf->intel_bo); -} - -static int -intel_map_bo(struct buffer *my_buf) -{ - if (drm_intel_gem_bo_map_gtt(my_buf->intel_bo) != 0) - return 0; - - my_buf->mmap = my_buf->intel_bo->virtual; - - return 1; -} - -static int -intel_bo_export_to_prime(struct buffer *buffer) -{ - return drm_intel_bo_gem_export_to_prime(buffer->intel_bo, >dmabuf_fd); -} - -static void -intel_unmap_bo(struct buffer *my_buf) -{ - drm_intel_gem_bo_unmap_gtt(my_buf->intel_bo); -} - -static void -intel_device_destroy(struct buffer *my_buf) -{ - drm_intel_bufmgr_destroy(my_buf->bufmgr); -} - -#endif /* HAVE_LIBDRM_INTEL */ -#ifdef HAVE_LIBDRM_FREEDRENO - -static int -fd_alloc_bo(struct buffer *buf) -{ - int flags = DRM_FREEDRENO_GEM_CACHE_WCOMBINE; - int size; - - buf->fd_dev = fd_device_new(buf->drm_fd); - buf->stride = ALIGN(buf->width, 32) * buf->bpp / 8; - size = bu
[PATCH weston 2/4 v3] simple-dmabuf-drm: fix build with --disable-egl
Just rely on getting the supported formats through the dmabuf extension. Signed-off-by: Emilio Pozuelo Monfort --- v3: this now drops the dependency on libEGL clients/simple-dmabuf-drm.c | 11 --- configure.ac| 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c index 1c8b6f36..4f1da878 100644 --- a/clients/simple-dmabuf-drm.c +++ b/clients/simple-dmabuf-drm.c @@ -57,7 +57,6 @@ #include #include "shared/zalloc.h" -#include "shared/platform.h" #include "xdg-shell-unstable-v6-client-protocol.h" #include "fullscreen-shell-unstable-v1-client-protocol.h" #include "linux-dmabuf-unstable-v1-client-protocol.h" @@ -841,7 +840,6 @@ static struct display * create_display(int opts, int format) { struct display *display; - const char *extensions; display = malloc(sizeof *display); if (display == NULL) { @@ -853,15 +851,6 @@ create_display(int opts, int format) display->req_dmabuf_immediate = opts & OPT_IMMEDIATE; - /* -* hard code format if the platform egl doesn't support format -* querying / advertising. -*/ - extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); - if (extensions && !weston_check_egl_extension(extensions, - "EGL_EXT_image_dma_buf_import_modifiers")) - display->xrgb_format_found = 1; - display->registry = wl_display_get_registry(display->display); wl_registry_add_listener(display->registry, _listener, display); diff --git a/configure.ac b/configure.ac index 39168e20..1ecba972 100644 --- a/configure.ac +++ b/configure.ac @@ -391,7 +391,7 @@ AC_ARG_ENABLE(simple-dmabuf-drm-client, [do not build the simple dmabuf drm client]),, enable_simple_dmabuf_drm_client="auto") if ! test "x$enable_simple_dmabuf_drm_client" = "xno"; then - PKG_CHECK_MODULES(SIMPLE_DMABUF_DRM_CLIENT, [wayland-client libdrm egl], [have_simple_dmabuf_libs=yes], + PKG_CHECK_MODULES(SIMPLE_DMABUF_DRM_CLIENT, [wayland-client libdrm], [have_simple_dmabuf_libs=yes], [have_simple_dmabuf_libs=no]) PKG_CHECK_MODULES(LIBDRM_PLATFORM_FREEDRENO, [libdrm_freedreno], -- 2.18.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston] simple-dmabuf-drm: drop dependency on libdrm
Signed-off-by: Emilio Pozuelo Monfort --- clients/simple-dmabuf-drm.c | 32 +++- configure.ac| 2 +- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c index 1d452183..a6c3b16d 100644 --- a/clients/simple-dmabuf-drm.c +++ b/clients/simple-dmabuf-drm.c @@ -42,7 +42,6 @@ #include #include -#include #include #include "shared/zalloc.h" @@ -130,15 +129,8 @@ fill_content(struct buffer *my_buf, uint64_t modifier) assert(my_buf->mmap); - if (my_buf->format == DRM_FORMAT_NV12) { - if (modifier == DRM_FORMAT_MOD_SAMSUNG_64_32_TILE) { - pix = (uint32_t *) my_buf->mmap; - for (y = 0; y < my_buf->height; y++) - memcpy([y * my_buf->width / 4], - _tiled[my_buf->width * y / 4], - my_buf->width); - } - else if (modifier == DRM_FORMAT_MOD_LINEAR) { + if (my_buf->format == GBM_FORMAT_NV12) { + if (modifier == DRM_FORMAT_MOD_LINEAR) { uint8_t *pix8; /* first plane: Y (2/3 of the buffer) */ for (y = 0; y < my_buf->height * 2/3; y++) { @@ -233,8 +225,7 @@ create_dmabuf_buffer(struct display *display, struct buffer *buffer, buffer->width = width; switch (format) { - case DRM_FORMAT_NV12: - format = GBM_FORMAT_NV12; + case GBM_FORMAT_NV12: /* adjust height for allocation of NV12 Y and UV planes */ buffer->height = height * 3 / 2; buffer->bpp = 8; @@ -287,7 +278,7 @@ create_dmabuf_buffer(struct display *display, struct buffer *buffer, modifier >> 32, modifier & 0x); - if (format == DRM_FORMAT_NV12) { + if (format == GBM_FORMAT_NV12) { /* add the second plane params */ zwp_linux_buffer_params_v1_add(params, buffer->dmabuf_fd, @@ -498,12 +489,11 @@ dmabuf_modifiers(void *data, struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf, uint64_t modifier = ((uint64_t) modifier_hi << 32) | modifier_lo; switch (format) { - case DRM_FORMAT_XRGB: + case GBM_FORMAT_XRGB: d->xrgb_format_found = 1; break; - case DRM_FORMAT_NV12: + case GBM_FORMAT_NV12: switch (modifier) { - case DRM_FORMAT_MOD_SAMSUNG_64_32_TILE: case DRM_FORMAT_MOD_LINEAR: d->nv12_format_found = 1; d->nv12_modifier = modifier; @@ -596,8 +586,8 @@ create_display(int opts, int format) wl_display_roundtrip(display->display); - if ((format == DRM_FORMAT_XRGB && !display->xrgb_format_found) || - (format == DRM_FORMAT_NV12 && !display->nv12_format_found)) { + if ((format == GBM_FORMAT_XRGB && !display->xrgb_format_found) || + (format == GBM_FORMAT_NV12 && !display->nv12_format_found)) { fprintf(stderr, "requested format is not available\n"); return NULL; } @@ -661,9 +651,9 @@ static int parse_import_format(const char* c) { if (!strcmp(c, "NV12")) - return DRM_FORMAT_NV12; + return GBM_FORMAT_NV12; else if (!strcmp(c, "XRGB")) - return DRM_FORMAT_XRGB; + return GBM_FORMAT_XRGB; else print_usage_and_exit(); @@ -677,7 +667,7 @@ main(int argc, char **argv) struct display *display; struct window *window; int opts = 0; - int import_format = DRM_FORMAT_XRGB; + int import_format = GBM_FORMAT_XRGB; int c, option_index, ret = 0; static struct option long_options[] = { diff --git a/configure.ac b/configure.ac index 08a5c7b1..24378d9b 100644 --- a/configure.ac +++ b/configure.ac @@ -391,7 +391,7 @@ AC_ARG_ENABLE(simple-dmabuf-drm-client, [do not build the simple dmabuf drm client]),, enable_simple_dmabuf_drm_client="auto") if ! test "x$enable_simple_dmabuf_drm_client" = "xno"; then - PKG_CHECK_MODULES(SIMPLE_DMABUF_DRM_CLIENT, [wayland-client libdrm gbm], [have_simple_dmabuf_libs=yes], + PKG_CHECK_MODULES(SIMPLE_DMABUF_DRM_CLIENT, [wayland-client gbm], [have_simple_dmabuf_libs=yes], [have_simple_dmabuf_libs=no]) PKG_CHECK_MODULES(LIBDRM_PLATFORM_FREEDRENO, [libdrm_freedreno], -- 2.18.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 1/4] simple-dmabuf-drm: require zwp_linux_dmabuf_v1 v3
We effectively require it as we don't react to dmabuf_format, only to dmabuf_modifiers, so there's a chance we may not get the supported formats information at all. Signed-off-by: Emilio Pozuelo Monfort --- clients/simple-dmabuf-drm.c | 12 +--- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c index fcab30e5..1c8b6f36 100644 --- a/clients/simple-dmabuf-drm.c +++ b/clients/simple-dmabuf-drm.c @@ -85,7 +85,6 @@ struct display { int nv12_format_found; uint64_t nv12_modifier; int req_dmabuf_immediate; - int req_dmabuf_modifiers; }; struct drm_device { @@ -821,16 +820,8 @@ registry_handle_global(void *data, struct wl_registry *registry, d->fshell = wl_registry_bind(registry, id, _fullscreen_shell_v1_interface, 1); } else if (strcmp(interface, "zwp_linux_dmabuf_v1") == 0) { - int ver; - if (d->req_dmabuf_modifiers) - ver = 3; - else if (d->req_dmabuf_immediate) - ver = 2; - else - ver = 1; d->dmabuf = wl_registry_bind(registry, -id, _linux_dmabuf_v1_interface, -ver); +id, _linux_dmabuf_v1_interface, 3); zwp_linux_dmabuf_v1_add_listener(d->dmabuf, _listener, d); } } @@ -861,7 +852,6 @@ create_display(int opts, int format) assert(display->display); display->req_dmabuf_immediate = opts & OPT_IMMEDIATE; - display->req_dmabuf_modifiers = (format == DRM_FORMAT_NV12); /* * hard code format if the platform egl doesn't support format -- 2.18.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 0/4] simple-dmabuf-drm improvements
The first patch is new, makes us always parse the formats / modifiers. Currently we don't parse them if we end up binding to version 1 or 2, which can cause us to abort for no good reason. The last patch is just to show how we could remove the libdrm dependency. The problem there is the lack of DRM_FORMAT_MOD_SAMSUNG_64_32_TILE, so we can't apply this yet. Anyway we have a bigger problem with the lack of NV12 support in the GBM patch... Emilio Pozuelo Monfort (4): simple-dmabuf-drm: require zwp_linux_dmabuf_v1 v3 simple-dmabuf-drm: fix build with --disable-egl simple-dmabuf-drm: use GBM generic calls simple-dmabuf-drm: drop dependency on libdrm clients/simple-dmabuf-drm.c | 384 +--- configure.ac| 2 +- 2 files changed, 45 insertions(+), 341 deletions(-) -- 2.18.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston] simple-dmabuf-drm: use GBM generic calls
No need to write libdrm driver specific code for each supported driver, we can just let GBM call the right one for us now. Signed-off-by: Emilio Pozuelo Monfort --- Hi, This simplifies the code a lot, using gbm_bo as Emil suggested. Some problems I still see: - NV12 doesn't work, it seems that backends/dri/gbm_dri.c:gbm_format_to_dri_format() doesn't support it. - We are still linking to libdrm, that's just to get the DRM_FORMAT_* definitions. I suppose we could switch those to GBM_FORMAT_* instead. - Not sure if I need to pass any flags to gbm_bo_create or gbm_bo_map. This works fine for me with XRGB. Thoughts? Comments? Thanks, Emilio clients/simple-dmabuf-drm.c | 320 +++- configure.ac| 2 +- 2 files changed, 27 insertions(+), 295 deletions(-) diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c index fcab30e5..cdee27b3 100644 --- a/clients/simple-dmabuf-drm.c +++ b/clients/simple-dmabuf-drm.c @@ -41,18 +41,7 @@ #include #include -#include - -#ifdef HAVE_LIBDRM_INTEL -#include -#include -#endif -#ifdef HAVE_LIBDRM_FREEDRENO -#include -#endif -#ifdef HAVE_LIBDRM_ETNAVIV -#include -#endif +#include #include #include @@ -66,14 +55,10 @@ #define DRM_FORMAT_MOD_LINEAR 0 #endif -struct buffer; - /* Possible options that affect the displayed image */ #define OPT_Y_INVERTED 1 /* contents has y axis inverted */ #define OPT_IMMEDIATE 2 /* create wl_buffer immediately */ -#define ALIGN(v, a) ((v + a - 1) & ~(a - 1)) - struct display { struct wl_display *display; struct wl_registry *registry; @@ -88,46 +73,22 @@ struct display { int req_dmabuf_modifiers; }; -struct drm_device { - int fd; - char *name; - - int (*alloc_bo)(struct buffer *buf); - void (*free_bo)(struct buffer *buf); - int (*export_bo_to_prime)(struct buffer *buf); - int (*map_bo)(struct buffer *buf); - void (*unmap_bo)(struct buffer *buf); - void (*device_destroy)(struct buffer *buf); -}; - struct buffer { struct wl_buffer *buffer; int busy; - struct drm_device *dev; int drm_fd; - -#ifdef HAVE_LIBDRM_INTEL - drm_intel_bufmgr *bufmgr; - drm_intel_bo *intel_bo; -#endif /* HAVE_LIBDRM_INTEL */ -#if HAVE_LIBDRM_FREEDRENO - struct fd_device *fd_dev; - struct fd_bo *fd_bo; -#endif /* HAVE_LIBDRM_FREEDRENO */ -#if HAVE_LIBDRM_ETNAVIV - struct etna_device *etna_dev; - struct etna_bo *etna_bo; -#endif /* HAVE_LIBDRM_ETNAVIV */ + struct gbm_device *dev; + struct gbm_bo *bo; uint32_t gem_handle; int dmabuf_fd; - uint8_t *mmap; + void *mmap; int width; int height; int bpp; - unsigned long stride; + uint32_t stride; int format; }; @@ -163,170 +124,6 @@ static const struct wl_buffer_listener buffer_listener = { buffer_release }; - -#ifdef HAVE_LIBDRM_INTEL -static int -intel_alloc_bo(struct buffer *my_buf) -{ - /* XXX: try different tiling modes for testing FB modifiers. */ - uint32_t tiling = I915_TILING_NONE; - - assert(my_buf->bufmgr); - - my_buf->intel_bo = drm_intel_bo_alloc_tiled(my_buf->bufmgr, "test", - my_buf->width, my_buf->height, - (my_buf->bpp / 8), , - _buf->stride, 0); - - printf("buffer allocated w %d, h %d, stride %lu, size %lu\n", - my_buf->width, my_buf->height, my_buf->stride, my_buf->intel_bo->size); - - if (!my_buf->intel_bo) - return 0; - - if (tiling != I915_TILING_NONE) - return 0; - - return 1; -} - -static void -intel_free_bo(struct buffer *my_buf) -{ - drm_intel_bo_unreference(my_buf->intel_bo); -} - -static int -intel_map_bo(struct buffer *my_buf) -{ - if (drm_intel_gem_bo_map_gtt(my_buf->intel_bo) != 0) - return 0; - - my_buf->mmap = my_buf->intel_bo->virtual; - - return 1; -} - -static int -intel_bo_export_to_prime(struct buffer *buffer) -{ - return drm_intel_bo_gem_export_to_prime(buffer->intel_bo, >dmabuf_fd); -} - -static void -intel_unmap_bo(struct buffer *my_buf) -{ - drm_intel_gem_bo_unmap_gtt(my_buf->intel_bo); -} - -static void -intel_device_destroy(struct buffer *my_buf) -{ - drm_intel_bufmgr_destroy(my_buf->bufmgr); -} - -#endif /* HAVE_LIBDRM_INTEL */ -#ifdef HAVE_LIBDRM_FREEDRENO - -static int -fd_alloc_bo(struct buffer *buf) -{ - int flags = DRM_FREEDRENO_GEM_CACHE_WCOMBINE; - int size; - - buf->fd_dev = fd_device_new(buf->drm_fd); - buf->stride = ALIGN(buf->width, 32) * buf->bpp / 8; - size = buf->stride * buf->he
Re: [PATCH weston v2] simple-dmabuf-drm: fix build with --disable-egl
On 10/07/18 15:16, Pekka Paalanen wrote: > On Mon, 9 Jul 2018 17:38:49 +0200 > Emilio Pozuelo Monfort wrote: > >> This code calls into EGL to see if the dmabuf import modifiers >> extension is available, and if not it assumes XRGB is supported. >> >> Rather than disabling this client doesn't get build if one disables >> EGL, we can just remove this and stop lying to ourselves. >> >> Signed-off-by: Emilio Pozuelo Monfort >> --- >> >> Alright, this removes this check entirely, which means the client will >> fail if the extension is not available. This is just a test client, so >> it's not the end of the world if that combination is tested. >> >> clients/simple-dmabuf-drm.c | 11 --- >> 1 file changed, 11 deletions(-) >> >> diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c >> index fcab30e5..2a21fe51 100644 >> --- a/clients/simple-dmabuf-drm.c >> +++ b/clients/simple-dmabuf-drm.c >> @@ -57,7 +57,6 @@ >> >> #include >> #include "shared/zalloc.h" >> -#include "shared/platform.h" >> #include "xdg-shell-unstable-v6-client-protocol.h" >> #include "fullscreen-shell-unstable-v1-client-protocol.h" >> #include "linux-dmabuf-unstable-v1-client-protocol.h" >> @@ -850,7 +849,6 @@ static struct display * >> create_display(int opts, int format) >> { >> struct display *display; >> -const char *extensions; >> >> display = malloc(sizeof *display); >> if (display == NULL) { >> @@ -863,15 +861,6 @@ create_display(int opts, int format) >> display->req_dmabuf_immediate = opts & OPT_IMMEDIATE; >> display->req_dmabuf_modifiers = (format == DRM_FORMAT_NV12); >> >> -/* >> - * hard code format if the platform egl doesn't support format >> - * querying / advertising. >> - */ >> -extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); >> -if (extensions && !weston_check_egl_extension(extensions, >> -"EGL_EXT_image_dma_buf_import_modifiers")) >> -display->xrgb_format_found = 1; >> - >> display->registry = wl_display_get_registry(display->display); >> wl_registry_add_listener(display->registry, >> _listener, display); > > Hi Emilio, > > while this change is good, I found a couple more things that this > exposes. > > The app still gets linked to libEGL and libgbm when it should not. > > The code you remove here was hiding a bug where xrgb_format_found > was not set if the dmabuf interface was negotiated to version 2 or 1. > The handler dmabuf_format() has no code. Another patch to fix this > would be nice. Yes, I have just found some problems when testing this patch for another change. So let's not apply this for now, I will see what's going on and send an updated one. Cheers, Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston] simple-dmabuf-drm: fix build with --disable-egl
On 10/07/18 14:52, Pekka Paalanen wrote: > On Tue, 3 Jul 2018 16:46:29 +0100 > Emil Velikov wrote: > >> Hi Emilio, >> >> On 2 July 2018 at 16:22, Emilio Pozuelo Monfort wrote: >>> Signed-off-by: Emilio Pozuelo Monfort >>> --- >>> I tried a build with --disable-egl as I didn't have the headers >>> installed, and it broke here. The EGL usage here seemed optional so I >>> did that, but I didn't run-test the result. If it would make more sense >>> to disable the client if EGL support is disabled I can do that. >>> >>> clients/simple-dmabuf-drm.c | 2 ++ >>> 1 file changed, 2 insertions(+) >>> >> Fairly orthogonal question, aimed at wayland devs: >> >> Why does this "simple" app has per-device code instead of using >> gbm_bo_map/unmap? >> API has been around for 2 years and every half recent Mesa driver has >> support for it. Only the really old ones do not radeon (r100), r200, >> nouveau_vieux and i915. > > Hi Emil, > > I've had the same question before myself, but now that you ask it > again, I don't remember the answer. > > This client was originally written in 2014, and I think at that time > there were no generic APIs to do what it needed to do. Not sure if > there were other reasons as well. I have a semi-working patch for this. I will send it soon to ask for comments. Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston v2] simple-dmabuf-drm: fix build with --disable-egl
This code calls into EGL to see if the dmabuf import modifiers extension is available, and if not it assumes XRGB is supported. Rather than disabling this client doesn't get build if one disables EGL, we can just remove this and stop lying to ourselves. Signed-off-by: Emilio Pozuelo Monfort --- Alright, this removes this check entirely, which means the client will fail if the extension is not available. This is just a test client, so it's not the end of the world if that combination is tested. clients/simple-dmabuf-drm.c | 11 --- 1 file changed, 11 deletions(-) diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c index fcab30e5..2a21fe51 100644 --- a/clients/simple-dmabuf-drm.c +++ b/clients/simple-dmabuf-drm.c @@ -57,7 +57,6 @@ #include #include "shared/zalloc.h" -#include "shared/platform.h" #include "xdg-shell-unstable-v6-client-protocol.h" #include "fullscreen-shell-unstable-v1-client-protocol.h" #include "linux-dmabuf-unstable-v1-client-protocol.h" @@ -850,7 +849,6 @@ static struct display * create_display(int opts, int format) { struct display *display; - const char *extensions; display = malloc(sizeof *display); if (display == NULL) { @@ -863,15 +861,6 @@ create_display(int opts, int format) display->req_dmabuf_immediate = opts & OPT_IMMEDIATE; display->req_dmabuf_modifiers = (format == DRM_FORMAT_NV12); - /* -* hard code format if the platform egl doesn't support format -* querying / advertising. -*/ - extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); - if (extensions && !weston_check_egl_extension(extensions, - "EGL_EXT_image_dma_buf_import_modifiers")) - display->xrgb_format_found = 1; - display->registry = wl_display_get_registry(display->display); wl_registry_add_listener(display->registry, _listener, display); -- 2.18.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 1/2] shot: add test for sub-surface with unmapped parent
This reproduces https://bugs.freedesktop.org/show_bug.cgi?id=94735. Signed-off-by: Emilio Pozuelo Monfort --- tests/reference/subsurface_mapped-00.png | Bin 0 -> 799 bytes tests/reference/subsurface_mapped-01.png | Bin 0 -> 841 bytes tests/subsurface-shot-test.c | 76 +++ 3 files changed, 76 insertions(+) create mode 100644 tests/reference/subsurface_mapped-00.png create mode 100644 tests/reference/subsurface_mapped-01.png diff --git a/tests/reference/subsurface_mapped-00.png b/tests/reference/subsurface_mapped-00.png new file mode 100644 index ..32cf32a0ed11d38b9028eda29109e06c99dce000 GIT binary patch literal 799 zcmeAS@N?(olHy`uVBq!ia0y~yU~~YoKX5Ps$$$P@Hb9Ck$=lt9;Xep2*t>i(0|V0) zPZ!6KiaBpDJMtb-U^sBV(DcSZzE>X)w43YGIc&-r>L$&*16m=d#Wzp$P!YDfm(V literal 0 HcmV?d1 diff --git a/tests/reference/subsurface_mapped-01.png b/tests/reference/subsurface_mapped-01.png new file mode 100644 index ..4e7196a2229a2e63adbf49d32a8c47db043f1c1c GIT binary patch literal 841 zcmeAS@N?(olHy`uVBq!ia0y~yU~~YoKX5Ps$$$P@Hb9Ck$=lt9;Xep2*t>i(0|V1P zPZ!6KiaBquZsa}Wz`){YUu2kf{Oyc6Wg6{8K0QxPoXkGz!#aIUUe52048Hw0nHzqy z@FX&|88AA}Xi)SyAfT4OA#BjXDRF32cth#8hDqmtn^qrc-8g5ndd!V)&);y?A7max zA$7y5+Tmoxxtqcd+SvzD9B$b7_V^p#1HN)}PDa0(vIRL#J}^{z1zopr E02fd6egFUf literal 0 HcmV?d1 diff --git a/tests/subsurface-shot-test.c b/tests/subsurface-shot-test.c index e8bab676..53c54578 100644 --- a/tests/subsurface-shot-test.c +++ b/tests/subsurface-shot-test.c @@ -261,3 +261,79 @@ TEST(subsurface_z_order) if (bufs[i]) buffer_destroy(bufs[i]); } + +TEST(subsurface_mapped) +{ + const char *test_name = get_test_name(); + struct client *client; + struct wl_surface *surface; + struct rectangle clip; + int fail = 0; + struct wl_subcompositor *subco; + struct wl_surface *child; + struct wl_subsurface *sub; + struct buffer *buf, *child_buf; + pixman_color_t red, blue; + + color(, 255, 0, 0); + color(, 0, 0, 255); + + /* Create the client */ + client = create_client(); + assert(client); + client->surface = create_test_surface(client); + surface = client->surface->wl_surface; + + /* move the pointer clearly away from our screenshooting area */ + weston_test_move_pointer(client->test->weston_test, 0, 1, 0, 2, 30); + + client->surface->x = 100; + client->surface->y = 100; + weston_test_move_surface(client->test->weston_test, client->surface->wl_surface, +client->surface->x, client->surface->y); + + wl_surface_set_buffer_scale(surface, 1); + wl_surface_set_buffer_transform(surface, WL_OUTPUT_TRANSFORM_NORMAL); + + wl_surface_commit(surface); + + clip.x = 100; + clip.y = 100; + clip.width = 100; + clip.height = 100; + printf("Clip: %d,%d %d x %d\n", clip.x, clip.y, clip.width, clip.height); + + /* create a wl_surface */ + subco = get_subcompositor(client); + assert(subco); + + child = wl_compositor_create_surface(client->wl_compositor); + assert(child); + + /* make it a sub-surface */ + sub = wl_subcompositor_get_subsurface(subco, child, surface); + assert(sub); + + wl_subsurface_set_desync(sub); + + /* give it content */ + child_buf = surface_commit_color(client, child, , 50, 50); + + /* verify that the sub-surface is not mapped */ + fail += check_screen(client, test_name, 0, , 0); + + /* give a buffer to the parent surface and make sure both the +* parent and the child get mapped */ + buf = surface_commit_color(client, surface, , 100, 100); + + fail += check_screen(client, test_name, 1, , 1); + + printf("Test complete\n"); + assert(fail == 0); + + wl_subsurface_destroy(sub); + wl_surface_destroy(child); + buffer_destroy(child_buf); + wl_surface_destroy(surface); + buffer_destroy(buf); +} -- 2.18.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 2/2] weston-test: don't map surfaces that have no content
If a surface has no content (e.g. no buffer), then it shouldn't be mapped, so that its subsurfaces don't get mapped either. This works fine in the desktop-shell, but is currently broken on the weston-test module. https://bugs.freedesktop.org/show_bug.cgi?id Signed-off-by: Emilio Pozuelo Monfort --- tests/weston-test.c | 9 + 1 file changed, 9 insertions(+) diff --git a/tests/weston-test.c b/tests/weston-test.c index 412eb243..b67bd9fd 100644 --- a/tests/weston-test.c +++ b/tests/weston-test.c @@ -157,12 +157,21 @@ notify_pointer_position(struct weston_test *test, struct wl_resource *resource) weston_test_send_pointer_position(resource, pointer->x, pointer->y); } +static bool +surface_has_content(struct weston_surface *surface) +{ + return surface->width > 0 && surface->height > 0; +} + static void test_surface_committed(struct weston_surface *surface, int32_t sx, int32_t sy) { struct weston_test_surface *test_surface = surface->committed_private; struct weston_test *test = test_surface->test; + if (!surface_has_content(surface)) + return; + if (wl_list_empty(_surface->view->layer_link.link)) weston_layer_entry_insert(>layer.view_list, _surface->view->layer_link); -- 2.18.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 0/2 v3] sub-surface with unmapped parent
I forgot to git add the test ref images. That's the only change here. Emilio Pozuelo Monfort (2): shot: add test for sub-surface with unmapped parent weston-test: don't map surfaces that have no content tests/reference/subsurface_mapped-00.png | Bin 0 -> 799 bytes tests/reference/subsurface_mapped-01.png | Bin 0 -> 841 bytes tests/subsurface-shot-test.c | 76 +++ tests/weston-test.c | 9 +++ 4 files changed, 85 insertions(+) create mode 100644 tests/reference/subsurface_mapped-00.png create mode 100644 tests/reference/subsurface_mapped-01.png -- 2.18.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 0/2] add test for sub-surface with unmapped parent
Nothing to fix in weston itself, a similar test works fine with the desktop shell. However the test doesn't work in the test shell, so fix it there. Pekka, I see what you meant when you said that we needed to call committed() and that my previous fix was wrong. This may need some improvements to surface_has_content() to check other variables in addition or instead of width and height, but hopefully the approach is better this time. Emilio Pozuelo Monfort (2): shot: add test for sub-surface with unmapped parent weston-test: don't map surfaces that have no content tests/reference/subsurface_mapped-00.png | Bin 0 -> 5294 bytes tests/reference/subsurface_mapped-01.png | Bin 0 -> 5612 bytes tests/subsurface-shot-test.c | 76 +++ tests/weston-test.c | 9 +++ 4 files changed, 85 insertions(+) create mode 100644 tests/reference/subsurface_mapped-00.png create mode 100644 tests/reference/subsurface_mapped-01.png -- 2.18.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 1/2] shot: add test for sub-surface with unmapped parent
This reproduces https://bugs.freedesktop.org/show_bug.cgi?id=94735. Signed-off-by: Emilio Pozuelo Monfort --- tests/reference/subsurface_mapped-00.png | Bin 0 -> 5294 bytes tests/reference/subsurface_mapped-01.png | Bin 0 -> 5612 bytes tests/subsurface-shot-test.c | 76 +++ 3 files changed, 76 insertions(+) create mode 100644 tests/reference/subsurface_mapped-00.png create mode 100644 tests/reference/subsurface_mapped-01.png diff --git a/tests/reference/subsurface_mapped-00.png b/tests/reference/subsurface_mapped-00.png new file mode 100644 index ..22dd566ab8c502c832e1338de9d1e1d27c785c46 GIT binary patch literal 5294 zcmeHL=Q|q=*H5d}MNxakC^3SdMq}MIyU>B!o7!scQQWjCsZta{t43|*HiH;NiPmkV zc9kS0LM1{-B(LZF`2Gp+^_+8^@$p<|UB7c)J}@_Bzbtea006Mxxoz|a066p4ssHEV z*;CE1kk>gitZw@cW*s8~}jF{f^Ns%P0hKIoiPz`)gzmUl;1-$v+A6pS8yg zRV>Lj-m=srdifTH^WJL-8O^Ls7EnnEU*r&}KW*6XiDLB}tg2J@-9pZ!A zPmzgi=Ico;*W@P%hw&(?yB30sICC@}{XN*r#Xqx%3-F#h_Tw%9Fe7%B^}WFV6=$Ll zF?+|G2WU$WF{FCklykys8mneG*@WY zHm4xhW=Lm(9w{{V;pbbbVcx6#>w7HqF6L87m zW`9I@*x_hW!UVR?A+A|`_sjF{S?6&-3Lf`d*%plR3Cg(Hbb?efjSO;VuOpr)`l-6? z?pP2PNW}T|SaPpD+2(Fl;r1t7q}({QUk_10WP-Gqgx((eP#L|3p$+D$6Y zc=j5#i?+#z!C> z1KZKWgQz9*{8yZ1gsvLNpHN}?9qQ{YJYP?-ntKEu;tXc2BdHrF?P3-? zH)6&+<^pzhXIn-%R!_8t2Nay}Kwtsq6nPVb!Efj+A}uDwba_hsX0tmlv6s=EW0>`$ zjzEiO&#
[PATCH weston 2/2] weston-test: don't map surfaces that have no content
If a surface has no content (e.g. no buffer), then it shouldn't be mapped, so that its subsurfaces don't get mapped either. This works fine in the desktop-shell, but is currently broken on the weston-test module. https://bugs.freedesktop.org/show_bug.cgi?id Signed-off-by: Emilio Pozuelo Monfort --- tests/weston-test.c | 9 + 1 file changed, 9 insertions(+) diff --git a/tests/weston-test.c b/tests/weston-test.c index 412eb243..b67bd9fd 100644 --- a/tests/weston-test.c +++ b/tests/weston-test.c @@ -157,12 +157,21 @@ notify_pointer_position(struct weston_test *test, struct wl_resource *resource) weston_test_send_pointer_position(resource, pointer->x, pointer->y); } +static bool +surface_has_content(struct weston_surface *surface) +{ + return surface->width > 0 && surface->height > 0; +} + static void test_surface_committed(struct weston_surface *surface, int32_t sx, int32_t sy) { struct weston_test_surface *test_surface = surface->committed_private; struct weston_test *test = test_surface->test; + if (!surface_has_content(surface)) + return; + if (wl_list_empty(_surface->view->layer_link.link)) weston_layer_entry_insert(>layer.view_list, _surface->view->layer_link); -- 2.18.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston] simple-dmabuf-drm: fix build with --disable-egl
On 03/07/18 11:00, Pekka Paalanen wrote: > On Mon, 2 Jul 2018 17:22:30 +0200 > Emilio Pozuelo Monfort wrote: > >> Signed-off-by: Emilio Pozuelo Monfort >> --- >> I tried a build with --disable-egl as I didn't have the headers >> installed, and it broke here. The EGL usage here seemed optional so I >> did that, but I didn't run-test the result. If it would make more sense >> to disable the client if EGL support is disabled I can do that. >> >> clients/simple-dmabuf-drm.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c >> index fcab30e5..1ae3a2dd 100644 >> --- a/clients/simple-dmabuf-drm.c >> +++ b/clients/simple-dmabuf-drm.c >> @@ -863,6 +863,7 @@ create_display(int opts, int format) >> display->req_dmabuf_immediate = opts & OPT_IMMEDIATE; >> display->req_dmabuf_modifiers = (format == DRM_FORMAT_NV12); >> >> +#if ENABLE_EGL >> /* >> * hard code format if the platform egl doesn't support format >> * querying / advertising. >> @@ -871,6 +872,7 @@ create_display(int opts, int format) >> if (extensions && !weston_check_egl_extension(extensions, >> "EGL_EXT_image_dma_buf_import_modifiers")) >> display->xrgb_format_found = 1; >> +#endif >> >> display->registry = wl_display_get_registry(display->display); >> wl_registry_add_listener(display->registry, > > Hi, > > that's very strange. This program does not use EGL or even GBM, that's > a completely dead hunk of code you're ifdeffing there as I can see. > Would be better to just remove it completely, and make sure the build > does not link libEGL or GBM. Include for shared/platform.h should be > useless too. It's not dead code, it's a fallback mechanism in case the EGL platform doesn't support EGL_EXT_image_dma_buf_import_modifiers. The problem is that configure.ac checks for EGL for simple-dmabuf-drm-client, but the client is not disabled if one builds with --disable-egl. Perhaps I should do that instead. After all, disable-egl disables the gl-renderer, which is needed for zwp_linux_dmabuf, which is needed by simple-dmabuf-drm-client. Thoughts? Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston] simple-dmabuf-drm: fix build with --disable-egl
Signed-off-by: Emilio Pozuelo Monfort --- I tried a build with --disable-egl as I didn't have the headers installed, and it broke here. The EGL usage here seemed optional so I did that, but I didn't run-test the result. If it would make more sense to disable the client if EGL support is disabled I can do that. clients/simple-dmabuf-drm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c index fcab30e5..1ae3a2dd 100644 --- a/clients/simple-dmabuf-drm.c +++ b/clients/simple-dmabuf-drm.c @@ -863,6 +863,7 @@ create_display(int opts, int format) display->req_dmabuf_immediate = opts & OPT_IMMEDIATE; display->req_dmabuf_modifiers = (format == DRM_FORMAT_NV12); +#if ENABLE_EGL /* * hard code format if the platform egl doesn't support format * querying / advertising. @@ -871,6 +872,7 @@ create_display(int opts, int format) if (extensions && !weston_check_egl_extension(extensions, "EGL_EXT_image_dma_buf_import_modifiers")) display->xrgb_format_found = 1; +#endif display->registry = wl_display_get_registry(display->display); wl_registry_add_listener(display->registry, -- 2.18.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston 2/2] Add .gitlab-ci.yml
On 06/06/18 10:12, Daniel Stone wrote: > Hi, > > On 6 June 2018 at 09:03, Pekka Paalanen wrote: >> On Tue, 5 Jun 2018 23:06:59 +0100 >> Daniel Stone wrote: >>> + - export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XX)" >>> + - export BUILD_ID="weston-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID" >>> + - export PREFIX="$(pwd)/prefix-$BUILD_ID" >>> + - export BUILDDIR="$(pwd)/build-$BUILD_ID" >>> + - mkdir "$BUILDDIR" "$PREFIX" >>> + - cd "$BUILDDIR" >>> + - ../autogen.sh --prefix="$PREFIX" --disable-setuid-install >>> --enable-xwayland --disable-xwayland-test --enable-x11-compositor >>> --enable-drm-compositor --enable-wayland-compositor >>> --enable-headless-compositor --enable-fbdev-compositor >>> --enable-screen-sharing --enable-vaapi-recorder --enable-simple-clients >>> --enable-simple-egl-clients --enable-simple-dmabuf-drm-client >>> --enable-simple-dmabuf-v4l-client --enable-clients >>> --enable-resize-optimization --enable-weston-launch >>> --enable-fullscreen-shell --enable-colord --enable-dbus >>> --enable-systemd-login --enable-junit-xml --enable-ivi-shell >>> --enable-wcap-tools --disable-libunwind --enable-demo-clients-install >>> --enable-lcms --with-cairo=image >> >> There is no option --disable-libunwind anymore. > > Right you are. > >> Should there be an explicit --disable-rdp-compositor? >> >> Alternatively, would stretch have any freerdp version Weston builds >> with? This can be done later, too. > > Yeah, there should be an explicit disable for now; freerdp2 isn't in > stretch at all. Later we could try to expand this to building on > different distros, some of which would provide a new enough RDP, and > re-enable it. freerdp2 is available in stretch-backports: freerdp2 | 2.0.0~git20180411.1.7a7b1802+dfsg1-2~bpo9+1 | stretch-backports | source freerdp2 | 2.0.0~git20180411.1.7a7b1802+dfsg1-2| testing | source freerdp2 | 2.0.0~git20180411.1.7a7b1802+dfsg1-2| unstable | source Perhaps you can add stretch-backports to sources.list and install it from there? Cheers, Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [ANNOUNCE] wayland-protocols 1.12
Hi Jonas, On 02/12/17 03:41, Jonas Ådahl wrote: > wayland-protocols 1.12 is now available. > > This version includes the new stable version of the XDG Shell protocol. In > short, the difference between the XDG Shell stable and the last unstable > version include (among other things): > > * The base interface and the global exposed via the registry changed from >zxdg_shell_v6 to xdg_wm_base. > * Fullscreen semantics were better defined and geometry requirements >relaxed to allow certain hardware optimizations. > * The popup positioner was changed to allow positioning against a point. > * The popup semantics was changed to allow future extendability. > * Toplevel parent-child relationship ambiguities were fixed. > * Unmap/map semantics were better defined. > * Various other ambiguities were fixed and documentation in general was >improved. > > Check the git log for details. > > > Here is the shortlog: > > David Edmundson (1): > xdg-shell/positioner: Replace edge bitfield with extended enum > > Jonas Ådahl (18): > Add xdg-shell to stable/ > xdg-shell: Rename interfaces > xdg-shell: Update copyright notices > xdg-shell: Reword the xdg_wm_base introduction > xdg-shell/positioner: Allow empty anchor_rect > xdg-shell: Replace 'monitor' with 'output' > xdg-shell/surface: Add note about window position and geometry > xdg-shell/toplevel: Clarify xdg_toplevel.set_parent(null) > xdg-shell/toplevel: Chain multiple parent-child relationships > xdg-shell/popup: Allow custom parent by passing null as parent > xdg-shell/positioner: Clarify flip semantics with anchor offset > xdg-shell: Fix typo > xdg-shell: Specify what happens when (un)maximizing while fullscreen > xdg-shell: Clarify set_fullscreen semantics > xdg-shell: Add unset_fullscreen description > xdg-shell: Soften fullscreen geometry requirements > Makefile.am: Install stable xdg-shell > configure.ac: Bump version to 1.12 > > Mike Blumenkrantz (1): > xdg-shell: clarify map/unmap wording > > git tag: 1.12 Did you forget to push the git tag? I don't see it in the repo. Thanks, Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston] configure: bump libweston to 3.0.0
On 14/03/17 11:29, Pekka Paalanen wrote: > From: Pekka Paalanen <pekka.paala...@collabora.co.uk> > > Bump the future release to 3.0.0 due to breaking ABI in libweston. > > We have merged a few patches already that change libweston/compositor.h. > While most of the changes arguably change only things libweston users > should not be touching, some change the size of e.g. struct > weston_output and struct weston_compositor, possibly moving member > offsets. We also haven't separated public and private parts from > compositor.h yet. To be on the safe side, bump the major now. I'm sure > there will be more changes that make the bump obviously necessary. > > Cc: Bryce Harrington <br...@osg.samsung.com> > Cc: Daniel Stone <dani...@collabora.com> > Signed-off-by: Pekka Paalanen <pekka.paala...@collabora.co.uk> Reviewed-by: Emilio Pozuelo Monfort <emilio.pozu...@collabora.co.uk> > --- > configure.ac | 10 +- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 9df85d2..6cc9f26 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -1,11 +1,11 @@ > -m4_define([weston_major_version], [2]) > -m4_define([weston_minor_version], [0]) > -m4_define([weston_micro_version], [90]) > +m4_define([weston_major_version], [2]) > +m4_define([weston_minor_version], [99]) > +m4_define([weston_micro_version], [90]) > m4_define([weston_version], >[weston_major_version.weston_minor_version.weston_micro_version]) > -m4_define([libweston_major_version], [2]) > +m4_define([libweston_major_version], [3]) > m4_define([libweston_minor_version], [0]) > -m4_define([libweston_patch_version], [90]) > +m4_define([libweston_patch_version], [0]) > > AC_PREREQ([2.64]) > AC_INIT([weston], > ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston 2/2] launcher: Add sysmacros.h include for major()
On 13/03/17 17:33, Daniel Stone wrote: > glibc 2.25 produces a warning when sysmacros.h is not directly included > but major() is used, as it is intended to be moved to sysmacros.h and > only there. Include it to keep the build happy. > > Signed-off-by: Daniel Stone <dani...@collabora.com> Series is: Reviewed-by: Emilio Pozuelo Monfort <emilio.pozu...@collabora.co.uk> > --- > libweston/launcher-direct.c| 1 + > libweston/launcher-logind.c| 1 + > libweston/launcher-weston-launch.c | 1 + > 3 files changed, 3 insertions(+) > > diff --git a/libweston/launcher-direct.c b/libweston/launcher-direct.c > index 4195cf65..3d8f5f67 100644 > --- a/libweston/launcher-direct.c > +++ b/libweston/launcher-direct.c > @@ -33,6 +33,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c > index 8de1ed11..f10a2831 100644 > --- a/libweston/launcher-logind.c > +++ b/libweston/launcher-logind.c > @@ -35,6 +35,7 @@ > #include > #include > #include > +#include > #include > #include > > diff --git a/libweston/launcher-weston-launch.c > b/libweston/launcher-weston-launch.c > index 930f4e0c..a7535ce7 100644 > --- a/libweston/launcher-weston-launch.c > +++ b/libweston/launcher-weston-launch.c > @@ -34,6 +34,7 @@ > #include > #include > #include > +#include > #include > #include > #include > ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston 1/3] tests: add a create_test_surface function
BTW note this series depends on this other one: https://patchwork.freedesktop.org/series/18695/ https://lists.freedesktop.org/archives/wayland-devel/2017-January/032890.html Cheers, Emilio On 03/02/17 16:10, Emilio Pozuelo Monfort wrote: > This doesn't attach a buffer to the surface. This is needed for the > next commit, where we have a test case with a surface that doesn't > have a buffer attached. > > Signed-off-by: Emilio Pozuelo Monfort <emilio.pozu...@collabora.co.uk> > --- > tests/weston-test-client-helper.c | 29 - > tests/weston-test-client-helper.h | 3 +++ > 2 files changed, 23 insertions(+), 9 deletions(-) > > diff --git a/tests/weston-test-client-helper.c > b/tests/weston-test-client-helper.c > index dd411925..4c27988d 100644 > --- a/tests/weston-test-client-helper.c > +++ b/tests/weston-test-client-helper.c > @@ -884,18 +884,13 @@ create_client(void) > return client; > } > > -struct client * > -create_client_and_test_surface(int x, int y, int width, int height) > +struct surface * > +create_test_surface(struct client *client) > { > - struct client *client; > struct surface *surface; > - pixman_color_t color = { 16384, 16384, 16384, 16384 }; /* uint16_t */ > - pixman_image_t *solid; > - > - client = create_client(); > > - /* initialize the client surface */ > surface = xzalloc(sizeof *surface); > + > surface->wl_surface = > wl_compositor_create_surface(client->wl_compositor); > assert(surface->wl_surface); > @@ -903,9 +898,25 @@ create_client_and_test_surface(int x, int y, int width, > int height) > wl_surface_add_listener(surface->wl_surface, _listener, > surface); > > - client->surface = surface; > wl_surface_set_user_data(surface->wl_surface, surface); > > + return surface; > +} > + > +struct client * > +create_client_and_test_surface(int x, int y, int width, int height) > +{ > + struct client *client; > + struct surface *surface; > + pixman_color_t color = { 16384, 16384, 16384, 16384 }; /* uint16_t */ > + pixman_image_t *solid; > + > + client = create_client(); > + > + /* initialize the client surface */ > + surface = create_test_surface(client); > + client->surface = surface; > + > surface->width = width; > surface->height = height; > surface->buffer = create_shm_buffer_a8r8g8b8(client, width, height); > diff --git a/tests/weston-test-client-helper.h > b/tests/weston-test-client-helper.h > index 8908ae7e..8ab59c61 100644 > --- a/tests/weston-test-client-helper.h > +++ b/tests/weston-test-client-helper.h > @@ -155,6 +155,9 @@ struct rectangle { > struct client * > create_client(void); > > +struct surface * > +create_test_surface(struct client *client); > + > struct client * > create_client_and_test_surface(int x, int y, int width, int height); > > ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston 3/3] compositor: don't map surfaces without a buffer
On 03/02/17 16:27, Derek Foreman wrote: > On 03/02/17 09:10 AM, Emilio Pozuelo Monfort wrote: >> We were calling weston_surface::committed on surfaces with >> no buffer attached. Stop doing that, since surface::committed >> will map the surfaces and put them in a visible layer. That may >> not be a problem for a single surface as it wouldn't be visible >> anyway because it's got no contents, but it is a problem if the >> surface has subsurfaces. >> >> This fixes the subsurface_mapped test, so mark it as expected >> to succeed. >> >> https://bugs.freedesktop.org/show_bug.cgi?id=94735 >> >> Signed-off-by: Emilio Pozuelo Monfort <emilio.pozu...@collabora.co.uk> >> --- >> libweston/compositor.c | 10 +- >> tests/subsurface-shot-test.c | 2 +- >> 2 files changed, 10 insertions(+), 2 deletions(-) >> >> diff --git a/libweston/compositor.c b/libweston/compositor.c >> index 81392063..8a018897 100644 >> --- a/libweston/compositor.c >> +++ b/libweston/compositor.c >> @@ -1589,6 +1589,12 @@ weston_surface_is_mapped(struct weston_surface >> *surface) >> return surface->is_mapped; >> } >> >> +static bool >> +weston_surface_has_content(struct weston_surface *surface) >> +{ >> +return surface->width > 0 && surface->height > 0; > > Are these going to be 0 if a NULL buffer is attached to an existing surface? Ah, good point. I'm thinking I could extend the test case to attach a NULL buffer, then attach a buffer again and verify the result is correct. As for your question, it looks like that's not the case. width_from_buffer seems reset by weston_surface_calculate_size_from_buffer(), called by weston_surface_attach(), but surface->width/height aren't reset AFAICS. I'll look at this. > > A quick read has me thinking width_from_buffer and height_from_buffer are > reset > on a NULL attach, but width and height only get updated on commit - so > depending > on when this function is called it might not return the expected result. > > If that's the intended behaviour, perhaps a comment to avoid misuse in the > future... > >> +} >> + >> static void >> surface_set_size(struct weston_surface *surface, int32_t width, int32_t >> height) >> { >> @@ -2928,7 +2934,9 @@ weston_surface_commit_state(struct weston_surface >> *surface, >> >> if (state->newly_attached || state->buffer_viewport.changed) { >> weston_surface_update_size(surface); >> -if (surface->committed) >> +if (surface->committed && >> +(state->newly_attached && >> + weston_surface_has_content(surface))) >> surface->committed(surface, state->sx, state->sy); >> } >> >> diff --git a/tests/subsurface-shot-test.c b/tests/subsurface-shot-test.c >> index e7da1e0e..275d4726 100644 >> --- a/tests/subsurface-shot-test.c >> +++ b/tests/subsurface-shot-test.c >> @@ -261,7 +261,7 @@ TEST(subsurface_z_order) >> buffer_destroy(bufs[i]); >> } >> >> -FAIL_TEST(subsurface_mapped) >> +TEST(subsurface_mapped) >> { >> const char *test_name = get_test_name(); >> struct client *client; > > Why not re-order these commits so the subsurface test is introduced in a > passing > state? I think it's useful to add it before the fix, so one can verify the test case was broken and the fix works. Cheers, Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 3/3] compositor: don't map surfaces without a buffer
We were calling weston_surface::committed on surfaces with no buffer attached. Stop doing that, since surface::committed will map the surfaces and put them in a visible layer. That may not be a problem for a single surface as it wouldn't be visible anyway because it's got no contents, but it is a problem if the surface has subsurfaces. This fixes the subsurface_mapped test, so mark it as expected to succeed. https://bugs.freedesktop.org/show_bug.cgi?id=94735 Signed-off-by: Emilio Pozuelo Monfort <emilio.pozu...@collabora.co.uk> --- libweston/compositor.c | 10 +- tests/subsurface-shot-test.c | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libweston/compositor.c b/libweston/compositor.c index 81392063..8a018897 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -1589,6 +1589,12 @@ weston_surface_is_mapped(struct weston_surface *surface) return surface->is_mapped; } +static bool +weston_surface_has_content(struct weston_surface *surface) +{ + return surface->width > 0 && surface->height > 0; +} + static void surface_set_size(struct weston_surface *surface, int32_t width, int32_t height) { @@ -2928,7 +2934,9 @@ weston_surface_commit_state(struct weston_surface *surface, if (state->newly_attached || state->buffer_viewport.changed) { weston_surface_update_size(surface); - if (surface->committed) + if (surface->committed && + (state->newly_attached && +weston_surface_has_content(surface))) surface->committed(surface, state->sx, state->sy); } diff --git a/tests/subsurface-shot-test.c b/tests/subsurface-shot-test.c index e7da1e0e..275d4726 100644 --- a/tests/subsurface-shot-test.c +++ b/tests/subsurface-shot-test.c @@ -261,7 +261,7 @@ TEST(subsurface_z_order) buffer_destroy(bufs[i]); } -FAIL_TEST(subsurface_mapped) +TEST(subsurface_mapped) { const char *test_name = get_test_name(); struct client *client; -- 2.11.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 2/3] shot: add test for sub-surface with unmapped parent
This reproduces https://bugs.freedesktop.org/show_bug.cgi?id=94735. The test currently fails, so mark it as expected to fail. Signed-off-by: Emilio Pozuelo Monfort <emilio.pozu...@collabora.co.uk> --- tests/reference/subsurface_mapped-00.png | Bin 0 -> 799 bytes tests/reference/subsurface_mapped-01.png | Bin 0 -> 841 bytes tests/subsurface-shot-test.c | 79 +++ 3 files changed, 79 insertions(+) create mode 100644 tests/reference/subsurface_mapped-00.png create mode 100644 tests/reference/subsurface_mapped-01.png diff --git a/tests/reference/subsurface_mapped-00.png b/tests/reference/subsurface_mapped-00.png new file mode 100644 index ..32cf32a0ed11d38b9028eda29109e06c99dce000 GIT binary patch literal 799 zcmeAS@N?(olHy`uVBq!ia0y~yU~~YoKX5Ps$$$P@Hb9Ck$=lt9;Xep2*t>i(0|V0) zPZ!6KiaBpDJMtb-U^sBV(DcSZzE>X)w43Y<zTkg6<~Q@Kf7clg*fKlMXjD9NKp-uF u!`PrjQsNK~Pa<2J!Km<Pm<+lE!M8n->GIc&-r>L$&*16m=d#Wzp$P!YDfm(V literal 0 HcmV?d1 diff --git a/tests/reference/subsurface_mapped-01.png b/tests/reference/subsurface_mapped-01.png new file mode 100644 index ..4e7196a2229a2e63adbf49d32a8c47db043f1c1c GIT binary patch literal 841 zcmeAS@N?(olHy`uVBq!ia0y~yU~~YoKX5Ps$$$P@Hb9Ck$=lt9;Xep2*t>i(0|V1P zPZ!6KiaBquZsa}Wz`){YUu2kf{Oyc6Wg6{8K0QxPoXkGz!#aIUUe52048Hw0nHzqy z@FX&|88AA}Xi)SyAfT4OA#BjXDRF32cth#8hDqmtn^qrc-8g5ndd!V)&);y?A7max zA$7y5+Tmoxxtqcd+SvzD9B$b7_V^p#1HN)}PDa0(vIRL#J}^{z1<V@^p00i_>zopr E02fd6egFUf literal 0 HcmV?d1 diff --git a/tests/subsurface-shot-test.c b/tests/subsurface-shot-test.c index df72ec28..e7da1e0e 100644 --- a/tests/subsurface-shot-test.c +++ b/tests/subsurface-shot-test.c @@ -260,3 +260,82 @@ TEST(subsurface_z_order) if (bufs[i]) buffer_destroy(bufs[i]); } + +FAIL_TEST(subsurface_mapped) +{ + const char *test_name = get_test_name(); + struct client *client; + struct wl_surface *surface; + struct rectangle clip; + int fail = 0; + struct wl_subcompositor *subco; + struct wl_surface *child; + struct wl_subsurface *sub; + struct buffer *buf, *child_buf; + pixman_color_t red, blue; + + color(, 255, 0, 0); + color(, 0, 0, 255); + + /* Create the client */ + client = create_client(); + assert(client); + client->surface = create_test_surface(client); + surface = client->surface->wl_surface; + + /* move the pointer clearly away from our screenshooting area */ + weston_test_move_pointer(client->test->weston_test, 2, 30); + + client->surface->x = 100; + client->surface->y = 100; + weston_test_move_surface(client->test->weston_test, client->surface->wl_surface, +client->surface->x, client->surface->y); + + /* we need one of these so that buffer_viewport.changed gets set and the commit +* has an effect */ + wl_surface_set_buffer_scale(surface, 1); + wl_surface_set_buffer_transform(surface, WL_OUTPUT_TRANSFORM_NORMAL); + + wl_surface_commit(surface); + + clip.x = 100; + clip.y = 100; + clip.width = 100; + clip.height = 100; + printf("Clip: %d,%d %d x %d\n", clip.x, clip.y, clip.width, clip.height); + + /* create a wl_surface */ + subco = get_subcompositor(client); + assert(subco); + + child = wl_compositor_create_surface(client->wl_compositor); + assert(child); + + /* make it a sub-surface */ + sub = wl_subcompositor_get_subsurface(subco, child, surface); + assert(sub); + + /* let the subsurface be drawn async from its parent */ + wl_subsurface_set_desync(sub); + + /* give it content */ + child_buf = surface_commit_color(client, child, , 50, 50); + + /* verify that the sub-surface is not mapped */ + fail += check_screen(client, test_name, 0, , 0); + + /* give a buffer to the parent surface and make sure both the +* parent and the child get mapped */ + buf = surface_commit_color(client, surface, , 100, 100); + + fail += check_screen(client, test_name, 1, , 1); + + printf("Test complete\n"); + assert(fail == 0); + + wl_subsurface_destroy(sub); + wl_surface_destroy(child); + buffer_destroy(child_buf); + wl_surface_destroy(surface); + buffer_destroy(buf); +} -- 2.11.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 1/3] tests: add a create_test_surface function
This doesn't attach a buffer to the surface. This is needed for the next commit, where we have a test case with a surface that doesn't have a buffer attached. Signed-off-by: Emilio Pozuelo Monfort <emilio.pozu...@collabora.co.uk> --- tests/weston-test-client-helper.c | 29 - tests/weston-test-client-helper.h | 3 +++ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c index dd411925..4c27988d 100644 --- a/tests/weston-test-client-helper.c +++ b/tests/weston-test-client-helper.c @@ -884,18 +884,13 @@ create_client(void) return client; } -struct client * -create_client_and_test_surface(int x, int y, int width, int height) +struct surface * +create_test_surface(struct client *client) { - struct client *client; struct surface *surface; - pixman_color_t color = { 16384, 16384, 16384, 16384 }; /* uint16_t */ - pixman_image_t *solid; - - client = create_client(); - /* initialize the client surface */ surface = xzalloc(sizeof *surface); + surface->wl_surface = wl_compositor_create_surface(client->wl_compositor); assert(surface->wl_surface); @@ -903,9 +898,25 @@ create_client_and_test_surface(int x, int y, int width, int height) wl_surface_add_listener(surface->wl_surface, _listener, surface); - client->surface = surface; wl_surface_set_user_data(surface->wl_surface, surface); + return surface; +} + +struct client * +create_client_and_test_surface(int x, int y, int width, int height) +{ + struct client *client; + struct surface *surface; + pixman_color_t color = { 16384, 16384, 16384, 16384 }; /* uint16_t */ + pixman_image_t *solid; + + client = create_client(); + + /* initialize the client surface */ + surface = create_test_surface(client); + client->surface = surface; + surface->width = width; surface->height = height; surface->buffer = create_shm_buffer_a8r8g8b8(client, width, height); diff --git a/tests/weston-test-client-helper.h b/tests/weston-test-client-helper.h index 8908ae7e..8ab59c61 100644 --- a/tests/weston-test-client-helper.h +++ b/tests/weston-test-client-helper.h @@ -155,6 +155,9 @@ struct rectangle { struct client * create_client(void); +struct surface * +create_test_surface(struct client *client); + struct client * create_client_and_test_surface(int x, int y, int width, int height); -- 2.11.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 7/7] compositor: damage pending subsurfaces when committing them
When a client changes the subsurfaces state, we need to damage them so the result is visible. We do that by flagging the surfaces when the state changes and causing damage when committing the state. This prevents normal repaints from considering these changes until a commit has happened, and allows the client to atomically schedule several changes. This fixes the subsurface_z_order test, which is now marked as expected to succeed. Signed-off-by: Emilio Pozuelo Monfort <emilio.pozu...@collabora.co.uk> Reviewed-by: Pekka Paalanen <pekka.paala...@collabora.co.uk> --- libweston/compositor.c | 31 +++ libweston/compositor.h | 3 +++ tests/subsurface-shot-test.c | 2 +- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/libweston/compositor.c b/libweston/compositor.c index 5e232778..81392063 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -2179,6 +2179,12 @@ view_list_add_subsurface_view(struct weston_compositor *compositor, } } +/* This recursively adds the sub-surfaces for a view, relying on the + * sub-surface order. Thus, if a client restacks the sub-surfaces, that + * change first happens to the sub-surface list, and then automatically + * propagates here. See weston_surface_damage_subsurfaces() for how the + * sub-surfaces receive damage when the client changes the state. + */ static void view_list_add(struct weston_compositor *compositor, struct weston_view *view) @@ -2667,6 +2673,24 @@ surface_set_input_region(struct wl_client *client, } } +/* Cause damage to this sub-surface and all its children. + * + * This is useful when there are state changes that need an implicit + * damage, e.g. a z-order change. + */ +static void +weston_surface_damage_subsurfaces(struct weston_subsurface *sub) +{ + struct weston_subsurface *child; + + weston_surface_damage(sub->surface); + sub->reordered = false; + + wl_list_for_each(child, >surface->subsurface_list, parent_link) + if (child != sub) + weston_surface_damage_subsurfaces(child); +} + static void weston_surface_commit_subsurface_order(struct weston_surface *surface) { @@ -2676,6 +2700,9 @@ weston_surface_commit_subsurface_order(struct weston_surface *surface) parent_link_pending) { wl_list_remove(>parent_link); wl_list_insert(>subsurface_list, >parent_link); + + if (sub->reordered) + weston_surface_damage_subsurfaces(sub); } } @@ -3625,6 +3652,8 @@ subsurface_place_above(struct wl_client *client, wl_list_remove(>parent_link_pending); wl_list_insert(sibling->parent_link_pending.prev, >parent_link_pending); + + sub->reordered = true; } static void @@ -3647,6 +3676,8 @@ subsurface_place_below(struct wl_client *client, wl_list_remove(>parent_link_pending); wl_list_insert(>parent_link_pending, >parent_link_pending); + + sub->reordered = true; } static void diff --git a/libweston/compositor.h b/libweston/compositor.h index b049c980..08e728a9 100644 --- a/libweston/compositor.h +++ b/libweston/compositor.h @@ -1235,6 +1235,9 @@ struct weston_subsurface { struct weston_surface_state cached; struct weston_buffer_reference cached_buffer_ref; + /* Sub-surface has been reordered; need to apply damage. */ + bool reordered; + int synchronized; /* Used for constructing the view tree */ diff --git a/tests/subsurface-shot-test.c b/tests/subsurface-shot-test.c index 29b03c41..df72ec28 100644 --- a/tests/subsurface-shot-test.c +++ b/tests/subsurface-shot-test.c @@ -173,7 +173,7 @@ surface_commit_color(struct client *client, struct wl_surface *surface, return buf; } -FAIL_TEST(subsurface_z_order) +TEST(subsurface_z_order) { const char *test_name = get_test_name(); struct client *client; -- 2.11.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 5/7] tests: put screenshots to ./logs by default
From: Pekka Paalanen <pekka.paala...@collabora.co.uk> Logs is where we write all our custom test logs, let's also put the screenshots in the same place by default from cluttering the base directory. Signed-off-by: Pekka Paalanen <pekka.paala...@collabora.co.uk> Reviewed-by: Emilio Pozuelo Monfort <emilio.pozu...@collabora.co.uk> --- tests/weston-test-client-helper.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c index fd6ebaf8..dd411925 100644 --- a/tests/weston-test-client-helper.c +++ b/tests/weston-test-client-helper.c @@ -932,9 +932,10 @@ output_path(void) char *path = getenv("WESTON_TEST_OUTPUT_PATH"); if (!path) - return "."; + return "./logs"; + return path; - } +} char* screenshot_output_filename(const char *basename, uint32_t seq) -- 2.11.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 6/7] tests: add subsurface-shot test
From: Pekka Paalanen <pekka.paala...@collabora.co.uk> This is marked as a FAIL_TEST, because the last image comparison fails due to a bug in Weston. Jointly authored by Pekka and Emilio. Signed-off-by: Pekka Paalanen <pekka.paala...@collabora.co.uk> Signed-off-by: Emilio Pozuelo Monfort <emilio.pozu...@collabora.co.uk> --- Makefile.am | 12 +- tests/reference/subsurface_z_order-00.png | Bin 0 -> 825 bytes tests/reference/subsurface_z_order-01.png | Bin 0 -> 858 bytes tests/reference/subsurface_z_order-02.png | Bin 0 -> 889 bytes tests/reference/subsurface_z_order-03.png | Bin 0 -> 903 bytes tests/reference/subsurface_z_order-04.png | Bin 0 -> 902 bytes tests/subsurface-shot-test.c | 262 ++ 7 files changed, 273 insertions(+), 1 deletion(-) create mode 100644 tests/reference/subsurface_z_order-00.png create mode 100644 tests/reference/subsurface_z_order-01.png create mode 100644 tests/reference/subsurface_z_order-02.png create mode 100644 tests/reference/subsurface_z_order-03.png create mode 100644 tests/reference/subsurface_z_order-04.png create mode 100644 tests/subsurface-shot-test.c diff --git a/Makefile.am b/Makefile.am index 3932095a..458dabb1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1213,6 +1213,7 @@ weston_tests =\ viewporter.weston \ roles.weston\ subsurface.weston \ + subsurface-shot.weston \ devices.weston ivi_tests = @@ -1373,6 +1374,10 @@ subsurface_weston_SOURCES = tests/subsurface-test.c subsurface_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS) subsurface_weston_LDADD = libtest-client.la +subsurface_shot_weston_SOURCES = tests/subsurface-shot-test.c +subsurface_shot_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS) +subsurface_shot_weston_LDADD = libtest-client.la + presentation_weston_SOURCES = \ tests/presentation-test.c \ shared/helpers.h @@ -1492,7 +1497,12 @@ EXTRA_DIST += \ tests/weston-tests-env \ tests/internal-screenshot.ini \ tests/reference/internal-screenshot-bad-00.png \ - tests/reference/internal-screenshot-good-00.png + tests/reference/internal-screenshot-good-00.png \ + tests/reference/subsurface_z_order-00.png \ + tests/reference/subsurface_z_order-01.png \ + tests/reference/subsurface_z_order-02.png \ + tests/reference/subsurface_z_order-03.png \ + tests/reference/subsurface_z_order-04.png BUILT_SOURCES += \ protocol/weston-test-protocol.c \ diff --git a/tests/reference/subsurface_z_order-00.png b/tests/reference/subsurface_z_order-00.png new file mode 100644 index ..f127154cb68edf8e0148ac0de00ea5ca360b371b GIT binary patch literal 825 zcmeAS@N?(olHy`uVBq!ia0y~yU~~YoKX5Ps$$$P@Hb9Ck$=lt9;Xep2*t>i(0|V1L zPZ!6KiaBquI`T3(inusVQ%IX=T;|45HlbP8=FQXRsjEf4JYCvf{FeQ~mpO6_G3p5% z!Uipz5{FoL5}Dcz7@cP{DEb@_P@})_w^?!lpMKXZQ%~7*ecrqRZn;6=rU3{BqO9ET rIHtOaxnLsufW{b6PNij%+F<YbhV6JNuW`njxgN@xNAsH5fN literal 0 HcmV?d1 diff --git a/tests/reference/subsurface_z_order-01.png b/tests/reference/subsurface_z_order-01.png new file mode 100644 index ..d356528105a9c1407d2b5abe5afa4ccb31e24e92 GIT binary patch literal 858 zcmeAS@N?(olHy`uVBq!ia0y~yU~~YoKX5Ps$$$P@Hb9Ck$=lt9;Xep2*t>i(0|PU^ zr;B4q#hkZyHu4^F5Mg!f(Kt5cahZ>wwO)IX!Xn1x!l)T1{i{yCN;f}yx{7Jmxy9@Z zzd0oivG61^wHYuv~xz#(kVG62G{Zu}aRIo~e|8?8HSRdp!7pph)+d{)0U z-Dmmp7o7LEzOA>?-~PDlkA?W4@g{b$5?kKvC?qzx_ZDADGQeR+Qc_ssD6d*kB5I hx(7J<V1(>9rfODhL8pZOKY^Kr!PC{xWt~$(69BBr`2GL@ literal 0 HcmV?d1 diff --git a/tests/reference/subsurface_z_order-02.png b/tests/reference/subsurface_z_order-02.png new file mode 100644 index ..7f3d4cce79f4a7a0af1662bd2c5e1cb37b77b729 GIT binary patch literal 889 zcmeAS@N?(olHy`uVBq!ia0y~yU~~YoKX5Ps$$$P@Hb9Ck$=lt9;Xep2*t>i(0|T?3 zr;B4q#hkZyHs&675MgyZ6<`=*Sz;NYv;A<<n!G0`cm<gFwa-0a-;?rj^X@aJtr z7qc_`=9D<Z!js6<X29q?qe0Q<fPh*8hp<7*00_sr^K1OPTj%C~Vu$YQ7o5u
[PATCH weston 2/7] tests/shell: get rid of static variables
From: Pekka Paalanen <pekka.paala...@collabora.co.uk> Stop using static variables and clean up when we're done. [Emilio: update to latest weston_layer API] Signed-off-by: Pekka Paalanen <pekka.paala...@collabora.co.uk> Signed-off-by: Emilio Pozuelo Monfort <emilio.pozu...@collabora.co.uk> --- tests/weston-test-desktop-shell.c | 128 -- 1 file changed, 82 insertions(+), 46 deletions(-) diff --git a/tests/weston-test-desktop-shell.c b/tests/weston-test-desktop-shell.c index a1ec7da7..2cf2271e 100644 --- a/tests/weston-test-desktop-shell.c +++ b/tests/weston-test-desktop-shell.c @@ -45,58 +45,62 @@ #define static_assert(cond, msg) #endif -static struct weston_desktop *desktop = NULL; -static struct weston_layer background_layer; -static struct weston_surface *background_surface = NULL; -static struct weston_view *background_view = NULL; -static struct weston_layer layer; -static struct weston_view *view = NULL; -/* - * libweston-desktop - */ +struct desktest_shell { + struct wl_listener compositor_destroy_listener; + struct weston_desktop *desktop; + struct weston_layer background_layer; + struct weston_surface *background_surface; + struct weston_view *background_view; + struct weston_layer layer; + struct weston_view *view; +}; static void desktop_surface_added(struct weston_desktop_surface *desktop_surface, void *shell) { + struct desktest_shell *dts = shell; - assert(!view); + assert(!dts->view); - view = weston_desktop_surface_create_view(desktop_surface); + dts->view = weston_desktop_surface_create_view(desktop_surface); - assert(view); + assert(dts->view); } static void desktop_surface_removed(struct weston_desktop_surface *desktop_surface, void *shell) { - assert(view); + struct desktest_shell *dts = shell; - weston_desktop_surface_unlink_view(view); - weston_view_destroy(view); - view = NULL; + assert(dts->view); + + weston_desktop_surface_unlink_view(dts->view); + weston_view_destroy(dts->view); + dts->view = NULL; } static void desktop_surface_committed(struct weston_desktop_surface *desktop_surface, - int32_t sx, int32_t sy, void *data) + int32_t sx, int32_t sy, void *shell) { + struct desktest_shell *dts = shell; struct weston_surface *surface = weston_desktop_surface_get_surface(desktop_surface); struct weston_geometry geometry = weston_desktop_surface_get_geometry(desktop_surface); - assert(view); + assert(dts->view); if (weston_surface_is_mapped(surface)) return; surface->is_mapped = true; - weston_layer_entry_insert(_list, >layer_link); - weston_view_set_position(view, 0 - geometry.x, 0 - geometry.y); - weston_view_update_transform(view); - view->is_mapped = true; + weston_layer_entry_insert(>layer.view_list, >view->layer_link); + weston_view_set_position(dts->view, 0 - geometry.x, 0 - geometry.y); + weston_view_update_transform(dts->view); + dts->view->is_mapped = true; } static void @@ -157,42 +161,74 @@ static const struct weston_desktop_api shell_desktop_api = { .pong = desktop_surface_pong, }; -/* * - * end of libweston-desktop * - * */ +static void +shell_destroy(struct wl_listener *listener, void *data) +{ + struct desktest_shell *dts; + + dts = container_of(listener, struct desktest_shell, + compositor_destroy_listener); + + weston_desktop_destroy(dts->desktop); + weston_view_destroy(dts->background_view); + weston_surface_destroy(dts->background_surface); + free(dts); +} WL_EXPORT int wet_shell_init(struct weston_compositor *ec, int *argc, char *argv[]) { - weston_layer_init(, ec); - weston_layer_init(_layer, ec); + struct desktest_shell *dts; + + dts = zalloc(sizeof *dts); + if (!dts) + return -1; + + dts->compositor_destroy_listener.notify = shell_destroy; + wl_signal_add(>destroy_signal, >compositor_destroy_listener); + + weston_layer_init(>layer, ec); + weston_layer_init(>background_layer, ec); weston_layer_set_position(>layer, WESTON_LAYER_POSITION_NORMAL); weston_layer_set_position(>background_layer, WESTON_LAYER_POSITION_BACKGROUND); - background_surface = weston_surface_create(ec); - if (background_surface == NULL) - return -1; - background_view = weston_view_create(background_surf
[PATCH weston 3/7] tests/shell: change background color
From: Pekka PaalanenPick the color 0xCC336699 as AARRGGBB, as if blended on black. This is the color used with developing the sub-surface shot tests. No other big reason than it should not be black to have better chances of catching blending problems. Signed-off-by: Pekka Paalanen --- tests/weston-test-desktop-shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/weston-test-desktop-shell.c b/tests/weston-test-desktop-shell.c index 2cf2271e..de844251 100644 --- a/tests/weston-test-desktop-shell.c +++ b/tests/weston-test-desktop-shell.c @@ -204,7 +204,7 @@ wet_shell_init(struct weston_compositor *ec, if (dts->background_view == NULL) goto out_surface; - weston_surface_set_color(dts->background_surface, 0.0, 0.0, 0.0, 1); + weston_surface_set_color(dts->background_surface, 0.16, 0.32, 0.48, 1.); pixman_region32_fini(>background_surface->opaque); pixman_region32_init_rect(>background_surface->opaque, 0, 0, 2000, 2000); pixman_region32_fini(>background_surface->input); -- 2.11.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 1/7] tests: add test-desktop-shell
From: Quentin Glidic <sardemff7+...@sardemff7.net> This is a new desktop shell plugin, specifically written for tests. It implements the bare minimum of a WM with predictable window positioning. It offers a known static background without forking any helper clients and therefore avoids any races with executing screenshot-based tests. Not forking unused helper clients also reduces the load during a test run. The code was written by Quentin as a part of a much larger private patch. Pekka, following Emilio's example, extracted just the shell plugin parts as a stand-alone patch and wrote the commit message. [Emilio: update to latest weston_layer and shell_init API] Signed-off-by: Quentin Glidic <sardemff7+...@sardemff7.net> Signed-off-by: Emilio Pozuelo Monfort <emilio.pozu...@collabora.co.uk> Signed-off-by: Pekka Paalanen <pekka.paala...@collabora.co.uk> --- Makefile.am | 8 ++ tests/weston-test-desktop-shell.c | 198 ++ 2 files changed, 206 insertions(+) create mode 100644 tests/weston-test-desktop-shell.c diff --git a/Makefile.am b/Makefile.am index 7743158a..3932095a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1236,6 +1236,7 @@ export abs_builddir noinst_LTLIBRARIES += \ weston-test.la \ + weston-test-desktop-shell.la\ $(module_tests) \ libtest-runner.la \ libtest-client.la @@ -1278,6 +1279,13 @@ nodist_weston_test_la_SOURCES = \ protocol/weston-test-protocol.c \ protocol/weston-test-server-protocol.h +weston_test_desktop_shell_la_LIBADD = libshared.la libweston-desktop-@LIBWESTON_MAJOR@.la $(COMPOSITOR_LIBS) +weston_test_desktop_shell_la_LDFLAGS = $(test_module_ldflags) +weston_test_desktop_shell_la_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS) +weston_test_desktop_shell_la_SOURCES = \ + tests/weston-test-desktop-shell.c \ + shared/helpers.h + if ENABLE_EGL weston_test_la_CFLAGS += $(EGL_TESTS_CFLAGS) weston_test_la_LDFLAGS += $(EGL_TESTS_LIBS) diff --git a/tests/weston-test-desktop-shell.c b/tests/weston-test-desktop-shell.c new file mode 100644 index ..a1ec7da7 --- /dev/null +++ b/tests/weston-test-desktop-shell.c @@ -0,0 +1,198 @@ +/* + * Copyright © 2010-2012 Intel Corporation + * Copyright © 2011-2012 Collabora, Ltd. + * Copyright © 2013 Raspberry Pi Foundation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "compositor/weston.h" +#include "shared/config-parser.h" +#include "shared/helpers.h" +#include "libweston-desktop/libweston-desktop.h" + +#ifndef static_assert +#define static_assert(cond, msg) +#endif + +static struct weston_desktop *desktop = NULL; +static struct weston_layer background_layer; +static struct weston_surface *background_surface = NULL; +static struct weston_view *background_view = NULL; +static struct weston_layer layer; +static struct weston_view *view = NULL; +/* + * libweston-desktop + */ + +static void +desktop_surface_added(struct weston_desktop_surface *desktop_surface, + void *shell) +{ + + assert(!view); + + view = weston_desktop_surface_create_view(desktop_surface); + + assert(view); +} + +static void +desktop_surface_removed(struct weston_desktop_surface *desktop_surface, + void *shell) +{ + assert(view); + + weston_desktop_surface_unlink_view(view); + weston_view_destroy(view); + view = NULL; +} + +static void +desktop_surface_committed(struct weston_desktop_surface *desktop_surface, +
[PATCH weston 4/7] tests: implement get_test_name()
From: Pekka Paalanen <pekka.paala...@collabora.co.uk> Screenshot tests often want to use the test name for writing out images. This is a helper to get the test name without writing it multiple times in the source. Signed-off-by: Pekka Paalanen <pekka.paala...@collabora.co.uk> Reviewed-by: Emilio Pozuelo Monfort <emilio.pozu...@collabora.co.uk> --- tests/weston-test-runner.c | 21 +++-- tests/weston-test-runner.h | 12 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/tests/weston-test-runner.c b/tests/weston-test-runner.c index b1e89bc2..f197265d 100644 --- a/tests/weston-test-runner.c +++ b/tests/weston-test-runner.c @@ -42,6 +42,14 @@ char __attribute__((weak)) *server_parameters=""; extern const struct weston_test __start_test_section, __stop_test_section; +static const char *test_name_; + +const char * +get_test_name(void) +{ + return test_name_; +} + static const struct weston_test * find_test(const char *name) { @@ -55,8 +63,17 @@ find_test(const char *name) } static void -run_test(const struct weston_test *t, void *data) +run_test(const struct weston_test *t, void *data, int iteration) { + char str[512]; + + if (data) { + snprintf(str, sizeof(str), "%s[%d]", t->name, iteration); + test_name_ = str; + } else { + test_name_ = t->name; + } + t->run(data); exit(EXIT_SUCCESS); } @@ -83,7 +100,7 @@ exec_and_report_test(const struct weston_test *t, void *test_data, int iteration assert(pid >= 0); if (pid == 0) - run_test(t, test_data); /* never returns */ + run_test(t, test_data, iteration); /* never returns */ if (waitid(P_ALL, 0, , WEXITED)) { fprintf(stderr, "waitid failed: %m\n"); diff --git a/tests/weston-test-runner.h b/tests/weston-test-runner.h index a4436919..21a059d6 100644 --- a/tests/weston-test-runner.h +++ b/tests/weston-test-runner.h @@ -80,4 +80,16 @@ struct weston_test { #define TEST_P(name, data) ARG_TEST(name, 0, data) #define FAIL_TEST_P(name, data) ARG_TEST(name, 1, data) +/** + * Get the test name string with counter + * + * \return The test name. For an iterated test, e.g. defined with TEST_P(), + * the name has a '[%d]' suffix to indicate the iteration. + * + * This is only usable from code paths inside TEST(), TEST_P(), etc. + * defined functions. + */ +const char * +get_test_name(void); + #endif -- 2.11.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston] compositor-rdp: Fix build with freerdp2
On 19/01/17 11:26, Daniel Stone wrote: > Hi Emilio, > > On 18 January 2017 at 17:43, Emilio Pozuelo Monfort <po...@debian.org> wrote: >> Based on a patch from John Moser <john.r.mo...@gmail.com> >> >> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=850658 >> >> Signed-off-by: Emilio Pozuelo Monfort <po...@debian.org> >> --- >> libweston/compositor-rdp.c | 8 >> 1 file changed, 8 insertions(+) >> >> diff --git a/libweston/compositor-rdp.c b/libweston/compositor-rdp.c >> index 223382ce..16f4c628 100644 >> --- a/libweston/compositor-rdp.c >> +++ b/libweston/compositor-rdp.c >> @@ -664,13 +664,21 @@ rdp_peer_context_new(freerdp_peer* client, >> RdpPeerContext* context) >> context->rfx_context->mode = RLGR3; >> context->rfx_context->width = client->settings->DesktopWidth; >> context->rfx_context->height = client->settings->DesktopHeight; >> +#ifdef PIXEL_FORMAT_BGRA32 >> + rfx_context_set_pixel_format(context->rfx_context, >> PIXEL_FORMAT_BGRA32); >> +#else >> rfx_context_set_pixel_format(context->rfx_context, >> RDP_PIXEL_FORMAT_B8G8R8A8); >> +#endif > > And still this fails on Fedora 25. The FreeRDP API is a thing of > absolute magic: https://phabricator.freedesktop.org/P9 > > Does it build with this patch instead? https://phabricator.freedesktop.org/P10 It doesn't, because your magic is before the #include color.h which defines PIXEL_*. This version works for me... Cheers, Emilio commit 505da12c9bea18194bb35f84dc472ee9d8e14ff2 Author: Emilio Pozuelo Monfort <po...@debian.org> Date: Wed Jan 18 18:43:35 2017 +0100 compositor-rdp: Fix build with freerdp2 Based on a patch from John Moser <john.r.mo...@gmail.com> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=850658 Signed-off-by: Emilio Pozuelo Monfort <po...@debian.org> Reviewed-by: Daniel Stone <dani...@collabora.com> --- a/libweston/compositor-rdp.c +++ b/libweston/compositor-rdp.c @@ -84,6 +84,15 @@ #define DEFAULT_AXIS_STEP_DISTANCE 10 #define RDP_MODE_FREQ 60 * 1000 +#if FREERDP_VERSION_MAJOR >= 2 && defined(PIXEL_FORMAT_BGRA32) && !defined(RDP_PIXEL_FORMAT_B8G8R8A8) + /* The RDP API is truly wonderful: the pixel format definition changed + * from BGRA32 to B8G8R8A8, but some versions ship with a definition of + * PIXEL_FORMAT_BGRA32 which doesn't actually build. Try really, really, + * hard to find one which does. */ +# define DEFAULT_PIXEL_FORMAT PIXEL_FORMAT_BGRA32 +#else +# define DEFAULT_PIXEL_FORMAT RDP_PIXEL_FORMAT_B8G8R8A8 +#endif struct rdp_output; @@ -618,13 +627,13 @@ context->rfx_context->mode = RLGR3; context->rfx_context->width = client->settings->DesktopWidth; context->rfx_context->height = client->settings->DesktopHeight; - rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_B8G8R8A8); + rfx_context_set_pixel_format(context->rfx_context, DEFAULT_PIXEL_FORMAT); context->nsc_context = nsc_context_new(); if (!context->nsc_context) goto out_error_nsc; - nsc_context_set_pixel_format(context->nsc_context, RDP_PIXEL_FORMAT_B8G8R8A8); + nsc_context_set_pixel_format(context->nsc_context, DEFAULT_PIXEL_FORMAT); context->encode_stream = Stream_New(NULL, 65536); if (!context->encode_stream) ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston] clients: fix errno handling
On 18/01/17 23:58, Emilio Pozuelo Monfort wrote: > On 18/01/17 23:21, Peter Hutterer wrote: >> clients/editor.c: In function ‘read_file’: >> clients/editor.c:1578:16: warning: logical ‘or’ applied to non-boolean >> constant [-Wlogical-op] >> errno = errsv || EINVAL; >> >> This works in the shell, but not in C. Introduced in 411ffabbb56b >> >> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> >> --- >> Changes to v1: >> - first version didn't return the right errno, whoops :) > > S-o-b me. Of course I meant r-b... Reviewed-by: Emilio Pozuelo Monfort <po...@debian.org> Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston] clients: fix errno handling
On 18/01/17 23:21, Peter Hutterer wrote: > clients/editor.c: In function ‘read_file’: > clients/editor.c:1578:16: warning: logical ‘or’ applied to non-boolean > constant [-Wlogical-op] > errno = errsv || EINVAL; > > This works in the shell, but not in C. Introduced in 411ffabbb56b > > Signed-off-by: Peter Hutterer> --- > Changes to v1: > - first version didn't return the right errno, whoops :) S-o-b me. Cheers, Emilio > clients/editor.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/clients/editor.c b/clients/editor.c > index f1dffe1..a0cc97a 100644 > --- a/clients/editor.c > +++ b/clients/editor.c > @@ -1575,7 +1575,7 @@ error: > if (fin) > fclose(fin); > free(buffer); > - errno = errsv || EINVAL; > + errno = errsv ? errsv : EINVAL; > > return NULL; > } > ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston] compositor-rdp: Fix build with freerdp2
Based on a patch from John Moser <john.r.mo...@gmail.com> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=850658 Signed-off-by: Emilio Pozuelo Monfort <po...@debian.org> --- libweston/compositor-rdp.c | 8 1 file changed, 8 insertions(+) diff --git a/libweston/compositor-rdp.c b/libweston/compositor-rdp.c index 223382ce..16f4c628 100644 --- a/libweston/compositor-rdp.c +++ b/libweston/compositor-rdp.c @@ -664,13 +664,21 @@ rdp_peer_context_new(freerdp_peer* client, RdpPeerContext* context) context->rfx_context->mode = RLGR3; context->rfx_context->width = client->settings->DesktopWidth; context->rfx_context->height = client->settings->DesktopHeight; +#ifdef PIXEL_FORMAT_BGRA32 + rfx_context_set_pixel_format(context->rfx_context, PIXEL_FORMAT_BGRA32); +#else rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_B8G8R8A8); +#endif context->nsc_context = nsc_context_new(); if (!context->nsc_context) goto out_error_nsc; +#ifdef PIXEL_FORMAT_BGRA32 + nsc_context_set_pixel_format(context->nsc_context, PIXEL_FORMAT_BGRA32); +#else nsc_context_set_pixel_format(context->nsc_context, RDP_PIXEL_FORMAT_B8G8R8A8); +#endif context->encode_stream = Stream_New(NULL, 65536); if (!context->encode_stream) -- 2.11.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston] compositor-rdp: Fix build with freerdp2
On 18/01/17 14:09, Daniel Stone wrote: > Hi Emilio, > > On 17 January 2017 at 19:58, Emilio Pozuelo Monfort <po...@debian.org> wrote: >> index 223382ce..94b4bfa9 100644 >> --- a/libweston/compositor-rdp.c >> +++ b/libweston/compositor-rdp.c >> @@ -664,13 +664,21 @@ rdp_peer_context_new(freerdp_peer* client, >> RdpPeerContext* context) >> context->rfx_context->mode = RLGR3; >> context->rfx_context->width = client->settings->DesktopWidth; >> context->rfx_context->height = client->settings->DesktopHeight; >> +#if FREERDP_VERSION_MAJOR == 1 && FREERDP_VERSION_MINOR == 1 >> rfx_context_set_pixel_format(context->rfx_context, >> RDP_PIXEL_FORMAT_B8G8R8A8); >> +#else >> + rfx_context_set_pixel_format(context->rfx_context, >> PIXEL_FORMAT_BGRA32); >> +#endif > > Unfortunately, as much as this fixes things on Debian, it breaks my > Fedora 25 build. F25 has a pre-release of 2.0.0 which seems to have a > halfway-between API: all the non-1.1 paths are valid here, but it > still has the old pixel-format definitions. > > I have FREERDP_VERSION_{MAJOR,MINOR,REVISION,SUFFIX} as 2, 0, 0, > "dev", respectively. Does Debian have something (maybe a slightly > larger version, or dropping the 'dev'), which could tell these apart? Same here and in upstream master. Debian has commit e60d0d5 from 2016-11-30. Looks like Fedora rawhide has a newer snapshot, commit 90877f5 from 2016-12-28: http://pkgs.fedoraproject.org/cgit/rpms/freerdp.git/commit/?id=ddef67974693f50fd8db95fa9e5759b07f91a980 We can check if PIXEL_FORMAT_BGRA32 is defined, and fall back to RDP_PIXEL_FORMAT_B8G8R8A8 if not. I'll send a patch for that. Cheers, Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston] clients: fix errno handling
On 18/01/17 01:53, Peter Hutterer wrote: > clients/editor.c: In function ‘read_file’: > clients/editor.c:1578:16: warning: logical ‘or’ applied to non-boolean > constant [-Wlogical-op] > errno = errsv || EINVAL; > > This works in the shell, but not in C. Introduced in 411ffabbb56b > > Signed-off-by: Peter Hutterer> --- > clients/editor.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/clients/editor.c b/clients/editor.c > index f1dffe1..135dd9f 100644 > --- a/clients/editor.c > +++ b/clients/editor.c > @@ -1575,7 +1575,8 @@ error: > if (fin) > fclose(fin); > free(buffer); > - errno = errsv || EINVAL; > + if (errsv == 0) > + errno = EINVAL; Shouldn't you add else errno = errsv; ? Otherwise you may not return the original errno, but errno==0 instead (e.g. if fclose() succeeded), which would be wrong. Cheers, Emilio > > return NULL; > } > ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston] compositor-rdp: Fix build with freerdp2
Based on a patch from John Moser <john.r.mo...@gmail.com> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=850658 Signed-off-by: Emilio Pozuelo Monfort <po...@debian.org> --- libweston/compositor-rdp.c | 8 1 file changed, 8 insertions(+) diff --git a/libweston/compositor-rdp.c b/libweston/compositor-rdp.c index 223382ce..94b4bfa9 100644 --- a/libweston/compositor-rdp.c +++ b/libweston/compositor-rdp.c @@ -664,13 +664,21 @@ rdp_peer_context_new(freerdp_peer* client, RdpPeerContext* context) context->rfx_context->mode = RLGR3; context->rfx_context->width = client->settings->DesktopWidth; context->rfx_context->height = client->settings->DesktopHeight; +#if FREERDP_VERSION_MAJOR == 1 && FREERDP_VERSION_MINOR == 1 rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_B8G8R8A8); +#else + rfx_context_set_pixel_format(context->rfx_context, PIXEL_FORMAT_BGRA32); +#endif context->nsc_context = nsc_context_new(); if (!context->nsc_context) goto out_error_nsc; +#if FREERDP_VERSION_MAJOR == 1 && FREERDP_VERSION_MINOR == 1 nsc_context_set_pixel_format(context->nsc_context, RDP_PIXEL_FORMAT_B8G8R8A8); +#else + nsc_context_set_pixel_format(context->nsc_context, PIXEL_FORMAT_BGRA32); +#endif context->encode_stream = Stream_New(NULL, 65536); if (!context->encode_stream) -- 2.11.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH wayland 3/3] tests: add scanner tests
On 11/11/16 15:56, Pekka Paalanen wrote: > On Thu, 10 Nov 2016 12:18:55 +0200 > Pekka Paalanen <ppaala...@gmail.com> wrote: > >> On Thu, 10 Nov 2016 11:11:51 +0100 >> Emilio Pozuelo Monfort <poch...@gmail.com> wrote: >> >>> On 10/11/16 10:57, Pekka Paalanen wrote: >>>> From: Pekka Paalanen <pekka.paala...@collabora.co.uk> >>>> >>>> Add tests that ensure that wayland-scanner output for a given input does >>>> not change unexpectedly. This makes it very easy to review >>>> wayland-scanner patches. >>>> >>>> Before, when patches were proposed for wayland-scanner, I had to >>>> build wayland without the patches, save the generated files into a >>>> temporary directory, apply the patches, build again, and diff the old >>>> vs. new generated file. >>>> >>>> No more. Now whenever someone makes intentional changes to >>>> wayland-scanner's output, he will also have to patch the example output >>>> files to match. That means that reviewers see the diff of the generated >>>> files straight from the patch itself. Verifying the diff is true is as >>>> easy as 'make check'. >>>> >>>> The tests use separate example XML files instead of wayland.xml >>>> directly, so that wayland.xml can be updated without fixing scanner >>>> tests, avoiding the churn. >>>> >>>> example.xml starts as a copy of wayland.xml. If wayland.xml starts using >>>> new wayland-scanner features, they should be copied into example.xml >>>> again to be covered by the tests. >>>> >>>> This patch relies on the previous patch to actually add all the data >>>> files for input and reference output. >>>> >>>> The scanner output is fed through sed to remove parts that are allowed >>>> to vary: the scanner version string. >>>> >>>> Task: https://phabricator.freedesktop.org/T3313 >>>> Signed-off-by: Pekka Paalanen <pekka.paala...@collabora.co.uk> >>>> --- >>>> .gitignore| 1 + >>>> Makefile.am | 34 +- >>>> tests/scanner-test.sh | 51 >>>> +++ >>>> 3 files changed, 85 insertions(+), 1 deletion(-) >>>> create mode 100755 tests/scanner-test.sh >>>> >>>> diff --git a/.gitignore b/.gitignore >>>> index 33e809c..8da9861 100644 >>>> --- a/.gitignore >>>> +++ b/.gitignore >>>> @@ -38,6 +38,7 @@ ctags >>>> /missing >>>> /stamp-h1 >>>> /test-driver >>>> +/tests/output/ >>>> Makefile >>>> Makefile.in >>>> exec-fd-leak-checker >>>> diff --git a/Makefile.am b/Makefile.am >>>> index d35231c..cd21915 100644 >>>> --- a/Makefile.am >>>> +++ b/Makefile.am >>>> @@ -168,7 +168,15 @@ if ENABLE_CPP_TEST >>>> built_test_programs += cpp-compile-test >>>> endif >>>> >>>> -TESTS = $(built_test_programs) >>>> +AM_TESTS_ENVIRONMENT = >>>> \ >>>> + export WAYLAND_SCANNER='$(top_builddir)/wayland-scanner'\ >>>> + TEST_DATA_DIR='$(top_srcdir)/tests/data'\ >>>> + TEST_OUTPUT_DIR='$(top_builddir)/tests/output' \ >>>> + SED=$(SED) \ >>>> + ; >>>> + >>>> +TESTS = $(built_test_programs)\ >>>> + tests/scanner-test.sh >>>> >>>> check_PROGRAMS = \ >>>>$(built_test_programs) \ >>>> @@ -245,4 +253,28 @@ os_wrappers_test_LDADD = libtest-runner.la >>>> >>>> exec_fd_leak_checker_SOURCES = tests/exec-fd-leak-checker.c >>>> exec_fd_leak_checker_LDADD = libtest-runner.la >>>> + >>>> +scanner_test_data_files = \ >>>> + $(top_srcdir)/tests/data/example.xml\ >>>> + $(top_srcdir)/tests/data/example-client.h \ >>>> + $(top_srcdir)/tests/data/example-server.h \ >>>> + $(top_srcdir)/tests/data/example-code.c \ >>>> + $(top_srcdir)/tests/data/small.xml \ >>>> + $(top_srcdir)/tests/data/small-code.c
Re: [PATCH wayland 3/3] tests: add scanner tests
On 10/11/16 10:57, Pekka Paalanen wrote: > From: Pekka Paalanen <pekka.paala...@collabora.co.uk> > > Add tests that ensure that wayland-scanner output for a given input does > not change unexpectedly. This makes it very easy to review > wayland-scanner patches. > > Before, when patches were proposed for wayland-scanner, I had to > build wayland without the patches, save the generated files into a > temporary directory, apply the patches, build again, and diff the old > vs. new generated file. > > No more. Now whenever someone makes intentional changes to > wayland-scanner's output, he will also have to patch the example output > files to match. That means that reviewers see the diff of the generated > files straight from the patch itself. Verifying the diff is true is as > easy as 'make check'. > > The tests use separate example XML files instead of wayland.xml > directly, so that wayland.xml can be updated without fixing scanner > tests, avoiding the churn. > > example.xml starts as a copy of wayland.xml. If wayland.xml starts using > new wayland-scanner features, they should be copied into example.xml > again to be covered by the tests. > > This patch relies on the previous patch to actually add all the data > files for input and reference output. > > The scanner output is fed through sed to remove parts that are allowed > to vary: the scanner version string. > > Task: https://phabricator.freedesktop.org/T3313 > Signed-off-by: Pekka Paalanen <pekka.paala...@collabora.co.uk> > --- > .gitignore| 1 + > Makefile.am | 34 +- > tests/scanner-test.sh | 51 > +++ > 3 files changed, 85 insertions(+), 1 deletion(-) > create mode 100755 tests/scanner-test.sh > > diff --git a/.gitignore b/.gitignore > index 33e809c..8da9861 100644 > --- a/.gitignore > +++ b/.gitignore > @@ -38,6 +38,7 @@ ctags > /missing > /stamp-h1 > /test-driver > +/tests/output/ > Makefile > Makefile.in > exec-fd-leak-checker > diff --git a/Makefile.am b/Makefile.am > index d35231c..cd21915 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -168,7 +168,15 @@ if ENABLE_CPP_TEST > built_test_programs += cpp-compile-test > endif > > -TESTS = $(built_test_programs) > +AM_TESTS_ENVIRONMENT = > \ > + export WAYLAND_SCANNER='$(top_builddir)/wayland-scanner'\ > + TEST_DATA_DIR='$(top_srcdir)/tests/data'\ > + TEST_OUTPUT_DIR='$(top_builddir)/tests/output' \ > + SED=$(SED) \ > + ; > + > +TESTS = $(built_test_programs) \ > + tests/scanner-test.sh > > check_PROGRAMS = \ > $(built_test_programs) \ > @@ -245,4 +253,28 @@ os_wrappers_test_LDADD = libtest-runner.la > > exec_fd_leak_checker_SOURCES = tests/exec-fd-leak-checker.c > exec_fd_leak_checker_LDADD = libtest-runner.la > + > +scanner_test_data_files =\ > + $(top_srcdir)/tests/data/example.xml\ > + $(top_srcdir)/tests/data/example-client.h \ > + $(top_srcdir)/tests/data/example-server.h \ > + $(top_srcdir)/tests/data/example-code.c \ > + $(top_srcdir)/tests/data/small.xml \ > + $(top_srcdir)/tests/data/small-code.c \ > + $(top_srcdir)/tests/data/small-client.h \ > + $(top_srcdir)/tests/data/small-server.h \ > + $(top_srcdir)/tests/data/small-code-core.c \ > + $(top_srcdir)/tests/data/small-client-core.h\ > + $(top_srcdir)/tests/data/small-server-core.h > + > +tests/scanner-test.sh: \ > + $(top_builddir)/wayland-scanner \ > + $(scanner_test_data_files) Dependencies should be in the same line. Otherwise it's easy to confuse them for rules. Other than that, the whole series looks good to me and is: Reviewed-by: Emilio Pozuelo Monfort <emilio.pozu...@collabora.co.uk> Cheers, Emilio > + > +EXTRA_DIST += tests/scanner-test.sh \ > + $(scanner_test_data_files) > + > +clean-local: > + -rm -rf tests/output > + > endif #ENABLE_LIBRARIES > diff --git a/tests/scanner-test.sh b/tests/scanner-test.sh > new file mode 100755 > index 000..7854b86 > --- /dev/null > +++ b/tests/scanner-test.sh > @@ -0,0 +1,51 @@ > +#!/bin/sh > + > +echo "srcdir: $srcdir" > +echo "scanner: $WAYLAND_SCANNER" > +echo "test_data_dir: $
Re: [PATCH libinput 1/2] udev: fix ALPS firmware detection
On 09/02/16 03:12, Peter Hutterer wrote: > The firmware version is in id.version, not id.model which is always > PSMOUSE_ALPS for ALPS devices. > > The various fw versions are listed in /drivers/input/mouse/alps.h and > are all hex numbers. Version 8 is actually 0x800, change the match > accordingly. > > Expected side-effect: earlier versions of ALPS touchpads now lose their > (erroneous) size assignment. > > Signed-off-by: Peter Hutterer> --- > udev/90-libinput-model-quirks.hwdb | 4 ++-- > udev/libinput-model-quirks.c | 4 ++-- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/udev/90-libinput-model-quirks.hwdb > b/udev/90-libinput-model-quirks.hwdb > index f23a7f9..6225da1 100644 > --- a/udev/90-libinput-model-quirks.hwdb > +++ b/udev/90-libinput-model-quirks.hwdb > @@ -22,8 +22,8 @@ libinput:name:*AlpsPS/2 ALPS DualPoint TouchPad:dmi:* > libinput:name:*AlpsPS/2 ALPS GlidePoint:dmi:* > LIBINPUT_MODEL_ALPS_TOUCHPAD=1 > > -libinput:name:*AlpsPS/2 ALPS DualPoint TouchPad:fwversion:8 > -libinput:name:*AlpsPS/2 ALPS GlidePoint:fwversion:8 > +libinput:name:*AlpsPS/2 ALPS DualPoint TouchPad:fwversion:800 > +libinput:name:*AlpsPS/2 ALPS GlidePoint:fwversion:800 > LIBINPUT_ATTR_SIZE_HINT=100x55 > > ## > diff --git a/udev/libinput-model-quirks.c b/udev/libinput-model-quirks.c > index 67115fa..c8baae7 100644 > --- a/udev/libinput-model-quirks.c > +++ b/udev/libinput-model-quirks.c > @@ -63,9 +63,9 @@ handle_touchpad_alps(struct udev_device *device) > if (sscanf(product, "%x/%x/%x/%x", , , , ) != 4) > return; > > - /* ALPS' firmware version is the PID */ > + /* ALPS' firmware version is the version */ > if (pid) Shouldn't that check for the version now? > - printf("LIBINPUT_MODEL_FIRMWARE_VERSION=%d\n", pid); > + printf("LIBINPUT_MODEL_FIRMWARE_VERSION=%x\n", version); > } > > static void > ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston] compositor: fix return code from main()
On 20/03/15 13:40, Pekka Paalanen wrote: From: Pekka Paalanen pekka.paala...@collabora.co.uk There were a few cases of 'goto out' in main() that did not set ret to EXIT_FAILURE. Shell failing to init is the one I hit when writing tests for ivi-shell. Rather than adding a few more 'ret = EXIT_FAILURE', make that the default and remove the redundant assignments. When Weston exits properly ec-exit_code will take care of the exit code. Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk --- src/compositor.c | 17 - 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index be2309a..47da818 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -5213,7 +5213,7 @@ weston_transform_to_string(uint32_t output_transform) int main(int argc, char *argv[]) { - int ret = EXIT_SUCCESS; + int ret = EXIT_FAILURE; struct wl_display *display; struct weston_compositor *ec; struct wl_event_source *signals[4]; @@ -5289,10 +5289,8 @@ int main(int argc, char *argv[]) signals[3] = wl_event_loop_add_signal(loop, SIGCHLD, sigchld_handler, NULL); - if (!signals[0] || !signals[1] || !signals[2] || !signals[3]) { - ret = EXIT_FAILURE; + if (!signals[0] || !signals[1] || !signals[2] || !signals[3]) goto out_signals; - } if (noconfig == 0) config = weston_config_parse(weston.ini); @@ -5312,15 +5310,12 @@ int main(int argc, char *argv[]) } backend_init = weston_load_module(backend, backend_init); - if (!backend_init) { - ret = EXIT_FAILURE; + if (!backend_init) goto out_signals; - } ec = backend_init(display, argc, argv, config); if (ec == NULL) { weston_log(fatal: failed to create compositor\n); - ret = EXIT_FAILURE; goto out_signals; } @@ -5337,10 +5332,8 @@ int main(int argc, char *argv[]) for (i = 1; i argc; i++) weston_log(fatal: unhandled option: %s\n, argv[i]); - if (argc 1) { - ret = EXIT_FAILURE; + if (argc 1) goto out; - } weston_compositor_log_capabilities(ec); @@ -5358,7 +5351,6 @@ int main(int argc, char *argv[]) primary_client = wl_client_create(display, fd); if (!primary_client) { weston_log(fatal: failed to add client: %m\n); - ret = EXIT_FAILURE; goto out; } primary_client_destroyed.notify = @@ -5366,7 +5358,6 @@ int main(int argc, char *argv[]) wl_client_add_destroy_listener(primary_client, primary_client_destroyed); } else if (weston_create_listening_socket(display, socket_name)) { - ret = EXIT_FAILURE; goto out; } Reviewed-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk Cheers, Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] cursor: free the array from which images are linked
On 18/03/15 01:53, Emmanuel Gil Peyrot wrote: --- cursor/wayland-cursor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cursor/wayland-cursor.c b/cursor/wayland-cursor.c index 1a5393a..410a0d4 100644 --- a/cursor/wayland-cursor.c +++ b/cursor/wayland-cursor.c @@ -190,6 +190,7 @@ wl_cursor_destroy(struct wl_cursor *cursor) for (i = 0; i cursor-image_count; i++) wl_cursor_image_destroy(cursor-images[i]); + free(cursor-images); free(cursor-name); free(cursor); } Looks good. Reviewed-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk Cheers, Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston] desktop-shell: Don't assume there is a pointer when resizing
Hi Kristian, On 19/06/14 07:37, Kristian Høgsberg wrote: On Wed, Jun 18, 2014 at 05:48:58PM +0200, Emilio Pozuelo Monfort wrote: From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk Fixes a crash on touch devices without a pointer, when touching the window frame of a client. Thanks, applied. At some point we'll get rid of all these pointer assumptions. I don't see this in master or 1.5. Maybe you forgot to push or something? Regards, Emilio Kristian Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- desktop-shell/shell.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 84f5c83..d965618 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -1784,7 +1784,8 @@ common_surface_resize(struct wl_resource *resource, struct shell_surface *shsurf = wl_resource_get_user_data(resource); struct weston_surface *surface; -if (seat-pointer-button_count == 0 || +if (seat-pointer == NULL || +seat-pointer-button_count == 0 || seat-pointer-grab_serial != serial || seat-pointer-focus == NULL) return; -- 2.0.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston] desktop-shell: Don't assume there is a pointer when resizing
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk Fixes a crash on touch devices without a pointer, when touching the window frame of a client. Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- desktop-shell/shell.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 84f5c83..d965618 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -1784,7 +1784,8 @@ common_surface_resize(struct wl_resource *resource, struct shell_surface *shsurf = wl_resource_get_user_data(resource); struct weston_surface *surface; - if (seat-pointer-button_count == 0 || + if (seat-pointer == NULL || + seat-pointer-button_count == 0 || seat-pointer-grab_serial != serial || seat-pointer-focus == NULL) return; -- 2.0.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston] exposay: fix crash when navigating with the keyboard
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk Commit a7592019 introduced an optimization that caused some exposay struct members to not be properly initialized, particularly cur_output, leading to crashes in some circumstances (e.g. pressing the down arrow key after going to exposay). Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- desktop-shell/exposay.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c index 1d8b40e..104b9d9 100644 --- a/desktop-shell/exposay.c +++ b/desktop-shell/exposay.c @@ -323,8 +323,10 @@ exposay_layout(struct desktop_shell *shell, struct shell_output *shell_output) i++; } - if (highlight) + if (highlight) { + shell-exposay.focus_current = NULL; exposay_highlight_surface(shell, highlight); + } weston_compositor_schedule_repaint(shell-compositor); -- 2.0.0.rc2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston 1/5] animation: fix move scale animation
On 22/05/14 22:41, Jonny Lamb wrote: Both weston_move_scale_run() and weston_slide_run() were broken in commit 3a869019. Commit a4a6f161 fixed and explained the problem for weston_slide_run() but weston_move_scale_run() remained broken. To fix weston_move_scale_run(), weston_view_animation_run() is also required. It was removed when _run() was split into two functions _create() and _run() in commit f5cc2b56, but _run() was not added in this commit. This can be easily reproduced by activating exposay. The patch works for me. Thanks, Emilio --- src/animation.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/animation.c b/src/animation.c index a29b34a..392e32d 100644 --- a/src/animation.c +++ b/src/animation.c @@ -458,8 +458,10 @@ weston_move_scale_run(struct weston_view *view, int dx, int dy, if (animation == NULL) return NULL; - weston_spring_init(animation-spring, 400.0, start, end); + weston_spring_init(animation-spring, 400.0, 0.0, 1.0); animation-spring.friction = 1150; + weston_view_animation_run(animation); + return animation; } ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: Wayland and Weston 1.5.0 is released
On 20/05/14 22:12, Kristian Høgsberg wrote: Hi, I tagged 1.5.0 of Wayland and Weston and uploaded tar balls last night. Tarballs available from http://wayland.freedesktop.org/releases.html as usual. Magic SHA1 number for the tags and tar balls: bace08b4a531ea4b80b4cf4e953320bc48ed7efe wayland-1.5.0.tar.xz 3ac62cd6b6012f40e37b1bd7fc1e8178585905ca wayland 1.5.0 tag 42939c536bcdfbd92edb5e51af76ce7f0a4c6ed7 weston-1.5.0.tar.xz 880193622024d7dc2b36421251d97b08da324570 weston 1.5.0 tag Yay! I'll get this into Debian soon. In retrospect, this release was pretty quiet. We ended up not merging a whole lot of features, but we did fix a lot of bugs and at one point the bug count [1] hit 14, the lowest in a long time. I think that's a pretty good feautre in itself. Definitely! Going forward, for master, I'd like to change the work flow a bit. The biggest problem with how we work today is me being a bottleneck at best or flat out dropping patches. So I'd like to open up commit access to some of the key contributors. Either people that have their corner of weston that they maintain (for example Pekka and the Raspberry Pi backend or Hardening and the RDP backend) or contributors who have been part of the project for a while and understands the code base well - or both. Nice. I hope you don't disappear though ;) Regards, Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston] exposay: don't crash if a view goes away
On 10/02/14 21:17, Daniel Stone wrote: Hi, On 10 February 2014 13:23, Emilio Pozuelo Monfort poch...@gmail.com wrote: When a view was destroyed while we were on exposay, we didn't remove it from the list of views, and so when leaving exposay we were trying to animate (and sometimes activate) a non-existent view, causing a crash. This should trigger re-layout as well - as should new windows. Certainly. I have opened https://bugs.freedesktop.org/show_bug.cgi?id=75186 to not forget about it. Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston 1/2] toytoolkit: avoid unnecessary redraws when focus changes
On 12/02/14 15:55, Jasper St. Pierre wrote: What reschedules the frame being drawn when focused is gained / lost, then? I'm not sure what reschedules it, but it does happen: twice when the window is focused, twice when it is unfocused (maybe something to optimize, why are we redrawing twice?). Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston 1/2] toytoolkit: avoid unnecessary redraws when focus changes
On 12/02/14 01:04, Bryce W. Harrington wrote: (For full disclosure - On one test run against master, I noticed the flower changed shape every time it received or lost focus, however I was never able to reproduce that behavior even after doing clean rebuilds.) That's precisely what made me find this bug, and should be 100% reproducible on master. I'm not sure why a clean rebuild would affect this. Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston] shell: Change stacking order calculation for popup surfaces
From: Philip Withnall philip.withn...@collabora.co.uk Always put them as the top-most layer in the layer list of their parent. This ensures that, for example, the popup menu produced by right-clicking on a surface (which is not currently at the top of the stacking order in the current workspace) is displayed at the top of the stacking order. [ Emilio: handle popups with non-shell-surface parents ] https://bugs.freedesktop.org/show_bug.cgi?id=74831 Signed-off-by: Philip Withnall philip.withn...@collabora.co.uk Co-authored-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- desktop-shell/shell.c | 47 +-- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index a73e8e0..d362f5f 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -2090,15 +2090,49 @@ shell_surface_calculate_layer_link (struct shell_surface *shsurf) struct weston_view *parent; switch (shsurf-type) { - case SHELL_SURFACE_POPUP: - case SHELL_SURFACE_TOPLEVEL: + case SHELL_SURFACE_POPUP: { + /* Popups should go at the front of the workspace of their +* parent surface, rather than just in front of the parent. This +* fixes the situation where there are two top-level windows: +* - Above +* - Below +* and a pop-up menu is created for 'Below'. We want: +* - Popup +* - Above +* - Below +* not: +* - Above +* - Popup +* - Below +*/ + struct shell_surface *parent_shsurf; + + parent_shsurf = get_shell_surface(shsurf-parent); + + if (parent_shsurf != NULL) + return shell_surface_calculate_layer_link(parent_shsurf); + else if (shsurf-parent) { + /* The parent surface may not be a shell surface, e.g. +* for right clicks on the panel. */ + parent = get_default_view(shsurf-parent); + + if (parent) + return parent-layer_link.prev; + } + + break; + } + + case SHELL_SURFACE_TOPLEVEL: { if (shsurf-state.fullscreen) { return shsurf-shell-fullscreen_layer.view_list; } else if (shsurf-parent) { - /* Move the surface to its parent layer so -* that surfaces which are transient for -* fullscreen surfaces don't get hidden by the -* fullscreen surfaces. */ + /* Move the surface to its parent layer so that +* surfaces which are transient for fullscreen surfaces +* don't get hidden by the fullscreen surfaces. +* However, unlike popups, transient surfaces are +* stacked in front of their parent but not in front of +* other surfaces of the same type. */ /* TODO: Handle a parent with multiple views */ parent = get_default_view(shsurf-parent); @@ -2106,6 +2140,7 @@ shell_surface_calculate_layer_link (struct shell_surface *shsurf) return parent-layer_link.prev; } break; + } case SHELL_SURFACE_XWAYLAND: return shsurf-shell-fullscreen_layer.view_list; -- 1.9.rc1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston] shell: activate windows upon a right click
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk This fixes the bug that commit da704d was trying to fix, where a popup would appear on top of its parent but behind other windows. https://bugs.freedesktop.org/show_bug.cgi?id=74831 Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- desktop-shell/shell.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index a73e8e0..be44905 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -5701,6 +5701,9 @@ shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell) weston_compositor_add_button_binding(ec, BTN_LEFT, 0, click_to_activate_binding, shell); + weston_compositor_add_button_binding(ec, BTN_RIGHT, 0, +click_to_activate_binding, +shell); weston_compositor_add_touch_binding(ec, 0, touch_to_activate_binding, shell); -- 1.9.rc1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston] Popup stacking
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk Hi, These two patches fix bug #74831 in two different ways. One of them, originally written by Philip, positions the popup on top of all other surfaces in the layer. That means that you can still end up with the parent surface behind a second parent (as the comment in the commit explains). The other commit activates a surface when you right-click on it. That is what at least gnome-shell does (I don't know about other WMs) and we may want to do the same. That change fixes the pop positioning bug because the parent surface is going to be on top, so placing the popup just above the parent surface is enough to have it on top of everything else. I'm leaning towards the second approach (activating the surface upon right click). Thoughts? Emilio -- 1.9.rc1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston] exposay: arrange views per-output
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk https://bugs.freedesktop.org/show_bug.cgi?id=73173 --- desktop-shell/exposay.c | 108 desktop-shell/shell.c | 7 desktop-shell/shell.h | 74 +++-- 3 files changed, 107 insertions(+), 82 deletions(-) diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c index fe7a3a7..b7e32c9 100644 --- a/desktop-shell/exposay.c +++ b/desktop-shell/exposay.c @@ -30,6 +30,7 @@ struct exposay_surface { struct desktop_shell *shell; + struct exposay_output *eoutput; struct weston_surface *surface; struct weston_view *view; struct wl_list link; @@ -140,6 +141,7 @@ exposay_highlight_surface(struct desktop_shell *shell, shell-exposay.row_current = esurface-row; shell-exposay.column_current = esurface-column; + shell-exposay.cur_output = esurface-eoutput; activate(shell, view-surface, shell-exposay.seat); shell-exposay.focus_current = view; @@ -178,32 +180,32 @@ exposay_pick(struct desktop_shell *shell, int x, int y) * aspect ratio into account really. Also needs to be notified of surface * addition and removal and adjust layout/animate accordingly. */ static enum exposay_layout_state -exposay_layout(struct desktop_shell *shell) +exposay_layout(struct desktop_shell *shell, struct shell_output *shell_output) { struct workspace *workspace = shell-exposay.workspace; - struct weston_compositor *compositor = shell-compositor; - struct weston_output *output = get_default_output(compositor); + struct weston_output *output = shell_output-output; + struct exposay_output *eoutput = shell_output-eoutput; struct weston_view *view; struct exposay_surface *esurface, *highlight = NULL; int w, h; int i; int last_row_removed = 0; - wl_list_init(shell-exposay.surface_list); - - shell-exposay.num_surfaces = 0; + eoutput-num_surfaces = 0; wl_list_for_each(view, workspace-layer.view_list, layer_link) { if (!get_shell_surface(view-surface)) continue; - shell-exposay.num_surfaces++; + if (view-output != output) + continue; + eoutput-num_surfaces++; } - if (shell-exposay.num_surfaces == 0) { - shell-exposay.grid_size = 0; - shell-exposay.hpadding_outer = 0; - shell-exposay.vpadding_outer = 0; - shell-exposay.padding_inner = 0; - shell-exposay.surface_size = 0; + if (eoutput-num_surfaces == 0) { + eoutput-grid_size = 0; + eoutput-hpadding_outer = 0; + eoutput-vpadding_outer = 0; + eoutput-padding_inner = 0; + eoutput-surface_size = 0; return EXPOSAY_LAYOUT_OVERVIEW; } @@ -219,37 +221,39 @@ exposay_layout(struct desktop_shell *shell) * XXX: Surely there has to be a better way to express this maths, * right?! */ - shell-exposay.grid_size = floor(sqrtf(shell-exposay.num_surfaces)); - if (pow(shell-exposay.grid_size, 2) != shell-exposay.num_surfaces) - shell-exposay.grid_size++; - last_row_removed = pow(shell-exposay.grid_size, 2) - shell-exposay.num_surfaces; + eoutput-grid_size = floor(sqrtf(eoutput-num_surfaces)); + if (pow(eoutput-grid_size, 2) != eoutput-num_surfaces) + eoutput-grid_size++; + last_row_removed = pow(eoutput-grid_size, 2) - eoutput-num_surfaces; - shell-exposay.hpadding_outer = (output-width / 10); - shell-exposay.vpadding_outer = (output-height / 10); - shell-exposay.padding_inner = 80; + eoutput-hpadding_outer = (output-width / 10); + eoutput-vpadding_outer = (output-height / 10); + eoutput-padding_inner = 80; - w = output-width - (shell-exposay.hpadding_outer * 2); - w -= shell-exposay.padding_inner * (shell-exposay.grid_size - 1); - w /= shell-exposay.grid_size; + w = output-width - (eoutput-hpadding_outer * 2); + w -= eoutput-padding_inner * (eoutput-grid_size - 1); + w /= eoutput-grid_size; - h = output-height - (shell-exposay.vpadding_outer * 2); - h -= shell-exposay.padding_inner * (shell-exposay.grid_size - 1); - h /= shell-exposay.grid_size; + h = output-height - (eoutput-vpadding_outer * 2); + h -= eoutput-padding_inner * (eoutput-grid_size - 1); + h /= eoutput-grid_size; - shell-exposay.surface_size = (w h) ? w : h; - if (shell-exposay.surface_size (output-width / 2)) - shell-exposay.surface_size = output-width / 2; - if (shell-exposay.surface_size (output-height / 2)) - shell-exposay.surface_size = output-height / 2; + eoutput
[PATCH weston v2 3/6] noop-renderer: Read the shm buffer contents on attach
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk The noop-renderer doesn't read buffer contents, which means bad buffers go undetected. Thus, read the buffer contents just for the purpose of triggering SIGBUS (and having the client killed). Fixes the bad-buffer test when run against the headless backend. Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- src/noop-renderer.c | 22 -- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/noop-renderer.c b/src/noop-renderer.c index 36d59be..72332eb 100644 --- a/src/noop-renderer.c +++ b/src/noop-renderer.c @@ -50,6 +50,9 @@ static void noop_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) { struct wl_shm_buffer *shm_buffer; + uint8_t *data; + uint32_t size, i, width, height, stride; + volatile unsigned char unused = 0; /* volatile so it's not optimized out */ if (!buffer) return; @@ -61,9 +64,24 @@ noop_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) return; } + data = wl_shm_buffer_get_data(shm_buffer); + stride = wl_shm_buffer_get_stride(shm_buffer); + width = wl_shm_buffer_get_width(shm_buffer); + height = wl_shm_buffer_get_height(shm_buffer); + size = stride * height; + + /* Access the buffer data to make sure the buffer's client gets killed +* if the buffer size is invalid. This makes the bad_buffer test pass. +* This can be removed if we start reading the buffer contents +* somewhere else, e.g. in repaint_output(). */ + wl_shm_buffer_begin_access(shm_buffer); + for (i = 0; i size; i++) + unused ^= data[i]; + wl_shm_buffer_end_access(shm_buffer); + buffer-shm_buffer = shm_buffer; - buffer-width = wl_shm_buffer_get_width(shm_buffer); - buffer-height = wl_shm_buffer_get_height(shm_buffer); + buffer-width = width; + buffer-height = height; } static void -- 1.9.rc1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston v2 2/6] noop-renderer: Set the buffer size on attach requests
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk This lets the compositor know the size of the surface as calculated in weston_surface_set_size_from_buffer(), and fixes a couple of tests when using the headless backend. Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- src/noop-renderer.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/src/noop-renderer.c b/src/noop-renderer.c index ad750b5..36d59be 100644 --- a/src/noop-renderer.c +++ b/src/noop-renderer.c @@ -49,6 +49,21 @@ noop_renderer_flush_damage(struct weston_surface *surface) static void noop_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) { + struct wl_shm_buffer *shm_buffer; + + if (!buffer) + return; + + shm_buffer = wl_shm_buffer_get(buffer-resource); + + if (!shm_buffer) { + weston_log(No-op renderer supports only SHM buffers\n); + return; + } + + buffer-shm_buffer = shm_buffer; + buffer-width = wl_shm_buffer_get_width(shm_buffer); + buffer-height = wl_shm_buffer_get_height(shm_buffer); } static void -- 1.9.rc1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston v2 5/6] tests: use the headless backend to run the test suite
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk Other backends can be used by passing BACKEND=some-backend.so, e.g. $ make check BACKEND=x11-backend.so Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- tests/weston-tests-env | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/weston-tests-env b/tests/weston-tests-env index 04b91a9..9180053 100755 --- a/tests/weston-tests-env +++ b/tests/weston-tests-env @@ -17,14 +17,12 @@ OUTLOG=$LOGDIR/$1-log.txt rm -f $SERVERLOG -if test x$WAYLAND_DISPLAY != x; then - BACKEND=$abs_builddir/.libs/wayland-backend.so -elif test x$DISPLAY != x; then - BACKEND=$abs_builddir/.libs/x11-backend.so -else - BACKEND=$abs_builddir/.libs/wayland-backend.so +if test -z $BACKEND; then + BACKEND=headless-backend.so fi +BACKEND=$abs_builddir/.libs/$BACKEND + case $TESTNAME in *.la|*.so) $WESTON --backend=$BACKEND \ -- 1.9.rc1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston v2 4/6] tests: Skip buffer-count if EGL initialization fails
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk That is the case when using the headless backend. In the future we may be able to use the mesa null egl platform but for now let's just skip it. Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- tests/buffer-count-test.c | 29 +++-- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/tests/buffer-count-test.c b/tests/buffer-count-test.c index c7ddeb6..dfc4673 100644 --- a/tests/buffer-count-test.c +++ b/tests/buffer-count-test.c @@ -31,6 +31,8 @@ #include wayland-egl.h #include GLES2/gl2.h +#define fail(msg) { fprintf(stderr, %s failed\n, msg); return -1; } + struct test_data { struct client *client; @@ -40,7 +42,7 @@ struct test_data { EGLSurface egl_surface; }; -static void +static int init_egl(struct test_data *test_data) { struct wl_egl_window *native_window; @@ -67,21 +69,24 @@ init_egl(struct test_data *test_data) test_data-egl_dpy = eglGetDisplay((EGLNativeDisplayType) test_data-client-wl_display); - assert(test_data-egl_dpy); + if (!test_data-egl_dpy) + fail(eglGetDisplay); - ret = eglInitialize(test_data-egl_dpy, major, minor); - assert(ret == EGL_TRUE); - ret = eglBindAPI(EGL_OPENGL_ES_API); - assert(ret == EGL_TRUE); + if (eglInitialize(test_data-egl_dpy, major, minor) != EGL_TRUE) + fail(eglInitialize); + if (eglBindAPI(EGL_OPENGL_ES_API) != EGL_TRUE) + fail(eglBindAPI); ret = eglChooseConfig(test_data-egl_dpy, config_attribs, test_data-egl_conf, 1, n); - assert(ret n == 1); + if (!(ret n == 1)) + fail(eglChooseConfig); test_data-egl_ctx = eglCreateContext(test_data-egl_dpy, test_data-egl_conf, EGL_NO_CONTEXT, context_attribs); - assert(test_data-egl_ctx); + if (!test_data-egl_ctx) + fail(eglCreateContext); native_window = wl_egl_window_create(surface-wl_surface, @@ -95,7 +100,8 @@ init_egl(struct test_data *test_data) ret = eglMakeCurrent(test_data-egl_dpy, test_data-egl_surface, test_data-egl_surface, test_data-egl_ctx); - assert(ret == EGL_TRUE); + if (ret != EGL_TRUE) + fail(eglMakeCurrent); /* This test is specific to mesa 10.1 and later, which is the * first release that doesn't accidentally triple-buffer. */ @@ -108,6 +114,7 @@ init_egl(struct test_data *test_data) if (major 10 || (major == 10 minor 1)) skip(mesa version too old (%s)\n, str); + return 0; } TEST(test_buffer_count) @@ -117,7 +124,9 @@ TEST(test_buffer_count) int i; test_data.client = client_create(10, 10, 10, 10); - init_egl(test_data); + if (init_egl(test_data) 0) + skip(could not initialize egl, +possibly using the headless backend\n); /* This is meant to represent a typical game loop which is * expecting eglSwapBuffers to block and throttle the -- 1.9.rc1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston 2/6] noop-renderer: Set the buffer size on attach requests
On 06/02/14 14:37, Pekka Paalanen wrote: On Thu, 6 Feb 2014 12:30:32 +0100 Emilio Pozuelo Monfort poch...@gmail.com wrote: From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk This lets the compositor know the size of the surface as calculated in weston_surface_set_size_from_buffer(), and fixes a couple of tests when using the headless backend. Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- src/noop-renderer.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/src/noop-renderer.c b/src/noop-renderer.c index ad750b5..cf1a7f2 100644 --- a/src/noop-renderer.c +++ b/src/noop-renderer.c @@ -49,6 +49,16 @@ noop_renderer_flush_damage(struct weston_surface *surface) static void noop_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) { +struct wl_shm_buffer *shm_buffer; + +if (!buffer) +return; + +shm_buffer = wl_shm_buffer_get(buffer-resource); + +buffer-shm_buffer = shm_buffer; +buffer-width = wl_shm_buffer_get_width(shm_buffer); +buffer-height = wl_shm_buffer_get_height(shm_buffer); } static void Hi, if we ever manage to create non-wl_shm buffers and end up here, wl_shm_buffer_get() will return NULL. It may become a problem if the headless backend ever grows EGL support. But until then, I'm ok with this. Oh yeah, I intended to do that... I have added a check similar to pixman-renderer's in v2. Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 5/6] tests: use the headless backend to run the test suite
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk Other backends can be used by passing BACKEND=some-backend.so, e.g. $ make check BACKEND=x11-backend.so Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- tests/weston-tests-env | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/weston-tests-env b/tests/weston-tests-env index 04b91a9..9180053 100755 --- a/tests/weston-tests-env +++ b/tests/weston-tests-env @@ -17,14 +17,12 @@ OUTLOG=$LOGDIR/$1-log.txt rm -f $SERVERLOG -if test x$WAYLAND_DISPLAY != x; then - BACKEND=$abs_builddir/.libs/wayland-backend.so -elif test x$DISPLAY != x; then - BACKEND=$abs_builddir/.libs/x11-backend.so -else - BACKEND=$abs_builddir/.libs/wayland-backend.so +if test -z $BACKEND; then + BACKEND=headless-backend.so fi +BACKEND=$abs_builddir/.libs/$BACKEND + case $TESTNAME in *.la|*.so) $WESTON --backend=$BACKEND \ -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 1/6] compositor-headless: create input devices
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk Fixes a segfault when using compositor-headless for the test suite as many tests assume there are input devices and try to use them through the wl_test interface. Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- src/compositor-headless.c | 30 ++ 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/compositor-headless.c b/src/compositor-headless.c index 5a5c1e6..4ecb8d4 100644 --- a/src/compositor-headless.c +++ b/src/compositor-headless.c @@ -131,6 +131,25 @@ headless_compositor_create_output(struct headless_compositor *c, return 0; } +static int +headless_input_create(struct headless_compositor *c) +{ + weston_seat_init(c-fake_seat, c-base, default); + + weston_seat_init_pointer(c-fake_seat); + + if (weston_seat_init_keyboard(c-fake_seat, NULL) 0) + return -1; + + return 0; +} + +static void +headless_input_destroy(struct headless_compositor *c) +{ + weston_seat_release(c-fake_seat); +} + static void headless_restore(struct weston_compositor *ec) { @@ -141,7 +160,7 @@ headless_destroy(struct weston_compositor *ec) { struct headless_compositor *c = (struct headless_compositor *) ec; - weston_seat_release(c-fake_seat); + headless_input_destroy(c); weston_compositor_shutdown(ec); free(ec); @@ -162,19 +181,22 @@ headless_compositor_create(struct wl_display *display, if (weston_compositor_init(c-base, display, argc, argv, config) 0) goto err_free; - weston_seat_init(c-fake_seat, c-base, default); + if (headless_input_create(c) 0) + goto err_compositor; c-base.destroy = headless_destroy; c-base.restore = headless_restore; if (headless_compositor_create_output(c, width, height) 0) - goto err_compositor; + goto err_input; if (noop_renderer_init(c-base) 0) - goto err_compositor; + goto err_input; return c-base; +err_input: + headless_input_destroy(c); err_compositor: weston_compositor_shutdown(c-base); err_free: -- 1.8.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 6/6] tests: Properly report skipped tests
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk We were calling exit(0) when tests were skipped, which counted them as passed instead of skipped. Fix this by properly exiting with 77 (which is what automake expects for skipped tests) from the tests themselves, then returning 77 again from weston-test-runner if all the tests were skipped. Finally the weston-test.so module catches weston-test-runner's exit code and uses it as an exit code, which is what automake will see and use. Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- tests/weston-test-client-helper.c | 8 +--- tests/weston-test-runner.c| 41 --- tests/weston-test.c | 6 ++ 3 files changed, 41 insertions(+), 14 deletions(-) diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c index 399aa44..186b395 100644 --- a/tests/weston-test-client-helper.c +++ b/tests/weston-test-client-helper.c @@ -505,9 +505,11 @@ skip(const char *fmt, ...) vfprintf(stderr, fmt, argp); va_end(argp); - /* automake tests uses exit code 77, but we don't have a good -* way to make weston exit with that from here. */ - exit(0); + /* automake tests uses exit code 77. weston-test-runner will see +* this and use it, and then weston-test's sigchld handler (in the +* weston process) will use that as an exit status, which is what +* automake will see in the end. */ + exit(77); } static void diff --git a/tests/weston-test-runner.c b/tests/weston-test-runner.c index 4274b39..6307566 100644 --- a/tests/weston-test-runner.c +++ b/tests/weston-test-runner.c @@ -32,6 +32,8 @@ #include signal.h #include weston-test-runner.h +#define SKIP 77 + extern const struct weston_test __start_test_section, __stop_test_section; static const struct weston_test * @@ -67,6 +69,7 @@ static int exec_and_report_test(const struct weston_test *t, void *test_data, int iteration) { int success = 0; + int skip = 0; int hardfail = 0; siginfo_t info; @@ -91,6 +94,8 @@ exec_and_report_test(const struct weston_test *t, void *test_data, int iteration fprintf(stderr, exit status %d, info.si_status); if (info.si_status == EXIT_SUCCESS) success = 1; + else if (info.si_status == SKIP) + skip = 1; break; case CLD_KILLED: case CLD_DUMPED: @@ -106,7 +111,10 @@ exec_and_report_test(const struct weston_test *t, void *test_data, int iteration if (success !hardfail) { fprintf(stderr, , pass.\n); return 1; - } else { + } else if (skip) { + fprintf(stderr, , skip.\n); + return SKIP; + } else { fprintf(stderr, , fail.\n); return 0; } @@ -114,14 +122,17 @@ exec_and_report_test(const struct weston_test *t, void *test_data, int iteration /* Returns number of tests and number of pass / fail in param args */ static int -iterate_test(const struct weston_test *t, int *passed) +iterate_test(const struct weston_test *t, int *passed, int *skipped) { - int i; + int ret, i; void *current_test_data = (void *) t-table_data; for (i = 0; i t-n_elements; ++i, current_test_data += t-element_size) { - if (exec_and_report_test(t, current_test_data, i)) + ret = exec_and_report_test(t, current_test_data, i); + if (ret == 0) ++(*passed); + else if (ret == SKIP) + ++(*skipped); } return t-n_elements; @@ -132,6 +143,7 @@ int main(int argc, char *argv[]) const struct weston_test *t; int total = 0; int pass = 0; + int skip = 0; if (argc == 2) { const char *testname = argv[1]; @@ -149,19 +161,26 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } - int number_passed_in_test = 0; - total += iterate_test(t, number_passed_in_test); + int number_passed_in_test = 0, number_skipped_in_test = 0; + total += iterate_test(t, number_passed_in_test, number_skipped_in_test); pass += number_passed_in_test; + skip += number_skipped_in_test; } else { for (t = __start_test_section; t __stop_test_section; t++) { - int number_passed_in_test = 0; - total += iterate_test(t, number_passed_in_test); + int number_passed_in_test = 0, number_skipped_in_test = 0; + total += iterate_test(t, number_passed_in_test, number_skipped_in_test); pass += number_passed_in_test; + skip
Re: [PATCH weston 6/6] tests: Properly report skipped tests
On 06/02/14 12:30, Emilio Pozuelo Monfort wrote: From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk We were calling exit(0) when tests were skipped, which counted them as passed instead of skipped. Fix this by properly exiting with 77 (which is what automake expects for skipped tests) from the tests themselves, then returning 77 again from weston-test-runner if all the tests were skipped. Finally the weston-test.so module catches weston-test-runner's exit code and uses it as an exit code, which is what automake will see and use. Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- tests/weston-test-client-helper.c | 8 +--- tests/weston-test-runner.c| 41 --- tests/weston-test.c | 6 ++ 3 files changed, 41 insertions(+), 14 deletions(-) diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c index 399aa44..186b395 100644 --- a/tests/weston-test-client-helper.c +++ b/tests/weston-test-client-helper.c @@ -505,9 +505,11 @@ skip(const char *fmt, ...) vfprintf(stderr, fmt, argp); va_end(argp); - /* automake tests uses exit code 77, but we don't have a good - * way to make weston exit with that from here. */ - exit(0); + /* automake tests uses exit code 77. weston-test-runner will see + * this and use it, and then weston-test's sigchld handler (in the + * weston process) will use that as an exit status, which is what + * automake will see in the end. */ + exit(77); } static void diff --git a/tests/weston-test-runner.c b/tests/weston-test-runner.c index 4274b39..6307566 100644 --- a/tests/weston-test-runner.c +++ b/tests/weston-test-runner.c @@ -32,6 +32,8 @@ #include signal.h #include weston-test-runner.h +#define SKIP 77 + extern const struct weston_test __start_test_section, __stop_test_section; static const struct weston_test * @@ -67,6 +69,7 @@ static int exec_and_report_test(const struct weston_test *t, void *test_data, int iteration) { int success = 0; + int skip = 0; int hardfail = 0; siginfo_t info; @@ -91,6 +94,8 @@ exec_and_report_test(const struct weston_test *t, void *test_data, int iteration fprintf(stderr, exit status %d, info.si_status); if (info.si_status == EXIT_SUCCESS) success = 1; + else if (info.si_status == SKIP) + skip = 1; break; case CLD_KILLED: case CLD_DUMPED: @@ -106,7 +111,10 @@ exec_and_report_test(const struct weston_test *t, void *test_data, int iteration if (success !hardfail) { fprintf(stderr, , pass.\n); return 1; - } else { + } else if (skip) { + fprintf(stderr, , skip.\n); + return SKIP; + } else { fprintf(stderr, , fail.\n); return 0; } @@ -114,14 +122,17 @@ exec_and_report_test(const struct weston_test *t, void *test_data, int iteration /* Returns number of tests and number of pass / fail in param args */ static int -iterate_test(const struct weston_test *t, int *passed) +iterate_test(const struct weston_test *t, int *passed, int *skipped) { - int i; + int ret, i; void *current_test_data = (void *) t-table_data; for (i = 0; i t-n_elements; ++i, current_test_data += t-element_size) { - if (exec_and_report_test(t, current_test_data, i)) + ret = exec_and_report_test(t, current_test_data, i); + if (ret == 0) ++(*passed); Logic here is inversed, the check should be ret == 1. I'll send a fixed patch tomorrow. Emilio + else if (ret == SKIP) + ++(*skipped); } return t-n_elements; @@ -132,6 +143,7 @@ int main(int argc, char *argv[]) const struct weston_test *t; int total = 0; int pass = 0; + int skip = 0; if (argc == 2) { const char *testname = argv[1]; @@ -149,19 +161,26 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } - int number_passed_in_test = 0; - total += iterate_test(t, number_passed_in_test); + int number_passed_in_test = 0, number_skipped_in_test = 0; + total += iterate_test(t, number_passed_in_test, number_skipped_in_test); pass += number_passed_in_test; + skip += number_skipped_in_test; } else { for (t = __start_test_section; t __stop_test_section; t++) { - int number_passed_in_test = 0; - total += iterate_test(t, number_passed_in_test); + int number_passed_in_test = 0, number_skipped_in_test = 0; + total
Re: [PATCH weston] Fullscreen surfaces
Hi Bill, On 30/01/14 23:33, Bill Spitzak wrote: There really should not be a fullscreen layer which is what is causing this problem. layers are imho a mistake except for the desttop and the mouse cursor. What I think needs to happen: Fullscreen, normal windows, and panels can be arranged in any stacking order, except the compositor enforces this rule: The panels are always just below the lowest fullscreen window. If there are no fullscreen windows then the panel is above all windows. There are several ways to enforce this but one that matches current window apis is: 1. When a window is raised and there are no fullscreen windows, the panels are also raised to remain above it. If there are fullscreen windows then the panel is not moved. Note that a window can be raised above a fullscreen window, thus solving this bug. 2. Whan a window switches to fullscreen it is also raised (thus it will end up above the panel). (an alternative is to lower the panel but that is not standard behavior in existing windowing systems). 3. When the last fullscreen window switches to non-fullscreen, the panel is raised above all windows. I think this could work well. It would indeed solve https://bugs.freedesktop.org/show_bug.cgi?id=74219. I just disagree with one detail: the panel should always be on top except when the top surface is fullscreened. So if there are two surfaces, a normal surface above and a fullscreen surface behind it, then the panel should be raised (that would be consistent with what we currently do and with what gnome-shell does). Regards, Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston] Fullscreen surfaces
On 03/02/14 17:14, Emilio Pozuelo Monfort wrote: Hi Bill, On 30/01/14 23:33, Bill Spitzak wrote: There really should not be a fullscreen layer which is what is causing this problem. layers are imho a mistake except for the desttop and the mouse cursor. What I think needs to happen: Fullscreen, normal windows, and panels can be arranged in any stacking order, except the compositor enforces this rule: The panels are always just below the lowest fullscreen window. If there are no fullscreen windows then the panel is above all windows. There are several ways to enforce this but one that matches current window apis is: 1. When a window is raised and there are no fullscreen windows, the panels are also raised to remain above it. If there are fullscreen windows then the panel is not moved. Note that a window can be raised above a fullscreen window, thus solving this bug. 2. Whan a window switches to fullscreen it is also raised (thus it will end up above the panel). (an alternative is to lower the panel but that is not standard behavior in existing windowing systems). 3. When the last fullscreen window switches to non-fullscreen, the panel is raised above all windows. I think this could work well. It would indeed solve https://bugs.freedesktop.org/show_bug.cgi?id=74219. I just disagree with one detail: the panel should always be on top except when the top surface is fullscreened. So if there are two surfaces, a normal surface above and a fullscreen surface behind it, then the panel should be raised (that would be consistent with what we currently do and with what gnome-shell does). I talked to Jasper on irc and he said mutter keeps a normal layer and a fullscreen layer, and adds an extra layer where the focused window is placed and which is drawn above the other layers. That would solve #74219 as well. However this made me think we can solve #74219 easily without adding an extra layer or removing the fullscreen layer. We just need to raise a surface to the top whenever it is focused, including lowering the fullscreen layer if that isn't empty. I'll try to look at this later this week if I can find some time. Cheers, Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston] compositor-rpi: Fix input initialization
On 03/02/14 20:00, Pekka Paalanen wrote: On Mon, 3 Feb 2014 16:57:27 +0100 poch...@gmail.com wrote: From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk The input initialization code assumes the outputs have already been initialized; thus create the outputs first. This fixes a segfault upon startup. It is also what the drm and fbdev backends do. --- src/compositor-rpi.c | 19 --- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c index 399090d..e7c0e0d 100644 --- a/src/compositor-rpi.c +++ b/src/compositor-rpi.c @@ -527,13 +527,6 @@ rpi_compositor_create(struct wl_display *display, int *argc, char *argv[], weston_log(Dispmanx planes are %s buffered.\n, compositor-single_buffer ? single : double); -if (udev_input_init(compositor-input, -compositor-base, -compositor-udev, seat0) != 0) { -weston_log(Failed to initialize udev input.\n); -goto out_launcher; -} - for (key = KEY_F1; key KEY_F9; key++) weston_compositor_add_key_binding(compositor-base, key, MODIFIER_CTRL | MODIFIER_ALT, @@ -549,19 +542,23 @@ rpi_compositor_create(struct wl_display *display, int *argc, char *argv[], bcm_host_init(); if (rpi_renderer_create(compositor-base, param-renderer) 0) -goto out_udev_input; +goto out_launcher; if (rpi_output_create(compositor, param-output_transform) 0) goto out_renderer; +if (udev_input_init(compositor-input, +compositor-base, +compositor-udev, seat0) != 0) { +weston_log(Failed to initialize udev input.\n); +goto out_renderer; Hi, if input init fails, was there something to clean up from rpi_output_create()? Otherwise looks fine. There's nothing to clean up. The newly created rpi_output structure has rpi_output_destroy as its destroy callback and that should be enough. Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston] build: Set a default aux dir
Looks good to me. Reviewed-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk On 01/02/14 18:48, Guillem Jover wrote: This moves all the auxiliary build scripts into a build-aux directory, and fixes an issue with configure being unable to find scripts because it tries to change to an empty directory to get the absolute path, which results in getting the path to the user's home directory instead. ,-- checking whether build environment is sane... yes /bin/bash: /home/user/missing: No such file or directory configure: WARNING: 'missing' script is too old or missing `--- Signed-off-by: Guillem Jover guil...@hadrons.org --- .gitignore | 8 +--- configure.ac | 1 + 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 111c56c..9ccac74 100644 --- a/.gitignore +++ b/.gitignore @@ -12,20 +12,14 @@ cscope.out .libs /aclocal.m4 /autom4te.cache -/compile -/config.guess +/build-aux/ /config.h /config.h.in /config.log /config.mk /config.status -/config.sub /configure -/depcomp -/install-sh /libtool -/ltmain.sh -/missing /stamp-h1 /test-driver /weston.ini diff --git a/configure.ac b/configure.ac index f190672..a9de41c 100644 --- a/configure.ac +++ b/configure.ac @@ -16,6 +16,7 @@ AC_SUBST([WESTON_VERSION_MINOR], [weston_minor_version]) AC_SUBST([WESTON_VERSION_MICRO], [weston_micro_version]) AC_SUBST([WESTON_VERSION], [weston_version]) +AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADERS([config.h]) AC_USE_SYSTEM_EXTENSIONS ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] dim-layer: fix dimming for unfocused surfaces
Hi Ander, On 29/01/14 16:09, Ander Conselvan de Oliveira wrote: On 01/15/2014 10:30 AM, Emilio Pozuelo Monfort wrote: bump On 07/01/14 17:23, poch...@gmail.com wrote: From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk Unfocusing a surface should dim it when dim-layer is enabled, but this got broken in commit 83ffd9. --- desktop-shell/shell.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index f85a269..cca96be 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -4141,6 +4141,7 @@ activate(struct desktop_shell *shell, struct weston_surface *es, struct weston_seat *seat) { struct weston_surface *main_surface; +struct weston_view *main_view; struct focus_state *state; struct workspace *ws; struct weston_surface *old_es; @@ -4162,8 +4163,18 @@ activate(struct desktop_shell *shell, struct weston_surface *es, shsurf = get_shell_surface(main_surface); if (shsurf-state.fullscreen) shell_configure_fullscreen(shsurf); -else +else { +ws = get_current_workspace(shell); +main_view = get_default_view(main_surface); +if (main_view) { +wl_list_remove(main_view-layer_link); +wl_list_insert(ws-layer.view_list, main_view-layer_link); +weston_view_damage_below(main_view); +weston_surface_damage(main_view-surface); +} So you're basically rewriting weston_view_restack() here. Wouldn't a better fix be to move the animation logic below the call to shell_surface_update_layer(), which is the place where the surface is restacked after the commit you mentioned. You are absolutely right. I'll send a new patch soon together with other fixes for fullscreen surfaces. Regards, Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] dim-layer: fix dimming for unfocused surfaces
bump On 07/01/14 17:23, poch...@gmail.com wrote: From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk Unfocusing a surface should dim it when dim-layer is enabled, but this got broken in commit 83ffd9. --- desktop-shell/shell.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index f85a269..cca96be 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -4141,6 +4141,7 @@ activate(struct desktop_shell *shell, struct weston_surface *es, struct weston_seat *seat) { struct weston_surface *main_surface; + struct weston_view *main_view; struct focus_state *state; struct workspace *ws; struct weston_surface *old_es; @@ -4162,8 +4163,18 @@ activate(struct desktop_shell *shell, struct weston_surface *es, shsurf = get_shell_surface(main_surface); if (shsurf-state.fullscreen) shell_configure_fullscreen(shsurf); - else + else { + ws = get_current_workspace(shell); + main_view = get_default_view(main_surface); + if (main_view) { + wl_list_remove(main_view-layer_link); + wl_list_insert(ws-layer.view_list, main_view-layer_link); + weston_view_damage_below(main_view); + weston_surface_damage(main_view-surface); + } + restore_all_output_modes(shell-compositor); + } if (shell-focus_animation_type != ANIMATION_NONE) { ws = get_current_workspace(shell); ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
wl_display_connect() falling back to wayland-0
Hi, I was looking at making gtk+ try the wayland backend before the x11 one [1]. This would solve the problem where every gtk+ app uses the x11 backend through XWayland when the latter is available. As you can read on comment #3 and in the patch from comment #1, wl_display_connect() currently falls back to wayland-0 if WAYLAND_DISPLAY is not in the environment, which causes the wayland backend initialization to succeed when running from X11 while weston is running (whether in a different tty or in an X11 window). The workaround I'm using in gtk+ is to directly fail the wayland backend initialization if WAYLAND_DISPLAY is not set, as Pekka suggested to me. This works nicely, making gtk+ apps use the x11 backend when launched from within X11, and use the wayland backend when started within weston. So my question is: why are we falling back to wayland-0 when WAYLAND_DISPLAY isn't set? Is this so that one can easily/quickly run apps from a tty for debugging purposes? Cheers, Emilio [1] https://bugzilla.gnome.org/show_bug.cgi?id=719989 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: Arrgggh Wayland is not compiling again (xcb-composite)
On 08/12/13 16:48, Bill Spitzak wrote: Make of weston is not working: ~/swdevl/wayland/weston$ make /dev/nullconfigure: error: Package requirements (xcb xcb-xfixes xcb-composite xcursor cairo-xcb) were not met: No package 'xcb-composite' found I have the .pc file: ls /usr/lib/i386-linux-gnu/pkgconfig pthread-stubs.pc xcb-composite.pc xcb-render.pc xcb-xfixes.pc xau.pcxcb.pcxcb-shape.pc xdmcp.pc And that directory is on the $PKG_CONFIG_PATH I also note that it seems to have found the xcb-fixes.pc in the same directory. Any idea how to fix this? It may be that any of the .pc files needed by xcb-composite is missing, which would be a packaging bug. Check config.log or the output of `pkg-config --libs xcb-composite'. Also it may be a dumb question, but why is weston depending on xcb-composite (or any of xcb at all)? Seems to be required for xwayland which you can disable with --disable-xwayland. I don't know what it is needed for. Emilio ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH 1/9] animation, shell: add kbd focus change animation
On 19/11/13 04:27, Bryce W. Harrington wrote: On Fri, Nov 15, 2013 at 05:53:30PM +0100, Emilio Pozuelo Monfort wrote: From: Louis-Francis Ratté-Boulianne l...@collabora.com When enabled, this will make all but the keyboard-focused window dim. Also the background gets dimmed, if there are any windows open. The panel is not dimmed. When the keyboard focus changes, the change in dimming is animated. The dimming is implemented with transparent solid-color surfaces, two at most. The net effect of two overlapping dim surfaces is kept constant during animations (stable fade animation). There is a new weston.ini option focus-animation, that defaults to none, and can be set to dim-layer to enable the focus change animation. [pq: Sliced, squashed, and rebased the patch series. Fixed surface alpha interaction with the switcher. Wrote the commit message.] [pochu: rebased, ported to weston_view] --- ... @@ -542,10 +649,21 @@ focus_state_surface_destroy(struct wl_listener *listener, void *data) if (main_surface != state-keyboard_focus) next = main_surface; +shell = state-seat-compositor-shell_interface.shell; if (next) { -shell = state-seat-compositor-shell_interface.shell; +state-keyboard_focus = NULL; activate(shell, next, state-seat); } else { +if (shell-focus_animation_type == ANIMATION_DIM_LAYER) { +if (state -ws-focus_animation) Is the space after state intentional? Oops, typo! Though it doesn't affect the code. Should be amended before committing though. Thanks for spotting it. Emilio + weston_view_animation_destroy(state-ws-focus_animation); + +state-ws-focus_animation = weston_fade_run( +state-ws-fsurf_front-view, +state-ws-fsurf_front-view-alpha, 0.0, 300, +focus_animation_done, state-ws); +} + wl_list_remove(state-link); focus_state_destroy(state); } Bryce ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 0/9] exposay alt-tab
Rebased on master and fixed a couple of conflicts with Giulio's recent input changes. Fixed the typo spotted by Bryce. Daniel Stone (3): Add modifier-only binding Add move/scale animation Add Exposay Emilio Pozuelo Monfort (5): input: Don't send leave events to destroyed views shell: Implement alt-tab switcher exposay: add cancel impl to the kbd grab iface exposay: Activate a surface when hovering it shell: Set output on the focus_surfaces' view Louis-Francis Ratté-Boulianne (1): animation, shell: add kbd focus change animation src/animation.c | 115 +- src/bindings.c | 58 +++ src/compositor.c |1 + src/compositor.h | 31 ++ src/input.c | 65 +++- src/shell.c | 1095 -- 6 files changed, 1334 insertions(+), 31 deletions(-) -- 1.8.4.rc3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 5/9] input: Don't send leave events to destroyed views
If a view which has focus is destroyed, we would send a leave event while changing focus, causing a segfault. Prevent this by listening to the view's destroy signal and removing it from the pointer focus. Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- src/compositor.h | 1 + src/input.c | 27 ++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/compositor.h b/src/compositor.h index a8504af..b84289a 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -308,6 +308,7 @@ struct weston_pointer { struct wl_list focus_resource_list; struct weston_view *focus; uint32_t focus_serial; + struct wl_listener focus_listener; struct wl_signal focus_signal; struct wl_signal motion_signal; diff --git a/src/input.c b/src/input.c index fc93f88..7480374 100644 --- a/src/input.c +++ b/src/input.c @@ -395,8 +395,9 @@ weston_pointer_create(struct weston_seat *seat) seat-compositor-default_pointer_grab); pointer-default_grab.pointer = pointer; pointer-grab = pointer-default_grab; - wl_signal_init(pointer-focus_signal); wl_signal_init(pointer-motion_signal); + wl_signal_init(pointer-focus_signal); + wl_list_init(pointer-focus_listener.link); pointer-sprite_destroy_listener.notify = pointer_handle_sprite_destroy; @@ -503,6 +504,23 @@ seat_send_updated_caps(struct weston_seat *seat) } } +static void +destroy_pointer_focus(struct wl_listener *listener, void *data) +{ + struct weston_pointer *pointer; + + pointer = container_of(listener, struct weston_pointer, + focus_listener); + + pointer-focus = NULL; + move_resources(pointer-resource_list, pointer-focus_resource_list); + + wl_list_remove(pointer-focus_listener.link); + wl_list_init(pointer-focus_listener.link); + + wl_signal_emit(pointer-focus_signal, pointer); +} + WL_EXPORT void weston_pointer_set_focus(struct weston_pointer *pointer, struct weston_view *view, @@ -559,7 +577,14 @@ weston_pointer_set_focus(struct weston_pointer *pointer, pointer-focus_serial = serial; } + if (!wl_list_empty(pointer-focus_listener.link)) { + wl_list_remove(pointer-focus_listener.link); + wl_list_init(pointer-focus_listener.link); + } pointer-focus = view; + pointer-focus_listener.notify = destroy_pointer_focus; + if (view) + wl_signal_add(view-destroy_signal, pointer-focus_listener); wl_signal_emit(pointer-focus_signal, pointer); } -- 1.8.4.rc3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 7/9] exposay: add cancel impl to the kbd grab iface
Otherwise we'll crash when cancel is called. Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- src/shell.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/src/shell.c b/src/shell.c index 2a8c04c..dae31a0 100644 --- a/src/shell.c +++ b/src/shell.c @@ -5351,9 +5351,19 @@ exposay_modifier(struct weston_keyboard_grab *grab, uint32_t serial, { } +static void +exposay_cancel(struct weston_keyboard_grab *grab) +{ + struct desktop_shell *shell = + container_of(grab, struct desktop_shell, exposay.grab_kbd); + + exposay_set_state(shell, EXPOSAY_TARGET_CANCEL, shell-exposay.seat); +} + static const struct weston_keyboard_grab_interface exposay_kbd_grab = { exposay_key, exposay_modifier, + exposay_cancel, }; /** -- 1.8.4.rc3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 2/9] Add modifier-only binding
From: Daniel Stone dan...@fooishbar.org Add the ability to bind to modifiers; the binding is armed when a key which sets the requested modifier is pressed, and triggered if the key is released with no other keys having been pressed in the meantime, as well as mouse buttons or scroll axes. This only works for direct modifiers (e.g. Shift and Alt), not modifiers which latch or lock. [pochu: rebased] --- src/bindings.c | 58 src/compositor.c | 1 + src/compositor.h | 16 src/input.c | 38 + 4 files changed, 113 insertions(+) diff --git a/src/bindings.c b/src/bindings.c index 7cbded9..fb758d1 100644 --- a/src/bindings.c +++ b/src/bindings.c @@ -76,6 +76,24 @@ weston_compositor_add_key_binding(struct weston_compositor *compositor, } WL_EXPORT struct weston_binding * +weston_compositor_add_modifier_binding(struct weston_compositor *compositor, + uint32_t modifier, + weston_modifier_binding_handler_t handler, + void *data) +{ + struct weston_binding *binding; + + binding = weston_compositor_add_binding(compositor, 0, 0, 0, + modifier, handler, data); + if (binding == NULL) + return NULL; + + wl_list_insert(compositor-modifier_binding_list.prev, binding-link); + + return binding; +} + +WL_EXPORT struct weston_binding * weston_compositor_add_button_binding(struct weston_compositor *compositor, uint32_t button, uint32_t modifier, weston_button_binding_handler_t handler, @@ -248,6 +266,10 @@ weston_compositor_run_key_binding(struct weston_compositor *compositor, if (state == WL_KEYBOARD_KEY_STATE_RELEASED) return; + /* Invalidate all active modifier bindings. */ + wl_list_for_each(b, compositor-modifier_binding_list, link) + b-key = key; + wl_list_for_each(b, compositor-key_binding_list, link) { if (b-key == key b-modifier == seat-modifier_state) { weston_key_binding_handler_t handler = b-handler; @@ -264,6 +286,34 @@ weston_compositor_run_key_binding(struct weston_compositor *compositor, } WL_EXPORT void +weston_compositor_run_modifier_binding(struct weston_compositor *compositor, + struct weston_seat *seat, + enum weston_keyboard_modifier modifier, + enum wl_keyboard_key_state state) +{ + struct weston_binding *b; + + wl_list_for_each(b, compositor-modifier_binding_list, link) { + weston_modifier_binding_handler_t handler = b-handler; + + if (b-modifier != modifier) + continue; + + /* Prime the modifier binding. */ + if (state == WL_KEYBOARD_KEY_STATE_PRESSED) { + b-key = 0; + continue; + } + /* Ignore the binding if a key was pressed in between. */ + else if (b-key != 0) { + return; + } + + handler(seat, modifier, b-data); + } +} + +WL_EXPORT void weston_compositor_run_button_binding(struct weston_compositor *compositor, struct weston_seat *seat, uint32_t time, uint32_t button, @@ -274,6 +324,10 @@ weston_compositor_run_button_binding(struct weston_compositor *compositor, if (state == WL_POINTER_BUTTON_STATE_RELEASED) return; + /* Invalidate all active modifier bindings. */ + wl_list_for_each(b, compositor-modifier_binding_list, link) + b-key = button; + wl_list_for_each(b, compositor-button_binding_list, link) { if (b-button == button b-modifier == seat-modifier_state) { weston_button_binding_handler_t handler = b-handler; @@ -308,6 +362,10 @@ weston_compositor_run_axis_binding(struct weston_compositor *compositor, { struct weston_binding *b; + /* Invalidate all active modifier bindings. */ + wl_list_for_each(b, compositor-modifier_binding_list, link) + b-key = axis; + wl_list_for_each(b, compositor-axis_binding_list, link) { if (b-axis == axis b-modifier == seat-modifier_state) { weston_axis_binding_handler_t handler = b-handler; diff --git a/src/compositor.c b/src/compositor.c index b8e0c6e..cca8170 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -3331,6 +3331,7 @@ weston_compositor_init(struct weston_compositor *ec, wl_list_init(ec-seat_list); wl_list_init(ec-output_list);
[PATCH 9/9] shell: Set output on the focus_surfaces' view
Otherwise we crash when animating the view. Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- src/shell.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/shell.c b/src/shell.c index 09ff86c..bf5c704 100644 --- a/src/shell.c +++ b/src/shell.c @@ -615,6 +615,7 @@ create_focus_surface(struct weston_compositor *ec, surface-configure_private = fsurf; fsurf-view = weston_view_create (surface); + fsurf-view-output = output; weston_view_configure(fsurf-view, output-x, output-y, output-width, output-height); -- 1.8.4.rc3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 6/9] shell: Implement alt-tab switcher
Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- src/shell.c | 248 1 file changed, 248 insertions(+) diff --git a/src/shell.c b/src/shell.c index b2bc74a..2a8c04c 100644 --- a/src/shell.c +++ b/src/shell.c @@ -3344,6 +3344,251 @@ terminate_binding(struct weston_seat *seat, uint32_t time, uint32_t key, } static void +lower_fullscreen_layer(struct desktop_shell *shell); + +struct alt_tab { + struct desktop_shell *shell; + struct weston_keyboard_grab grab; + + struct wl_list *current; + + struct wl_list preview_list; +}; + +struct alt_tab_preview { + struct alt_tab *alt_tab; + + struct weston_view *view; + struct weston_transform transform; + + struct wl_listener listener; + + struct wl_list link; +}; + +static void +alt_tab_next(struct alt_tab *alt_tab) +{ + alt_tab-current = alt_tab-current-next; + + /* Make sure we're not pointing to the list header e.g. after +* cycling through the whole list. */ + if (alt_tab-current-next == alt_tab-preview_list.next) + alt_tab-current = alt_tab-current-next; +} + +static void +alt_tab_destroy(struct alt_tab *alt_tab) +{ + struct alt_tab_preview *preview, *next; + struct weston_keyboard *keyboard = alt_tab-grab.keyboard; + + if (alt_tab-current alt_tab-current != alt_tab-preview_list) { + preview = wl_container_of(alt_tab-current, preview, link); + + activate(alt_tab-shell, preview-view-surface, +(struct weston_seat *) keyboard-seat); + } + + wl_list_for_each_safe(preview, next, alt_tab-preview_list, link) { + wl_list_remove(preview-link); + wl_list_remove(preview-listener.link); + weston_view_destroy(preview-view); + free(preview); + } + + weston_keyboard_end_grab(keyboard); + if (keyboard-input_method_resource) + keyboard-grab = keyboard-input_method_grab; + + free(alt_tab); +} + +static void +alt_tab_handle_surface_destroy(struct wl_listener *listener, void *data) +{ + struct alt_tab_preview *preview = + container_of(listener, struct alt_tab_preview, listener); + struct alt_tab *alt_tab = preview-alt_tab; + int advance = 0; + + /* If the preview that we're removing is the currently selected one, +* we want to move to the next one. So we move to -prev and then +* call _next() after removing the preview. */ + if (alt_tab-current == preview-link) { + alt_tab-current = alt_tab-current-prev; + advance = 1; + } + + wl_list_remove(preview-listener.link); + wl_list_remove(preview-link); + + free(preview); + + if (advance) + alt_tab_next(alt_tab); + + /* If the last preview goes away, stop the alt-tab */ + if (wl_list_empty(alt_tab-current)) + alt_tab_destroy(alt_tab); +} + +static void +alt_tab_key(struct weston_keyboard_grab *grab, + uint32_t time, uint32_t key, uint32_t state_w) +{ + struct alt_tab *alt_tab = container_of(grab, struct alt_tab, grab); + enum wl_keyboard_key_state state = state_w; + + if (key == KEY_TAB state == WL_KEYBOARD_KEY_STATE_PRESSED) + alt_tab_next(alt_tab); +} + +static void +alt_tab_modifier(struct weston_keyboard_grab *grab, uint32_t serial, +uint32_t mods_depressed, uint32_t mods_latched, +uint32_t mods_locked, uint32_t group) +{ + struct alt_tab *alt_tab = container_of(grab, struct alt_tab, grab); + struct weston_seat *seat = (struct weston_seat *) grab-keyboard-seat; + + if ((seat-modifier_state MODIFIER_ALT) == 0) + alt_tab_destroy(alt_tab); +} + +static void +alt_tab_cancel(struct weston_keyboard_grab *grab) +{ + struct alt_tab *alt_tab = container_of(grab, struct alt_tab, grab); + + alt_tab_destroy(alt_tab); +} + +static const struct weston_keyboard_grab_interface alt_tab_grab = { + alt_tab_key, + alt_tab_modifier, + alt_tab_cancel, +}; + +static int +view_for_alt_tab(struct weston_view *view) +{ + if (!get_shell_surface(view-surface)) + return 0; + + if (get_shell_surface_type(view-surface) == SHELL_SURFACE_TRANSIENT) + return 0; + + if (view != get_default_view(view-surface)) + return 0; + + return 1; +} + +static void +alt_tab_binding(struct weston_seat *seat, uint32_t time, uint32_t key, + void *data) +{ + struct alt_tab *alt_tab; + struct desktop_shell *shell = data; + struct weston_output *output = get_default_output(shell-compositor); + struct workspace *ws; + struct weston_view *view; + int num_surfaces = 0; + int x, y, side, margin; + + wl_list_for_each(view
[PATCH 1/9] animation, shell: add kbd focus change animation
From: Louis-Francis Ratté-Boulianne l...@collabora.com When enabled, this will make all but the keyboard-focused window dim. Also the background gets dimmed, if there are any windows open. The panel is not dimmed. When the keyboard focus changes, the change in dimming is animated. The dimming is implemented with transparent solid-color surfaces, two at most. The net effect of two overlapping dim surfaces is kept constant during animations (stable fade animation). There is a new weston.ini option focus-animation, that defaults to none, and can be set to dim-layer to enable the focus change animation. [pq: Sliced, squashed, and rebased the patch series. Fixed surface alpha interaction with the switcher. Wrote the commit message.] [pochu: rebased, ported to weston_view] --- src/animation.c | 53 +-- src/compositor.h | 8 ++ src/shell.c | 262 +-- 3 files changed, 293 insertions(+), 30 deletions(-) diff --git a/src/animation.c b/src/animation.c index c71b506..8739f19 100644 --- a/src/animation.c +++ b/src/animation.c @@ -127,9 +127,10 @@ struct weston_view_animation { weston_view_animation_frame_func_t reset; weston_view_animation_done_func_t done; void *data; + void *private; }; -static void +WL_EXPORT void weston_view_animation_destroy(struct weston_view_animation *animation) { wl_list_remove(animation-animation.link); @@ -185,7 +186,8 @@ weston_view_animation_run(struct weston_view *view, weston_view_animation_frame_func_t frame, weston_view_animation_frame_func_t reset, weston_view_animation_done_func_t done, - void *data) + void *data, + void *private) { struct weston_view_animation *animation; @@ -200,6 +202,7 @@ weston_view_animation_run(struct weston_view *view, animation-data = data; animation-start = start; animation-stop = stop; + animation-private = private; weston_matrix_init(animation-transform.matrix); wl_list_insert(view-geometry.transformation_list, animation-transform.link); @@ -257,7 +260,7 @@ weston_zoom_run(struct weston_view *view, float start, float stop, zoom = weston_view_animation_run(view, start, stop, zoom_frame, reset_alpha, -done, data); +done, data, NULL); weston_spring_init(zoom-spring, 300.0, start, stop); zoom-spring.friction = 1400; @@ -286,7 +289,7 @@ weston_fade_run(struct weston_view *view, fade = weston_view_animation_run(view, 0, end, fade_frame, reset_alpha, -done, data); +done, data, NULL); weston_spring_init(fade-spring, k, start, end); @@ -305,6 +308,46 @@ weston_fade_update(struct weston_view_animation *fade, float target) } static void +stable_fade_frame(struct weston_view_animation *animation) +{ + struct weston_view *back_view; + + if (animation-spring.current 0.999) + animation-view-alpha = 1; + else if (animation-spring.current 0.001 ) + animation-view-alpha = 0; + else + animation-view-alpha = animation-spring.current; + + back_view = (struct weston_view *) animation-private; + back_view-alpha = + (animation-spring.target - animation-view-alpha) / + (1.0 - animation-view-alpha); + weston_view_geometry_dirty(back_view); +} + +WL_EXPORT struct weston_view_animation * +weston_stable_fade_run(struct weston_view *front_view, float start, + struct weston_view *back_view, float end, + weston_view_animation_done_func_t done, void *data) +{ + struct weston_view_animation *fade; + + fade = weston_view_animation_run(front_view, 0, 0, + stable_fade_frame, NULL, + done, data, back_view); + + + weston_spring_init(fade-spring, 400, start, end); + fade-spring.friction = 1150; + + front_view-alpha = start; + back_view-alpha = end; + + return fade; +} + +static void slide_frame(struct weston_view_animation *animation) { float scale; @@ -324,7 +367,7 @@ weston_slide_run(struct weston_view *view, float start, float stop, animation = weston_view_animation_run(view, start, stop, slide_frame, NULL, done, - data); + data, NULL); if (!animation) return NULL; diff --git a/src/compositor.h b/src/compositor.h
[PATCH 4/9] Add Exposay
From: Daniel Stone dan...@fooishbar.org Exposay provides window overview functions which, when a key which produces the binding modifier is pressed on its own, scales all currently-open windows down to be shown overlaid on the desktop, providing keyboard and mouse navigation to be able to switch window focus. [pochu: rebased, ported to weston_view] --- src/shell.c | 575 1 file changed, 575 insertions(+) diff --git a/src/shell.c b/src/shell.c index 9ad36bb..b2bc74a 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1,6 +1,7 @@ /* * Copyright © 2010-2012 Intel Corporation * Copyright © 2011-2012 Collabora, Ltd. + * Copyright © 2013 Raspberry Pi Foundation * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided @@ -56,6 +57,19 @@ enum fade_type { FADE_OUT }; +enum exposay_target_state { + EXPOSAY_TARGET_OVERVIEW, /* show all windows */ + EXPOSAY_TARGET_CANCEL, /* return to normal, same focus */ + EXPOSAY_TARGET_SWITCH, /* return to normal, switch focus */ +}; + +enum exposay_layout_state { + EXPOSAY_LAYOUT_INACTIVE = 0, /* normal desktop */ + EXPOSAY_LAYOUT_ANIMATE_TO_INACTIVE, /* in transition to normal */ + EXPOSAY_LAYOUT_OVERVIEW, /* show all windows */ + EXPOSAY_LAYOUT_ANIMATE_TO_OVERVIEW, /* in transition to all windows */ +}; + struct focus_state { struct weston_seat *seat; struct workspace *ws; @@ -180,6 +194,34 @@ struct desktop_shell { struct wl_event_source *startup_timer; } fade; + struct exposay { + /* XXX: Make these exposay_surfaces. */ + struct weston_view *focus_prev; + struct weston_view *focus_current; + struct weston_view *clicked; + struct workspace *workspace; + struct weston_seat *seat; + struct wl_list surface_list; + + struct weston_keyboard_grab grab_kbd; + struct weston_pointer_grab grab_ptr; + +enum exposay_target_state state_target; +enum exposay_layout_state state_cur; + int in_flight; /* number of animations still running */ + + int num_surfaces; + int grid_size; + int surface_size; + + int hpadding_outer; + int vpadding_outer; + int padding_inner; + + int row_current; + int column_current; + } exposay; + uint32_t binding_modifier; enum animation_type win_animation_type; enum animation_type startup_animation_type; @@ -4675,6 +4717,534 @@ switcher_binding(struct weston_seat *seat, uint32_t time, uint32_t key, switcher_next(switcher); } +struct exposay_surface { + struct desktop_shell *shell; + struct weston_surface *surface; + struct weston_view *view; + struct wl_list link; + + int x; + int y; + int width; + int height; + double scale; + + int row; + int column; + + /* The animations only apply a transformation for their own lifetime, +* and don't have an option to indefinitely maintain the +* transformation in a steady state - so, we apply our own once the +* animation has finished. */ + struct weston_transform transform; +}; + +static void exposay_set_state(struct desktop_shell *shell, + enum exposay_target_state state, + struct weston_seat *seat); +static void exposay_check_state(struct desktop_shell *shell); + +static void +exposay_in_flight_inc(struct desktop_shell *shell) +{ + shell-exposay.in_flight++; +} + +static void +exposay_in_flight_dec(struct desktop_shell *shell) +{ + if (--shell-exposay.in_flight 0) + return; + + exposay_check_state(shell); +} + +static void +exposay_animate_in_done(struct weston_view_animation *animation, void *data) +{ + struct exposay_surface *esurface = data; + + wl_list_insert(esurface-view-geometry.transformation_list, + esurface-transform.link); + weston_matrix_init(esurface-transform.matrix); + weston_matrix_scale(esurface-transform.matrix, + esurface-scale, esurface-scale, 1.0f); + weston_matrix_translate(esurface-transform.matrix, + esurface-x - esurface-view-geometry.x, + esurface-y - esurface-view-geometry.y, + 0); + + weston_view_geometry_dirty(esurface-view); + weston_compositor_schedule_repaint(esurface-view-surface-compositor); + + exposay_in_flight_dec(esurface-shell); +} + +static void +exposay_animate_in(struct exposay_surface *esurface) +{ +
[PATCH] exposay: move the pointer in our motion handler
This is necessary since commit 1959ab. --- src/shell.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/shell.c b/src/shell.c index bf5c704..82c3cd8 100644 --- a/src/shell.c +++ b/src/shell.c @@ -5232,11 +5232,14 @@ exposay_layout(struct desktop_shell *shell) } static void -exposay_motion(struct weston_pointer_grab *grab, uint32_t time) +exposay_motion(struct weston_pointer_grab *grab, uint32_t time, + wl_fixed_t x, wl_fixed_t y) { struct desktop_shell *shell = container_of(grab, struct desktop_shell, exposay.grab_ptr); + weston_pointer_move(grab-pointer, x, y); + exposay_pick(shell, wl_fixed_to_int(grab-pointer-x), wl_fixed_to_int(grab-pointer-y)); -- 1.8.4.rc3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH v2 wayland] pkg-config: scanner isn't arch-independent
Ping? wayland-scanner hasn't been dropped and the .pc location is still bogus. On 20/08/13 00:58, Kristian Høgsberg wrote: On Fri, Aug 16, 2013 at 03:55:52PM +0100, Daniel Stone wrote: Hi, On 16 August 2013 15:50, David Herrmann dh.herrm...@gmail.com wrote: On Fri, Aug 16, 2013 at 2:26 PM, Daniel Stone dan...@fooishbar.org wrote: $(datadir) rather than $(libdir), is for architecture-independent data. pkg-config files should only be installed there if they're shareable across architectures, e.g. headers/data only, which wayland-scanner is not. Move it to $(libdir) with the other pkg-config files. Yepp, we should definitely use pkgconfig_DATA. Reviewed-by: David Herrmann dh.herrm...@gmail.com Of course, this all becomes irrelevant if the patch to drop wayland-scanner.{m4,mk,pc} gets dropped. And I'm definitely in favor of just dropping it. Kristian Cheers, Daniel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 2/9] Add modifier-only binding
From: Daniel Stone dan...@fooishbar.org Add the ability to bind to modifiers; the binding is armed when a key which sets the requested modifier is pressed, and triggered if the key is released with no other keys having been pressed in the meantime, as well as mouse buttons or scroll axes. This only works for direct modifiers (e.g. Shift and Alt), not modifiers which latch or lock. [pochu: rebased] --- src/bindings.c | 58 src/compositor.c | 1 + src/compositor.h | 16 src/input.c | 38 + 4 files changed, 113 insertions(+) diff --git a/src/bindings.c b/src/bindings.c index 7cbded9..fb758d1 100644 --- a/src/bindings.c +++ b/src/bindings.c @@ -76,6 +76,24 @@ weston_compositor_add_key_binding(struct weston_compositor *compositor, } WL_EXPORT struct weston_binding * +weston_compositor_add_modifier_binding(struct weston_compositor *compositor, + uint32_t modifier, + weston_modifier_binding_handler_t handler, + void *data) +{ + struct weston_binding *binding; + + binding = weston_compositor_add_binding(compositor, 0, 0, 0, + modifier, handler, data); + if (binding == NULL) + return NULL; + + wl_list_insert(compositor-modifier_binding_list.prev, binding-link); + + return binding; +} + +WL_EXPORT struct weston_binding * weston_compositor_add_button_binding(struct weston_compositor *compositor, uint32_t button, uint32_t modifier, weston_button_binding_handler_t handler, @@ -248,6 +266,10 @@ weston_compositor_run_key_binding(struct weston_compositor *compositor, if (state == WL_KEYBOARD_KEY_STATE_RELEASED) return; + /* Invalidate all active modifier bindings. */ + wl_list_for_each(b, compositor-modifier_binding_list, link) + b-key = key; + wl_list_for_each(b, compositor-key_binding_list, link) { if (b-key == key b-modifier == seat-modifier_state) { weston_key_binding_handler_t handler = b-handler; @@ -264,6 +286,34 @@ weston_compositor_run_key_binding(struct weston_compositor *compositor, } WL_EXPORT void +weston_compositor_run_modifier_binding(struct weston_compositor *compositor, + struct weston_seat *seat, + enum weston_keyboard_modifier modifier, + enum wl_keyboard_key_state state) +{ + struct weston_binding *b; + + wl_list_for_each(b, compositor-modifier_binding_list, link) { + weston_modifier_binding_handler_t handler = b-handler; + + if (b-modifier != modifier) + continue; + + /* Prime the modifier binding. */ + if (state == WL_KEYBOARD_KEY_STATE_PRESSED) { + b-key = 0; + continue; + } + /* Ignore the binding if a key was pressed in between. */ + else if (b-key != 0) { + return; + } + + handler(seat, modifier, b-data); + } +} + +WL_EXPORT void weston_compositor_run_button_binding(struct weston_compositor *compositor, struct weston_seat *seat, uint32_t time, uint32_t button, @@ -274,6 +324,10 @@ weston_compositor_run_button_binding(struct weston_compositor *compositor, if (state == WL_POINTER_BUTTON_STATE_RELEASED) return; + /* Invalidate all active modifier bindings. */ + wl_list_for_each(b, compositor-modifier_binding_list, link) + b-key = button; + wl_list_for_each(b, compositor-button_binding_list, link) { if (b-button == button b-modifier == seat-modifier_state) { weston_button_binding_handler_t handler = b-handler; @@ -308,6 +362,10 @@ weston_compositor_run_axis_binding(struct weston_compositor *compositor, { struct weston_binding *b; + /* Invalidate all active modifier bindings. */ + wl_list_for_each(b, compositor-modifier_binding_list, link) + b-key = axis; + wl_list_for_each(b, compositor-axis_binding_list, link) { if (b-axis == axis b-modifier == seat-modifier_state) { weston_axis_binding_handler_t handler = b-handler; diff --git a/src/compositor.c b/src/compositor.c index c6cf682..34c0551 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -3332,6 +3332,7 @@ weston_compositor_init(struct weston_compositor *ec, wl_list_init(ec-seat_list); wl_list_init(ec-output_list);
[PATCH 1/9] animation, shell: add kbd focus change animation
From: Louis-Francis Ratté-Boulianne l...@collabora.com When enabled, this will make all but the keyboard-focused window dim. Also the background gets dimmed, if there are any windows open. The panel is not dimmed. When the keyboard focus changes, the change in dimming is animated. The dimming is implemented with transparent solid-color surfaces, two at most. The net effect of two overlapping dim surfaces is kept constant during animations (stable fade animation). There is a new weston.ini option focus-animation, that defaults to none, and can be set to dim-layer to enable the focus change animation. [pq: Sliced, squashed, and rebased the patch series. Fixed surface alpha interaction with the switcher. Wrote the commit message.] [pochu: rebased, ported to weston_view] --- src/animation.c | 53 +-- src/compositor.h | 8 ++ src/shell.c | 262 +-- 3 files changed, 293 insertions(+), 30 deletions(-) diff --git a/src/animation.c b/src/animation.c index c71b506..8739f19 100644 --- a/src/animation.c +++ b/src/animation.c @@ -127,9 +127,10 @@ struct weston_view_animation { weston_view_animation_frame_func_t reset; weston_view_animation_done_func_t done; void *data; + void *private; }; -static void +WL_EXPORT void weston_view_animation_destroy(struct weston_view_animation *animation) { wl_list_remove(animation-animation.link); @@ -185,7 +186,8 @@ weston_view_animation_run(struct weston_view *view, weston_view_animation_frame_func_t frame, weston_view_animation_frame_func_t reset, weston_view_animation_done_func_t done, - void *data) + void *data, + void *private) { struct weston_view_animation *animation; @@ -200,6 +202,7 @@ weston_view_animation_run(struct weston_view *view, animation-data = data; animation-start = start; animation-stop = stop; + animation-private = private; weston_matrix_init(animation-transform.matrix); wl_list_insert(view-geometry.transformation_list, animation-transform.link); @@ -257,7 +260,7 @@ weston_zoom_run(struct weston_view *view, float start, float stop, zoom = weston_view_animation_run(view, start, stop, zoom_frame, reset_alpha, -done, data); +done, data, NULL); weston_spring_init(zoom-spring, 300.0, start, stop); zoom-spring.friction = 1400; @@ -286,7 +289,7 @@ weston_fade_run(struct weston_view *view, fade = weston_view_animation_run(view, 0, end, fade_frame, reset_alpha, -done, data); +done, data, NULL); weston_spring_init(fade-spring, k, start, end); @@ -305,6 +308,46 @@ weston_fade_update(struct weston_view_animation *fade, float target) } static void +stable_fade_frame(struct weston_view_animation *animation) +{ + struct weston_view *back_view; + + if (animation-spring.current 0.999) + animation-view-alpha = 1; + else if (animation-spring.current 0.001 ) + animation-view-alpha = 0; + else + animation-view-alpha = animation-spring.current; + + back_view = (struct weston_view *) animation-private; + back_view-alpha = + (animation-spring.target - animation-view-alpha) / + (1.0 - animation-view-alpha); + weston_view_geometry_dirty(back_view); +} + +WL_EXPORT struct weston_view_animation * +weston_stable_fade_run(struct weston_view *front_view, float start, + struct weston_view *back_view, float end, + weston_view_animation_done_func_t done, void *data) +{ + struct weston_view_animation *fade; + + fade = weston_view_animation_run(front_view, 0, 0, + stable_fade_frame, NULL, + done, data, back_view); + + + weston_spring_init(fade-spring, 400, start, end); + fade-spring.friction = 1150; + + front_view-alpha = start; + back_view-alpha = end; + + return fade; +} + +static void slide_frame(struct weston_view_animation *animation) { float scale; @@ -324,7 +367,7 @@ weston_slide_run(struct weston_view *view, float start, float stop, animation = weston_view_animation_run(view, start, stop, slide_frame, NULL, done, - data); + data, NULL); if (!animation) return NULL; diff --git a/src/compositor.h b/src/compositor.h
[PATCH 0/9] exposay alt-tab
The following series adds exposay as previously submitted on the list but rebased on master. It also adds an alt-tab switcher which is a nice demonstration of weston_views. In addition there's a bug fix in the input code that is easily triggered by exposay. Daniel Stone (3): Add modifier-only binding Add move/scale animation Add Exposay Emilio Pozuelo Monfort (5): input: Don't send leave events to destroyed views shell: Implement alt-tab switcher exposay: add cancel impl to the kbd grab iface exposay: Activate a surface when hovering it shell: Set output on the focus_surfaces' view Louis-Francis Ratté-Boulianne (1): animation, shell: add kbd focus change animation src/animation.c | 115 +- src/bindings.c | 58 +++ src/compositor.c |1 + src/compositor.h | 31 ++ src/input.c | 63 src/shell.c | 1095 -- 6 files changed, 1333 insertions(+), 30 deletions(-) -- 1.8.4.rc3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 8/9] exposay: Activate a surface when hovering it
This causes the surface to get the keyboard focus, which in turn causes focus-animation to nicely work with exposay, making the not focused surfaces to be dimmed. Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- src/shell.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/shell.c b/src/shell.c index accf4de..08d2627 100644 --- a/src/shell.c +++ b/src/shell.c @@ -5064,8 +5064,7 @@ exposay_highlight_surface(struct desktop_shell *shell, view = esurface-view; } - animate_focus_change(shell, shell-exposay.workspace, -shell-exposay.focus_current, view); + activate(shell, view-surface, shell-exposay.seat); shell-exposay.focus_current = view; } -- 1.8.4.rc3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 4/9] Add Exposay
From: Daniel Stone dan...@fooishbar.org Exposay provides window overview functions which, when a key which produces the binding modifier is pressed on its own, scales all currently-open windows down to be shown overlaid on the desktop, providing keyboard and mouse navigation to be able to switch window focus. [pochu: rebased, ported to weston_view] --- src/shell.c | 575 1 file changed, 575 insertions(+) diff --git a/src/shell.c b/src/shell.c index 038feae..d7e7240 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1,6 +1,7 @@ /* * Copyright © 2010-2012 Intel Corporation * Copyright © 2011-2012 Collabora, Ltd. + * Copyright © 2013 Raspberry Pi Foundation * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided @@ -56,6 +57,19 @@ enum fade_type { FADE_OUT }; +enum exposay_target_state { + EXPOSAY_TARGET_OVERVIEW, /* show all windows */ + EXPOSAY_TARGET_CANCEL, /* return to normal, same focus */ + EXPOSAY_TARGET_SWITCH, /* return to normal, switch focus */ +}; + +enum exposay_layout_state { + EXPOSAY_LAYOUT_INACTIVE = 0, /* normal desktop */ + EXPOSAY_LAYOUT_ANIMATE_TO_INACTIVE, /* in transition to normal */ + EXPOSAY_LAYOUT_OVERVIEW, /* show all windows */ + EXPOSAY_LAYOUT_ANIMATE_TO_OVERVIEW, /* in transition to all windows */ +}; + struct focus_state { struct weston_seat *seat; struct workspace *ws; @@ -180,6 +194,34 @@ struct desktop_shell { struct wl_event_source *startup_timer; } fade; + struct exposay { + /* XXX: Make these exposay_surfaces. */ + struct weston_view *focus_prev; + struct weston_view *focus_current; + struct weston_view *clicked; + struct workspace *workspace; + struct weston_seat *seat; + struct wl_list surface_list; + + struct weston_keyboard_grab grab_kbd; + struct weston_pointer_grab grab_ptr; + +enum exposay_target_state state_target; +enum exposay_layout_state state_cur; + int in_flight; /* number of animations still running */ + + int num_surfaces; + int grid_size; + int surface_size; + + int hpadding_outer; + int vpadding_outer; + int padding_inner; + + int row_current; + int column_current; + } exposay; + uint32_t binding_modifier; enum animation_type win_animation_type; enum animation_type startup_animation_type; @@ -4661,6 +4703,534 @@ switcher_binding(struct weston_seat *seat, uint32_t time, uint32_t key, switcher_next(switcher); } +struct exposay_surface { + struct desktop_shell *shell; + struct weston_surface *surface; + struct weston_view *view; + struct wl_list link; + + int x; + int y; + int width; + int height; + double scale; + + int row; + int column; + + /* The animations only apply a transformation for their own lifetime, +* and don't have an option to indefinitely maintain the +* transformation in a steady state - so, we apply our own once the +* animation has finished. */ + struct weston_transform transform; +}; + +static void exposay_set_state(struct desktop_shell *shell, + enum exposay_target_state state, + struct weston_seat *seat); +static void exposay_check_state(struct desktop_shell *shell); + +static void +exposay_in_flight_inc(struct desktop_shell *shell) +{ + shell-exposay.in_flight++; +} + +static void +exposay_in_flight_dec(struct desktop_shell *shell) +{ + if (--shell-exposay.in_flight 0) + return; + + exposay_check_state(shell); +} + +static void +exposay_animate_in_done(struct weston_view_animation *animation, void *data) +{ + struct exposay_surface *esurface = data; + + wl_list_insert(esurface-view-geometry.transformation_list, + esurface-transform.link); + weston_matrix_init(esurface-transform.matrix); + weston_matrix_scale(esurface-transform.matrix, + esurface-scale, esurface-scale, 1.0f); + weston_matrix_translate(esurface-transform.matrix, + esurface-x - esurface-view-geometry.x, + esurface-y - esurface-view-geometry.y, + 0); + + weston_view_geometry_dirty(esurface-view); + weston_compositor_schedule_repaint(esurface-view-surface-compositor); + + exposay_in_flight_dec(esurface-shell); +} + +static void +exposay_animate_in(struct exposay_surface *esurface) +{ +
Re: [PATCH] input: Don't send leave events to destroyed views
On 12/11/13 19:28, Emilio Pozuelo Monfort wrote: If a view which has focus is destroyed, we would send a leave event while changing focus, causing a segfault. Prevent this by listening to the view's destroy signal and removing it from the pointer focus. Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- src/compositor.h | 1 + src/input.c | 22 ++ 2 files changed, 23 insertions(+) diff --git a/src/compositor.h b/src/compositor.h index 21d94d3..b69111f 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -311,6 +311,7 @@ struct weston_pointer { struct wl_list focus_resource_list; struct weston_view *focus; uint32_t focus_serial; + struct wl_listener focus_listener; struct wl_signal focus_signal; struct weston_view *sprite; diff --git a/src/input.c b/src/input.c index ed3e06f..64f0606 100644 --- a/src/input.c +++ b/src/input.c @@ -392,6 +392,7 @@ weston_pointer_create(void) pointer-default_grab.pointer = pointer; pointer-grab = pointer-default_grab; wl_signal_init(pointer-focus_signal); + wl_list_init(pointer-focus_listener.link); pointer-sprite_destroy_listener.notify = pointer_handle_sprite_destroy; @@ -487,6 +488,23 @@ seat_send_updated_caps(struct weston_seat *seat) } } +static void +destroy_pointer_focus(struct wl_listener *listener, void *data) +{ + struct weston_pointer *pointer; + + pointer = container_of(listener, struct weston_pointer, +focus_listener); + + pointer-focus = NULL; + move_resources(pointer-resource_list, pointer-focus_resource_list); + + wl_list_remove(pointer-focus_listener.link); + wl_list_init(pointer-focus_listener.link); + + wl_signal_emit(pointer-focus_signal, pointer); +} + WL_EXPORT void weston_pointer_set_focus(struct weston_pointer *pointer, struct weston_view *view, @@ -543,7 +561,11 @@ weston_pointer_set_focus(struct weston_pointer *pointer, pointer-focus_serial = serial; } + if (!wl_list_empty(pointer-focus_listener.link)) + wl_list_remove(pointer-focus_listener.link); pointer-focus = view; + pointer-focus_listener.notify = destroy_pointer_focus; + wl_signal_add(view-destroy_signal, pointer-focus_listener); There's a bug here if view is NULL (e.g. when unsetting focus). I'll send an updated patch. Emilio wl_signal_emit(pointer-focus_signal, pointer); } ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH] input: Don't send leave events to destroyed views
If a view which has focus is destroyed, we would send a leave event while changing focus, causing a segfault. Prevent this by listening to the view's destroy signal and removing it from the pointer focus. Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- src/compositor.h | 1 + src/input.c | 22 ++ 2 files changed, 23 insertions(+) diff --git a/src/compositor.h b/src/compositor.h index 21d94d3..b69111f 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -311,6 +311,7 @@ struct weston_pointer { struct wl_list focus_resource_list; struct weston_view *focus; uint32_t focus_serial; + struct wl_listener focus_listener; struct wl_signal focus_signal; struct weston_view *sprite; diff --git a/src/input.c b/src/input.c index ed3e06f..64f0606 100644 --- a/src/input.c +++ b/src/input.c @@ -392,6 +392,7 @@ weston_pointer_create(void) pointer-default_grab.pointer = pointer; pointer-grab = pointer-default_grab; wl_signal_init(pointer-focus_signal); + wl_list_init(pointer-focus_listener.link); pointer-sprite_destroy_listener.notify = pointer_handle_sprite_destroy; @@ -487,6 +488,23 @@ seat_send_updated_caps(struct weston_seat *seat) } } +static void +destroy_pointer_focus(struct wl_listener *listener, void *data) +{ + struct weston_pointer *pointer; + + pointer = container_of(listener, struct weston_pointer, + focus_listener); + + pointer-focus = NULL; + move_resources(pointer-resource_list, pointer-focus_resource_list); + + wl_list_remove(pointer-focus_listener.link); + wl_list_init(pointer-focus_listener.link); + + wl_signal_emit(pointer-focus_signal, pointer); +} + WL_EXPORT void weston_pointer_set_focus(struct weston_pointer *pointer, struct weston_view *view, @@ -543,7 +561,11 @@ weston_pointer_set_focus(struct weston_pointer *pointer, pointer-focus_serial = serial; } + if (!wl_list_empty(pointer-focus_listener.link)) + wl_list_remove(pointer-focus_listener.link); pointer-focus = view; + pointer-focus_listener.notify = destroy_pointer_focus; + wl_signal_add(view-destroy_signal, pointer-focus_listener); wl_signal_emit(pointer-focus_signal, pointer); } -- 1.8.4.rc3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH v2 2/2] compositor: check if seteuid worked
Hi, On 25/09/13 14:48, Alex DAMIAN wrote: From: Alexandru DAMIAN alexandru.dam...@intel.com Checking the return value from seteuid in order to not launch clients with the wrong effective uid. Signed-off-by: Alexandru DAMIAN alexandru.dam...@intel.com --- src/compositor.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index bc4837f..2a16f52 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -247,8 +247,11 @@ child_client_exec(int sockfd, const char *path) sigfillset(allsigs); sigprocmask(SIG_UNBLOCK, allsigs, NULL); - /* Launch clients as the user. */ - seteuid(getuid()); + /* Launch clients as the user. Do not lauch clients with wrong euid.*/ + if (seteuid(getuid()) -1) { Missing == operator; this code won't build as is. Emilio + weston_log(compositor: failed seteuid\n); + return; + } /* SOCK_CLOEXEC closes both ends, so we dup the fd to get a * non-CLOEXEC fd to pass through exec. */ ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 1/2] weston.ini: update path for the flower client
From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk --- weston.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weston.ini b/weston.ini index a37afe0..9a7137f 100644 --- a/weston.ini +++ b/weston.ini @@ -33,7 +33,7 @@ path=/usr/bin/google-chrome [launcher] icon=/usr/share/icons/gnome/24x24/apps/arts.png -path=./clients/flower +path=./clients/weston-flower [screensaver] # Uncomment path to disable screensaver -- 1.8.4.rc3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel