crocus: stop using util_framebuffer_init
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36416>
This commit is contained in:
committed by
Marge Bot
parent
df803d825f
commit
391945d90b
@@ -182,48 +182,6 @@ crocus_get_sample_position(struct pipe_context *ctx,
|
||||
out_value[1] = u.a.y[sample_index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy a context, freeing any associated memory.
|
||||
*/
|
||||
static void
|
||||
crocus_destroy_context(struct pipe_context *ctx)
|
||||
{
|
||||
struct crocus_context *ice = (struct crocus_context *)ctx;
|
||||
struct crocus_screen *screen = (struct crocus_screen *)ctx->screen;
|
||||
|
||||
blorp_finish(&ice->blorp);
|
||||
|
||||
intel_perf_free_context(ice->perf_ctx);
|
||||
if (ctx->stream_uploader)
|
||||
u_upload_destroy(ctx->stream_uploader);
|
||||
|
||||
if (ice->blitter)
|
||||
util_blitter_destroy(ice->blitter);
|
||||
screen->vtbl.destroy_state(ice);
|
||||
|
||||
util_framebuffer_init(ctx, NULL, ice->state.fb_cbufs, &ice->state.fb_zsbuf);
|
||||
util_unreference_framebuffer_state(&ice->state.framebuffer);
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(ice->shaders.scratch_bos); i++) {
|
||||
for (unsigned j = 0; j < ARRAY_SIZE(ice->shaders.scratch_bos[i]); j++)
|
||||
crocus_bo_unreference(ice->shaders.scratch_bos[i][j]);
|
||||
}
|
||||
|
||||
crocus_destroy_program_cache(ice);
|
||||
u_upload_destroy(ice->query_buffer_uploader);
|
||||
|
||||
crocus_bo_unreference(ice->workaround_bo);
|
||||
|
||||
slab_destroy_child(&ice->transfer_pool);
|
||||
slab_destroy_child(&ice->transfer_pool_unsync);
|
||||
|
||||
crocus_batch_free(&ice->batches[CROCUS_BATCH_RENDER]);
|
||||
if (ice->batches[CROCUS_BATCH_COMPUTE].ice)
|
||||
crocus_batch_free(&ice->batches[CROCUS_BATCH_COMPUTE]);
|
||||
|
||||
ralloc_free(ice);
|
||||
}
|
||||
|
||||
#define genX_call(devinfo, func, ...) \
|
||||
switch ((devinfo)->verx10) { \
|
||||
case 80: \
|
||||
@@ -251,6 +209,49 @@ crocus_destroy_context(struct pipe_context *ctx)
|
||||
UNREACHABLE("Unknown hardware generation"); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy a context, freeing any associated memory.
|
||||
*/
|
||||
static void
|
||||
crocus_destroy_context(struct pipe_context *ctx)
|
||||
{
|
||||
struct crocus_context *ice = (struct crocus_context *)ctx;
|
||||
struct crocus_screen *screen = (struct crocus_screen *)ctx->screen;
|
||||
const struct intel_device_info *devinfo = &screen->devinfo;
|
||||
|
||||
blorp_finish(&ice->blorp);
|
||||
|
||||
intel_perf_free_context(ice->perf_ctx);
|
||||
if (ctx->stream_uploader)
|
||||
u_upload_destroy(ctx->stream_uploader);
|
||||
|
||||
if (ice->blitter)
|
||||
util_blitter_destroy(ice->blitter);
|
||||
screen->vtbl.destroy_state(ice);
|
||||
|
||||
genX_call(devinfo, crocus_framebuffer_init, ctx, NULL, ice->state.fb_cbufs, &ice->state.fb_zsbuf);
|
||||
util_unreference_framebuffer_state(&ice->state.framebuffer);
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(ice->shaders.scratch_bos); i++) {
|
||||
for (unsigned j = 0; j < ARRAY_SIZE(ice->shaders.scratch_bos[i]); j++)
|
||||
crocus_bo_unreference(ice->shaders.scratch_bos[i][j]);
|
||||
}
|
||||
|
||||
crocus_destroy_program_cache(ice);
|
||||
u_upload_destroy(ice->query_buffer_uploader);
|
||||
|
||||
crocus_bo_unreference(ice->workaround_bo);
|
||||
|
||||
slab_destroy_child(&ice->transfer_pool);
|
||||
slab_destroy_child(&ice->transfer_pool_unsync);
|
||||
|
||||
crocus_batch_free(&ice->batches[CROCUS_BATCH_RENDER]);
|
||||
if (ice->batches[CROCUS_BATCH_COMPUTE].ice)
|
||||
crocus_batch_free(&ice->batches[CROCUS_BATCH_COMPUTE]);
|
||||
|
||||
ralloc_free(ice);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a context.
|
||||
*
|
||||
|
||||
@@ -37,6 +37,9 @@ void genX(crocus_upload_urb)(struct crocus_batch *batch,
|
||||
void genX(crocus_update_pma_fix)(struct crocus_context *ice,
|
||||
struct crocus_batch *batch,
|
||||
bool enable);
|
||||
void
|
||||
genX(crocus_framebuffer_init)(struct pipe_context *pctx, const struct pipe_framebuffer_state *fb, struct pipe_surface **cbufs, struct pipe_surface **zsbuf);
|
||||
|
||||
/* crocus_blorp.c */
|
||||
void genX(crocus_init_blorp)(struct crocus_context *ice);
|
||||
|
||||
|
||||
@@ -3371,6 +3371,45 @@ crocus_set_viewport_states(struct pipe_context *ctx,
|
||||
ice->state.dirty |= CROCUS_DIRTY_CC_VIEWPORT;
|
||||
}
|
||||
|
||||
void
|
||||
genX(crocus_framebuffer_init)(struct pipe_context *pctx, const struct pipe_framebuffer_state *fb, struct pipe_surface **cbufs, struct pipe_surface **zsbuf)
|
||||
{
|
||||
if (fb) {
|
||||
for (unsigned i = 0; i < fb->nr_cbufs; i++) {
|
||||
if (cbufs[i] && pipe_surface_equal(&fb->cbufs[i], cbufs[i]))
|
||||
continue;
|
||||
|
||||
struct pipe_surface *psurf = fb->cbufs[i].texture ? crocus_create_surface(pctx, fb->cbufs[i].texture, &fb->cbufs[i]) : NULL;
|
||||
if (cbufs[i])
|
||||
crocus_surface_destroy(pctx, cbufs[i]);
|
||||
cbufs[i] = psurf;
|
||||
}
|
||||
|
||||
for (unsigned i = fb->nr_cbufs; i < PIPE_MAX_COLOR_BUFS; i++) {
|
||||
if (cbufs[i])
|
||||
crocus_surface_destroy(pctx, cbufs[i]);
|
||||
cbufs[i] = NULL;
|
||||
}
|
||||
|
||||
if (*zsbuf && pipe_surface_equal(&fb->zsbuf, *zsbuf))
|
||||
return;
|
||||
struct pipe_surface *zsurf = fb->zsbuf.texture ? crocus_create_surface(pctx, fb->zsbuf.texture, &fb->zsbuf) : NULL;
|
||||
if (*zsbuf)
|
||||
crocus_surface_destroy(pctx, *zsbuf);
|
||||
*zsbuf = zsurf;
|
||||
} else {
|
||||
for (unsigned i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
|
||||
if (cbufs[i])
|
||||
crocus_surface_destroy(pctx, cbufs[i]);
|
||||
cbufs[i] = NULL;
|
||||
}
|
||||
if (*zsbuf)
|
||||
crocus_surface_destroy(pctx, *zsbuf);
|
||||
*zsbuf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The pipe->set_framebuffer_state() driver hook.
|
||||
*
|
||||
@@ -3432,7 +3471,7 @@ crocus_set_framebuffer_state(struct pipe_context *ctx,
|
||||
|
||||
/* wm thread dispatch enable */
|
||||
ice->state.dirty |= CROCUS_DIRTY_WM;
|
||||
util_framebuffer_init(ctx, state, ice->state.fb_cbufs, &ice->state.fb_zsbuf);
|
||||
genX(crocus_framebuffer_init)(ctx, state, ice->state.fb_cbufs, &ice->state.fb_zsbuf);
|
||||
util_copy_framebuffer_state(cso, state);
|
||||
cso->samples = samples;
|
||||
cso->layers = layers;
|
||||
@@ -9231,7 +9270,6 @@ genX(crocus_init_state)(struct crocus_context *ice)
|
||||
ctx->create_rasterizer_state = crocus_create_rasterizer_state;
|
||||
ctx->create_sampler_state = crocus_create_sampler_state;
|
||||
ctx->create_sampler_view = crocus_create_sampler_view;
|
||||
ctx->create_surface = crocus_create_surface;
|
||||
ctx->create_vertex_elements_state = crocus_create_vertex_elements;
|
||||
ctx->bind_blend_state = crocus_bind_blend_state;
|
||||
ctx->bind_depth_stencil_alpha_state = crocus_bind_zsa_state;
|
||||
|
||||
Reference in New Issue
Block a user