aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_perf.c
diff options
context:
space:
mode:
authorMartin Peres <martin.peres@free.fr>2011-04-13 18:46:19 -0400
committerBen Skeggs <bskeggs@redhat.com>2011-05-15 20:50:30 -0400
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 670e3cb697e..5b87e68b00a 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)
82 u8 version, headerlen, recordlen, entries; 82 u8 version, headerlen, recordlen, entries;
83 u8 *perf, *entry; 83 u8 *perf, *entry;
84 int vid, i; 84 int vid, i;
85 u8 ramcfg = (nv_rd32(dev, NV_PEXTDEV_BOOT_0) & 0x3c) >> 2;
85 86
86 if (bios->type == NVBIOS_BIT) { 87 if (bios->type == NVBIOS_BIT) {
87 if (bit_table(dev, 'P', &P)) 88 if (bit_table(dev, 'P', &P))
@@ -124,6 +125,8 @@ nouveau_perf_init(struct drm_device *dev)
124 for (i = 0; i < entries; i++) { 125 for (i = 0; i < entries; i++) {
125 struct nouveau_pm_level *perflvl = &pm->perflvl[pm->nr_perflvl]; 126 struct nouveau_pm_level *perflvl = &pm->perflvl[pm->nr_perflvl];
126 127
128 perflvl->timing = NULL;
129
127 if (entry[0] == 0xff) { 130 if (entry[0] == 0xff) {
128 entry += recordlen; 131 entry += recordlen;
129 continue; 132 continue;
@@ -190,6 +193,22 @@ nouveau_perf_init(struct drm_device *dev)
190 } 193 }
191 } 194 }
192 195
196 /* get the corresponding memory timings */
197 if (pm->memtimings.supported) {
198 u8 timing_id = 0xff;
199 u16 extra_data;
200
201 if (version > 0x15 && version < 0x40 &&
202 ramcfg < perf[4]) {
203 extra_data = perf[3] + (ramcfg * perf[5]);
204 timing_id = entry[extra_data + 1];
205 }
206
207 if (pm->memtimings.nr_timing > timing_id)
208 perflvl->timing =
209 &pm->memtimings.timing[timing_id];
210 }
211
193 snprintf(perflvl->name, sizeof(perflvl->name), 212 snprintf(perflvl->name, sizeof(perflvl->name),
194 "performance_level_%d", i); 213 "performance_level_%d", i);
195 perflvl->id = i; 214 perflvl->id = i;