Lines Matching refs:rsc
42 vc4_resource_bo_alloc(struct vc4_resource *rsc)
44 struct pipe_resource *prsc = &rsc->base;
50 rsc,
51 rsc->slices[0].size,
52 rsc->slices[0].offset,
53 rsc->slices[0].offset +
54 rsc->slices[0].size +
55 rsc->cube_map_stride * (prsc->array_size - 1));
59 rsc->slices[0].offset +
60 rsc->slices[0].size +
61 rsc->cube_map_stride * (prsc->array_size - 1),
64 vc4_bo_unreference(&rsc->bo);
65 rsc->bo = bo;
80 struct vc4_resource *rsc = vc4_resource(ptrans->resource);
81 struct vc4_resource_slice *slice = &rsc->slices[ptrans->level];
84 vc4_store_tiled_image(rsc->bo->map + slice->offset +
85 ptrans->box.z * rsc->cube_map_stride,
88 slice->tiling, rsc->cpp,
106 struct vc4_resource *rsc = vc4_resource(prsc);
123 rsc->bo->private) {
128 if (vc4_resource_bo_alloc(rsc)) {
152 rsc->writes++;
153 rsc->initialized_buffers = ~0;
170 buf = vc4_bo_map_unsynchronized(rsc->bo);
172 buf = vc4_bo_map(rsc->bo);
180 struct vc4_resource_slice *slice = &rsc->slices[level];
181 if (rsc->tiled) {
191 ptrans->stride = ptrans->box.width * rsc->cpp;
199 ptrans->box.z * rsc->cube_map_stride,
201 slice->tiling, rsc->cpp,
211 ptrans->box.x / util_format_get_blockwidth(format) * rsc->cpp +
212 ptrans->box.z * rsc->cube_map_stride;
231 struct vc4_resource *rsc = vc4_resource(prsc);
232 struct vc4_resource_slice *slice = &rsc->slices[level];
235 if (!rsc->tiled ||
247 buf = vc4_bo_map_unsynchronized(rsc->bo);
249 buf = vc4_bo_map(rsc->bo);
252 box->z * rsc->cube_map_stride,
255 slice->tiling, rsc->cpp,
264 struct vc4_resource *rsc = vc4_resource(prsc);
265 vc4_bo_unreference(&rsc->bo);
267 if (rsc->scanout)
268 renderonly_scanout_destroy(rsc->scanout, screen->ro);
270 free(rsc);
274 vc4_resource_modifier(struct vc4_resource *rsc)
276 if (rsc->tiled)
290 struct vc4_resource *rsc = vc4_resource(prsc);
292 whandle->stride = rsc->slices[0].stride;
294 whandle->modifier = vc4_resource_modifier(rsc);
300 rsc->bo->private = false;
312 return vc4_bo_flink(rsc->bo, &whandle->handle);
315 return renderonly_get_handle(rsc->scanout, whandle);
317 whandle->handle = rsc->bo->handle;
322 whandle->handle = vc4_bo_get_dmabuf(rsc->bo);
336 struct vc4_resource *rsc = vc4_resource(prsc);
340 *value = rsc->slices[level].stride;
346 *value = vc4_resource_modifier(rsc);
354 vc4_setup_slices(struct vc4_resource *rsc, const char *caller)
356 struct pipe_resource *prsc = &rsc->base;
367 uint32_t utile_w = vc4_utile_width(rsc->cpp);
368 uint32_t utile_h = vc4_utile_height(rsc->cpp);
371 struct vc4_resource_slice *slice = &rsc->slices[i];
382 if (!rsc->tiled) {
393 rsc->cpp)) {
407 slice->stride = (level_width * rsc->cpp *
420 "rsc %s %p (format %s: vc4 %d), %dx%d: "
422 caller, rsc,
424 rsc->vc4_format,
436 uint32_t page_align_offset = (align(rsc->slices[0].offset, 4096) -
437 rsc->slices[0].offset);
440 rsc->slices[i].offset += page_align_offset;
447 rsc->cube_map_stride = align(rsc->slices[0].offset +
448 rsc->slices[0].size, 4096);
456 struct vc4_resource *rsc = CALLOC_STRUCT(vc4_resource);
457 if (!rsc)
459 struct pipe_resource *prsc = &rsc->base;
467 rsc->cpp = util_format_get_blocksize(tmpl->format);
469 rsc->cpp = sizeof(uint32_t);
471 assert(rsc->cpp);
473 return rsc;
479 struct vc4_resource *rsc = vc4_resource(prsc);
482 if (!rsc->tiled) {
503 struct vc4_resource *rsc = vc4_resource_setup(pscreen, tmpl);
504 struct pipe_resource *prsc = &rsc->base;
531 vc4_size_is_lt(prsc->width0, prsc->height0, rsc->cpp))
544 rsc->tiled = should_tile;
548 rsc->tiled = true;
550 rsc->tiled = false;
557 rsc->vc4_format = get_resource_texture_format(prsc);
559 vc4_setup_slices(rsc, "create");
560 if (!vc4_resource_bo_alloc(rsc))
565 if (rsc->tiled)
570 .handle = rsc->bo->handle,
588 rsc->scanout =
590 if (!rsc->scanout)
594 vc4_bo_label(screen, rsc->bo, "%sresource %dx%d@%d/%d",
597 rsc->cpp * 8, prsc->last_level);
620 struct vc4_resource *rsc = vc4_resource_setup(pscreen, tmpl);
621 struct pipe_resource *prsc = &rsc->base;
622 struct vc4_resource_slice *slice = &rsc->slices[0];
624 if (!rsc)
629 rsc->bo = vc4_bo_open_name(screen, whandle->handle);
632 rsc->bo = vc4_bo_open_dmabuf(screen, whandle->handle);
640 if (!rsc->bo)
644 .handle = rsc->bo->handle,
661 rsc->tiled = false;
664 rsc->tiled = true;
673 rsc->vc4_format = get_resource_texture_format(prsc);
674 vc4_setup_slices(rsc, "import");
677 if (rsc->tiled) {
685 rsc->slices[0].offset += whandle->offset;
687 if (rsc->slices[0].offset + rsc->slices[0].size >
688 rsc->bo->size) {
692 rsc->slices[0].size,
693 rsc->bo->size);
703 rsc->scanout =
709 if (rsc->tiled && whandle->stride != slice->stride) {
722 } else if (!rsc->tiled) {
739 struct vc4_resource *rsc = vc4_resource(ptex);
759 surface->offset = (rsc->slices[level].offset +
760 psurf->u.tex.first_layer * rsc->cube_map_stride);
761 surface->tiling = rsc->slices[level].tiling;
777 struct vc4_resource *rsc = vc4_resource(prsc);
778 uint32_t *map = vc4_bo_map(rsc->bo);
779 uint32_t stride = rsc->slices[0].stride / 4;
787 if (rsc->vc4_format != VC4_TEXTURE_TYPE_RGBA32R) {
874 struct vc4_resource *rsc = vc4_resource(prsc);
880 uint32_t *tile = (vc4_bo_map(rsc->bo) +