Commit 0c6e2bf4 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Flip vertical mode

parent 58d0edd8
......@@ -652,14 +652,12 @@ struct mali_single_framebuffer {
u32 zero3[8];
/* Points to the end of the framebuffer. Compute as "framebuffer
* pointer + width * height * pixel_size", where pixel_size = 4 (for
* ARGB). Negative stride is computed as -(width * pixel_size), 32-bit
* two's complement. The framebuffer is traversed backwards in the hw,
* it would appear. */
mali_ptr framebuffer_end;
int32_t negative_stride;
/* By default, the framebuffer is upside down from OpenGL's
* perspective. Set framebuffer to the end and negate the stride to
* flip in the Y direction */
mali_ptr framebuffer;
int32_t stride;
u32 zero4;
......
......@@ -253,8 +253,8 @@ panwrap_replay_sfbd(uint64_t gpu_va, int job_no)
panwrap_prop("width = MALI_POSITIVE(%" PRId16 ")", s->width + 1);
panwrap_prop("height = MALI_POSITIVE(%" PRId16 ")", s->height + 1);
MEMORY_PROP(s, framebuffer_end);
panwrap_prop("negative_stride = %d", s->negative_stride);
MEMORY_PROP(s, framebuffer);
panwrap_prop("stride = %d", s->stride);
/* Earlier in the actual commandstream -- right before width -- but we
* delay to flow nicer */
......
......@@ -103,9 +103,15 @@ trans_new_frag_framebuffer(struct panfrost_context *ctx)
{
struct mali_single_framebuffer fb = trans_emit_fbd(ctx);
/* Framebuffer start is computed relative to the end */
fb.framebuffer_end = ctx->framebuffer.gpu + ctx->framebuffer.size;
fb.negative_stride = -ctx->stride;
fb.framebuffer = ctx->framebuffer.gpu;
fb.stride = ctx->stride;
/* The default is upside down from OpenGL's perspective */
if (ctx->flip_vertical) {
fb.framebuffer += ctx->framebuffer.size;
fb.stride = -fb.stride;
}
fb.format = 0xb84e0281; /* RGB32, no MSAA */
......@@ -1375,6 +1381,7 @@ trans_setup_framebuffer(struct panfrost_context *ctx, uint32_t *addr, int width,
ctx->height = height;
ctx->bytes_per_pixel = 4; /* RGB32 */
ctx->has_alpha_channel = false;
ctx->flip_vertical = true; /* OpenGL */
#ifdef HAVE_DRI3
/* drisw rounds the stride */
......
......@@ -61,10 +61,13 @@ struct panfrost_context {
/* Common framebuffer settings */
int width;
int height;
int32_t stride; /* Signed as framebuffers are written upside down */
int32_t stride; /* Signed as framebuffers can be flipped vertically */
int bytes_per_pixel;
bool has_alpha_channel;
/* Set for OpenGL's default mode. */
bool flip_vertical;
/* Each render job has multiple framebuffer descriptors associated with
* it, used for various purposes with more or less the same format. The
* most obvious is the fragment framebuffer descriptor, which carries
......
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