Commit 7e22e71e authored by Christoph Bumiller's avatar Christoph Bumiller Committed by Ben Skeggs

drm/nvc0-: support NOUVEAU_GETPARAM_GRAPH_UNITS

Signed-off-by: default avatarChristoph Bumiller <e0425955@student.tuwien.ac.at>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent e30441ad
...@@ -46,6 +46,14 @@ struct nv40_graph_chan { ...@@ -46,6 +46,14 @@ struct nv40_graph_chan {
struct nouveau_graph_chan base; struct nouveau_graph_chan base;
}; };
static u64
nv40_graph_units(struct nouveau_graph *graph)
{
struct nv40_graph_priv *priv = (void *)graph;
return nv_rd32(priv, 0x1540);
}
/******************************************************************************* /*******************************************************************************
* Graphics object classes * Graphics object classes
******************************************************************************/ ******************************************************************************/
...@@ -359,6 +367,8 @@ nv40_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine, ...@@ -359,6 +367,8 @@ nv40_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
else else
nv_engine(priv)->sclass = nv40_graph_sclass; nv_engine(priv)->sclass = nv40_graph_sclass;
nv_engine(priv)->tile_prog = nv40_graph_tile_prog; nv_engine(priv)->tile_prog = nv40_graph_tile_prog;
priv->base.units = nv40_graph_units;
return 0; return 0;
} }
......
...@@ -48,6 +48,14 @@ struct nv50_graph_chan { ...@@ -48,6 +48,14 @@ struct nv50_graph_chan {
struct nouveau_graph_chan base; struct nouveau_graph_chan base;
}; };
static u64
nv50_graph_units(struct nouveau_graph *graph)
{
struct nv50_graph_priv *priv = (void *)graph;
return nv_rd32(priv, 0x1540);
}
/******************************************************************************* /*******************************************************************************
* Graphics object classes * Graphics object classes
******************************************************************************/ ******************************************************************************/
...@@ -819,6 +827,8 @@ nv50_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine, ...@@ -819,6 +827,8 @@ nv50_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
nv_subdev(priv)->intr = nv50_graph_intr; nv_subdev(priv)->intr = nv50_graph_intr;
nv_engine(priv)->cclass = &nv50_graph_cclass; nv_engine(priv)->cclass = &nv50_graph_cclass;
priv->base.units = nv50_graph_units;
switch (nv_device(priv)->chipset) { switch (nv_device(priv)->chipset) {
case 0x50: case 0x50:
nv_engine(priv)->sclass = nv50_graph_sclass; nv_engine(priv)->sclass = nv50_graph_sclass;
......
...@@ -60,6 +60,19 @@ nvc8_graph_sclass[] = { ...@@ -60,6 +60,19 @@ nvc8_graph_sclass[] = {
{} {}
}; };
u64
nvc0_graph_units(struct nouveau_graph *graph)
{
struct nvc0_graph_priv *priv = (void *)graph;
u64 cfg;
cfg = (u32)priv->gpc_nr;
cfg |= (u32)priv->tpc_total << 8;
cfg |= (u64)priv->rop_nr << 32;
return cfg;
}
/******************************************************************************* /*******************************************************************************
* PGRAPH context * PGRAPH context
******************************************************************************/ ******************************************************************************/
...@@ -529,6 +542,8 @@ nvc0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine, ...@@ -529,6 +542,8 @@ nvc0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
nv_subdev(priv)->intr = nvc0_graph_intr; nv_subdev(priv)->intr = nvc0_graph_intr;
nv_engine(priv)->cclass = &nvc0_graph_cclass; nv_engine(priv)->cclass = &nvc0_graph_cclass;
priv->base.units = nvc0_graph_units;
if (nouveau_boolopt(device->cfgopt, "NvGrUseFW", false)) { if (nouveau_boolopt(device->cfgopt, "NvGrUseFW", false)) {
nv_info(priv, "using external firmware\n"); nv_info(priv, "using external firmware\n");
if (nvc0_graph_ctor_fw(priv, "fuc409c", &priv->fuc409c) || if (nvc0_graph_ctor_fw(priv, "fuc409c", &priv->fuc409c) ||
......
...@@ -169,4 +169,6 @@ int nvc0_graph_context_ctor(struct nouveau_object *, struct nouveau_object *, ...@@ -169,4 +169,6 @@ int nvc0_graph_context_ctor(struct nouveau_object *, struct nouveau_object *,
struct nouveau_object **); struct nouveau_object **);
void nvc0_graph_context_dtor(struct nouveau_object *); void nvc0_graph_context_dtor(struct nouveau_object *);
u64 nvc0_graph_units(struct nouveau_graph *);
#endif #endif
...@@ -217,6 +217,8 @@ nve0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine, ...@@ -217,6 +217,8 @@ nve0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
nv_engine(priv)->cclass = &nve0_graph_cclass; nv_engine(priv)->cclass = &nve0_graph_cclass;
nv_engine(priv)->sclass = nve0_graph_sclass; nv_engine(priv)->sclass = nve0_graph_sclass;
priv->base.units = nvc0_graph_units;
if (nouveau_boolopt(device->cfgopt, "NvGrUseFW", false)) { if (nouveau_boolopt(device->cfgopt, "NvGrUseFW", false)) {
nv_info(priv, "using external firmware\n"); nv_info(priv, "using external firmware\n");
if (nvc0_graph_ctor_fw(priv, "fuc409c", &priv->fuc409c) || if (nvc0_graph_ctor_fw(priv, "fuc409c", &priv->fuc409c) ||
......
...@@ -26,6 +26,10 @@ struct nouveau_graph_chan { ...@@ -26,6 +26,10 @@ struct nouveau_graph_chan {
struct nouveau_graph { struct nouveau_graph {
struct nouveau_engine base; struct nouveau_engine base;
/* Returns chipset-specific counts of units packed into an u64.
*/
u64 (*units)(struct nouveau_graph *);
}; };
static inline struct nouveau_graph * static inline struct nouveau_graph *
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <subdev/fb.h> #include <subdev/fb.h>
#include <subdev/timer.h> #include <subdev/timer.h>
#include <subdev/instmem.h> #include <subdev/instmem.h>
#include <engine/graph.h>
#include "nouveau_drm.h" #include "nouveau_drm.h"
#include "nouveau_dma.h" #include "nouveau_dma.h"
...@@ -168,6 +169,7 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS) ...@@ -168,6 +169,7 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_device *device = nv_device(drm->device); struct nouveau_device *device = nv_device(drm->device);
struct nouveau_timer *ptimer = nouveau_timer(device); struct nouveau_timer *ptimer = nouveau_timer(device);
struct nouveau_graph *graph = (void *)nouveau_engine(device, NVDEV_ENGINE_GR);
struct drm_nouveau_getparam *getparam = data; struct drm_nouveau_getparam *getparam = data;
switch (getparam->param) { switch (getparam->param) {
...@@ -208,14 +210,8 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS) ...@@ -208,14 +210,8 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
getparam->value = 1; getparam->value = 1;
break; break;
case NOUVEAU_GETPARAM_GRAPH_UNITS: case NOUVEAU_GETPARAM_GRAPH_UNITS:
/* NV40 and NV50 versions are quite different, but register getparam->value = graph->units ? graph->units(graph) : 0;
* address is the same. User is supposed to know the card break;
* family anyway... */
if (device->chipset >= 0x40) {
getparam->value = nv_rd32(device, 0x001540);
break;
}
/* FALLTHRU */
default: default:
nv_debug(device, "unknown parameter %lld\n", getparam->param); nv_debug(device, "unknown parameter %lld\n", getparam->param);
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment