_EGLConfig *conf, void *native_window,
const EGLint *attrib_list)
{
- __DRIcreateNewDrawableFunc createNewDrawable;
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_config *dri2_conf = dri2_egl_config(conf);
struct wl_egl_window *window = native_window;
}
if (!dri2_init_surface(&dri2_surf->base, disp, EGL_WINDOW_BIT, conf,
- attrib_list, false))
+ attrib_list, false, native_window))
goto cleanup_surf;
config = dri2_get_dri_config(dri2_conf, EGL_WINDOW_BIT,
if (dri2_dpy->flush)
dri2_surf->wl_win->resize_callback = resize_callback;
- if (dri2_dpy->image_driver)
- createNewDrawable = dri2_dpy->image_driver->createNewDrawable;
- else if (dri2_dpy->dri2)
- createNewDrawable = dri2_dpy->dri2->createNewDrawable;
- else
- createNewDrawable = dri2_dpy->swrast->createNewDrawable;
-
- dri2_surf->dri_drawable = (*createNewDrawable)(dri2_dpy->dri_screen, config,
- dri2_surf);
- if (dri2_surf->dri_drawable == NULL) {
- _eglError(EGL_BAD_ALLOC, "createNewDrawable");
+ if (!dri2_create_drawable(dri2_dpy, config, dri2_surf))
goto cleanup_surf_wrapper;
- }
dri2_surf->base.SwapInterval = dri2_dpy->default_swap_interval;
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
- if (dri2_surf->base.Width != dri2_surf->wl_win->attached_width ||
- dri2_surf->base.Height != dri2_surf->wl_win->attached_height) {
-
- dri2_wl_release_buffers(dri2_surf);
+ if (dri2_surf->base.Width != dri2_surf->wl_win->width ||
+ dri2_surf->base.Height != dri2_surf->wl_win->height) {
dri2_surf->base.Width = dri2_surf->wl_win->width;
dri2_surf->base.Height = dri2_surf->wl_win->height;
dri2_surf->dy = dri2_surf->wl_win->dy;
}
+ if (dri2_surf->base.Width != dri2_surf->wl_win->attached_width ||
+ dri2_surf->base.Height != dri2_surf->wl_win->attached_height) {
+ dri2_wl_release_buffers(dri2_surf);
+ }
+
if (get_back_bo(dri2_surf) < 0) {
_eglError(EGL_BAD_ALLOC, "failed to allocate color buffer");
return -1;
return 0;
}
+static int
+update_buffers_if_needed(struct dri2_egl_surface *dri2_surf)
+{
+ if (dri2_surf->back != NULL)
+ return 0;
+
+ return update_buffers(dri2_surf);
+}
+
static __DRIbuffer *
dri2_wl_get_buffers_with_format(__DRIdrawable * driDrawable,
int *width, int *height,
/* Make sure we have a back buffer in case we're swapping without ever
* rendering. */
- if (get_back_bo(dri2_surf) < 0)
+ if (update_buffers_if_needed(dri2_surf) < 0)
return _eglError(EGL_BAD_ALLOC, "dri2_swap_buffers");
if (draw->SwapInterval > 0) {
{
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surface);
- if (get_back_bo(dri2_surf) < 0) {
+ if (update_buffers_if_needed(dri2_surf) < 0) {
_eglError(EGL_BAD_ALLOC, "dri2_query_buffer_age");
return -1;
}