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()
109 if (llvmpipe_resource_is_1d(&lpr->base)) in llvmpipe_texture_layout()
122 lpr->row_stride[level] = nblocksx * block_size; in llvmpipe_texture_layout()
124 lpr->row_stride[level] = align(nblocksx * block_size, util_cpu_caps.cacheline); in llvmpipe_texture_layout()
127 if ((uint64_t)lpr->row_stride[level] * nblocksy > LP_MAX_TEXTURE_SIZE) { in llvmpipe_texture_layout()
132 lpr->img_stride[level] = lpr->row_stride[level] * nblocksy; in llvmpipe_texture_layout()
135 if (lpr->base.target == PIPE_TEXTURE_CUBE) { in llvmpipe_texture_layout()
139 if (lpr->base.target == PIPE_TEXTURE_3D) in llvmpipe_texture_layout()
141 else if (lpr->base.target == PIPE_TEXTURE_1D_ARRAY || in llvmpipe_texture_layout()
142 lpr->base.target == PIPE_TEXTURE_2D_ARRAY || in llvmpipe_texture_layout()
143 lpr->base.target == PIPE_TEXTURE_CUBE || in llvmpipe_texture_layout()
144 lpr->base.target == PIPE_TEXTURE_CUBE_ARRAY) in llvmpipe_texture_layout()
150 mipsize = (uint64_t)lpr->img_stride[level] * num_slices; in llvmpipe_texture_layout()
156 lpr->mip_offsets[level] = total_size; in llvmpipe_texture_layout()
170 lpr->tex_data = align_malloc(total_size, mip_align); in llvmpipe_texture_layout()
171 if (!lpr->tex_data) { in llvmpipe_texture_layout()
175 memset(lpr->tex_data, 0, total_size); in llvmpipe_texture_layout()
194 struct llvmpipe_resource lpr; in llvmpipe_can_create_resource() local
195 memset(&lpr, 0, sizeof(lpr)); in llvmpipe_can_create_resource()
196 lpr.base = *res; in llvmpipe_can_create_resource()
197 return llvmpipe_texture_layout(llvmpipe_screen(screen), &lpr, false); in llvmpipe_can_create_resource()
203 struct llvmpipe_resource *lpr, in llvmpipe_displaytarget_layout() argument
211 const unsigned width = MAX2(1, align(lpr->base.width0, TILE_SIZE)); in llvmpipe_displaytarget_layout()
212 const unsigned height = MAX2(1, align(lpr->base.height0, TILE_SIZE)); in llvmpipe_displaytarget_layout()
214 lpr->dt = winsys->displaytarget_create(winsys, in llvmpipe_displaytarget_layout()
215 lpr->base.bind, in llvmpipe_displaytarget_layout()
216 lpr->base.format, in llvmpipe_displaytarget_layout()
220 &lpr->row_stride[0] ); in llvmpipe_displaytarget_layout()
222 if (lpr->dt == NULL) in llvmpipe_displaytarget_layout()
226 void *map = winsys->displaytarget_map(winsys, lpr->dt, in llvmpipe_displaytarget_layout()
230 memset(map, 0, height * lpr->row_stride[0]); in llvmpipe_displaytarget_layout()
232 winsys->displaytarget_unmap(winsys, lpr->dt); in llvmpipe_displaytarget_layout()
245 struct llvmpipe_resource *lpr = CALLOC_STRUCT(llvmpipe_resource); in llvmpipe_resource_create_front() local
246 if (!lpr) in llvmpipe_resource_create_front()
249 lpr->base = *templat; in llvmpipe_resource_create_front()
250 pipe_reference_init(&lpr->base.reference, 1); in llvmpipe_resource_create_front()
251 lpr->base.screen = &screen->base; in llvmpipe_resource_create_front()
255 if (llvmpipe_resource_is_texture(&lpr->base)) { in llvmpipe_resource_create_front()
256 if (lpr->base.bind & (PIPE_BIND_DISPLAY_TARGET | in llvmpipe_resource_create_front()
260 if (!llvmpipe_displaytarget_layout(screen, lpr, map_front_private)) in llvmpipe_resource_create_front()
265 if (!llvmpipe_texture_layout(screen, lpr, true)) in llvmpipe_resource_create_front()
281 lpr->data = align_malloc(bytes + (LP_RASTER_BLOCK_SIZE - 1) * 4 * sizeof(float), 64); in llvmpipe_resource_create_front()
288 lpr->row_stride[0] = bytes; in llvmpipe_resource_create_front()
289 if (!lpr->data) in llvmpipe_resource_create_front()
291 memset(lpr->data, 0, bytes); in llvmpipe_resource_create_front()
294 lpr->id = id_counter++; in llvmpipe_resource_create_front()
297 insert_at_tail(&resource_list, lpr); in llvmpipe_resource_create_front()
300 return &lpr->base; in llvmpipe_resource_create_front()
303 FREE(lpr); in llvmpipe_resource_create_front()
321 struct llvmpipe_resource *lpr = llvmpipe_resource(pt); in llvmpipe_resource_destroy() local
323 if (lpr->dt) { in llvmpipe_resource_destroy()
326 winsys->displaytarget_destroy(winsys, lpr->dt); in llvmpipe_resource_destroy()
330 if (lpr->tex_data) { in llvmpipe_resource_destroy()
331 align_free(lpr->tex_data); in llvmpipe_resource_destroy()
332 lpr->tex_data = NULL; in llvmpipe_resource_destroy()
335 else if (!lpr->userBuffer) { in llvmpipe_resource_destroy()
336 assert(lpr->data); in llvmpipe_resource_destroy()
337 align_free(lpr->data); in llvmpipe_resource_destroy()
341 if (lpr->next) in llvmpipe_resource_destroy()
342 remove_from_list(lpr); in llvmpipe_resource_destroy()
345 FREE(lpr); in llvmpipe_resource_destroy()
358 struct llvmpipe_resource *lpr = llvmpipe_resource(resource); in llvmpipe_resource_map() local
368 if (lpr->dt) { in llvmpipe_resource_map()
385 map = winsys->displaytarget_map(winsys, lpr->dt, dt_usage); in llvmpipe_resource_map()
388 lpr->tex_data = map; in llvmpipe_resource_map()
394 map = llvmpipe_get_texture_image_address(lpr, layer, level); in llvmpipe_resource_map()
398 return lpr->data; in llvmpipe_resource_map()
411 struct llvmpipe_resource *lpr = llvmpipe_resource(resource); in llvmpipe_resource_unmap() local
413 if (lpr->dt) { in llvmpipe_resource_unmap()
421 winsys->displaytarget_unmap(winsys, lpr->dt); in llvmpipe_resource_unmap()
429 struct llvmpipe_resource *lpr = llvmpipe_resource(resource); in llvmpipe_resource_data() local
433 return lpr->data; in llvmpipe_resource_data()
444 struct llvmpipe_resource *lpr; in llvmpipe_resource_from_handle() local
448 lpr = CALLOC_STRUCT(llvmpipe_resource); in llvmpipe_resource_from_handle()
449 if (!lpr) { in llvmpipe_resource_from_handle()
453 lpr->base = *template; in llvmpipe_resource_from_handle()
454 pipe_reference_init(&lpr->base.reference, 1); in llvmpipe_resource_from_handle()
455 lpr->base.screen = screen; in llvmpipe_resource_from_handle()
462 assert(lpr->base.width0 == width); in llvmpipe_resource_from_handle()
463 assert(lpr->base.height0 == height); in llvmpipe_resource_from_handle()
466 lpr->dt = winsys->displaytarget_from_handle(winsys, in llvmpipe_resource_from_handle()
469 &lpr->row_stride[0]); in llvmpipe_resource_from_handle()
470 if (!lpr->dt) { in llvmpipe_resource_from_handle()
474 lpr->id = id_counter++; in llvmpipe_resource_from_handle()
477 insert_at_tail(&resource_list, lpr); in llvmpipe_resource_from_handle()
480 return &lpr->base; in llvmpipe_resource_from_handle()
483 FREE(lpr); in llvmpipe_resource_from_handle()
497 struct llvmpipe_resource *lpr = llvmpipe_resource(pt); in llvmpipe_resource_get_handle() local
499 assert(lpr->dt); in llvmpipe_resource_get_handle()
500 if (!lpr->dt) in llvmpipe_resource_get_handle()
503 return winsys->displaytarget_get_handle(winsys, lpr->dt, whandle); in llvmpipe_resource_get_handle()
517 struct llvmpipe_resource *lpr = llvmpipe_resource(resource); in llvmpipe_transfer_map() local
569 pt->stride = lpr->row_stride[level]; in llvmpipe_transfer_map()
570 pt->layer_stride = lpr->img_stride[level]; in llvmpipe_transfer_map()
594 printf("transfer map tex %u mode %s\n", lpr->id, mode); in llvmpipe_transfer_map()
597 format = lpr->base.format; in llvmpipe_transfer_map()
723 tex_image_face_size(const struct llvmpipe_resource *lpr, unsigned level) in tex_image_face_size() argument
725 return lpr->img_stride[level]; in tex_image_face_size()
734 llvmpipe_get_texture_image_address(struct llvmpipe_resource *lpr, in llvmpipe_get_texture_image_address() argument
739 assert(llvmpipe_resource_is_texture(&lpr->base)); in llvmpipe_get_texture_image_address()
741 offset = lpr->mip_offsets[level]; in llvmpipe_get_texture_image_address()
744 offset += face_slice * tex_image_face_size(lpr, level); in llvmpipe_get_texture_image_address()
746 return (ubyte *) lpr->tex_data + offset; in llvmpipe_get_texture_image_address()
756 const struct llvmpipe_resource *lpr = llvmpipe_resource_const(resource); in llvmpipe_resource_size() local
761 size = lpr->total_alloc_size; in llvmpipe_resource_size()
774 struct llvmpipe_resource *lpr; in llvmpipe_print_resources() local
778 foreach(lpr, &resource_list) { in llvmpipe_print_resources()
779 unsigned size = llvmpipe_resource_size(&lpr->base); in llvmpipe_print_resources()
781 lpr->id, (void *) lpr, in llvmpipe_print_resources()
782 lpr->base.width0, lpr->base.height0, lpr->base.depth0, in llvmpipe_print_resources()
783 size, lpr->base.reference.count); in llvmpipe_print_resources()