diff --git a/src/gallium/auxiliary/driver_trace/tr_screen.c b/src/gallium/auxiliary/driver_trace/tr_screen.c index 452061198f0..95cc4d18a84 100644 --- a/src/gallium/auxiliary/driver_trace/tr_screen.c +++ b/src/gallium/auxiliary/driver_trace/tr_screen.c @@ -1657,12 +1657,3 @@ trace_screen(struct pipe_screen *screen) assert(screen->destroy == trace_screen_destroy); return (struct trace_screen *)screen; } - -struct pipe_screen * -trace_screen_unwrap(struct pipe_screen *_screen) -{ - if (_screen->destroy != trace_screen_destroy) - return _screen; - struct trace_screen *tr_scr = trace_screen(_screen); - return tr_scr->screen; -} diff --git a/src/gallium/auxiliary/driver_trace/tr_screen.h b/src/gallium/auxiliary/driver_trace/tr_screen.h index f373053e659..5e20093788c 100644 --- a/src/gallium/auxiliary/driver_trace/tr_screen.h +++ b/src/gallium/auxiliary/driver_trace/tr_screen.h @@ -65,9 +65,6 @@ struct trace_screen struct trace_screen * trace_screen(struct pipe_screen *screen); -struct pipe_screen * -trace_screen_unwrap(struct pipe_screen *_screen); - #ifdef __cplusplus } #endif diff --git a/src/gallium/drivers/zink/zink_kopper.c b/src/gallium/drivers/zink/zink_kopper.c index 7475bdd1bf8..e7816ea378e 100644 --- a/src/gallium/drivers/zink/zink_kopper.c +++ b/src/gallium/drivers/zink/zink_kopper.c @@ -23,7 +23,6 @@ */ #include "util/detect_os.h" -#include "driver_trace/tr_screen.h" #include "zink_context.h" #include "zink_screen.h" @@ -656,7 +655,8 @@ zink_kopper_acquire(struct zink_context *ctx, struct zink_resource *res, uint64_ const struct kopper_swapchain *cswap = cdt->swapchain; res->obj->new_dt |= res->base.b.width0 != cswap->scci.imageExtent.width || res->base.b.height0 != cswap->scci.imageExtent.height; - VkResult ret = kopper_acquire(zink_screen(trace_screen_unwrap(ctx->base.screen)), res, timeout); + struct zink_screen *zscreen = zink_screen(kopper_get_zink_screen(ctx->base.screen)); + VkResult ret = kopper_acquire(zscreen, res, timeout); if (ret == VK_SUCCESS || ret == VK_SUBOPTIMAL_KHR) { if (cswap != cdt->swapchain) { ctx->swapchain_size = cdt->swapchain->scci.imageExtent; diff --git a/src/gallium/drivers/zink/zink_kopper.h b/src/gallium/drivers/zink/zink_kopper.h index 89106975266..8b91f38f69e 100644 --- a/src/gallium/drivers/zink/zink_kopper.h +++ b/src/gallium/drivers/zink/zink_kopper.h @@ -134,6 +134,13 @@ zink_kopper_acquired(const struct kopper_displaytarget *cdt, uint32_t idx) return idx != UINT32_MAX && cdt->swapchain->images[idx].acquired; } +static inline struct pipe_screen * kopper_get_zink_screen(struct pipe_screen *screen) +{ + struct pipe_screen *pscreen = screen->get_driver_pipe_screen ? + screen->get_driver_pipe_screen(screen) : screen; + return pscreen; +} + void zink_kopper_update_last_written(struct zink_resource *res); diff --git a/src/gallium/frontends/dri/dri_screen.c b/src/gallium/frontends/dri/dri_screen.c index 54b657e0c2c..fe09eb5d65c 100644 --- a/src/gallium/frontends/dri/dri_screen.c +++ b/src/gallium/frontends/dri/dri_screen.c @@ -642,7 +642,6 @@ dri_init_screen(struct dri_screen *screen, &screen->max_gl_es1_version, &screen->max_gl_es2_version); - screen->unwrapped_screen = trace_screen_unwrap(pscreen); screen->throttle = pscreen->get_param(pscreen, PIPE_CAP_THROTTLE); if (pscreen->get_param(pscreen, PIPE_CAP_DEVICE_PROTECTED_CONTEXT)) screen->has_protected_context = true; diff --git a/src/gallium/frontends/dri/dri_screen.h b/src/gallium/frontends/dri/dri_screen.h index 32114095c29..e4a6d80ae8b 100644 --- a/src/gallium/frontends/dri/dri_screen.h +++ b/src/gallium/frontends/dri/dri_screen.h @@ -127,7 +127,6 @@ struct dri_screen opencl_dri_event_get_fence_t opencl_dri_event_get_fence; /* kopper */ - struct pipe_screen *unwrapped_screen; bool has_dmabuf; bool is_sw; }; diff --git a/src/gallium/frontends/dri/kopper.c b/src/gallium/frontends/dri/kopper.c index ec304f55d8a..42ccbb08b1c 100644 --- a/src/gallium/frontends/dri/kopper.c +++ b/src/gallium/frontends/dri/kopper.c @@ -363,14 +363,13 @@ kopper_update_drawable_info(struct dri_drawable *drawable) struct dri_screen *screen = drawable->screen; bool is_window = drawable->info.bos.sType != 0; int x, y; - struct pipe_screen *pscreen = screen->unwrapped_screen; struct pipe_resource *ptex = drawable->textures[ST_ATTACHMENT_BACK_LEFT] ? drawable->textures[ST_ATTACHMENT_BACK_LEFT] : drawable->textures[ST_ATTACHMENT_FRONT_LEFT]; bool do_kopper_update = is_window && ptex && screen->fd == -1; if (drawable->info.bos.sType == VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR && do_kopper_update) - zink_kopper_update(pscreen, ptex, &drawable->w, &drawable->h); + zink_kopper_update(kopper_get_zink_screen(screen->base.screen), ptex, &drawable->w, &drawable->h); else get_drawable_info(drawable, &x, &y, &drawable->w, &drawable->h); } @@ -602,7 +601,6 @@ kopperSetSwapInterval(__DRIdrawable *dPriv, int interval) { struct dri_drawable *drawable = dri_drawable(dPriv); struct dri_screen *screen = drawable->screen; - struct pipe_screen *pscreen = screen->unwrapped_screen; struct pipe_resource *ptex = drawable->textures[ST_ATTACHMENT_BACK_LEFT] ? drawable->textures[ST_ATTACHMENT_BACK_LEFT] : drawable->textures[ST_ATTACHMENT_FRONT_LEFT]; @@ -614,8 +612,10 @@ kopperSetSwapInterval(__DRIdrawable *dPriv, int interval) * we're before allocation, then the initial_swap_interval will be used when * the swapchain is eventually created. */ - if (ptex) + if (ptex) { + struct pipe_screen *pscreen = kopper_get_zink_screen(screen->base.screen); zink_kopper_set_swap_interval(pscreen, ptex, interval); + } drawable->info.initial_swap_interval = interval; }