kopper: the latest awfulness exposed by piglit glx-multi-window-single-context
I've been working on more kopper fixes (!17149 (merged)), and I've discovered something terrible in the course of examining bin/glx-multi-window-single-context
.
Basically it works like this:
- loop (0..7) -> makecurrent(ctx, window[i]), create swapchain(i) -> draw(i)
- loop (0..7) -> makecurrent(ctx, window[i]) -> readback swapchain[i]
The problem arises in the second loop: by this point, the pipe_resource
objects kopper created for the swapchain have had all their references removed save for the dangling ones on pending cmdbuf submissions. This means that for the later parts of the second loop, the process of recycling batches will kill off the swapchain resources, ultimately killing the swapchains and breaking the test.
Not entirely sure what to do about this. Setting psc->base.keep_native_window_glx_drawable
for the zink case in drisw avoids the issue neatly, but unconditionally keeping swapchains around until they die seems potentially suboptimal? I could keep them alive internally in zink and free them all on screen destruction, but that seems worse.