mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-13 02:40:28 +01:00
freedreno: Add aux-context support
A global aux-context can be created on-demand for cases where we need to (for example) blit a resource when we only have a screen ptr. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23324>
This commit is contained in:
parent
221a6986ba
commit
75193262fd
2 changed files with 35 additions and 0 deletions
|
|
@ -146,6 +146,9 @@ fd_screen_destroy(struct pipe_screen *pscreen)
|
|||
{
|
||||
struct fd_screen *screen = fd_screen(pscreen);
|
||||
|
||||
if (screen->aux_ctx)
|
||||
screen->aux_ctx->destroy(screen->aux_ctx);
|
||||
|
||||
if (screen->tess_bo)
|
||||
fd_bo_del(screen->tess_bo);
|
||||
|
||||
|
|
@ -1230,9 +1233,34 @@ fd_screen_create(int fd,
|
|||
|
||||
slab_create_parent(&screen->transfer_pool, sizeof(struct fd_transfer), 16);
|
||||
|
||||
simple_mtx_init(&screen->aux_ctx_lock, mtx_plain);
|
||||
|
||||
return pscreen;
|
||||
|
||||
fail:
|
||||
fd_screen_destroy(pscreen);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct fd_context *
|
||||
fd_screen_aux_context_get(struct pipe_screen *pscreen)
|
||||
{
|
||||
struct fd_screen *screen = fd_screen(pscreen);
|
||||
|
||||
simple_mtx_lock(&screen->aux_ctx_lock);
|
||||
|
||||
if (!screen->aux_ctx) {
|
||||
screen->aux_ctx = pscreen->context_create(pscreen, NULL, 0);
|
||||
}
|
||||
|
||||
return fd_context(screen->aux_ctx);
|
||||
}
|
||||
|
||||
void
|
||||
fd_screen_aux_context_put(struct pipe_screen *pscreen)
|
||||
{
|
||||
struct fd_screen *screen = fd_screen(pscreen);
|
||||
|
||||
screen->aux_ctx->flush(screen->aux_ctx, NULL, 0);
|
||||
simple_mtx_unlock(&screen->aux_ctx_lock);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,6 +170,9 @@ struct fd_screen {
|
|||
*/
|
||||
const enum pc_di_primtype *primtypes;
|
||||
uint32_t primtypes_mask;
|
||||
|
||||
simple_mtx_t aux_ctx_lock;
|
||||
struct pipe_context *aux_ctx;
|
||||
};
|
||||
|
||||
static inline struct fd_screen *
|
||||
|
|
@ -178,6 +181,10 @@ fd_screen(struct pipe_screen *pscreen)
|
|||
return (struct fd_screen *)pscreen;
|
||||
}
|
||||
|
||||
struct fd_context;
|
||||
struct fd_context * fd_screen_aux_context_get(struct pipe_screen *pscreen);
|
||||
void fd_screen_aux_context_put(struct pipe_screen *pscreen);
|
||||
|
||||
static inline void
|
||||
fd_screen_lock(struct fd_screen *screen)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue