nv50,nvc0: leave queries on during blit, turn them on for 2d engine
authorIlia Mirkin <imirkin@alum.mit.edu>
Sat, 3 May 2014 07:00:07 +0000 (03:00 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sun, 11 May 2014 23:26:31 +0000 (19:26 -0400)
Fixes the new logic of the conditional rendering piglit test.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/nouveau/nv50/nv50_query.c
src/gallium/drivers/nouveau/nv50/nv50_screen.c
src/gallium/drivers/nouveau/nv50/nv50_surface.c
src/gallium/drivers/nouveau/nvc0/nvc0_query.c
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
src/gallium/drivers/nouveau/nvc0/nvc0_surface.c

index 6f25a0822c4f506196d5a786af9e2523c1502cdd..6a17139e1cde6e405f0fd19b24121a35b4133176 100644 (file)
@@ -332,7 +332,7 @@ nv50_render_condition(struct pipe_context *pipe,
    nv50->cond_cond = condition;
    nv50->cond_mode = mode;
 
-   PUSH_SPACE(push, 6);
+   PUSH_SPACE(push, 9);
 
    if (!pq) {
       BEGIN_NV04(push, NV50_3D(COND_MODE), 1);
@@ -351,6 +351,10 @@ nv50_render_condition(struct pipe_context *pipe,
    PUSH_DATAh(push, q->bo->offset + q->offset);
    PUSH_DATA (push, q->bo->offset + q->offset);
    PUSH_DATA (push, NV50_3D_COND_MODE_RES_NON_ZERO);
+
+   BEGIN_NV04(push, NV50_2D(COND_ADDRESS_HIGH), 2);
+   PUSH_DATAh(push, q->bo->offset + q->offset);
+   PUSH_DATA (push, q->bo->offset + q->offset);
 }
 
 void
index fcac3c1903aa03d08999241bd9ee4ff0ffc679f4..68d30ea2045dd3430001ccbe49e0d5451dd93bba 100644 (file)
@@ -398,6 +398,8 @@ nv50_screen_init_hwctx(struct nv50_screen *screen)
    PUSH_DATA (push, 0);
    BEGIN_NV04(push, SUBC_2D(0x0888), 1);
    PUSH_DATA (push, 1);
+   BEGIN_NV04(push, NV50_2D(COND_MODE), 1);
+   PUSH_DATA (push, NV50_2D_COND_MODE_ALWAYS);
 
    BEGIN_NV04(push, SUBC_3D(NV01_SUBCHAN_OBJECT), 1);
    PUSH_DATA (push, screen->tesla->handle);
index 6b4dc4d49495b7bd8c10da11d481dd3e5be2b34b..df3bc86fb482c768d7048c0eadd90e3168d5a6cd 100644 (file)
@@ -611,6 +611,7 @@ struct nv50_blitctx
    uint8_t mode;
    uint16_t color_mask;
    uint8_t filter;
+   uint8_t render_condition_enable;
    enum pipe_texture_target target;
    struct {
       struct pipe_framebuffer_state fb;
@@ -933,7 +934,7 @@ nv50_blitctx_prepare_state(struct nv50_blitctx *blit)
 {
    struct nouveau_pushbuf *push = blit->nv50->base.pushbuf;
 
-   if (blit->nv50->cond_query) {
+   if (blit->nv50->cond_query && !blit->render_condition_enable) {
       BEGIN_NV04(push, NV50_3D(COND_MODE), 1);
       PUSH_DATA (push, NV50_3D_COND_MODE_ALWAYS);
    }
@@ -1071,7 +1072,7 @@ nv50_blitctx_post_blit(struct nv50_blitctx *blit)
    nv50->samplers[2][0] = blit->saved.sampler[0];
    nv50->samplers[2][1] = blit->saved.sampler[1];
 
-   if (nv50->cond_query)
+   if (nv50->cond_query && !blit->render_condition_enable)
       nv50->base.pipe.render_condition(&nv50->base.pipe, nv50->cond_query,
                                        nv50->cond_cond, nv50->cond_mode);
 
@@ -1105,6 +1106,7 @@ nv50_blit_3d(struct nv50_context *nv50, const struct pipe_blit_info *info)
    blit->mode = nv50_blit_select_mode(info);
    blit->color_mask = nv50_blit_derive_color_mask(info);
    blit->filter = nv50_blit_get_filter(info);
+   blit->render_condition_enable = info->render_condition_enable;
 
    nv50_blit_select_fp(blit, info);
    nv50_blitctx_pre_blit(blit);
@@ -1262,6 +1264,11 @@ nv50_blit_eng2d(struct nv50_context *nv50, const struct pipe_blit_info *info)
       PUSH_DATA (push, 1); /* enable */
    }
 
+   if (nv50->cond_query && info->render_condition_enable) {
+      BEGIN_NV04(push, NV50_2D(COND_MODE), 1);
+      PUSH_DATA (push, NV50_2D_COND_MODE_RES_NON_ZERO);
+   }
+
    if (mask != 0xffffffff) {
       BEGIN_NV04(push, NV50_2D(ROP), 1);
       PUSH_DATA (push, 0xca); /* DPSDxax */
@@ -1384,6 +1391,10 @@ nv50_blit_eng2d(struct nv50_context *nv50, const struct pipe_blit_info *info)
       BEGIN_NV04(push, NV50_2D(OPERATION), 1);
       PUSH_DATA (push, NV50_2D_OPERATION_SRCCOPY);
    }
+   if (nv50->cond_query && info->render_condition_enable) {
+      BEGIN_NV04(push, NV50_2D(COND_MODE), 1);
+      PUSH_DATA (push, NV50_2D_COND_MODE_ALWAYS);
+   }
 }
 
 static void
index 21aa3580e7c16494ac7e051518c5eee162ff4935..856f685ceb617808cd10d8bba506b598e90a8752 100644 (file)
@@ -585,12 +585,15 @@ nvc0_render_condition(struct pipe_context *pipe,
    if (wait)
       nvc0_query_fifo_wait(push, pq);
 
-   PUSH_SPACE(push, 4);
+   PUSH_SPACE(push, 7);
    PUSH_REFN (push, q->bo, NOUVEAU_BO_GART | NOUVEAU_BO_RD);
    BEGIN_NVC0(push, NVC0_3D(COND_ADDRESS_HIGH), 3);
    PUSH_DATAh(push, q->bo->offset + q->offset);
    PUSH_DATA (push, q->bo->offset + q->offset);
    PUSH_DATA (push, cond);
+   BEGIN_NVC0(push, NVC0_2D(COND_ADDRESS_HIGH), 2);
+   PUSH_DATAh(push, q->bo->offset + q->offset);
+   PUSH_DATA (push, q->bo->offset + q->offset);
 }
 
 void
index 2166788e00e3608aa4b848e5506702dff1a4205c..1da991c8d1345f8d618f11ff9aa0f82260a770a6 100644 (file)
@@ -677,6 +677,8 @@ nvc0_screen_create(struct nouveau_device *dev)
    PUSH_DATA (push, 0x3f);
    BEGIN_NVC0(push, SUBC_2D(0x0888), 1);
    PUSH_DATA (push, 1);
+   BEGIN_NVC0(push, NVC0_2D(COND_MODE), 1);
+   PUSH_DATA (push, NVC0_2D_COND_MODE_ALWAYS);
 
    BEGIN_NVC0(push, SUBC_2D(NVC0_GRAPH_NOTIFY_ADDRESS_HIGH), 2);
    PUSH_DATAh(push, screen->fence.bo->offset + 16);
index 4a550b0bb401fb1582866e9f157555fdfa5c6613..acadb2cc4f16236d8f69f12a3b8c3a9bfd12089d 100644 (file)
@@ -503,6 +503,7 @@ struct nvc0_blitctx
    uint8_t mode;
    uint16_t color_mask;
    uint8_t filter;
+   uint8_t render_condition_enable;
    enum pipe_texture_target target;
    struct {
       struct pipe_framebuffer_state fb;
@@ -691,7 +692,7 @@ nvc0_blitctx_prepare_state(struct nvc0_blitctx *blit)
 
    /* TODO: maybe make this a MACRO (if we need more logic) ? */
 
-   if (blit->nvc0->cond_query)
+   if (blit->nvc0->cond_query && !blit->render_condition_enable)
       IMMED_NVC0(push, NVC0_3D(COND_MODE), NVC0_3D_COND_MODE_ALWAYS);
 
    /* blend state */
@@ -833,7 +834,7 @@ nvc0_blitctx_post_blit(struct nvc0_blitctx *blit)
    nvc0->textures_dirty[4] |= 3;
    nvc0->samplers_dirty[4] |= 3;
 
-   if (nvc0->cond_query)
+   if (nvc0->cond_query && !blit->render_condition_enable)
       nvc0->base.pipe.render_condition(&nvc0->base.pipe, nvc0->cond_query,
                                        nvc0->cond_cond, nvc0->cond_mode);
 
@@ -868,6 +869,7 @@ nvc0_blit_3d(struct nvc0_context *nvc0, const struct pipe_blit_info *info)
    blit->mode = nv50_blit_select_mode(info);
    blit->color_mask = nv50_blit_derive_color_mask(info);
    blit->filter = nv50_blit_get_filter(info);
+   blit->render_condition_enable = info->render_condition_enable;
 
    nvc0_blit_select_fp(blit, info);
    nvc0_blitctx_pre_blit(blit);
@@ -1030,6 +1032,9 @@ nvc0_blit_eng2d(struct nvc0_context *nvc0, const struct pipe_blit_info *info)
       PUSH_DATA (push, 1); /* enable */
    }
 
+   if (nvc0->cond_query && info->render_condition_enable)
+      IMMED_NVC0(push, NVC0_2D(COND_MODE), NVC0_2D_COND_MODE_RES_NON_ZERO);
+
    if (mask != 0xffffffff) {
       IMMED_NVC0(push, NVC0_2D(ROP), 0xca); /* DPSDxax */
       IMMED_NVC0(push, NVC0_2D(PATTERN_COLOR_FORMAT),
@@ -1154,6 +1159,8 @@ nvc0_blit_eng2d(struct nvc0_context *nvc0, const struct pipe_blit_info *info)
       IMMED_NVC0(push, NVC0_2D(CLIP_ENABLE), 0);
    if (mask != 0xffffffff)
       IMMED_NVC0(push, NVC0_2D(OPERATION), NVC0_2D_OPERATION_SRCCOPY);
+   if (nvc0->cond_query && info->render_condition_enable)
+      IMMED_NVC0(push, NVC0_2D(COND_MODE), NVC0_2D_COND_MODE_ALWAYS);
 }
 
 static void