bool renderable = tmpl->bind &
(PIPE_BIND_RENDER_TARGET | PIPE_BIND_DEPTH_STENCIL);
+ bool afbc = bo->layout == PAN_AFBC;
bool tiled = bo->layout == PAN_TILED;
bool should_align = renderable || tiled;
if (l == 0)
size_2d = slice_one_size;
+ /* Compute AFBC sizes if necessary */
+ if (afbc) {
+ slice->header_size =
+ panfrost_afbc_header_size(width, height);
+
+ offset += slice->header_size;
+ }
+
offset += slice_full_size;
width = u_minify(width, 1);
bool should_tile = is_streaming && is_texture && is_2d;
+ /* Depth/stencil can't be tiled, only linear or AFBC */
+ should_tile &= !(template->bind & PIPE_BIND_DEPTH_STENCIL);
+
/* Set the layout appropriately */
bo->layout = should_tile ? PAN_TILED : PAN_LINEAR;
panfrost_setup_slices(template, bo);
- if (bo->layout == PAN_TILED || bo->layout == PAN_LINEAR) {
- struct panfrost_memory mem;
+ struct panfrost_memory mem;
- panfrost_drm_allocate_slab(screen, &mem, bo->size / 4096, true, 0, 0, 0);
+ panfrost_drm_allocate_slab(screen, &mem, bo->size / 4096, true, 0, 0, 0);
- bo->cpu = mem.cpu;
- bo->gpu = mem.gpu;
- bo->gem_handle = mem.gem_handle;
- }
+ bo->cpu = mem.cpu;
+ bo->gpu = mem.gpu;
+ bo->gem_handle = mem.gem_handle;
return bo;
}
static void
panfrost_destroy_bo(struct panfrost_screen *screen, struct panfrost_bo *bo)
{
- if ((bo->layout == PAN_LINEAR || bo->layout == PAN_TILED) &&
- !bo->imported) {
+ if (!bo->imported) {
struct panfrost_memory mem = {
.cpu = bo->cpu,
.gpu = bo->gpu,
panfrost_drm_free_slab(screen, &mem);
}
- if (bo->layout == PAN_AFBC) {
- /* TODO */
- DBG("--leaking afbc (%d bytes)--\n", bo->afbc_metadata_size);
- }
-
if (bo->has_checksum) {
struct panfrost_memory mem = {
.cpu = bo->checksum_slab.cpu,