nv50,nvc0: don't keep track of whether fb rt0 is integer-only
authorIlia Mirkin <imirkin@alum.mit.edu>
Thu, 20 Oct 2016 02:36:03 +0000 (22:36 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Fri, 21 Oct 2016 06:28:26 +0000 (02:28 -0400)
This reverts commits 1af0641db345209c076e9b1ba4dca7524541671a and
a6ad49cbbd599aec054d0a3163fff5ad724f2b18.

st/mesa adjusts the rasterizer state for us now.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/gallium/drivers/nouveau/nv50/nv50_state.c
src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
src/gallium/drivers/nouveau/nv50/nv50_stateobj.h
src/gallium/drivers/nouveau/nvc0/nvc0_state.c
src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
src/gallium/drivers/nouveau/nvc0/nvc0_stateobj.h

index 57b23e6af5cde84804fd61345dbaaaa5503688c1..99d70d129c274884284331b64e08118146c4330b 100644 (file)
@@ -119,6 +119,7 @@ nv50_blend_state_create(struct pipe_context *pipe,
    struct nv50_blend_stateobj *so = CALLOC_STRUCT(nv50_blend_stateobj);
    int i;
    bool emit_common_func = cso->rt[0].blend_enable;
+   uint32_t ms;
 
    if (nv50_context(pipe)->screen->tesla->oclass >= NVA3_3D_CLASS) {
       SB_BEGIN_3D(so, BLEND_INDEPENDENT, 1);
@@ -190,6 +191,15 @@ nv50_blend_state_create(struct pipe_context *pipe,
       SB_DATA    (so, nv50_colormask(cso->rt[0].colormask));
    }
 
+   ms = 0;
+   if (cso->alpha_to_coverage)
+      ms |= NV50_3D_MULTISAMPLE_CTRL_ALPHA_TO_COVERAGE;
+   if (cso->alpha_to_one)
+      ms |= NV50_3D_MULTISAMPLE_CTRL_ALPHA_TO_ONE;
+
+   SB_BEGIN_3D(so, MULTISAMPLE_CTRL, 1);
+   SB_DATA    (so, ms);
+
    assert(so->size <= ARRAY_SIZE(so->state));
    return so;
 }
index 5a3bb3e719adb05617902903786c24caa165322c..c6f0363075a190e84450a0201864b37f6376fc70 100644 (file)
@@ -1,5 +1,4 @@
 
-#include "util/u_format.h"
 #include "util/u_viewport.h"
 
 #include "nv50/nv50_context.h"
@@ -347,25 +346,6 @@ nv50_validate_derived_2(struct nv50_context *nv50)
    }
 }
 
-static void
-nv50_validate_derived_3(struct nv50_context *nv50)
-{
-   struct nouveau_pushbuf *push = nv50->base.pushbuf;
-   struct pipe_framebuffer_state *fb = &nv50->framebuffer;
-   uint32_t ms = 0;
-
-   if ((!fb->nr_cbufs || !fb->cbufs[0] ||
-        !util_format_is_pure_integer(fb->cbufs[0]->format)) && nv50->blend) {
-      if (nv50->blend->pipe.alpha_to_coverage)
-         ms |= NV50_3D_MULTISAMPLE_CTRL_ALPHA_TO_COVERAGE;
-      if (nv50->blend->pipe.alpha_to_one)
-         ms |= NV50_3D_MULTISAMPLE_CTRL_ALPHA_TO_ONE;
-   }
-
-   BEGIN_NV04(push, NV50_3D(MULTISAMPLE_CTRL), 1);
-   PUSH_DATA (push, ms);
-}
-
 static void
 nv50_validate_clip(struct nv50_context *nv50)
 {
@@ -535,7 +515,6 @@ validate_list_3d[] = {
     { nv50_validate_derived_rs,    NV50_NEW_3D_FRAGPROG | NV50_NEW_3D_RASTERIZER |
                                    NV50_NEW_3D_VERTPROG | NV50_NEW_3D_GMTYPROG },
     { nv50_validate_derived_2,     NV50_NEW_3D_ZSA | NV50_NEW_3D_FRAMEBUFFER },
-    { nv50_validate_derived_3,     NV50_NEW_3D_BLEND | NV50_NEW_3D_FRAMEBUFFER },
     { nv50_validate_clip,          NV50_NEW_3D_CLIP | NV50_NEW_3D_RASTERIZER |
                                    NV50_NEW_3D_VERTPROG | NV50_NEW_3D_GMTYPROG },
     { nv50_constbufs_validate,     NV50_NEW_3D_CONSTBUF },
index 9598b04e0f49eec693bffeed6e02021174747f05..579da9a110c1973e5bf4e8d952376b397bbc9c7f 100644 (file)
@@ -19,7 +19,7 @@
 struct nv50_blend_stateobj {
    struct pipe_blend_state pipe;
    int size;
-   uint32_t state[82]; // TODO: allocate less if !independent_blend_enable
+   uint32_t state[84]; // TODO: allocate less if !independent_blend_enable
 };
 
 struct nv50_rasterizer_stateobj {
index 928b78556511efda50247b30e1495fea5fa6fe0f..bba35f1e9b303b4ead70af52a3d4e763cc74dff1 100644 (file)
@@ -91,6 +91,7 @@ nvc0_blend_state_create(struct pipe_context *pipe,
    struct nvc0_blend_stateobj *so = CALLOC_STRUCT(nvc0_blend_stateobj);
    int i;
    int r; /* reference */
+   uint32_t ms;
    uint8_t blend_en = 0;
    bool indep_masks = false;
    bool indep_funcs = false;
@@ -176,6 +177,15 @@ nvc0_blend_state_create(struct pipe_context *pipe,
       }
    }
 
+   ms = 0;
+   if (cso->alpha_to_coverage)
+      ms |= NVC0_3D_MULTISAMPLE_CTRL_ALPHA_TO_COVERAGE;
+   if (cso->alpha_to_one)
+      ms |= NVC0_3D_MULTISAMPLE_CTRL_ALPHA_TO_ONE;
+
+   SB_BEGIN_3D(so, MULTISAMPLE_CTRL, 1);
+   SB_DATA    (so, ms);
+
    assert(so->size <= ARRAY_SIZE(so->state));
    return so;
 }
index 1d8ebe642bb07b4ff861985da50e3f3e54a2eb98..88766f425907ab1f12571b0c2cd9bc55921c3834 100644 (file)
@@ -1,5 +1,4 @@
 
-#include "util/u_format.h"
 #include "util/u_framebuffer.h"
 #include "util/u_math.h"
 #include "util/u_viewport.h"
@@ -671,25 +670,6 @@ nvc0_validate_zsa_fb(struct nvc0_context *nvc0)
    }
 }
 
-static void
-nvc0_validate_blend_fb(struct nvc0_context *nvc0)
-{
-   struct nouveau_pushbuf *push = nvc0->base.pushbuf;
-   struct pipe_framebuffer_state *fb = &nvc0->framebuffer;
-   uint32_t ms = 0;
-
-   if ((!fb->nr_cbufs || !fb->cbufs[0] ||
-        !util_format_is_pure_integer(fb->cbufs[0]->format)) && nvc0->blend) {
-      if (nvc0->blend->pipe.alpha_to_coverage)
-         ms |= NVC0_3D_MULTISAMPLE_CTRL_ALPHA_TO_COVERAGE;
-      if (nvc0->blend->pipe.alpha_to_one)
-         ms |= NVC0_3D_MULTISAMPLE_CTRL_ALPHA_TO_ONE;
-   }
-
-   BEGIN_NVC0(push, NVC0_3D(MULTISAMPLE_CTRL), 1);
-   PUSH_DATA (push, ms);
-}
-
 static void
 nvc0_validate_rast_fb(struct nvc0_context *nvc0)
 {
@@ -792,7 +772,6 @@ validate_list_3d[] = {
     { nvc0_validate_fp_zsa_rast,   NVC0_NEW_3D_FRAGPROG | NVC0_NEW_3D_ZSA |
                                    NVC0_NEW_3D_RASTERIZER },
     { nvc0_validate_zsa_fb,        NVC0_NEW_3D_ZSA | NVC0_NEW_3D_FRAMEBUFFER },
-    { nvc0_validate_blend_fb,      NVC0_NEW_3D_BLEND | NVC0_NEW_3D_FRAMEBUFFER },
     { nvc0_validate_rast_fb,       NVC0_NEW_3D_RASTERIZER | NVC0_NEW_3D_FRAMEBUFFER },
     { nvc0_validate_clip,          NVC0_NEW_3D_CLIP | NVC0_NEW_3D_RASTERIZER |
                                    NVC0_NEW_3D_VERTPROG |
index c900fcadcb7d9626727a3962854ed9e043252ff3..054b1e77d785a921d7192375552b3e4da34d24b6 100644 (file)
@@ -17,7 +17,7 @@
 struct nvc0_blend_stateobj {
    struct pipe_blend_state pipe;
    int size;
-   uint32_t state[70];
+   uint32_t state[72];
 };
 
 struct nvc0_rasterizer_stateobj {