From d151d8cd043b753b50a0ca306aa2bdc07bf60bcb Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Thu, 16 Jan 2014 21:05:12 +0000 Subject: [PATCH] nv30: rt_formats we salute you Printfs for the bug in https://bugs.freedesktop.org/show_bug.cgi?id=73358 Signed-off-by: Emil Velikov --- src/gallium/drivers/nouveau/nv30/nv30_clear.c | 9 +++++++++ .../drivers/nouveau/nv30/nv30_state_validate.c | 23 ++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/gallium/drivers/nouveau/nv30/nv30_clear.c b/src/gallium/drivers/nouveau/nv30/nv30_clear.c index 5317e89..08de9c0 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_clear.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_clear.c @@ -32,6 +32,9 @@ #include "nv30/nv30_context.h" #include "nv30/nv30_format.h" +#include +#include + static INLINE uint32_t pack_rgba(enum pipe_format format, const float *rgba) { @@ -105,8 +108,10 @@ nv30_clear_render_target(struct pipe_context *pipe, struct pipe_surface *ps, struct nouveau_object *eng3d = nv30->screen->eng3d; struct nouveau_pushbuf_refn refn; uint32_t rt_format; + uint32_t hw_format; rt_format = nv30_format(pipe->screen, ps->format)->hw; + hw_format = rt_format; if (util_format_get_blocksize(ps->format) == 4) rt_format |= NV30_3D_RT_FORMAT_ZETA_Z24S8; else @@ -119,6 +124,10 @@ nv30_clear_render_target(struct pipe_context *pipe, struct pipe_surface *ps, } else { rt_format |= NV30_3D_RT_FORMAT_TYPE_LINEAR; } + fprintf(stderr,"%s: p_format %x, rt_format %x, hw %x\n", __func__, + util_format_name(ps->format), ps->format, rt_format, hw_format); + if (rt_format == 0x00000120) + return; refn.bo = mt->base.bo; refn.flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_WR; diff --git a/src/gallium/drivers/nouveau/nv30/nv30_state_validate.c b/src/gallium/drivers/nouveau/nv30/nv30_state_validate.c index f227559..076fcdb 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_state_validate.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_state_validate.c @@ -32,6 +32,9 @@ #include "nv30/nv30_context.h" #include "nv30/nv30_format.h" +#include +#include + static void nv30_validate_fb(struct nv30_context *nv30) { @@ -40,6 +43,8 @@ nv30_validate_fb(struct nv30_context *nv30) struct nouveau_pushbuf *push = nv30->base.pushbuf; struct nouveau_object *eng3d = nv30->screen->eng3d; uint32_t rt_format; + uint32_t hw_format; + uint32_t p_format; int h = fb->height; int w = fb->width; int x = 0; @@ -50,9 +55,14 @@ nv30_validate_fb(struct nv30_context *nv30) nv30->state.rt_enable |= NV30_3D_RT_ENABLE_MRT; rt_format = 0; + hw_format = 0; + p_format = 0; if (fb->nr_cbufs > 0) { struct nv30_miptree *mt = nv30_miptree(fb->cbufs[0]->texture); rt_format |= nv30_format(pscreen, fb->cbufs[0]->format)->hw; + hw_format = rt_format; + p_format = fb->cbufs[0]->format; + rt_format |= mt->ms_mode; if (mt->swizzled) rt_format |= NV30_3D_RT_FORMAT_TYPE_SWIZZLED; @@ -65,8 +75,15 @@ nv30_validate_fb(struct nv30_context *nv30) rt_format |= NV30_3D_RT_FORMAT_COLOR_R5G6B5; } + fprintf(stderr,"%s: p_format %x, rt_format %x, hw %x\n", __func__, p_format, rt_format, hw_format); + + hw_format = 0; + p_format = 0; if (fb->zsbuf) { rt_format |= nv30_format(pscreen, fb->zsbuf->format)->hw; + hw_format = nv30_format(pscreen, fb->zsbuf->format)->hw; + p_format = fb->zsbuf->format; + if (nv30_miptree(fb->zsbuf->texture)->swizzled) rt_format |= NV30_3D_RT_FORMAT_TYPE_SWIZZLED; else @@ -78,6 +95,12 @@ nv30_validate_fb(struct nv30_context *nv30) rt_format |= NV30_3D_RT_FORMAT_ZETA_Z16; } + printf(stderr,"%s: p_format %s(%x) , rt_format %x, hw %x\n", __func__, + util_format_name(p_format), p_format, rt_format, hw_format); + + if (rt_format == 0x00000120) + return; + /* hardware rounds down render target offset to 64 bytes, but surfaces * with a size of 2x2 pixel (16bpp) or 1x1 pixel (32bpp) have an * unaligned start aaddress. For these two important square formats -- 1.8.5.2