Commit 9be44a52 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Stride field

parent 3dc6f1ff
......@@ -1683,12 +1683,16 @@ panfrost_resource_create_front(struct pipe_screen *screen,
so->bytes_per_pixel = 4;
#endif
size_t sz = so->bytes_per_pixel * template->width0;
/* TODO: Alignment? */
so->stride = so->bytes_per_pixel * template->width0;
size_t sz = so->stride;
if (template->height0) sz *= template->height0;
if (template->depth0) sz *= template->depth0;
/* TODO: Allocate straight on the cmdstream for zero-copy operation */
/* TODO: For linear resources, allocate straight on the cmdstream for
* zero-copy operation */
for (int l = 0; l < (template->last_level + 1); ++l) {
so->cpu[l] = malloc(sz);
......@@ -1729,7 +1733,7 @@ panfrost_transfer_map(struct pipe_context *pctx,
transfer->level = level;
transfer->usage = usage;
transfer->box = *box;
transfer->stride = resource->width0 * rsrc->bytes_per_pixel;
transfer->stride = rsrc->stride;
*out_transfer = transfer;
assert(!transfer->box.z);
......@@ -2025,7 +2029,6 @@ panfrost_tile_texture(struct panfrost_context *ctx, struct panfrost_resource *rs
{
int width = rsrc->base.width0 >> level;
int height = rsrc->base.height0 >> level;
int stride = width * rsrc->bytes_per_pixel; /* TODO: Alignment? */
/* Estimate swizzled bitmap size. Slight overestimates are fine.
* Underestimates will result in memory corruption or worse. */
......@@ -2039,7 +2042,7 @@ panfrost_tile_texture(struct panfrost_context *ctx, struct panfrost_resource *rs
/* Run actual texture swizzle, writing directly to the mapped GPU chunk
* we allocated */
trans_texture_swizzle(width, height, rsrc->bytes_per_pixel, stride, rsrc->cpu[level], swizzled);
trans_texture_swizzle(width, height, rsrc->bytes_per_pixel, rsrc->stride, rsrc->cpu[level], swizzled);
}
static void
......
......@@ -214,6 +214,9 @@ struct panfrost_resource {
/* Valid for textures; 1 otherwise */
int bytes_per_pixel;
/* bytes_per_pixel*width + padding */
int stride;
struct sw_displaytarget *dt;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment