static boolean ximage_surface_swap_buffers(struct native_surface *nsurf) { struct ximage_surface *xsurf = ximage_surface(nsurf); boolean ret; ret = resource_surface_present(xsurf->rsurf, NATIVE_ATTACHMENT_BACK_LEFT, (void *) &xsurf->xdraw); resource_surface_swap_buffers(xsurf->rsurf, NATIVE_ATTACHMENT_FRONT_LEFT, NATIVE_ATTACHMENT_BACK_LEFT, TRUE); /* the front/back buffers have been swapped */ ximage_surface_invalidate(&xsurf->base); return ret; }
static boolean wayland_surface_swap_buffers(struct native_surface *nsurf) { struct wayland_surface *surface = wayland_surface(nsurf); struct wayland_display *display = surface->display; int ret = 0; while (surface->frame_callback && ret != -1) ret = wl_display_dispatch_queue(display->dpy, display->queue); if (ret == -1) return EGL_FALSE; surface->frame_callback = wl_surface_frame(surface->win->surface); wl_callback_add_listener(surface->frame_callback, &frame_listener, surface); wl_proxy_set_queue((struct wl_proxy *) surface->frame_callback, display->queue); if (surface->type == WL_WINDOW_SURFACE) { resource_surface_swap_buffers(surface->rsurf, NATIVE_ATTACHMENT_FRONT_LEFT, NATIVE_ATTACHMENT_BACK_LEFT, FALSE); wayland_buffers_swap(surface->buffer, WL_BUFFER_FRONT, WL_BUFFER_BACK); if (surface->buffer[WL_BUFFER_FRONT] == NULL) surface->buffer[WL_BUFFER_FRONT] = display->create_buffer(display, surface, NATIVE_ATTACHMENT_FRONT_LEFT); wl_surface_attach(surface->win->surface, surface->buffer[WL_BUFFER_FRONT], surface->dx, surface->dy); resource_surface_get_size(surface->rsurf, (uint *) &surface->win->attached_width, (uint *) &surface->win->attached_height); surface->dx = 0; surface->dy = 0; } surface->sequence_number++; wayland_event_handler->invalid_surface(&display->base, &surface->base, surface->sequence_number); return TRUE; }
static boolean wayland_surface_swap_buffers(struct native_surface *nsurf) { struct wayland_surface *surface = wayland_surface(nsurf); struct wayland_display *display = surface->display; struct wl_callback *callback; while (surface->block_swap_buffers) wl_display_iterate(display->dpy, WL_DISPLAY_READABLE); surface->block_swap_buffers = TRUE; callback = wl_surface_frame(surface->win->surface); wl_callback_add_listener(callback, &frame_listener, surface); if (surface->type == WL_WINDOW_SURFACE) { resource_surface_swap_buffers(surface->rsurf, NATIVE_ATTACHMENT_FRONT_LEFT, NATIVE_ATTACHMENT_BACK_LEFT, FALSE); wayland_buffers_swap(surface->buffer, WL_BUFFER_FRONT, WL_BUFFER_BACK); if (surface->buffer[WL_BUFFER_FRONT] == NULL) surface->buffer[WL_BUFFER_FRONT] = display->create_buffer(display, surface, NATIVE_ATTACHMENT_FRONT_LEFT); wl_surface_attach(surface->win->surface, surface->buffer[WL_BUFFER_FRONT], surface->dx, surface->dy); resource_surface_get_size(surface->rsurf, (uint *) &surface->win->attached_width, (uint *) &surface->win->attached_height); surface->dx = 0; surface->dy = 0; } surface->sequence_number++; wayland_event_handler->invalid_surface(&display->base, &surface->base, surface->sequence_number); return TRUE; }
static boolean gdi_surface_swap_buffers(struct native_surface *nsurf) { struct gdi_surface *gsurf = gdi_surface(nsurf); HDC hDC; boolean ret; hDC = GetDC(gsurf->hWnd); ret = resource_surface_present(gsurf->rsurf, NATIVE_ATTACHMENT_BACK_LEFT, (void *) hDC); ReleaseDC(gsurf->hWnd, hDC); resource_surface_swap_buffers(gsurf->rsurf, NATIVE_ATTACHMENT_FRONT_LEFT, NATIVE_ATTACHMENT_BACK_LEFT, TRUE); /* the front/back buffers have been swapped */ gdi_surface_invalidate(&gsurf->base); return ret; }
static boolean psl1ght_surface_swap_buffers(struct native_surface *nsurf) { struct psl1ght_surface *pssurf = psl1ght_surface(nsurf); struct psl1ght_display *psdpy = pssurf->psdpy; boolean ret = TRUE; if (pssurf->is_current) { ret = resource_surface_present(pssurf->rsurf, NATIVE_ATTACHMENT_BACK_LEFT, NULL); } resource_surface_swap_buffers(pssurf->rsurf, NATIVE_ATTACHMENT_FRONT_LEFT, NATIVE_ATTACHMENT_BACK_LEFT, FALSE); /* the front/back textures are swapped */ pssurf->sequence_number++; psdpy->event_handler->invalid_surface(&psdpy->base, &pssurf->base, pssurf->sequence_number); return ret; }
static boolean drm_surface_swap_buffers(struct native_surface *nsurf) { struct drm_surface *drmsurf = drm_surface(nsurf); struct drm_crtc *drmcrtc = &drmsurf->current_crtc; struct drm_display *drmdpy = drmsurf->drmdpy; struct drm_framebuffer tmp_fb; int err; if (!drmsurf->have_pageflip) return drm_surface_copy_swap(nsurf); if (!drmsurf->back_fb.buffer_id) { if (!drm_surface_init_framebuffers(&drmsurf->base, TRUE)) return FALSE; } if (drmsurf->is_shown && drmcrtc->crtc) { err = drmModePageFlip(drmdpy->fd, drmcrtc->crtc->crtc_id, drmsurf->back_fb.buffer_id, 0, NULL); if (err) { drmsurf->have_pageflip = FALSE; return drm_surface_copy_swap(nsurf); } } /* swap the buffers */ tmp_fb = drmsurf->front_fb; drmsurf->front_fb = drmsurf->back_fb; drmsurf->back_fb = tmp_fb; resource_surface_swap_buffers(drmsurf->rsurf, NATIVE_ATTACHMENT_FRONT_LEFT, NATIVE_ATTACHMENT_BACK_LEFT, FALSE); /* the front/back textures are swapped */ drmsurf->sequence_number++; drmdpy->event_handler->invalid_surface(&drmdpy->base, &drmsurf->base, drmsurf->sequence_number); return TRUE; }