Lines Matching refs:lpr
69 struct llvmpipe_resource *lpr, in llvmpipe_texture_layout() argument
72 struct pipe_resource *pt = &lpr->base; in llvmpipe_texture_layout()
111 if (llvmpipe_resource_is_1d(&lpr->base)) in llvmpipe_texture_layout()
124 lpr->row_stride[level] = nblocksx * block_size; in llvmpipe_texture_layout()
126 lpr->row_stride[level] = align(nblocksx * block_size, util_cpu_caps.cacheline); in llvmpipe_texture_layout()
129 if ((uint64_t)lpr->row_stride[level] * nblocksy > LP_MAX_TEXTURE_SIZE) { in llvmpipe_texture_layout()
134 lpr->img_stride[level] = lpr->row_stride[level] * nblocksy; in llvmpipe_texture_layout()
137 if (lpr->base.target == PIPE_TEXTURE_CUBE) { in llvmpipe_texture_layout()
141 if (lpr->base.target == PIPE_TEXTURE_3D) in llvmpipe_texture_layout()
143 else if (lpr->base.target == PIPE_TEXTURE_1D_ARRAY || in llvmpipe_texture_layout()
144 lpr->base.target == PIPE_TEXTURE_2D_ARRAY || in llvmpipe_texture_layout()
145 lpr->base.target == PIPE_TEXTURE_CUBE || in llvmpipe_texture_layout()
146 lpr->base.target == PIPE_TEXTURE_CUBE_ARRAY) in llvmpipe_texture_layout()
152 mipsize = (uint64_t)lpr->img_stride[level] * num_slices; in llvmpipe_texture_layout()
158 lpr->mip_offsets[level] = total_size; in llvmpipe_texture_layout()
171 lpr->sample_stride = total_size; in llvmpipe_texture_layout()
174 lpr->size_required = total_size; in llvmpipe_texture_layout()
176 lpr->tex_data = align_malloc(total_size, mip_align); in llvmpipe_texture_layout()
177 if (!lpr->tex_data) { in llvmpipe_texture_layout()
181 memset(lpr->tex_data, 0, total_size); in llvmpipe_texture_layout()
200 struct llvmpipe_resource lpr; in llvmpipe_can_create_resource() local
201 memset(&lpr, 0, sizeof(lpr)); in llvmpipe_can_create_resource()
202 lpr.base = *res; in llvmpipe_can_create_resource()
203 return llvmpipe_texture_layout(llvmpipe_screen(screen), &lpr, false); in llvmpipe_can_create_resource()
209 struct llvmpipe_resource *lpr, in llvmpipe_displaytarget_layout() argument
217 const unsigned width = MAX2(1, align(lpr->base.width0, TILE_SIZE)); in llvmpipe_displaytarget_layout()
218 const unsigned height = MAX2(1, align(lpr->base.height0, TILE_SIZE)); in llvmpipe_displaytarget_layout()
220 lpr->dt = winsys->displaytarget_create(winsys, in llvmpipe_displaytarget_layout()
221 lpr->base.bind, in llvmpipe_displaytarget_layout()
222 lpr->base.format, in llvmpipe_displaytarget_layout()
226 &lpr->row_stride[0] ); in llvmpipe_displaytarget_layout()
228 if (lpr->dt == NULL) in llvmpipe_displaytarget_layout()
232 void *map = winsys->displaytarget_map(winsys, lpr->dt, in llvmpipe_displaytarget_layout()
236 memset(map, 0, height * lpr->row_stride[0]); in llvmpipe_displaytarget_layout()
238 winsys->displaytarget_unmap(winsys, lpr->dt); in llvmpipe_displaytarget_layout()
251 struct llvmpipe_resource *lpr = CALLOC_STRUCT(llvmpipe_resource); in llvmpipe_resource_create_all() local
252 if (!lpr) in llvmpipe_resource_create_all()
255 lpr->base = *templat; in llvmpipe_resource_create_all()
256 pipe_reference_init(&lpr->base.reference, 1); in llvmpipe_resource_create_all()
257 lpr->base.screen = &screen->base; in llvmpipe_resource_create_all()
261 if (llvmpipe_resource_is_texture(&lpr->base)) { in llvmpipe_resource_create_all()
262 if (lpr->base.bind & (PIPE_BIND_DISPLAY_TARGET | in llvmpipe_resource_create_all()
266 if (!llvmpipe_displaytarget_layout(screen, lpr, map_front_private)) in llvmpipe_resource_create_all()
271 if (!llvmpipe_texture_layout(screen, lpr, alloc_backing)) in llvmpipe_resource_create_all()
292 lpr->row_stride[0] = bytes; in llvmpipe_resource_create_all()
294 lpr->size_required = bytes; in llvmpipe_resource_create_all()
296 lpr->size_required += (LP_RASTER_BLOCK_SIZE - 1) * 4 * sizeof(float); in llvmpipe_resource_create_all()
299 lpr->data = align_malloc(lpr->size_required, 64); in llvmpipe_resource_create_all()
301 if (!lpr->data) in llvmpipe_resource_create_all()
303 memset(lpr->data, 0, bytes); in llvmpipe_resource_create_all()
307 lpr->id = id_counter++; in llvmpipe_resource_create_all()
310 insert_at_tail(&resource_list, lpr); in llvmpipe_resource_create_all()
313 return &lpr->base; in llvmpipe_resource_create_all()
316 FREE(lpr); in llvmpipe_resource_create_all()
341 struct llvmpipe_resource *lpr; in llvmpipe_resource_create_unbacked() local
345 lpr = llvmpipe_resource(pt); in llvmpipe_resource_create_unbacked()
346 lpr->backable = true; in llvmpipe_resource_create_unbacked()
347 *size_required = lpr->size_required; in llvmpipe_resource_create_unbacked()
356 struct llvmpipe_resource *lpr = llvmpipe_resource(pt); in llvmpipe_resource_destroy() local
358 if (!lpr->backable) { in llvmpipe_resource_destroy()
359 if (lpr->dt) { in llvmpipe_resource_destroy()
362 winsys->displaytarget_destroy(winsys, lpr->dt); in llvmpipe_resource_destroy()
366 if (lpr->tex_data) { in llvmpipe_resource_destroy()
367 align_free(lpr->tex_data); in llvmpipe_resource_destroy()
368 lpr->tex_data = NULL; in llvmpipe_resource_destroy()
371 else if (!lpr->userBuffer) { in llvmpipe_resource_destroy()
372 if (lpr->data) in llvmpipe_resource_destroy()
373 align_free(lpr->data); in llvmpipe_resource_destroy()
377 if (lpr->next) in llvmpipe_resource_destroy()
378 remove_from_list(lpr); in llvmpipe_resource_destroy()
381 FREE(lpr); in llvmpipe_resource_destroy()
394 struct llvmpipe_resource *lpr = llvmpipe_resource(resource); in llvmpipe_resource_map() local
404 if (lpr->dt) { in llvmpipe_resource_map()
421 map = winsys->displaytarget_map(winsys, lpr->dt, dt_usage); in llvmpipe_resource_map()
424 lpr->tex_data = map; in llvmpipe_resource_map()
430 map = llvmpipe_get_texture_image_address(lpr, layer, level); in llvmpipe_resource_map()
434 return lpr->data; in llvmpipe_resource_map()
447 struct llvmpipe_resource *lpr = llvmpipe_resource(resource); in llvmpipe_resource_unmap() local
449 if (lpr->dt) { in llvmpipe_resource_unmap()
457 winsys->displaytarget_unmap(winsys, lpr->dt); in llvmpipe_resource_unmap()
465 struct llvmpipe_resource *lpr = llvmpipe_resource(resource); in llvmpipe_resource_data() local
469 return lpr->data; in llvmpipe_resource_data()
480 struct llvmpipe_resource *lpr; in llvmpipe_resource_from_handle() local
484 lpr = CALLOC_STRUCT(llvmpipe_resource); in llvmpipe_resource_from_handle()
485 if (!lpr) { in llvmpipe_resource_from_handle()
489 lpr->base = *template; in llvmpipe_resource_from_handle()
490 pipe_reference_init(&lpr->base.reference, 1); in llvmpipe_resource_from_handle()
491 lpr->base.screen = screen; in llvmpipe_resource_from_handle()
498 assert(lpr->base.width0 == width); in llvmpipe_resource_from_handle()
499 assert(lpr->base.height0 == height); in llvmpipe_resource_from_handle()
502 lpr->dt = winsys->displaytarget_from_handle(winsys, in llvmpipe_resource_from_handle()
505 &lpr->row_stride[0]); in llvmpipe_resource_from_handle()
506 if (!lpr->dt) { in llvmpipe_resource_from_handle()
510 lpr->id = id_counter++; in llvmpipe_resource_from_handle()
513 insert_at_tail(&resource_list, lpr); in llvmpipe_resource_from_handle()
516 return &lpr->base; in llvmpipe_resource_from_handle()
519 FREE(lpr); in llvmpipe_resource_from_handle()
533 struct llvmpipe_resource *lpr = llvmpipe_resource(pt); in llvmpipe_resource_get_handle() local
535 assert(lpr->dt); in llvmpipe_resource_get_handle()
536 if (!lpr->dt) in llvmpipe_resource_get_handle()
539 return winsys->displaytarget_get_handle(winsys, lpr->dt, whandle); in llvmpipe_resource_get_handle()
554 struct llvmpipe_resource *lpr = llvmpipe_resource(resource); in llvmpipe_transfer_map_ms() local
606 pt->stride = lpr->row_stride[level]; in llvmpipe_transfer_map_ms()
607 pt->layer_stride = lpr->img_stride[level]; in llvmpipe_transfer_map_ms()
631 printf("transfer map tex %u mode %s\n", lpr->id, mode); in llvmpipe_transfer_map_ms()
634 format = lpr->base.format; in llvmpipe_transfer_map_ms()
655 map += sample * lpr->sample_stride; in llvmpipe_transfer_map_ms()
773 tex_image_face_size(const struct llvmpipe_resource *lpr, unsigned level) in tex_image_face_size() argument
775 return lpr->img_stride[level]; in tex_image_face_size()
784 llvmpipe_get_texture_image_address(struct llvmpipe_resource *lpr, in llvmpipe_get_texture_image_address() argument
789 assert(llvmpipe_resource_is_texture(&lpr->base)); in llvmpipe_get_texture_image_address()
791 offset = lpr->mip_offsets[level]; in llvmpipe_get_texture_image_address()
794 offset += face_slice * tex_image_face_size(lpr, level); in llvmpipe_get_texture_image_address()
796 return (ubyte *) lpr->tex_data + offset; in llvmpipe_get_texture_image_address()
806 const struct llvmpipe_resource *lpr = llvmpipe_resource_const(resource); in llvmpipe_resource_size() local
811 size = lpr->total_alloc_size; in llvmpipe_resource_size()
843 struct llvmpipe_resource *lpr = llvmpipe_resource(pt); in llvmpipe_resource_bind_backing() local
845 if (!lpr->backable) in llvmpipe_resource_bind_backing()
848 if (llvmpipe_resource_is_texture(&lpr->base)) in llvmpipe_resource_bind_backing()
849 lpr->tex_data = (char *)pmem + offset; in llvmpipe_resource_bind_backing()
851 lpr->data = (char *)pmem + offset; in llvmpipe_resource_bind_backing()
852 lpr->backing_offset = offset; in llvmpipe_resource_bind_backing()
870 struct llvmpipe_resource *lpr; in llvmpipe_print_resources() local
874 foreach(lpr, &resource_list) { in llvmpipe_print_resources()
875 unsigned size = llvmpipe_resource_size(&lpr->base); in llvmpipe_print_resources()
877 lpr->id, (void *) lpr, in llvmpipe_print_resources()
878 lpr->base.width0, lpr->base.height0, lpr->base.depth0, in llvmpipe_print_resources()
879 size, lpr->base.reference.count); in llvmpipe_print_resources()
893 struct llvmpipe_resource *lpr = llvmpipe_resource(resource); in llvmpipe_get_resource_info() local
895 *stride = lpr->row_stride[0]; in llvmpipe_get_resource_info()
910 struct llvmpipe_resource *lpr = llvmpipe_resource(resource); in llvmpipe_resource_get_param() local
917 *value = lpr->row_stride[level]; in llvmpipe_resource_get_param()
920 *value = lpr->mip_offsets[level] + (lpr->img_stride[level] * layer); in llvmpipe_resource_get_param()
923 *value = lpr->img_stride[level]; in llvmpipe_resource_get_param()