llvmpipe: size initial allocation and free scenes

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14923>
This commit is contained in:
Dave Airlie 2020-03-31 15:57:19 +10:00 committed by Marge Bot
parent 4649a941e3
commit 486dada6bc
2 changed files with 10 additions and 11 deletions

View File

@ -1178,7 +1178,7 @@ lp_setup_is_resource_referenced( const struct lp_setup_context *setup,
} }
/* check textures referenced by the scene */ /* check textures referenced by the scene */
for (i = 0; i < ARRAY_SIZE(setup->scenes); i++) { for (i = 0; i < setup->num_active_scenes; i++) {
if (lp_scene_is_resource_referenced(setup->scenes[i], texture)) { if (lp_scene_is_resource_referenced(setup->scenes[i], texture)) {
return LP_REFERENCED_FOR_READ; return LP_REFERENCED_FOR_READ;
} }
@ -1559,7 +1559,7 @@ lp_setup_destroy( struct lp_setup_context *setup )
} }
/* free the scenes in the 'empty' queue */ /* free the scenes in the 'empty' queue */
for (i = 0; i < ARRAY_SIZE(setup->scenes); i++) { for (i = 0; i < setup->num_active_scenes; i++) {
struct lp_scene *scene = setup->scenes[i]; struct lp_scene *scene = setup->scenes[i];
if (scene->fence) if (scene->fence)
@ -1612,15 +1612,13 @@ lp_setup_create( struct pipe_context *pipe,
slab_create(&setup->scene_slab, slab_create(&setup->scene_slab,
sizeof(struct lp_scene), sizeof(struct lp_scene),
MAX_SCENES); INITIAL_SCENES);
/* create some empty scenes */ /* create just one scene for starting point */
for (i = 0; i < MAX_SCENES; i++) { setup->scenes[0] = lp_scene_create( setup );
setup->scenes[i] = lp_scene_create( setup ); if (!setup->scenes[0]) {
if (!setup->scenes[i]) { goto no_scenes;
goto no_scenes;
}
setup->num_active_scenes++;
} }
setup->num_active_scenes++;
setup->triangle = first_triangle; setup->triangle = first_triangle;
setup->line = first_line; setup->line = first_line;

View File

@ -57,7 +57,8 @@ struct lp_setup_variant;
/** Max number of scenes */ /** Max number of scenes */
/* XXX: make multiple scenes per context work, see lp_setup_rasterize_scene */ /* XXX: make multiple scenes per context work, see lp_setup_rasterize_scene */
#define MAX_SCENES 1 #define INITIAL_SCENES 4
#define MAX_SCENES 64