bool flip_y)
{
struct panfrost_resource *rsrc = pan_resource(surf->texture);
-
- signed stride =
- util_format_get_stride(surf->format, surf->texture->width0);
+ int stride = rsrc->bo->stride;
rt->format = panfrost_mfbd_format(surf);
fbx->flags |= MALI_EXTRA_PRESENT | MALI_EXTRA_ZS | 0x1;
fbx->ds_linear.depth = rsrc->bo->gpu[0];
- fbx->ds_linear.depth_stride =
- util_format_get_stride(surf->format, surf->texture->width0);
+ fbx->ds_linear.depth_stride = rsrc->bo->stride;
} else {
assert(0);
}
struct panfrost_resource *rsrc = (struct panfrost_resource *) ctx->pipe_framebuffer.cbufs[0]->texture;
if (rsrc->bo->has_checksum) {
- int stride = util_format_get_stride(rsrc->base.format, rsrc->base.width0);
-
fb.unk3 |= MALI_MFBD_EXTRA;
fbx.flags |= MALI_EXTRA_PRESENT;
fbx.checksum_stride = rsrc->bo->checksum_stride;
- fbx.checksum = rsrc->bo->gpu[0] + stride * rsrc->base.height0;
+ fbx.checksum = rsrc->bo->gpu[0] + rsrc->bo->stride * rsrc->base.height0;
}
}
prsc->screen = pscreen;
rsc->bo = screen->driver->import_bo(screen, whandle);
+ rsc->bo->stride = whandle->stride;
if (screen->ro) {
rsc->scanout =
struct panfrost_screen *screen = pan_screen(pscreen);
struct panfrost_resource *rsrc = (struct panfrost_resource *) pt;
struct renderonly_scanout *scanout = rsrc->scanout;
- int bytes_per_pixel = util_format_get_blocksize(rsrc->base.format);
- int stride = bytes_per_pixel * rsrc->base.width0; /* TODO: Alignment? */
- handle->stride = stride;
handle->modifier = DRM_FORMAT_MOD_INVALID;
if (handle->type == WINSYS_HANDLE_TYPE_SHARED) {
return TRUE;
handle->handle = rsrc->bo->gem_handle;
+ handle->stride = rsrc->bo->stride;
return TRUE;
} else if (handle->type == WINSYS_HANDLE_TYPE_FD) {
if (scanout) {
if (ret == -1)
return FALSE;
+ handle->stride = scanout->stride;
handle->handle = args.fd;
return TRUE;
} else
- return screen->driver->export_bo(screen, rsrc->bo->gem_handle, handle);
+ return screen->driver->export_bo(screen, rsrc->bo->gem_handle, rsrc->bo->stride, handle);
}
return FALSE;
/* Calculate the size of the bo */
int bytes_per_pixel = util_format_get_blocksize(template->format);
- int stride = bytes_per_pixel * template->width0; /* TODO: Alignment? */
+ int stride = ALIGN(template->width0, 16) * bytes_per_pixel;
size_t sz = stride;
if (template->height0) sz *= template->height0;
/* TODO: Mipmap */
}
+ bo->stride = stride;
+
return bo;
}
struct renderonly_scanout *scanout;
struct winsys_handle handle;
- /* TODO: align width0 and height0? */
-
scanout = renderonly_scanout_for_resource(&scanout_templat,
pscreen->ro, &handle);
if (!scanout)
{
struct panfrost_context *ctx = pan_context(pctx);
int bytes_per_pixel = util_format_get_blocksize(resource->format);
- int stride = bytes_per_pixel * resource->width0; /* TODO: Alignment? */
+ struct panfrost_bo *bo = pan_resource(resource)->bo;
uint8_t *cpu;
struct pipe_transfer *transfer = CALLOC_STRUCT(pipe_transfer);
transfer->level = level;
transfer->usage = usage;
transfer->box = *box;
- transfer->stride = stride;
+ transfer->stride = bo->stride;
assert(!transfer->box.z);
pipe_resource_reference(&transfer->resource, resource);
if (cpu == NULL)
return NULL;
- return cpu + transfer->box.x * bytes_per_pixel + transfer->box.y * stride;
+ return cpu + transfer->box.x * bytes_per_pixel + transfer->box.y * bo->stride;
}
static void
{
struct panfrost_bo *bo = (struct panfrost_bo *)rsrc->bo;
int bytes_per_pixel = util_format_get_blocksize(rsrc->base.format);
- int stride = bytes_per_pixel * rsrc->base.width0; /* TODO: Alignment? */
int width = rsrc->base.width0 >> level;
int height = rsrc->base.height0 >> level;
/* Run actual texture swizzle, writing directly to the mapped
* GPU chunk we allocated */
- panfrost_texture_swizzle(width, height, bytes_per_pixel, stride, bo->cpu[level], swizzled);
+ panfrost_texture_swizzle(width, height, bytes_per_pixel, bo->stride, bo->cpu[level], swizzled);
}
static void