aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau
diff options
context:
space:
mode:
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>2013-03-27 17:16:54 -0400
committerBen Skeggs <bskeggs@redhat.com>2013-04-26 01:37:41 -0400
commit7e22e71e80fe35592fbc64a0e382108a8ce28495 (patch)
tree56a4866445e32a5e59e0e0cbc3f6153b5d52a7b9 /drivers/gpu/drm/nouveau
parente30441adb91b020044f257c5c8e41022f3406ba1 (diff)
drm/nvc0-: support NOUVEAU_GETPARAM_GRAPH_UNITS
Signed-off-by: Christoph Bumiller <e0425955@student.tuwien.ac.at> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau')
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nv40.c10
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nv50.c10
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c15
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h2
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nve0.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/include/engine/graph.h4
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_abi16.c12
7 files changed, 47 insertions, 8 deletions
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nv40.c b/drivers/gpu/drm/nouveau/core/engine/graph/nv40.c
index 17049d5c723d..193a5de1b482 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nv40.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nv40.c
@@ -46,6 +46,14 @@ struct nv40_graph_chan {
46 struct nouveau_graph_chan base; 46 struct nouveau_graph_chan base;
47}; 47};
48 48
49static u64
50nv40_graph_units(struct nouveau_graph *graph)
51{
52 struct nv40_graph_priv *priv = (void *)graph;
53
54 return nv_rd32(priv, 0x1540);
55}
56
49/******************************************************************************* 57/*******************************************************************************
50 * Graphics object classes 58 * Graphics object classes
51 ******************************************************************************/ 59 ******************************************************************************/
@@ -359,6 +367,8 @@ nv40_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
359 else 367 else
360 nv_engine(priv)->sclass = nv40_graph_sclass; 368 nv_engine(priv)->sclass = nv40_graph_sclass;
361 nv_engine(priv)->tile_prog = nv40_graph_tile_prog; 369 nv_engine(priv)->tile_prog = nv40_graph_tile_prog;
370
371 priv->base.units = nv40_graph_units;
362 return 0; 372 return 0;
363} 373}
364 374
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c b/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c
index f2b1a7a124f2..1ac36110ca19 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c
@@ -48,6 +48,14 @@ struct nv50_graph_chan {
48 struct nouveau_graph_chan base; 48 struct nouveau_graph_chan base;
49}; 49};
50 50
51static u64
52nv50_graph_units(struct nouveau_graph *graph)
53{
54 struct nv50_graph_priv *priv = (void *)graph;
55
56 return nv_rd32(priv, 0x1540);
57}
58
51/******************************************************************************* 59/*******************************************************************************
52 * Graphics object classes 60 * Graphics object classes
53 ******************************************************************************/ 61 ******************************************************************************/
@@ -819,6 +827,8 @@ nv50_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
819 nv_subdev(priv)->intr = nv50_graph_intr; 827 nv_subdev(priv)->intr = nv50_graph_intr;
820 nv_engine(priv)->cclass = &nv50_graph_cclass; 828 nv_engine(priv)->cclass = &nv50_graph_cclass;
821 829
830 priv->base.units = nv50_graph_units;
831
822 switch (nv_device(priv)->chipset) { 832 switch (nv_device(priv)->chipset) {
823 case 0x50: 833 case 0x50:
824 nv_engine(priv)->sclass = nv50_graph_sclass; 834 nv_engine(priv)->sclass = nv50_graph_sclass;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
index 0de0dd724aff..5ce49412e482 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
@@ -60,6 +60,19 @@ nvc8_graph_sclass[] = {
60 {} 60 {}
61}; 61};
62 62
63u64
64nvc0_graph_units(struct nouveau_graph *graph)
65{
66 struct nvc0_graph_priv *priv = (void *)graph;
67 u64 cfg;
68
69 cfg = (u32)priv->gpc_nr;
70 cfg |= (u32)priv->tpc_total << 8;
71 cfg |= (u64)priv->rop_nr << 32;
72
73 return cfg;
74}
75
63/******************************************************************************* 76/*******************************************************************************
64 * PGRAPH context 77 * PGRAPH context
65 ******************************************************************************/ 78 ******************************************************************************/
@@ -529,6 +542,8 @@ nvc0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
529 nv_subdev(priv)->intr = nvc0_graph_intr; 542 nv_subdev(priv)->intr = nvc0_graph_intr;
530 nv_engine(priv)->cclass = &nvc0_graph_cclass; 543 nv_engine(priv)->cclass = &nvc0_graph_cclass;
531 544
545 priv->base.units = nvc0_graph_units;
546
532 if (nouveau_boolopt(device->cfgopt, "NvGrUseFW", false)) { 547 if (nouveau_boolopt(device->cfgopt, "NvGrUseFW", false)) {
533 nv_info(priv, "using external firmware\n"); 548 nv_info(priv, "using external firmware\n");
534 if (nvc0_graph_ctor_fw(priv, "fuc409c", &priv->fuc409c) || 549 if (nvc0_graph_ctor_fw(priv, "fuc409c", &priv->fuc409c) ||
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h
index a1e78de46456..af033dc24440 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h
@@ -169,4 +169,6 @@ int nvc0_graph_context_ctor(struct nouveau_object *, struct nouveau_object *,
169 struct nouveau_object **); 169 struct nouveau_object **);
170void nvc0_graph_context_dtor(struct nouveau_object *); 170void nvc0_graph_context_dtor(struct nouveau_object *);
171 171
172u64 nvc0_graph_units(struct nouveau_graph *);
173
172#endif 174#endif
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c
index 4857f913efdd..4b45afb62461 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c
@@ -217,6 +217,8 @@ nve0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
217 nv_engine(priv)->cclass = &nve0_graph_cclass; 217 nv_engine(priv)->cclass = &nve0_graph_cclass;
218 nv_engine(priv)->sclass = nve0_graph_sclass; 218 nv_engine(priv)->sclass = nve0_graph_sclass;
219 219
220 priv->base.units = nvc0_graph_units;
221
220 if (nouveau_boolopt(device->cfgopt, "NvGrUseFW", false)) { 222 if (nouveau_boolopt(device->cfgopt, "NvGrUseFW", false)) {
221 nv_info(priv, "using external firmware\n"); 223 nv_info(priv, "using external firmware\n");
222 if (nvc0_graph_ctor_fw(priv, "fuc409c", &priv->fuc409c) || 224 if (nvc0_graph_ctor_fw(priv, "fuc409c", &priv->fuc409c) ||
diff --git a/drivers/gpu/drm/nouveau/core/include/engine/graph.h b/drivers/gpu/drm/nouveau/core/include/engine/graph.h
index 6943b40d0817..5d392439f2ac 100644
--- a/drivers/gpu/drm/nouveau/core/include/engine/graph.h
+++ b/drivers/gpu/drm/nouveau/core/include/engine/graph.h
@@ -26,6 +26,10 @@ struct nouveau_graph_chan {
26 26
27struct nouveau_graph { 27struct nouveau_graph {
28 struct nouveau_engine base; 28 struct nouveau_engine base;
29
30 /* Returns chipset-specific counts of units packed into an u64.
31 */
32 u64 (*units)(struct nouveau_graph *);
29}; 33};
30 34
31static inline struct nouveau_graph * 35static inline struct nouveau_graph *
diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c
index 5eb3e0da7c6e..1c4c6c9161ac 100644
--- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
+++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
@@ -30,6 +30,7 @@
30#include <subdev/fb.h> 30#include <subdev/fb.h>
31#include <subdev/timer.h> 31#include <subdev/timer.h>
32#include <subdev/instmem.h> 32#include <subdev/instmem.h>
33#include <engine/graph.h>
33 34
34#include "nouveau_drm.h" 35#include "nouveau_drm.h"
35#include "nouveau_dma.h" 36#include "nouveau_dma.h"
@@ -168,6 +169,7 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
168 struct nouveau_drm *drm = nouveau_drm(dev); 169 struct nouveau_drm *drm = nouveau_drm(dev);
169 struct nouveau_device *device = nv_device(drm->device); 170 struct nouveau_device *device = nv_device(drm->device);
170 struct nouveau_timer *ptimer = nouveau_timer(device); 171 struct nouveau_timer *ptimer = nouveau_timer(device);
172 struct nouveau_graph *graph = (void *)nouveau_engine(device, NVDEV_ENGINE_GR);
171 struct drm_nouveau_getparam *getparam = data; 173 struct drm_nouveau_getparam *getparam = data;
172 174
173 switch (getparam->param) { 175 switch (getparam->param) {
@@ -208,14 +210,8 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
208 getparam->value = 1; 210 getparam->value = 1;
209 break; 211 break;
210 case NOUVEAU_GETPARAM_GRAPH_UNITS: 212 case NOUVEAU_GETPARAM_GRAPH_UNITS:
211 /* NV40 and NV50 versions are quite different, but register 213 getparam->value = graph->units ? graph->units(graph) : 0;
212 * address is the same. User is supposed to know the card 214 break;
213 * family anyway... */
214 if (device->chipset >= 0x40) {
215 getparam->value = nv_rd32(device, 0x001540);
216 break;
217 }
218 /* FALLTHRU */
219 default: 215 default:
220 nv_debug(device, "unknown parameter %lld\n", getparam->param); 216 nv_debug(device, "unknown parameter %lld\n", getparam->param);
221 return -EINVAL; 217 return -EINVAL;