diff --git a/src/gallium/frontends/dri/dri_drawable.h b/src/gallium/frontends/dri/dri_drawable.h index cac2602fdb6..c8241d6c2ed 100644 --- a/src/gallium/frontends/dri/dri_drawable.h +++ b/src/gallium/frontends/dri/dri_drawable.h @@ -91,6 +91,7 @@ struct dri_drawable struct kopper_loader_info info; __DRIimage *image; //texture_from_pixmap bool is_window; + bool window_valid; bool has_modifiers; /* hooks filled in by dri2 & drisw */ diff --git a/src/gallium/frontends/dri/kopper.c b/src/gallium/frontends/dri/kopper.c index bc7fe59be26..b43658d6a75 100644 --- a/src/gallium/frontends/dri/kopper.c +++ b/src/gallium/frontends/dri/kopper.c @@ -555,6 +555,7 @@ XXX do this once swapinterval is hooked up assert(data); drawable->textures[statts[i]] = screen->base.screen->resource_create_drawable(screen->base.screen, &templ, data); + drawable->window_valid = !!drawable->textures[statts[i]]; } #ifdef VK_USE_PLATFORM_XCB_KHR else if (is_pixmap && statts[i] == ST_ATTACHMENT_FRONT_LEFT && !screen->is_sw) { @@ -904,6 +905,9 @@ kopperSetSwapInterval(__DRIdrawable *dPriv, int interval) drawable->textures[ST_ATTACHMENT_BACK_LEFT] : drawable->textures[ST_ATTACHMENT_FRONT_LEFT]; + /* can't set swap interval on non-windows */ + if (!drawable->window_valid) + return; /* the conditional is because we can be called before buffer allocation. If * we're before allocation, then the initial_swap_interval will be used when * the swapchain is eventually created. @@ -922,6 +926,10 @@ kopperQueryBufferAge(__DRIdrawable *dPriv) drawable->textures[ST_ATTACHMENT_BACK_LEFT] : drawable->textures[ST_ATTACHMENT_FRONT_LEFT]; + /* can't get buffer age from non-window swapchain */ + if (!drawable->window_valid) + return 0; + /* Wait for glthread to finish because we can't use pipe_context from * multiple threads. */