Lines Matching defs:gmem
83 * meant to be the minimal set of data that results in a unique gmem
84 * configuration, avoiding multiple keys arriving at the same gmem
89 * max_scissor which would result in the same gmem state, do not
134 dump_gmem_state(const struct fd_gmem_stateobj *gmem)
137 printf("GMEM LAYOUT: bin=%ux%u, nbins=%ux%u\n", gmem->bin_w, gmem->bin_h,
138 gmem->nbins_x, gmem->nbins_y);
139 for (int i = 0; i < ARRAY_SIZE(gmem->cbuf_base); i++) {
140 if (!gmem->cbuf_cpp[i])
143 unsigned size = gmem->cbuf_cpp[i] * gmem->bin_w * gmem->bin_h;
145 gmem->cbuf_base[i], size, gmem->cbuf_cpp[i]);
147 total = gmem->cbuf_base[i] + size;
150 for (int i = 0; i < ARRAY_SIZE(gmem->zsbuf_base); i++) {
151 if (!gmem->zsbuf_cpp[i])
154 unsigned size = gmem->zsbuf_cpp[i] * gmem->bin_w * gmem->bin_h;
156 gmem->zsbuf_base[i], size, gmem->zsbuf_cpp[i]);
158 total = gmem->zsbuf_base[i] + size;
161 printf("total: 0x%06x (of 0x%06x)\n", total, gmem->screen->gmemsize_bytes);
172 struct fd_gmem_stateobj *gmem)
174 struct fd_screen *screen = gmem->screen;
191 gmem->bin_w = bin_w;
192 gmem->bin_h = bin_h;
197 gmem->nbins_x = DIV_ROUND_UP(key->width, bin_w);
198 gmem->nbins_y = DIV_ROUND_UP(key->height, bin_h);
202 gmem->cbuf_base[i] = util_align_npot(total, gmem_align);
203 total = gmem->cbuf_base[i] + key->cbuf_cpp[i] * bin_w * bin_h;
208 gmem->zsbuf_base[0] = util_align_npot(total, gmem_align);
209 total = gmem->zsbuf_base[0] + key->zsbuf_cpp[0] * bin_w * bin_h;
213 gmem->zsbuf_base[1] = util_align_npot(total, gmem_align);
214 total = gmem->zsbuf_base[1] + key->zsbuf_cpp[1] * bin_w * bin_h;
221 calc_nbins(struct gmem_key *key, struct fd_gmem_stateobj *gmem)
223 struct fd_screen *screen = gmem->screen;
252 while (!layout_gmem(key, nbins_x, nbins_y, gmem)) {
264 layout_gmem(key, nbins_x - 1, nbins_y + 1, gmem)) {
268 layout_gmem(key, nbins_x + 1, nbins_y - 1, gmem)) {
273 layout_gmem(key, nbins_x, nbins_y, gmem);
279 struct fd_gmem_stateobj *gmem =
281 pipe_reference_init(&gmem->reference, 1);
282 gmem->screen = screen;
283 gmem->key = key;
284 list_inithead(&gmem->node);
291 calc_nbins(key, gmem);
293 DBG("using %d bins of size %dx%d", gmem->nbins_x * gmem->nbins_y,
294 gmem->bin_w, gmem->bin_h);
296 memcpy(gmem->cbuf_cpp, key->cbuf_cpp, sizeof(key->cbuf_cpp));
297 memcpy(gmem->zsbuf_cpp, key->zsbuf_cpp, sizeof(key->zsbuf_cpp));
298 gmem->minx = key->minx;
299 gmem->miny = key->miny;
300 gmem->width = key->width;
301 gmem->height = key->height;
304 dump_gmem_state(gmem);
327 while (div_round_up(gmem->nbins_y, tpp_y) > npipes)
329 while ((div_round_up(gmem->nbins_y, tpp_y) *
330 div_round_up(gmem->nbins_x, tpp_x)) > npipes)
339 gmem->maxpw = tpp_x;
340 gmem->maxph = tpp_y;
345 struct fd_vsc_pipe *pipe = &gmem->vsc_pipe[i];
347 if (xoff >= gmem->nbins_x) {
352 if (yoff >= gmem->nbins_y) {
358 pipe->w = MIN2(tpp_x, gmem->nbins_x - xoff);
359 pipe->h = MIN2(tpp_y, gmem->nbins_y - yoff);
365 gmem->num_vsc_pipes = MAX2(1, i);
368 struct fd_vsc_pipe *pipe = &gmem->vsc_pipe[i];
373 printf("%dx%d ... tpp=%dx%d\n", gmem->nbins_x, gmem->nbins_y, tpp_x,
375 for (i = 0; i < ARRAY_SIZE(gmem->vsc_pipe); i++) {
376 struct fd_vsc_pipe *pipe = &gmem->vsc_pipe[i];
386 for (i = 0; i < gmem->nbins_y; i++) {
392 bh = MIN2(gmem->bin_h, key->miny + key->height - yoff);
395 for (j = 0; j < gmem->nbins_x; j++) {
396 struct fd_tile *tile = &gmem->tile[t];
399 assert(t < ARRAY_SIZE(gmem->tile));
402 p = ((i / tpp_y) * div_round_up(gmem->nbins_x, tpp_x)) + (j / tpp_x);
403 assert(p < gmem->num_vsc_pipes);
406 bw = MIN2(gmem->bin_w, key->minx + key->width - xoff);
435 for (i = 0; i < gmem->nbins_y; i+=2) {
436 unsigned col0 = gmem->nbins_x * i;
437 for (j = 0; j < gmem->nbins_x/2; j++) {
438 swap(gmem->tile[col0 + j], gmem->tile[col0 + gmem->nbins_x - j - 1]);
445 for (i = 0; i < gmem->nbins_y; i++) {
446 for (j = 0; j < gmem->nbins_x; j++) {
447 struct fd_tile *tile = &gmem->tile[t++];
454 return gmem;
458 __fd_gmem_destroy(struct fd_gmem_stateobj *gmem)
460 struct fd_gmem_cache *cache = &gmem->screen->gmem_cache;
462 fd_screen_assert_locked(gmem->screen);
464 _mesa_hash_table_remove_key(cache->ht, gmem->key);
465 list_del(&gmem->node);
467 ralloc_free(gmem->key);
468 ralloc_free(gmem);
548 struct fd_gmem_stateobj *gmem = NULL;
565 /* limit the # of cached gmem states, discarding the least
578 fd_gmem_reference(&gmem, entry->data);
580 list_delinit(&gmem->node);
581 list_add(&gmem->node, &cache->lru);
585 return gmem;
593 render_tiles(struct fd_batch *batch, struct fd_gmem_stateobj *gmem) assert_dt
605 for (i = 0; i < (gmem->nbins_x * gmem->nbins_y); i++) {
606 struct fd_tile *tile = &gmem->tile[i];
608 trace_start_tile(&batch->trace, batch->gmem, tile->bin_h, tile->yoff, tile->bin_w,
620 ctx->query_prepare_tile(batch, i, batch->gmem);
623 trace_start_draw_ib(&batch->trace, batch->gmem);
627 ctx->screen->emit_ib(batch->gmem, batch->draw);
629 trace_end_draw_ib(&batch->trace, batch->gmem);
650 ctx->query_prepare_tile(batch, 0, batch->gmem);
653 trace_start_draw_ib(&batch->trace, batch->gmem);
656 ctx->screen->emit_ib(batch->gmem, batch->draw);
659 trace_end_draw_ib(&batch->trace, batch->gmem);
698 trace_flush_batch(&batch->trace, batch->gmem, batch, batch->cleared,
700 trace_framebuffer_state(&batch->trace, batch->gmem, pfb);
746 trace_render_sysmem(&batch->trace, batch->gmem);
747 trace_start_render_pass(&batch->trace, batch->gmem,
754 trace_end_render_pass(&batch->trace, batch->gmem);
757 struct fd_gmem_stateobj *gmem = lookup_gmem_state(batch, false, false);
758 batch->gmem_state = gmem;
759 trace_render_gmem(&batch->trace, batch->gmem, gmem->nbins_x, gmem->nbins_y,
760 gmem->bin_w, gmem->bin_h);
761 trace_start_render_pass(&batch->trace, batch->gmem,
764 pfb->nr_cbufs, pfb->samples, gmem->nbins_x * gmem->nbins_y,
765 gmem->bin_w, gmem->bin_h);
767 ctx->query_prepare(batch, gmem->nbins_x * gmem->nbins_y);
768 render_tiles(batch, gmem);
769 trace_end_render_pass(&batch->trace, batch->gmem);
773 fd_gmem_reference(&gmem, NULL);
792 struct fd_gmem_stateobj *gmem = lookup_gmem_state(batch, !!pfb->zsbuf, true);
793 unsigned nbins = gmem->maxpw * gmem->maxph;
796 fd_gmem_reference(&gmem, NULL);