From 7cb8b2029bd8ea740d1d7a8f5b14ad4422341659 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sun, 2 Mar 2014 00:59:35 +1000 Subject: fbdemos: align height to RS requirements When detiling, the RS requires dimensions for the window size that are a multiple of 4. With two pixel pipes this amounts to 8. Hence pad the height of the output buffers to the next multiple of 8. --- src/etnaviv/etna_rs.c | 2 ++ src/lib/fbdemos.c | 13 ++++++++++--- src/lib/fbdemos.h | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/etnaviv/etna_rs.c b/src/etnaviv/etna_rs.c index 785f644..616901b 100644 --- a/src/etnaviv/etna_rs.c +++ b/src/etnaviv/etna_rs.c @@ -26,6 +26,7 @@ #include #include +#include //#define DEBUG #ifdef DEBUG # include @@ -92,6 +93,7 @@ void etna_compile_rs_state(struct etna_ctx *restrict ctx, struct compiled_rs_sta } else if (ctx->conn->chip.pixel_pipes == 2) { + assert((rs->height&7) == 0); /* GPU hangs happen if height not 8-aligned */ if (source_multi) { SET_STATE(RS_PIPE_SOURCE_ADDR[1], rs->source_addr[1]); diff --git a/src/lib/fbdemos.c b/src/lib/fbdemos.c index 1c25c9d..b1683c6 100644 --- a/src/lib/fbdemos.c +++ b/src/lib/fbdemos.c @@ -50,6 +50,10 @@ struct fbdemos_scaffold *_fbs; /* for gdb */ int fbdemos_msaa_samples = 0; +// Align height to 8 to make sure we can use the buffer as target +// for resolve even on GPUs with two pixel pipes +#define ETNA_FB_HEIGHT_ALIGN (8) + void fbdemo_init(struct fbdemos_scaffold **out) { struct fbdemos_scaffold *fbs = CALLOC_STRUCT(fbdemos_scaffold); @@ -210,7 +214,10 @@ int fb_open(struct viv_conn *conn, int num, struct fb_info *out) out->fd = fd; out->stride = out->fb_fix.line_length; - out->buffer_stride = out->stride * out->fb_var.yres; + // Align height to make sure we can use the buffer as target + // for resolve even on GPUs with two pixel pipes + out->padded_height = etna_align_up(out->fb_var.yres, ETNA_FB_HEIGHT_ALIGN); + out->buffer_stride = out->stride * out->padded_height; out->num_buffers = out->fb_fix.smem_len / out->buffer_stride; if(out->num_buffers > ETNA_FB_MAX_BUFFERS) @@ -230,7 +237,7 @@ int fb_open(struct viv_conn *conn, int num, struct fb_info *out) out->buffer_stride); } printf("number of fb buffers: %i\n", out->num_buffers); - int req_virth = (out->num_buffers * out->fb_var.yres); + int req_virth = (out->num_buffers * out->padded_height); if(out->fb_var.yres_virtual < req_virth) { printf("required virtual h is %i, current virtual h is %i: requesting change", @@ -305,7 +312,7 @@ int etna_fb_bind_resource(struct fbdemos_scaffold *fbs, struct pipe_resource *rt .dither = {0xffffffff, 0xffffffff}, // XXX dither when going from 24 to 16 bit? .clear_mode = VIVS_RS_CLEAR_CONTROL_MODE_DISABLED, .width = fb->fb_var.xres * msaa_xscale, - .height = fb->fb_var.yres * msaa_yscale + .height = fb->padded_height * msaa_yscale }); } return 0; diff --git a/src/lib/fbdemos.h b/src/lib/fbdemos.h index f3604df..acb4558 100644 --- a/src/lib/fbdemos.h +++ b/src/lib/fbdemos.h @@ -36,6 +36,7 @@ struct fb_info int fd; int num_buffers; struct etna_bo *buffer[ETNA_FB_MAX_BUFFERS]; + int padded_height; size_t stride; size_t buffer_stride; struct fb_var_screeninfo fb_var; -- cgit