summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/nouveau/nouveau_perf.c
diff options
context:
space:
mode:
authorMartin Peres <martin.peres@free.fr>2011-04-14 00:46:19 +0200
committerBen Skeggs <bskeggs@redhat.com>2011-05-16 10:50:30 +1000
commite614b2e7ca9f9946cede13b34c950b92af6fa7ef (patch)
treed721917f2a547fd6f9471deb36bb23aceb569b70 /drivers/gpu/drm/nouveau/nouveau_perf.c
parentdac55b58253fe4ced44979543bde35d25eaf56dc (diff)
drm/nouveau: Associate memtimings with performance levels on cards <= nv98
v2 (Ben Skeggs): fix ramcfg strap, and remove bogus handling of perf 0x40 Signed-off-by: Martin Peres <martin.peres@ensi-bourges.fr> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_perf.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_perf.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_perf.c b/drivers/gpu/drm/nouveau/nouveau_perf.c
index 670e3cb697ec..5b87e68b00ae 100644
--- a/drivers/gpu/drm/nouveau/nouveau_perf.c
+++ b/drivers/gpu/drm/nouveau/nouveau_perf.c
@@ -82,6 +82,7 @@ nouveau_perf_init(struct drm_device *dev)
u8 version, headerlen, recordlen, entries;
u8 *perf, *entry;
int vid, i;
+ u8 ramcfg = (nv_rd32(dev, NV_PEXTDEV_BOOT_0) & 0x3c) >> 2;
if (bios->type == NVBIOS_BIT) {
if (bit_table(dev, 'P', &P))
@@ -124,6 +125,8 @@ nouveau_perf_init(struct drm_device *dev)
for (i = 0; i < entries; i++) {
struct nouveau_pm_level *perflvl = &pm->perflvl[pm->nr_perflvl];
+ perflvl->timing = NULL;
+
if (entry[0] == 0xff) {
entry += recordlen;
continue;
@@ -190,6 +193,22 @@ nouveau_perf_init(struct drm_device *dev)
}
}
+ /* get the corresponding memory timings */
+ if (pm->memtimings.supported) {
+ u8 timing_id = 0xff;
+ u16 extra_data;
+
+ if (version > 0x15 && version < 0x40 &&
+ ramcfg < perf[4]) {
+ extra_data = perf[3] + (ramcfg * perf[5]);
+ timing_id = entry[extra_data + 1];
+ }
+
+ if (pm->memtimings.nr_timing > timing_id)
+ perflvl->timing =
+ &pm->memtimings.timing[timing_id];
+ }
+
snprintf(perflvl->name, sizeof(perflvl->name),
"performance_level_%d", i);
perflvl->id = i;