llvmpipe: Remove x/y from cmd_bin

These were mostly just a waste of memory and cache pressure, and were
really only used for debugging.

This change reduces instruction count (as measured by callgrind's Ir
event) of gnome-shell-perf-tool on Ivybridge by 3.5% ± 0.015% (n=20).

Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Adam Jackson
2013-05-29 01:36:43 +02:00
committed by Roland Scheidegger
parent eb4c992ea5
commit e881c9a5dc
6 changed files with 30 additions and 47 deletions

View File

@@ -87,13 +87,14 @@ lp_rast_end( struct lp_rasterizer *rast )
*/ */
static void static void
lp_rast_tile_begin(struct lp_rasterizer_task *task, lp_rast_tile_begin(struct lp_rasterizer_task *task,
const struct cmd_bin *bin) const struct cmd_bin *bin,
int x, int y)
{ {
LP_DBG(DEBUG_RAST, "%s %d,%d\n", __FUNCTION__, bin->x, bin->y); LP_DBG(DEBUG_RAST, "%s %d,%d\n", __FUNCTION__, x, y);
task->bin = bin; task->bin = bin;
task->x = bin->x * TILE_SIZE; task->x = x * TILE_SIZE;
task->y = bin->y * TILE_SIZE; task->y = y * TILE_SIZE;
/* reset pointers to color and depth tile(s) */ /* reset pointers to color and depth tile(s) */
memset(task->color_tiles, 0, sizeof(task->color_tiles)); memset(task->color_tiles, 0, sizeof(task->color_tiles));
@@ -575,13 +576,14 @@ static lp_rast_cmd_func dispatch[LP_RAST_OP_MAX] =
static void static void
do_rasterize_bin(struct lp_rasterizer_task *task, do_rasterize_bin(struct lp_rasterizer_task *task,
const struct cmd_bin *bin) const struct cmd_bin *bin,
int x, int y)
{ {
const struct cmd_block *block; const struct cmd_block *block;
unsigned k; unsigned k;
if (0) if (0)
lp_debug_bin(bin); lp_debug_bin(bin, x, y);
for (block = bin->head; block; block = block->next) { for (block = bin->head; block; block = block->next) {
for (k = 0; k < block->count; k++) { for (k = 0; k < block->count; k++) {
@@ -600,11 +602,11 @@ do_rasterize_bin(struct lp_rasterizer_task *task,
*/ */
static void static void
rasterize_bin(struct lp_rasterizer_task *task, rasterize_bin(struct lp_rasterizer_task *task,
const struct cmd_bin *bin ) const struct cmd_bin *bin, int x, int y )
{ {
lp_rast_tile_begin( task, bin ); lp_rast_tile_begin( task, bin, x, y );
do_rasterize_bin(task, bin); do_rasterize_bin(task, bin, x, y);
lp_rast_tile_end(task); lp_rast_tile_end(task);
@@ -646,27 +648,16 @@ rasterize_scene(struct lp_rasterizer_task *task,
if (!task->rast->no_rast && !scene->discard) { if (!task->rast->no_rast && !scene->discard) {
/* loop over scene bins, rasterize each */ /* loop over scene bins, rasterize each */
#if 0
{
unsigned i, j;
for (i = 0; i < scene->tiles_x; i++) {
for (j = 0; j < scene->tiles_y; j++) {
struct cmd_bin *bin = lp_scene_get_bin(scene, i, j);
rasterize_bin(task, bin, i, j);
}
}
}
#else
{ {
struct cmd_bin *bin; struct cmd_bin *bin;
int i, j;
assert(scene); assert(scene);
while ((bin = lp_scene_bin_iter_next(scene))) { while ((bin = lp_scene_bin_iter_next(scene, &i, &j))) {
if (!is_empty_bin( bin )) if (!is_empty_bin( bin ))
rasterize_bin(task, bin); rasterize_bin(task, bin, i, j);
} }
} }
#endif
} }

View File

@@ -90,13 +90,13 @@ is_blend( const struct lp_rast_state *state,
static void static void
debug_bin( const struct cmd_bin *bin ) debug_bin( const struct cmd_bin *bin, int x, int y )
{ {
const struct lp_rast_state *state = NULL; const struct lp_rast_state *state = NULL;
const struct cmd_block *head = bin->head; const struct cmd_block *head = bin->head;
int i, j = 0; int i, j = 0;
debug_printf("bin %d,%d:\n", bin->x, bin->y); debug_printf("bin %d,%d:\n", x, y);
while (head) { while (head) {
for (i = 0; i < head->count; i++, j++) { for (i = 0; i < head->count; i++, j++) {
@@ -231,13 +231,14 @@ debug_triangle(int tilex, int tiley,
static void static void
do_debug_bin( struct tile *tile, do_debug_bin( struct tile *tile,
const struct cmd_bin *bin, const struct cmd_bin *bin,
int x, int y,
boolean print_cmds) boolean print_cmds)
{ {
unsigned k, j = 0; unsigned k, j = 0;
const struct cmd_block *block; const struct cmd_block *block;
int tx = bin->x * TILE_SIZE; int tx = x * TILE_SIZE;
int ty = bin->y * TILE_SIZE; int ty = y * TILE_SIZE;
memset(tile->data, ' ', sizeof tile->data); memset(tile->data, ' ', sizeof tile->data);
tile->coverage = 0; tile->coverage = 0;
@@ -286,13 +287,13 @@ do_debug_bin( struct tile *tile,
} }
void void
lp_debug_bin( const struct cmd_bin *bin) lp_debug_bin( const struct cmd_bin *bin, int i, int j)
{ {
struct tile tile; struct tile tile;
int x,y; int x,y;
if (bin->head) { if (bin->head) {
do_debug_bin(&tile, bin, TRUE); do_debug_bin(&tile, bin, i, j, TRUE);
debug_printf("------------------------------------------------------------------\n"); debug_printf("------------------------------------------------------------------\n");
for (y = 0; y < TILE_SIZE; y++) { for (y = 0; y < TILE_SIZE; y++) {
@@ -349,9 +350,9 @@ lp_debug_draw_bins_by_coverage( struct lp_scene *scene )
struct tile tile; struct tile tile;
if (bin->head) { if (bin->head) {
//lp_debug_bin(bin); //lp_debug_bin(bin, x, y);
do_debug_bin(&tile, bin, FALSE); do_debug_bin(&tile, bin, x, y, FALSE);
total += tile.coverage; total += tile.coverage;
possible += 64*64; possible += 64*64;
@@ -419,7 +420,7 @@ lp_debug_bins( struct lp_scene *scene )
for (x = 0; x < scene->tiles_x; x++) { for (x = 0; x < scene->tiles_x; x++) {
struct cmd_bin *bin = lp_scene_get_bin(scene, x, y); struct cmd_bin *bin = lp_scene_get_bin(scene, x, y);
if (bin->head) { if (bin->head) {
debug_bin(bin); debug_bin(bin, x, y);
} }
} }
} }

View File

@@ -341,6 +341,6 @@ lp_rast_set_state(struct lp_rasterizer_task *task,
const union lp_rast_cmd_arg arg); const union lp_rast_cmd_arg arg);
void void
lp_debug_bin( const struct cmd_bin *bin ); lp_debug_bin( const struct cmd_bin *bin, int x, int y );
#endif #endif

View File

@@ -468,7 +468,7 @@ lp_scene_bin_iter_begin( struct lp_scene *scene )
* of work (a bin) to work on. * of work (a bin) to work on.
*/ */
struct cmd_bin * struct cmd_bin *
lp_scene_bin_iter_next( struct lp_scene *scene ) lp_scene_bin_iter_next( struct lp_scene *scene , int *x, int *y)
{ {
struct cmd_bin *bin = NULL; struct cmd_bin *bin = NULL;
@@ -485,6 +485,8 @@ lp_scene_bin_iter_next( struct lp_scene *scene )
} }
bin = lp_scene_get_bin(scene, scene->curr_x, scene->curr_y); bin = lp_scene_get_bin(scene, scene->curr_x, scene->curr_y);
*x = scene->curr_x;
*y = scene->curr_y;
end: end:
/*printf("return bin %p at %d, %d\n", (void *) bin, *bin_x, *bin_y);*/ /*printf("return bin %p at %d, %d\n", (void *) bin, *bin_x, *bin_y);*/

View File

@@ -94,8 +94,6 @@ struct data_block {
* For each screen tile we have one of these bins. * For each screen tile we have one of these bins.
*/ */
struct cmd_bin { struct cmd_bin {
ushort x;
ushort y;
const struct lp_rast_state *last_state; /* most recent state set in bin */ const struct lp_rast_state *last_state; /* most recent state set in bin */
struct cmd_block *head; struct cmd_block *head;
struct cmd_block *tail; struct cmd_block *tail;
@@ -375,7 +373,7 @@ void
lp_scene_bin_iter_begin( struct lp_scene *scene ); lp_scene_bin_iter_begin( struct lp_scene *scene );
struct cmd_bin * struct cmd_bin *
lp_scene_bin_iter_next( struct lp_scene *scene ); lp_scene_bin_iter_next( struct lp_scene *scene, int *x, int *y );

View File

@@ -181,7 +181,7 @@ begin_binning( struct lp_setup_context *setup )
struct lp_scene *scene = setup->scene; struct lp_scene *scene = setup->scene;
boolean need_zsload = FALSE; boolean need_zsload = FALSE;
boolean ok; boolean ok;
unsigned i, j; unsigned i;
assert(scene); assert(scene);
assert(scene->fence == NULL); assert(scene->fence == NULL);
@@ -192,15 +192,6 @@ begin_binning( struct lp_setup_context *setup )
if (!scene->fence) if (!scene->fence)
return FALSE; return FALSE;
/* Initialize the bin flags and x/y coords:
*/
for (i = 0; i < scene->tiles_x; i++) {
for (j = 0; j < scene->tiles_y; j++) {
scene->tile[i][j].x = i;
scene->tile[i][j].y = j;
}
}
ok = try_update_scene_state(setup); ok = try_update_scene_state(setup);
if (!ok) if (!ok)
return FALSE; return FALSE;