[PATCH weston] libweston: Fix clear timing of output repainted flag

2018-07-09 Thread Tomohito Esaki
Since the repaint status of the flushed output may be reset if a output
repaint is failed, it is necessary to clear the repainted flag
immediately after output repaint flush/cancel.

Signed-off-by: Tomohito Esaki 
---
 libweston/compositor.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libweston/compositor.c b/libweston/compositor.c
index 516be96..9deb781 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -2450,8 +2450,6 @@ weston_output_maybe_repaint(struct weston_output *output, 
struct timespec *now,
int ret = 0;
int64_t msec_to_repaint;
 
-   output->repainted = false;
-
/* We're not ready yet; come back to make a decision later. */
if (output->repaint_status != REPAINT_SCHEDULED)
return ret;
@@ -2563,6 +2561,9 @@ output_repaint_timer_handler(void *data)
repaint_data);
}
 
+   wl_list_for_each(output, >output_list, link)
+   output->repainted = false;
+
output_repaint_timer_arm(compositor);
 
return 0;
-- 
2.7.4

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston 1/2] libweston: fix indentation

2018-06-04 Thread Tomohito Esaki
Signed-off-by: Tomohito Esaki 
---
 libweston/compositor.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libweston/compositor.c b/libweston/compositor.c
index 101096c..d11a655 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -2546,13 +2546,13 @@ output_repaint_timer_handler(void *data)
}
 
if (ret == 0) {
-   if (compositor->backend->repaint_flush)
-   compositor->backend->repaint_flush(compositor,
-  repaint_data);
+   if (compositor->backend->repaint_flush)
+   compositor->backend->repaint_flush(compositor,
+  repaint_data);
} else {
-   if (compositor->backend->repaint_cancel)
-   compositor->backend->repaint_cancel(compositor,
-   repaint_data);
+   if (compositor->backend->repaint_cancel)
+   compositor->backend->repaint_cancel(compositor,
+   repaint_data);
}
 
output_repaint_timer_arm(compositor);
-- 
2.7.4

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston 2/2] libweston: Reset repaint schedule for all repainted outputs when repaint cancel

2018-06-04 Thread Tomohito Esaki
All outputs is canceled repaint when a output repaint is failed. At that
time, the output whose repaint is success is not scheduled because the
repaint status of that is still REPAINT_AWAITING_COMPLETION. Therefore,
we need to reset repaint schedule for all repainted outputs.

Signed-off-by: Tomohito Esaki 
---
 libweston/compositor.c | 8 
 libweston/compositor.h | 3 +++
 2 files changed, 11 insertions(+)

