weston_log("set gamma failed: %m\n");
}
-static void
+static int
drm_output_repaint(struct weston_output *output_base,
pixman_region32_t *damage)
{
int ret = 0;
if (output->destroy_pending)
- return;
+ return -1;
if (!output->next)
drm_output_render(output, damage);
if (!output->next)
- return;
+ return -1;
mode = container_of(output->base.current_mode, struct drm_mode, base);
if (!output->current) {
&mode->mode_info);
if (ret) {
weston_log("set mode failed: %m\n");
- return;
+ goto err_pageflip;
}
output_base->set_dpms(output_base, WESTON_DPMS_ON);
}
output->next->fb_id,
DRM_MODE_PAGE_FLIP_EVENT, output) < 0) {
weston_log("queueing pageflip failed: %m\n");
- return;
+ goto err_pageflip;
}
output->page_flip_pending = 1;
output->vblank_pending = 1;
}
- return;
+ return 0;
+
+err_pageflip:
+ if (output->next) {
+ drm_output_release_fb(output, output->next);
+ output->next = NULL;
+ }
+
+ return -1;
}
static void
1000000 / output->mode.refresh);
}
-static void
+static int
fbdev_output_repaint(struct weston_output *base, pixman_region32_t *damage)
{
struct fbdev_output *output = to_fbdev_output(base);
wl_event_source_timer_update(output->finish_frame_timer,
1000000 / output->mode.refresh);
}
+
+ return 0;
}
static int
return 1;
}
-static void
+static int
headless_output_repaint(struct weston_output *output_base,
pixman_region32_t *damage)
{
wl_event_source_timer_update(output->finish_frame_timer, 16);
- return;
+ return 0;
}
static void
weston_output_finish_frame(output, msec);
}
-static void
+static int
rdp_output_repaint(struct weston_output *output_base, pixman_region32_t *damage)
{
struct rdp_output *output = container_of(output_base, struct rdp_output, base);
&ec->primary_plane.damage, damage);
wl_event_source_timer_update(output->finish_frame_timer, 16);
+ return 0;
}
static void
weston_output_finish_frame(output, time);
}
-static void
+static int
rpi_output_repaint(struct weston_output *base, pixman_region32_t *damage)
{
struct rpi_output *output = to_rpi_output(base);
/* schedule callback to rpi_output_update_complete() */
rpi_dispmanx_update_submit(update, output);
DBG("frame update submitted\n");
+ return 0;
}
static void
wl_surface_commit(output->parent.surface);
}
-static void
+static int
wayland_output_repaint(struct weston_output *output_base,
pixman_region32_t *damage)
{
pixman_region32_subtract(&ec->primary_plane.damage,
&ec->primary_plane.damage, damage);
-
+ return 0;
}
static void
weston_output_finish_frame(output, msec);
}
-static void
+static int
x11_output_repaint_gl(struct weston_output *output_base,
pixman_region32_t *damage)
{
&ec->primary_plane.damage, damage);
wl_event_source_timer_update(output->finish_frame_timer, 10);
+ return 0;
}
static void
}
-static void
+static int
x11_output_repaint_shm(struct weston_output *output_base,
pixman_region32_t *damage)
{
}
wl_event_source_timer_update(output->finish_frame_timer, 10);
+ return 0;
}
static int
}
}
-static void
+static int
weston_output_repaint(struct weston_output *output, uint32_t msecs)
{
struct weston_compositor *ec = output->compositor;
struct weston_frame_callback *cb, *cnext;
struct wl_list frame_callback_list;
pixman_region32_t output_damage;
+ int r;
/* Rebuild the surface list and update surface transforms up front. */
weston_compositor_build_surface_list(ec);
if (output->dirty)
weston_output_update_matrix(output);
- output->repaint(output, &output_damage);
+ r = output->repaint(output, &output_damage);
pixman_region32_fini(&output_damage);
animation->frame_counter++;
animation->frame(animation, output, msecs);
}
+
+ return r;
}
static int
struct weston_compositor *compositor = output->compositor;
struct wl_event_loop *loop =
wl_display_get_event_loop(compositor->wl_display);
- int fd;
+ int fd, r;
output->frame_time = msecs;
if (output->repaint_needed &&
compositor->state != WESTON_COMPOSITOR_SLEEPING &&
compositor->state != WESTON_COMPOSITOR_OFFSCREEN) {
- weston_output_repaint(output, msecs);
- return;
+ r = weston_output_repaint(output, msecs);
+ if (!r)
+ return;
}
output->repaint_scheduled = 0;
struct wl_list mode_list;
void (*start_repaint_loop)(struct weston_output *output);
- void (*repaint)(struct weston_output *output,
+ int (*repaint)(struct weston_output *output,
pixman_region32_t *damage);
void (*destroy)(struct weston_output *output);
void (*assign_planes)(struct weston_output *output);