EGLBoolean eglSwapBuffers(EGLDisplay display, EGLSurface surface) { if(!libEGL) { shim_load_libEGL(); } if(!global_smaa) { global_smaa = smaa_create(); } smaa_update(global_smaa); return _eglSwapBuffers(display, surface); }
/* If the backbuffer is on a videocard, this is extraordinarily slow! */ static EGLBoolean fbSwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw) { fbContext *context = (fbContext *)_eglGetCurrentContext(); fbSurface *fs = Lookup_fbSurface(draw); struct gl_renderbuffer * front_renderbuffer = fs->mesa_framebuffer->Attachment[BUFFER_FRONT_LEFT].Renderbuffer; void *frontBuffer = front_renderbuffer->Data; int currentPitch = ((driRenderbuffer *)front_renderbuffer)->pitch; void *backBuffer = fs->mesa_framebuffer->Attachment[BUFFER_BACK_LEFT].Renderbuffer->Data; if (!_eglSwapBuffers(drv, dpy, draw)) return EGL_FALSE; if (context) { GLcontext *ctx = context->glCtx; if (ctx->Visual.doubleBufferMode) { int i; int offset = 0; char *tmp = _mesa_malloc(currentPitch); _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */ ASSERT(frontBuffer); ASSERT(backBuffer); for (i = 0; i < fs->Base.Height; i++) { _mesa_memcpy(tmp, (char *) backBuffer + offset, currentPitch); _mesa_memcpy((char *) frontBuffer + offset, tmp, currentPitch); offset += currentPitch; } _mesa_free(tmp); } } else { /* XXX this shouldn't be an error but we can't handle it for now */ _mesa_problem(NULL, "fbSwapBuffers: drawable has no context!\n"); return EGL_FALSE; } return EGL_TRUE; }
static EGLBoolean xlib_eglSwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw) { /* error checking step: */ if (!_eglSwapBuffers(drv, dpy, draw)) return EGL_FALSE; { struct xlib_egl_surface *xsurf = lookup_surface(draw); struct pipe_winsys *pws = xsurf->winsys; struct pipe_surface *psurf = st_get_framebuffer_surface(xsurf->Framebuffer, ST_SURFACE_BACK_LEFT); st_notify_swapbuffers(xsurf->Framebuffer); display_surface(pws, psurf, xsurf); check_and_update_buffer_size(xsurf); } return EGL_TRUE; }
EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) { EGL_DEBUG("%s: %s\n", __FILE__, __func__); EGL_DLSYM(eglSwapBuffers); return _eglSwapBuffers(dpy, surface); }