diff --git a/libweston/compositor.c b/libweston/compositor.c
index d11a655..91f311d 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -2450,6 +2450,8 @@ weston_output_maybe_repaint(struct weston_output *output, 
struct timespec *now,
int ret = 0;
int64_t msec_to_repaint;
 
+   output->repainted = false;
+
/* We're not ready yet; come back to make a decision later. */
if (output->repaint_status != REPAINT_SCHEDULED)
return ret;
@@ -2479,6 +2481,7 @@ weston_output_maybe_repaint(struct weston_output *output, 
struct timespec *now,
if (ret != 0)
goto err;
 
+   output->repainted = true;
return ret;
 
 err:
@@ -2550,6 +2553,11 @@ output_repaint_timer_handler(void *data)
compositor->backend->repaint_flush(compositor,
   repaint_data);
} else {
+   wl_list_for_each(output, >output_list, link) {
+   if (output->repainted)
+   weston_output_schedule_repaint_reset(output);
+   }
+
if (compositor->backend->repaint_cancel)
compositor->backend->repaint_cancel(compositor,
repaint_data);
diff --git a/libweston/compositor.h b/libweston/compositor.h
index c2c40ee..8942ab9 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -212,6 +212,9 @@ struct weston_output {
 *  if set, a repaint will eventually occur. */
bool repaint_needed;
 
+   /** Used only between repaint_begin and repaint_cancel. */
+   bool repainted;
+
/** State of the repaint loop */
enum {
REPAINT_NOT_SCHEDULED = 0, /**< idle; no repaint will occur */
-- 
2.7.4

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston] desktop-shell: remove surface listener when surface is destroyed

2018-01-30 Thread Tomohito Esaki
There may be race condition between destroying surface and destroying
output. If handle_output_destroy() is called after surface is destroyed,
illegal memory access occurs when surface destroy signals is
unregistered from the panel/background. This patch fixes this issue and
removes unnecessary initialization for panel surface listener.

Signed-off-by: Tomohito Esaki <e...@igel.co.jp>
---
 desktop-shell/shell.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index a2a93e2..de76ebe 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -2939,6 +2939,7 @@ handle_background_surface_destroy(struct wl_listener 
*listener, void *data)
container_of(listener, struct shell_output, 
background_surface_listener);
 
weston_log("background surface gone\n");
+   wl_list_remove(>background_surface_listener.link);
output->background_surface = NULL;
 }
 
@@ -3023,6 +3024,7 @@ handle_panel_surface_destroy(struct wl_listener 
*listener, void *data)
container_of(listener, struct shell_output, panel_surface_listener);
 
weston_log("panel surface gone\n");
+   wl_list_remove(>panel_surface_listener.link);
output->panel_surface = NULL;
 }
 
@@ -4714,8 +4716,10 @@ handle_output_destroy(struct wl_listener *listener, void 
*data)
 
shell_for_each_layer(shell, shell_output_destroy_move_layer, output);
 
-   wl_list_remove(_listener->panel_surface_listener.link);
-   wl_list_remove(_listener->background_surface_listener.link);
+   if (output_listener->panel_surface)
+   wl_list_remove(_listener->panel_surface_listener.link);
+   if (output_listener->background_surface)
+   
wl_list_remove(_listener->background_surface_listener.link);
wl_list_remove(_listener->destroy_listener.link);
wl_list_remove(_listener->link);
free(output_listener);
@@ -4761,7 +4765,6 @@ create_shell_output(struct desktop_shell *shell,
shell_output->output = output;
shell_output->shell = shell;
shell_output->destroy_listener.notify = handle_output_destroy;
-   wl_list_init(_output->panel_surface_listener.link);
wl_signal_add(>destroy_signal,
  _output->destroy_listener);
wl_list_insert(shell->output_list.prev, _output->link);
-- 
2.7.4

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston] compositor-drm: calculate source rect using viewport top-left for sprite plane

2016-09-30 Thread Tomohito Esaki
Add the viewport offset position into the sprite plane cropping
calculation. Without this patch the sprite plane always outputs from the
top left corner of the source buffer.

Signed-off-by: Tomohito Esaki <e...@igel.co.jp>
---
 libweston/compositor-drm.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 8319d7c..31f9724 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -1105,6 +1105,19 @@ drm_output_prepare_overlay_view(struct drm_output 
*output,
if (sy2 > wl_fixed_from_int(ev->surface->height))
sy2 = wl_fixed_from_int(ev->surface->height);
 
+   /* Calculate source crop offset */
+   if (viewport->buffer.src_width != wl_fixed_from_int(-1) &&
+   viewport->buffer.src_height != wl_fixed_from_int(-1)) {
+   if (sx1 < viewport->buffer.src_x) {
+   sx1 = viewport->buffer.src_x;
+   sx2 += sx1;
+   }
+   if (sy1 < viewport->buffer.src_y) {
+   sy1 = viewport->buffer.src_y;
+   sy2 += sy1;
+   }
+   }
+
tbox.x1 = sx1;
tbox.y1 = sy1;
tbox.x2 = sx2;
-- 
2.7.4

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston v2 3/3] compositor-drm: Support linux_dmabuf output for sprite planes without gbm

2016-09-30 Thread Tomohito Esaki
Multiplanar formats are supported by using drmModeAddFB2 and bypassing
gbm. If drmModeAddFB2 isn't available, the existing gbm bo import path
is used and multiplanar formats are unsupported.

Signed-off-by: Tomohito Esaki <e...@igel.co.jp>
---
 libweston/compositor-drm.c | 53 +++---
 1 file changed, 26 insertions(+), 27 deletions(-)

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index b15fa01..f0e6f7c 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -1008,11 +1008,9 @@ page_flip_handler(int fd, unsigned int frame,
 
 static uint32_t
 drm_output_check_sprite_format(struct drm_sprite *s,
-  struct weston_view *ev, struct gbm_bo *bo)
+  struct weston_view *ev, uint32_t format)
 {
-   uint32_t i, format;
-
-   format = gbm_bo_get_format(bo);
+   uint32_t i;
 
if (format == GBM_FORMAT_ARGB) {
pixman_region32_t r;
@@ -1053,15 +1051,12 @@ drm_output_prepare_overlay_view(struct drm_output 
*output,
struct drm_sprite *s;
struct linux_dmabuf_buffer *dmabuf;
int found = 0;
-   struct gbm_bo *bo;
+   struct gbm_bo *bo = NULL;
pixman_region32_t dest_rect, src_rect;
pixman_box32_t *box, tbox;
uint32_t format;
wl_fixed_t sx1, sy1, sx2, sy2;
 
-   if (b->gbm == NULL)
-   return NULL;
-
if (viewport->buffer.transform != output->base.transform)
return NULL;
 
@@ -1101,15 +1096,9 @@ drm_output_prepare_overlay_view(struct drm_output 
*output,
if (!found)
return NULL;
 
-   if ((dmabuf = linux_dmabuf_buffer_get(buffer_resource))) {
+   if ((dmabuf = linux_dmabuf_buffer_get(buffer_resource)) &&
+   b->no_addfb2 && b->gbm) {
 #ifdef HAVE_GBM_FD_IMPORT
-   /* XXX: TODO:
-*
-* Use AddFB2 directly, do not go via GBM.
-* Add support for multiplanar formats.
-* Both require refactoring in the DRM-backend to
-* support a mix of gbm_bos and drmfbs.
-*/
struct gbm_import_fd_data gbm_dmabuf = {
.fd = dmabuf->attributes.fd[0],
.width  = dmabuf->attributes.width,
@@ -1126,22 +1115,32 @@ drm_output_prepare_overlay_view(struct drm_output 
*output,
 #else
return NULL;
 #endif
-   } else {
+   } else if (b->gbm) {
bo = gbm_bo_import(b->gbm, GBM_BO_IMPORT_WL_BUFFER,
   buffer_resource, GBM_BO_USE_SCANOUT);
}
-   if (!bo)
-   return NULL;
 
-   format = drm_output_check_sprite_format(s, ev, bo);
-   if (format == 0) {
-   gbm_bo_destroy(bo);
-   return NULL;
-   }
+   if (bo) {
+   format = drm_output_check_sprite_format(
+   s, ev, gbm_bo_get_format(bo));
+   if (format == 0)
+   return NULL;
+
+   s->next = drm_fb_get_from_bo(bo, b, format);
+   if (!s->next) {
+   gbm_bo_destroy(bo);
+   return NULL;
+   }
+   } else if (dmabuf) {
+   format = drm_output_check_sprite_format(
+   s, ev, dmabuf->attributes.format);
+   if (format == 0)
+   return NULL;
 
-   s->next = drm_fb_get_from_bo(bo, b, format);
-   if (!s->next) {
-   gbm_bo_destroy(bo);
+   s->next = drm_fb_create_dmabuf(dmabuf, b, format);
+   if (!s->next)
+   return NULL;
+   } else {
return NULL;
}
 
-- 
2.7.4

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston v2 2/3] compositor-drm: Add scanout support for linux_dmabuf buffers

2016-09-30 Thread Tomohito Esaki
This implementations bypasses gbm and passes the dmabuf handles directly
to libdrm for composition.

Signed-off-by: Tomohito Esaki <e...@igel.co.jp>
---
 libweston/compositor-drm.c | 125 ++---
 1 file changed, 107 insertions(+), 18 deletions(-)

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index a707fc4..b15fa01 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -151,6 +151,9 @@ struct drm_fb {
 
/* Used by dumb fbs */
void *map;
+
+   /* Used by dmabuf */
+   bool is_dmabuf;
 };
 
 struct drm_edid {
@@ -389,6 +392,76 @@ drm_fb_destroy_dumb(struct drm_fb *fb)
drmIoctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, _arg);
 }
 
+static inline void
+close_drm_handle(int fd, uint32_t handle)
+{
+   struct drm_gem_close gem_close = { .handle = handle };
+   int ret;
+
+   ret = drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, _close);
+   if (ret)
+   weston_log("DRM_IOCTL_GEM_CLOSE failed.(%s)\n",
+  strerror(errno));
+}
+
+static struct drm_fb *
+drm_fb_create_dmabuf(struct linux_dmabuf_buffer *dmabuf,
+struct drm_backend *backend, uint32_t format)
+{
+   struct drm_fb *fb = NULL;
+   uint32_t width, height, fb_id, handles[4] = {0};
+   int i, ret;
+
+   if (!format)
+   return NULL;
+
+   width = dmabuf->attributes.width;
+   height = dmabuf->attributes.height;
+   if (backend->min_width > width ||
+   width > backend->max_width ||
+   backend->min_height > height ||
+   height > backend->max_height)
+   return NULL;
+
+   for (i = 0; i < dmabuf->attributes.n_planes; i++) {
+   ret = drmPrimeFDToHandle(backend->drm.fd,
+dmabuf->attributes.fd[i],
+[i]);
+   if (ret)
+   goto done;
+   }
+
+   ret = drmModeAddFB2(backend->drm.fd, width, height,
+   format, handles, dmabuf->attributes.stride,
+   dmabuf->attributes.offset, _id, 0);
+   if (ret)
+   goto done;
+
+   fb = zalloc(sizeof *fb);
+   if (!fb)
+   goto done;
+
+   fb->fb_id = fb_id;
+   fb->stride = dmabuf->attributes.stride[0];
+   fb->fd = backend->drm.fd;
+   fb->is_dmabuf = true;
+
+done:
+   for (i = 0; i < dmabuf->attributes.n_planes; i++) {
+   if (!handles[i])
+   continue;
+   close_drm_handle(backend->drm.fd, handles[i]);
+   }
+
+   return fb;
+}
+
+static void
+drm_fb_destroy_dmabuf(struct drm_fb *fb)
+{
+   drm_fb_destroy(fb, fb->fd);
+}
+
 static struct drm_fb *
 drm_fb_get_from_bo(struct gbm_bo *bo,
   struct drm_backend *backend, uint32_t format)
@@ -475,6 +548,8 @@ drm_output_release_fb(struct drm_output *output, struct 
drm_fb *fb)
if (fb->map &&
 (fb != output->dumb[0] && fb != output->dumb[1])) {
drm_fb_destroy_dumb(fb);
+   } else if (fb->is_dmabuf) {
+   drm_fb_destroy_dmabuf(fb);
} else if (fb->bo) {
if (fb->is_client_buffer)
gbm_bo_destroy(fb->bo);
@@ -486,12 +561,12 @@ drm_output_release_fb(struct drm_output *output, struct 
drm_fb *fb)
 
 static uint32_t
 drm_output_check_scanout_format(struct drm_output *output,
-   struct weston_surface *es, struct gbm_bo *bo)
+   struct weston_surface *es, uint32_t format)
 {
-   uint32_t format;
pixman_region32_t r;
 
-   format = gbm_bo_get_format(bo);
+   /* We relay on the GBM format enum and DRM format enum to be
+  identical */
 
if (format == GBM_FORMAT_ARGB) {
/* We can scanout an ARGB buffer if the surface's
@@ -521,12 +596,13 @@ drm_output_prepare_scanout_view(struct drm_output *output,
struct drm_backend *b = to_drm_backend(output->base.compositor);
struct weston_buffer *buffer = ev->surface->buffer_ref.buffer;
struct weston_buffer_viewport *viewport = >surface->buffer_viewport;
-   struct gbm_bo *bo;
+   struct linux_dmabuf_buffer *dmabuf;
+   struct gbm_bo *bo = NULL;
uint32_t format;
 
if (ev->geometry.x != output->base.x ||
ev->geometry.y != output->base.y ||
-   buffer == NULL || b->gbm == NULL ||
+   buffer == NULL ||
buffer->width != output->base.current_mode->width ||
buffer->height != output->base.current_mode->height ||
output->base.transform != viewport->buffer.transform ||
@@ -536,22 +612,35 @@ dr

[PATCH weston v2 1/3] compositor-drm: refactor destroy drm_fb function

2016-09-30 Thread Tomohito Esaki
The drm_fb destroy callback to mostly the same thing regardless of
whether the buffer is a dumb buffer or gbm buffer. This patch refactors
the common parts into a new function that can be called for both cases.

Signed-off-by: Tomohito Esaki <e...@igel.co.jp>
---
 libweston/compositor-drm.c | 31 ---
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 8319d7c..a707fc4 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -261,17 +261,23 @@ drm_sprite_crtc_supported(struct drm_output *output, 
uint32_t supported)
 }
 
 static void
-drm_fb_destroy_callback(struct gbm_bo *bo, void *data)
+drm_fb_destroy(struct drm_fb *fb, int fd)
 {
-   struct drm_fb *fb = data;
-   struct gbm_device *gbm = gbm_bo_get_device(bo);
-
if (fb->fb_id)
-   drmModeRmFB(gbm_device_get_fd(gbm), fb->fb_id);
+   drmModeRmFB(fd, fb->fb_id);
 
weston_buffer_reference(>buffer_ref, NULL);
 
-   free(data);
+   free(fb);
+}
+
+static void
+drm_fb_destroy_gbm_fb(struct gbm_bo *bo, void *data)
+{
+   struct drm_fb *fb = data;
+   struct gbm_device *gbm = gbm_bo_get_device(bo);
+
+   drm_fb_destroy(fb, gbm_device_get_fd(gbm));
 }
 
 static struct drm_fb *
@@ -370,22 +376,17 @@ static void
 drm_fb_destroy_dumb(struct drm_fb *fb)
 {
struct drm_mode_destroy_dumb destroy_arg;
+   int fd = fb->fd;
 
if (!fb->map)
return;
 
-   if (fb->fb_id)
-   drmModeRmFB(fb->fd, fb->fb_id);
-
-   weston_buffer_reference(>buffer_ref, NULL);
-
munmap(fb->map, fb->size);
-
memset(_arg, 0, sizeof(destroy_arg));
destroy_arg.handle = fb->handle;
-   drmIoctl(fb->fd, DRM_IOCTL_MODE_DESTROY_DUMB, _arg);
 
-   free(fb);
+   drm_fb_destroy(fb, fd);
+   drmIoctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, _arg);
 }
 
 static struct drm_fb *
@@ -446,7 +447,7 @@ drm_fb_get_from_bo(struct gbm_bo *bo,
goto err_free;
}
 
-   gbm_bo_set_user_data(bo, fb, drm_fb_destroy_callback);
+   gbm_bo_set_user_data(bo, fb, drm_fb_destroy_gbm_fb);
 
return fb;
 
-- 
2.7.4

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston v2 0/3] compositor: Support linux_dmabuf multiplanar formats for scanout/sprite planes

2016-09-30 Thread Tomohito Esaki
These patches add support multiplanar formats by using linux_dmabuf instead of
gbm for scanout/sprite plane importing.

When rendering linux_dmabuf buffers, gbm isn't required, and multiplanar
formats can be supported by using drmModeAddFB2() instead of gbm_import().

The first patch refactors destroy drm_fb, the second patch adapts the functions
that create and destroy the drm_fb struct to add support for linux_dmabuf.

v2:
 - rebased to apply on git master
 - fix function declaration to comply weston coding style.
 - remove logging when buffer size < backend size or buffer size > backend size.
 - fix leaking prime FD handle for dmabuf.
 - refactor destroy drm_fb
 - use boolean insted of linux_dmabuf pointer for checking if buffer is dmabuf
 - add comment into drm_output_check_scanout_format().
 - separate some "if" statements for readability.

Tomohito Esaki (3):
  compositor-drm: refactor destroy drm_fb function
  compositor-drm: Add scanout support for linux_dmabuf buffers
  compositor-drm: Support linux_dmabuf output for sprite planes without
gbm

 libweston/compositor-drm.c | 209 -
 1 file changed, 149 insertions(+), 60 deletions(-)

-- 
2.7.4

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston 0/2] compositor: Support linux_dmabuf multiplanar formats for scanout/sprite planes

2016-05-27 Thread Tomohito Esaki
These patches add support multiplanar formats by using linux_dmabuf instead of
gbm for scanout/sprite plane importing.

When rendering linux_dmabuf buffers, gbm isn't required, and multiplanar
formats can be supported by using drmModeAddFB2() instead of gbm_import().

The first patch adapts the functions that create and destroy the drm_fb struct
to add support for linux_dmabuf.

Tomohito Esaki (2):
  compositor-drm: Add scanout support for linux_dmabuf buffers
  compositor-drm: Support linux_dmabuf output for sprite planes without
gbm

 src/compositor-drm.c | 175 +--
 1 file changed, 127 insertions(+), 48 deletions(-)

-- 
2.7.4

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH] Provide damage region for screen recording on Raspberry Pi

2015-10-21 Thread Tomohito Esaki
From: Shinya Saito <ssa...@igel.co.jp>

When trying to do sceen recording using the screenshooter, no screen data
was ever processed because the rpi-renderer never set the previous frames
damage area.

Update the rpi-renderer to copy the necessary data.

Signed-off-by: Shinya Saito <ssa...@igel.co.jp>
Signed-off-by: Tomohito Esaki <e...@igel.co.jp>
---

 Tested on weston v1.8.0
 Compile tested on v1.9.0. (I don't have access to a Raspberry Pi right now)

 src/rpi-renderer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/rpi-renderer.c b/src/rpi-renderer.c
index d0a9797..76e1ddf 100644
--- a/src/rpi-renderer.c
+++ b/src/rpi-renderer.c
@@ -1410,6 +1410,7 @@ rpi_renderer_repaint_output(struct weston_output *base,
/* The frame_signal is emitted in rpi_renderer_finish_frame(),
 * so that the firmware can capture the up-to-date contents.
 */
+   pixman_region32_copy(>previous_damage, output_damage);
 }
 
 static void
-- 
1.8.0

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH] screenshooter: correct output ordering of screencast recording when Y-flip is off

2015-07-07 Thread Tomohito Esaki
The screenshooter encoder wrote the output from either top-to-bottom or
bottom-to-top, depending on the Y-flip setting, but wcap-decode only
decodes from bottom-to-top. Make the encoder always output from
bottom-to-top, to match the decoder, and flip the input (source)
according to the Y-flip setting.

Signed-off-by: Tomohito Esaki e...@igel.co.jp
---
 src/screenshooter.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/screenshooter.c b/src/screenshooter.c
index b7b8dce..6dae12f 100644
--- a/src/screenshooter.c
+++ b/src/screenshooter.c
@@ -417,14 +417,14 @@ weston_recorder_frame_notify(struct wl_listener 
*listener, void *data)
compositor-read_format, recorder-rect,
r[i].x1, y_orig, width, height);
 
-   s = recorder-rect;
p = outbuf;
run = prev = 0; /* quiet gcc */
for (j = 0; j  height; j++) {
if (do_yflip)
-   y_orig = r[i].y2 - j - 1;
+   s = recorder-rect + width * j;
else
-   y_orig = r[i].y1 + j;
+   s = recorder-rect + width * (height - j - 1);
+   y_orig = r[i].y2 - j - 1;
d = recorder-frame + stride * y_orig + r[i].x1;
 
for (k = 0; k  width; k++) {
-- 
1.8.0

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel