drm/nouveau/gr/gk104-: correct crop/zrop num_active_fbps setting
authorBen Skeggs <bskeggs@redhat.com>
Thu, 26 Mar 2015 03:26:20 +0000 (13:26 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 14 Apr 2015 07:00:54 +0000 (17:00 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk104.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm107.c

index 1166b1aa152559957975a34ea10563b98e8f83b8..e9852764ac1d1b08bb07caf3206c1181ffcf1b30 100644 (file)
@@ -88,6 +88,7 @@ void gk104_grctx_generate_bundle(struct gf100_grctx *);
 void gk104_grctx_generate_pagepool(struct gf100_grctx *);
 void gk104_grctx_generate_unkn(struct gf100_gr_priv *);
 void gk104_grctx_generate_r418bb8(struct gf100_gr_priv *);
+void gk104_grctx_generate_rop_active_fbps(struct gf100_gr_priv *);
 
 extern struct nvkm_oclass *gk110_grctx_oclass;
 extern struct nvkm_oclass *gk110b_grctx_oclass;
index 5e9454ba158fe816e7c381e7518a259efb1565d8..b12f6a9fd9266e4c0614e3a925a8026d3890c423 100644 (file)
@@ -940,6 +940,14 @@ gk104_grctx_generate_r418bb8(struct gf100_gr_priv *priv)
                nv_wr32(priv, 0x40780c + (i * 4), data[i]);
 }
 
+void
+gk104_grctx_generate_rop_active_fbps(struct gf100_gr_priv *priv)
+{
+       const u32 fbp_count = nv_rd32(priv, 0x120074);
+       nv_mask(priv, 0x408850, 0x0000000f, fbp_count); /* zrop */
+       nv_mask(priv, 0x408958, 0x0000000f, fbp_count); /* crop */
+}
+
 void
 gk104_grctx_generate_main(struct gf100_gr_priv *priv, struct gf100_grctx *info)
 {
@@ -970,13 +978,7 @@ gk104_grctx_generate_main(struct gf100_gr_priv *priv, struct gf100_grctx *info)
                nv_wr32(priv, 0x4064d0 + (i * 0x04), 0x00000000);
 
        nv_wr32(priv, 0x405b00, (priv->tpc_total << 8) | priv->gpc_nr);
-       if (priv->gpc_nr == 1) {
-               nv_mask(priv, 0x408850, 0x0000000f, priv->tpc_nr[0]);
-               nv_mask(priv, 0x408958, 0x0000000f, priv->tpc_nr[0]);
-       } else {
-               nv_mask(priv, 0x408850, 0x0000000f, priv->gpc_nr);
-               nv_mask(priv, 0x408958, 0x0000000f, priv->gpc_nr);
-       }
+       gk104_grctx_generate_rop_active_fbps(priv);
        nv_mask(priv, 0x419f78, 0x00000001, 0x00000000);
 
        gf100_gr_icmd(priv, oclass->icmd);
index b2fae6e389e24260bb5093ffdd9fa5d90982f277..206f8caafe1ceca4152988a58f8d1c6d72be5be4 100644 (file)
@@ -982,13 +982,7 @@ gm107_grctx_generate_main(struct gf100_gr_priv *priv, struct gf100_grctx *info)
 
        nv_wr32(priv, 0x405b00, (priv->tpc_total << 8) | priv->gpc_nr);
 
-       if (priv->gpc_nr == 1) {
-               nv_mask(priv, 0x408850, 0x0000000f, priv->tpc_nr[0]);
-               nv_mask(priv, 0x408958, 0x0000000f, priv->tpc_nr[0]);
-       } else {
-               nv_mask(priv, 0x408850, 0x0000000f, priv->gpc_nr);
-               nv_mask(priv, 0x408958, 0x0000000f, priv->gpc_nr);
-       }
+       gk104_grctx_generate_rop_active_fbps(priv);
 
        gf100_gr_icmd(priv, oclass->icmd);
        nv_wr32(priv, 0x404154, 0x00000400);