diff options
author | Marek Olšák <[email protected]> | 2017-02-05 01:20:51 +0100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-03-16 14:14:19 +1100 |
commit | c83562ccaa5f4bd42f4f59c519b48faeb295e354 (patch) | |
tree | d997283ca998e8c737bcd667dde3acd3e03d0dfa /src/mesa/state_tracker | |
parent | 93bdad3253cfa353cadf4444711c70f39e9baf09 (diff) |
gallium: implement the backend of threaded GL dispatch
Acked-by: Timothy Arceri <[email protected]>
Tested-by: Dieter Nützel <[email protected]>
Tested-by: Mike Lothian <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_context.c | 13 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_manager.c | 19 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index a528f343700..869e6e9f87b 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -29,6 +29,7 @@ #include "main/accum.h" #include "main/api_exec.h" #include "main/context.h" +#include "main/glthread.h" #include "main/samplerobj.h" #include "main/shaderobj.h" #include "main/version.h" @@ -612,6 +613,17 @@ st_emit_string_marker(struct gl_context *ctx, const GLchar *string, GLsizei len) st->pipe->emit_string_marker(st->pipe, string, len); } +static void +st_set_background_context(struct gl_context *ctx) +{ + struct st_context *st = ctx->st; + struct st_manager *smapi = + (struct st_manager*)st->iface.st_context_private; + + assert(smapi->set_background_context); + smapi->set_background_context(&st->iface); +} + void st_init_driver_functions(struct pipe_screen *screen, struct dd_function_table *functions) { @@ -656,4 +668,5 @@ void st_init_driver_functions(struct pipe_screen *screen, functions->Enable = st_Enable; functions->UpdateState = st_invalidate_state; functions->QueryMemoryInfo = st_query_memory_info; + functions->SetBackgroundContext = st_set_background_context; } diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index e663b017174..dad408a451e 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -29,6 +29,7 @@ #include "main/extensions.h" #include "main/context.h" #include "main/debug_output.h" +#include "main/glthread.h" #include "main/texobj.h" #include "main/teximage.h" #include "main/texstate.h" @@ -629,6 +630,22 @@ st_context_destroy(struct st_context_iface *stctxi) st_destroy_context(st); } +static void +st_start_thread(struct st_context_iface *stctxi) +{ + struct st_context *st = (struct st_context *) stctxi; + + _mesa_glthread_init(st->ctx); +} + +static void +st_thread_finish(struct st_context_iface *stctxi) +{ + struct st_context *st = (struct st_context *) stctxi; + + _mesa_glthread_finish(st->ctx); +} + static struct st_context_iface * st_api_create_context(struct st_api *stapi, struct st_manager *smapi, const struct st_context_attribs *attribs, @@ -723,6 +740,8 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi, st->iface.teximage = st_context_teximage; st->iface.copy = st_context_copy; st->iface.share = st_context_share; + st->iface.start_thread = st_start_thread; + st->iface.thread_finish = st_thread_finish; st->iface.st_context_private = (void *) smapi; st->iface.cso_context = st->cso_context; st->iface.pipe = st->pipe; |