mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 13:38:06 +02:00
gallium/hud: separate code for record context init/release
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
parent
fc07acc21e
commit
37ded08321
2 changed files with 37 additions and 16 deletions
|
|
@ -680,9 +680,9 @@ hud_stop_queries(struct hud_context *hud, struct pipe_context *pipe)
|
||||||
void
|
void
|
||||||
hud_run(struct hud_context *hud, struct pipe_resource *tex)
|
hud_run(struct hud_context *hud, struct pipe_resource *tex)
|
||||||
{
|
{
|
||||||
hud_stop_queries(hud, hud->pipe);
|
hud_stop_queries(hud, hud->record_pipe);
|
||||||
hud_draw_results(hud, tex);
|
hud_draw_results(hud, tex);
|
||||||
hud_start_queries(hud, hud->pipe);
|
hud_start_queries(hud, hud->record_pipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -1651,6 +1651,35 @@ fail:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
hud_unset_record_context(struct hud_context *hud)
|
||||||
|
{
|
||||||
|
struct pipe_context *pipe = hud->record_pipe;
|
||||||
|
struct hud_pane *pane, *pane_tmp;
|
||||||
|
struct hud_graph *graph, *graph_tmp;
|
||||||
|
|
||||||
|
if (!pipe)
|
||||||
|
return;
|
||||||
|
|
||||||
|
LIST_FOR_EACH_ENTRY_SAFE(pane, pane_tmp, &hud->pane_list, head) {
|
||||||
|
LIST_FOR_EACH_ENTRY_SAFE(graph, graph_tmp, &pane->graph_list, head) {
|
||||||
|
LIST_DEL(&graph->head);
|
||||||
|
hud_graph_destroy(graph, pipe);
|
||||||
|
}
|
||||||
|
LIST_DEL(&pane->head);
|
||||||
|
FREE(pane);
|
||||||
|
}
|
||||||
|
|
||||||
|
hud_batch_query_cleanup(&hud->batch_query, pipe);
|
||||||
|
hud->record_pipe = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
hud_set_record_context(struct hud_context *hud, struct pipe_context *pipe)
|
||||||
|
{
|
||||||
|
hud->record_pipe = pipe;
|
||||||
|
}
|
||||||
|
|
||||||
struct hud_context *
|
struct hud_context *
|
||||||
hud_create(struct cso_context *cso)
|
hud_create(struct cso_context *cso)
|
||||||
{
|
{
|
||||||
|
|
@ -1752,6 +1781,7 @@ hud_create(struct cso_context *cso)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
hud_set_record_context(hud, cso_get_pipe_context(cso));
|
||||||
hud_parse_env_var(hud, screen, env);
|
hud_parse_env_var(hud, screen, env);
|
||||||
return hud;
|
return hud;
|
||||||
}
|
}
|
||||||
|
|
@ -1759,20 +1789,7 @@ hud_create(struct cso_context *cso)
|
||||||
void
|
void
|
||||||
hud_destroy(struct hud_context *hud)
|
hud_destroy(struct hud_context *hud)
|
||||||
{
|
{
|
||||||
struct pipe_context *pipe = hud->pipe;
|
hud_unset_record_context(hud);
|
||||||
struct hud_pane *pane, *pane_tmp;
|
|
||||||
struct hud_graph *graph, *graph_tmp;
|
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY_SAFE(pane, pane_tmp, &hud->pane_list, head) {
|
|
||||||
LIST_FOR_EACH_ENTRY_SAFE(graph, graph_tmp, &pane->graph_list, head) {
|
|
||||||
LIST_DEL(&graph->head);
|
|
||||||
hud_graph_destroy(graph, pipe);
|
|
||||||
}
|
|
||||||
LIST_DEL(&pane->head);
|
|
||||||
FREE(pane);
|
|
||||||
}
|
|
||||||
|
|
||||||
hud_batch_query_cleanup(&hud->batch_query, pipe);
|
|
||||||
hud_unset_draw_context(hud);
|
hud_unset_draw_context(hud);
|
||||||
pipe_resource_reference(&hud->font.texture, NULL);
|
pipe_resource_reference(&hud->font.texture, NULL);
|
||||||
FREE(hud);
|
FREE(hud);
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,10 @@ enum hud_counter {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct hud_context {
|
struct hud_context {
|
||||||
|
/* Context where queries are executed. */
|
||||||
|
struct pipe_context *record_pipe;
|
||||||
|
|
||||||
|
/* Context where the HUD is drawn: */
|
||||||
struct pipe_context *pipe;
|
struct pipe_context *pipe;
|
||||||
struct cso_context *cso;
|
struct cso_context *cso;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue