Home | History | Annotate | Download | only in llvmpipe

Lines Matching full:scene

50  * Create a new scene object.
56 struct lp_scene *scene = CALLOC_STRUCT(lp_scene);
57 if (!scene)
60 scene->pipe = pipe;
62 scene->data.head =
65 pipe_mutex_init(scene->mutex);
68 /* Do some scene limit sanity checks here */
74 * less than the max allowed scene size.
82 return scene;
87 * Free all data associated with the given scene, and the scene itself.
90 lp_scene_destroy(struct lp_scene *scene)
92 lp_fence_reference(&scene->fence, NULL);
93 pipe_mutex_destroy(scene->mutex);
94 assert(scene->data.head->next == NULL);
95 FREE(scene->data.head);
96 FREE(scene);
101 * Check if the scene's bins are all empty.
105 lp_scene_is_empty(struct lp_scene *scene )
111 const struct cmd_bin *bin = lp_scene_get_bin(scene, x, y);
122 * this scene. Used in triangle emit to avoid having to check success
126 lp_scene_is_oom(struct lp_scene *scene)
128 return scene->alloc_failed;
136 lp_scene_bin_reset(struct lp_scene *scene, unsigned x, unsigned y)
138 struct cmd_bin *bin = lp_scene_get_bin(scene, x, y);
150 lp_scene_begin_rasterization(struct lp_scene *scene)
152 const struct pipe_framebuffer_state *fb = &scene->fb;
157 for (i = 0; i < scene->fb.nr_cbufs; i++) {
158 struct pipe_surface *cbuf = scene->fb.cbufs[i];
161 scene->cbufs[i].stride = 0;
162 scene->cbufs[i].layer_stride = 0;
163 scene->cbufs[i].map = NULL;
168 scene->cbufs[i].stride = llvmpipe_resource_stride(cbuf->texture,
170 scene->cbufs[i].layer_stride = llvmpipe_layer_stride(cbuf->texture,
173 scene->cbufs[i].map = llvmpipe_resource_map(cbuf->texture,
177 scene->cbufs[i].format_bytes = util_format_get_blocksize(cbuf->format);
182 scene->cbufs[i].stride = cbuf->texture->width0;
183 scene->cbufs[i].layer_stride = 0;
184 scene->cbufs[i].map = lpr->data;
185 scene->cbufs[i].map += cbuf->u.buf.first_element * pixstride;
186 scene->cbufs[i].format_bytes = util_format_get_blocksize(cbuf->format);
191 struct pipe_surface *zsbuf = scene->fb.zsbuf;
192 scene->zsbuf.stride = llvmpipe_resource_stride(zsbuf->texture, zsbuf->u.tex.level);
193 scene->zsbuf.layer_stride = llvmpipe_layer_stride(zsbuf->texture, zsbuf->u.tex.level);
195 scene->zsbuf.map = llvmpipe_resource_map(zsbuf->texture,
199 scene->zsbuf.format_bytes = util_format_get_blocksize(zsbuf->format);
207 * Free all the temporary data in a scene.
210 lp_scene_end_rasterization(struct lp_scene *scene )
215 for (i = 0; i < scene->fb.nr_cbufs; i++) {
216 if (scene->cbufs[i].map) {
217 struct pipe_surface *cbuf = scene->fb.cbufs[i];
223 scene->cbufs[i].map = NULL;
228 if (scene->zsbuf.map) {
229 struct pipe_surface *zsbuf = scene->fb.zsbuf;
233 scene->zsbuf.map = NULL;
238 for (i = 0; i < scene->tiles_x; i++) {
239 for (j = 0; j < scene->tiles_y; j++) {
240 struct cmd_bin *bin = lp_scene_get_bin(scene, i, j);
250 assert(lp_scene_is_empty(scene));
258 for (ref = scene->resources; ref; ref = ref->next) {
273 debug_printf("scene %d resources, sz %d\n",
274 j, scene->resource_reference_size);
277 /* Free all scene data blocks:
280 struct data_block_list *list = &scene->data;
292 lp_fence_reference(&scene->fence, NULL);
294 scene->resources = NULL;
295 scene->scene_size = 0;
296 scene->resource_reference_size = 0;
298 scene->alloc_failed = FALSE;
300 util_unreference_framebuffer_state( &scene->fb );
309 lp_scene_new_cmd_block( struct lp_scene *scene,
312 struct cmd_block *block = lp_scene_alloc(scene, sizeof(struct cmd_block));
331 lp_scene_new_data_block( struct lp_scene *scene )
333 if (scene->scene_size + DATA_BLOCK_SIZE > LP_SCENE_MAX_SIZE) {
335 scene->alloc_failed = TRUE;
343 scene->scene_size += sizeof *block;
346 block->next = scene->data.head;
347 scene->data.head = block;
355 * Return number of bytes used for all bin data within a scene.
356 * This does not include resources (textures) referenced by the scene.
359 lp_scene_data_size( const struct lp_scene *scene )
363 for (block = scene->data.head; block; block = block->next) {
372 * Add a reference to a resource by the scene.
375 lp_scene_add_resource_reference(struct lp_scene *scene,
379 struct resource_ref *ref, **last = &scene->resources;
384 for (ref = scene->resources; ref; ref = ref->next) {
404 *last = lp_scene_alloc(scene, sizeof *ref);
415 scene->resource_reference_size += llvmpipe_resource_size(resource);
417 /* Heuristic to advise scene flushes. This isn't helpful in the
418 * initial setup of the scene, but after that point flush on the
423 scene->resource_reference_size >= LP_SCENE_MAX_RESOURCE_SIZE)
431 * Does this scene have a reference to the given resource?
434 lp_scene_is_resource_referenced(const struct lp_scene *scene,
440 for (ref = scene->resources; ref; ref = ref->next) {
454 next_bin(struct lp_scene *scene)
456 scene->curr_x++;
457 if (scene->curr_x >= scene->tiles_x) {
458 scene->curr_x = 0;
459 scene->curr_y++;
461 if (scene->curr_y >= scene->tiles_y) {
470 lp_scene_bin_iter_begin( struct lp_scene *scene )
472 scene->curr_x = scene->curr_y = -1;
483 lp_scene_bin_iter_next( struct lp_scene *scene , int *x, int *y)
487 pipe_mutex_lock(scene->mutex);
489 if (scene->curr_x < 0) {
491 scene->curr_x = 0;
492 scene->curr_y = 0;
494 else if (!next_bin(scene)) {
499 bin = lp_scene_get_bin(scene, scene->curr_x, scene->curr_y);
500 *x = scene->curr_x;
501 *y = scene->curr_y;
505 pipe_mutex_unlock(scene->mutex);
510 void lp_scene_begin_binning( struct lp_scene *scene,
516 assert(lp_scene_is_empty(scene));
518 scene->discard = discard;
519 util_copy_framebuffer_state(&scene->fb, fb);
521 scene->tiles_x = align(fb->width, TILE_SIZE) / TILE_SIZE;
522 scene->tiles_y = align(fb->height, TILE_SIZE) / TILE_SIZE;
523 assert(scene->tiles_x <= TILES_X);
524 assert(scene->tiles_y <= TILES_Y);
532 for (i = 0; i < scene->fb.nr_cbufs; i++) {
533 struct pipe_surface *cbuf = scene->fb.cbufs[i];
545 struct pipe_surface *zsbuf = scene->fb.zsbuf;
548 scene->fb_max_layer = max_layer;
552 void lp_scene_end_binning( struct lp_scene *scene )
555 debug_printf("rasterize scene:\n");
557 scene->scene_size);
559 lp_scene_data_size(scene));
562 lp_debug_bins( scene );