+#ifdef EGL_NOK_swap_region
+static EGLBoolean
+egl_g3d_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
+ EGLint num_rects, const EGLint *rects)
+{
+ /* Note: y=0=top */
+ return swap_buffers(drv, dpy, surf, num_rects, rects, EGL_TRUE);
+}
+#endif /* EGL_NOK_swap_region */
+
+static EGLBoolean
+egl_g3d_post_sub_buffer(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
+ EGLint x, EGLint y, EGLint width, EGLint height)
+{
+ EGLint rect[4];
+
+ if (x < 0 || y < 0 || width < 0 || height < 0)
+ return _eglError(EGL_BAD_PARAMETER, "eglPostSubBufferNV");
+
+ /* clamp */
+ if (x + width > surf->Width)
+ width = surf->Width - x;
+ if (y + height > surf->Height)
+ height = surf->Height - y;
+
+ if (width <= 0 || height <= 0)
+ return EGL_TRUE;
+
+ rect[0] = x;
+ /* Note: y=0=bottom */
+ rect[1] = surf->Height - y - height;
+ rect[2] = width;
+ rect[3] = height;
+
+ return swap_buffers(drv, dpy, surf, 1, rect, EGL_TRUE);