Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/nv40: make detection of 0x4097-ful chipsets available everywhere

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>

+20 -18
+14
drivers/gpu/drm/nouveau/nouveau_drv.h
··· 1574 1574 dev->pdev->subsystem_device == sub_device; 1575 1575 } 1576 1576 1577 + /* returns 1 if device is one of the nv4x using the 0x4497 object class, 1578 + * helpful to determine a number of other hardware features 1579 + */ 1580 + static inline int 1581 + nv44_graph_class(struct drm_device *dev) 1582 + { 1583 + struct drm_nouveau_private *dev_priv = dev->dev_private; 1584 + 1585 + if ((dev_priv->chipset & 0xf0) == 0x60) 1586 + return 1; 1587 + 1588 + return !(0x0baf & (1 << (dev_priv->chipset & 0x0f))); 1589 + } 1590 + 1577 1591 /* memory type/access flags, do not match hardware values */ 1578 1592 #define NV_MEM_ACCESS_RO 1 1579 1593 #define NV_MEM_ACCESS_WO 2
+1 -2
drivers/gpu/drm/nouveau/nv40_graph.c
··· 451 451 NVOBJ_CLASS(dev, 0x309e, GR); /* swzsurf */ 452 452 453 453 /* curie */ 454 - if (dev_priv->chipset >= 0x60 || 455 - 0x00005450 & (1 << (dev_priv->chipset & 0x0f))) 454 + if (nv44_graph_class(dev)) 456 455 NVOBJ_CLASS(dev, 0x4497, GR); 457 456 else 458 457 NVOBJ_CLASS(dev, 0x4097, GR);
+5 -16
drivers/gpu/drm/nouveau/nv40_grctx.c
··· 118 118 */ 119 119 120 120 static int 121 - nv40_graph_4097(struct drm_device *dev) 122 - { 123 - struct drm_nouveau_private *dev_priv = dev->dev_private; 124 - 125 - if ((dev_priv->chipset & 0xf0) == 0x60) 126 - return 0; 127 - 128 - return !!(0x0baf & (1 << dev_priv->chipset)); 129 - } 130 - 131 - static int 132 121 nv40_graph_vs_count(struct drm_device *dev) 133 122 { 134 123 struct drm_nouveau_private *dev_priv = dev->dev_private; ··· 208 219 gr_def(ctx, 0x4009dc, 0x80000000); 209 220 } else { 210 221 cp_ctx(ctx, 0x400840, 20); 211 - if (!nv40_graph_4097(ctx->dev)) { 222 + if (nv44_graph_class(ctx->dev)) { 212 223 for (i = 0; i < 8; i++) 213 224 gr_def(ctx, 0x400860 + (i * 4), 0x00000001); 214 225 } ··· 217 228 gr_def(ctx, 0x400888, 0x00000040); 218 229 cp_ctx(ctx, 0x400894, 11); 219 230 gr_def(ctx, 0x400894, 0x00000040); 220 - if (nv40_graph_4097(ctx->dev)) { 231 + if (!nv44_graph_class(ctx->dev)) { 221 232 for (i = 0; i < 8; i++) 222 233 gr_def(ctx, 0x4008a0 + (i * 4), 0x80000000); 223 234 } ··· 535 546 static void 536 547 nv40_graph_construct_state3d_3(struct nouveau_grctx *ctx) 537 548 { 538 - int len = nv40_graph_4097(ctx->dev) ? 0x0684 : 0x0084; 549 + int len = nv44_graph_class(ctx->dev) ? 0x0084 : 0x0684; 539 550 540 551 cp_out (ctx, 0x300000); 541 552 cp_lsr (ctx, len - 4); ··· 571 582 } else { 572 583 b0_offset = 0x1d40/4; /* 2200 */ 573 584 b1_offset = 0x3f40/4; /* 0b00 : 0a40 */ 574 - vs_len = nv40_graph_4097(dev) ? 0x4a40/4 : 0x4980/4; 585 + vs_len = nv44_graph_class(dev) ? 0x4980/4 : 0x4a40/4; 575 586 } 576 587 577 588 cp_lsr(ctx, vs_len * vs_nr + 0x300/4); 578 - cp_out(ctx, nv40_graph_4097(dev) ? 0x800041 : 0x800029); 589 + cp_out(ctx, nv44_graph_class(dev) ? 0x800029 : 0x800041); 579 590 580 591 offset = ctx->ctxvals_pos; 581 592 ctx->ctxvals_pos += (0x0300/4 + (vs_nr * vs_len));