diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-04 02:29:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-04 02:29:23 -0400 |
commit | 612a9aab56a93533e76e3ad91642db7033e03b69 (patch) | |
tree | 8402096973f67af941f9392f7da06cca03e0b58a /drivers/gpu/drm/nouveau/nouveau_perf.c | |
parent | 3a494318b14b1bc0f59d2d6ce84c505c74d82d2a (diff) | |
parent | 268d28371cd326be4dfcd7eba5917bf4b9d30c8f (diff) |
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm merge (part 1) from Dave Airlie:
"So first of all my tree and uapi stuff has a conflict mess, its my
fault as the nouveau stuff didn't hit -next as were trying to rebase
regressions out of it before we merged.
Highlights:
- SH mobile modesetting driver and associated helpers
- some DRM core documentation
- i915 modesetting rework, haswell hdmi, haswell and vlv fixes, write
combined pte writing, ilk rc6 support,
- nouveau: major driver rework into a hw core driver, makes features
like SLI a lot saner to implement,
- psb: add eDP/DP support for Cedarview
- radeon: 2 layer page tables, async VM pte updates, better PLL
selection for > 2 screens, better ACPI interactions
The rest is general grab bag of fixes.
So why part 1? well I have the exynos pull req which came in a bit
late but was waiting for me to do something they shouldn't have and it
looks fairly safe, and David Howells has some more header cleanups
he'd like me to pull, that seem like a good idea, but I'd like to get
this merge out of the way so -next dosen't get blocked."
Tons of conflicts mostly due to silly include line changes, but mostly
mindless. A few other small semantic conflicts too, noted from Dave's
pre-merged branch.
* 'drm-next' of git://people.freedesktop.org/~airlied/linux: (447 commits)
drm/nv98/crypt: fix fuc build with latest envyas
drm/nouveau/devinit: fixup various issues with subdev ctor/init ordering
drm/nv41/vm: fix and enable use of "real" pciegart
drm/nv44/vm: fix and enable use of "real" pciegart
drm/nv04/dmaobj: fixup vm target handling in preparation for nv4x pcie
drm/nouveau: store supported dma mask in vmmgr
drm/nvc0/ibus: initial implementation of subdev
drm/nouveau/therm: add support for fan-control modes
drm/nouveau/hwmon: rename pwm0* to pmw1* to follow hwmon's rules
drm/nouveau/therm: calculate the pwm divisor on nv50+
drm/nouveau/fan: rewrite the fan tachometer driver to get more precision, faster
drm/nouveau/therm: move thermal-related functions to the therm subdev
drm/nouveau/bios: parse the pwm divisor from the perf table
drm/nouveau/therm: use the EXTDEV table to detect i2c monitoring devices
drm/nouveau/therm: rework thermal table parsing
drm/nouveau/gpio: expose the PWM/TOGGLE parameter found in the gpio vbios table
drm/nouveau: fix pm initialization order
drm/nouveau/bios: check that fixed tvdac gpio data is valid before using it
drm/nouveau: log channel debug/error messages from client object rather than drm client
drm/nouveau: have drm debugging macros build on top of core macros
...
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_perf.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_perf.c | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_perf.c b/drivers/gpu/drm/nouveau/nouveau_perf.c index 4946d308a362..4fe883c54918 100644 --- a/drivers/gpu/drm/nouveau/nouveau_perf.c +++ b/drivers/gpu/drm/nouveau/nouveau_perf.c | |||
@@ -24,14 +24,15 @@ | |||
24 | 24 | ||
25 | #include <drm/drmP.h> | 25 | #include <drm/drmP.h> |
26 | 26 | ||
27 | #include "nouveau_drv.h" | 27 | #include "nouveau_drm.h" |
28 | #include "nouveau_reg.h" | ||
28 | #include "nouveau_pm.h" | 29 | #include "nouveau_pm.h" |
29 | 30 | ||
30 | static u8 * | 31 | static u8 * |
31 | nouveau_perf_table(struct drm_device *dev, u8 *ver) | 32 | nouveau_perf_table(struct drm_device *dev, u8 *ver) |
32 | { | 33 | { |
33 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 34 | struct nouveau_drm *drm = nouveau_drm(dev); |
34 | struct nvbios *bios = &dev_priv->vbios; | 35 | struct nvbios *bios = &drm->vbios; |
35 | struct bit_entry P; | 36 | struct bit_entry P; |
36 | 37 | ||
37 | if (!bit_table(dev, 'P', &P) && P.version && P.version <= 2) { | 38 | if (!bit_table(dev, 'P', &P) && P.version && P.version <= 2) { |
@@ -87,7 +88,7 @@ u8 * | |||
87 | nouveau_perf_rammap(struct drm_device *dev, u32 freq, | 88 | nouveau_perf_rammap(struct drm_device *dev, u32 freq, |
88 | u8 *ver, u8 *hdr, u8 *cnt, u8 *len) | 89 | u8 *ver, u8 *hdr, u8 *cnt, u8 *len) |
89 | { | 90 | { |
90 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 91 | struct nouveau_drm *drm = nouveau_drm(dev); |
91 | struct bit_entry P; | 92 | struct bit_entry P; |
92 | u8 *perf, i = 0; | 93 | u8 *perf, i = 0; |
93 | 94 | ||
@@ -114,8 +115,8 @@ nouveau_perf_rammap(struct drm_device *dev, u32 freq, | |||
114 | return NULL; | 115 | return NULL; |
115 | } | 116 | } |
116 | 117 | ||
117 | if (dev_priv->chipset == 0x49 || | 118 | if (nv_device(drm->device)->chipset == 0x49 || |
118 | dev_priv->chipset == 0x4b) | 119 | nv_device(drm->device)->chipset == 0x4b) |
119 | freq /= 2; | 120 | freq /= 2; |
120 | 121 | ||
121 | while ((perf = nouveau_perf_entry(dev, i++, ver, hdr, cnt, len))) { | 122 | while ((perf = nouveau_perf_entry(dev, i++, ver, hdr, cnt, len))) { |
@@ -142,12 +143,13 @@ nouveau_perf_rammap(struct drm_device *dev, u32 freq, | |||
142 | u8 * | 143 | u8 * |
143 | nouveau_perf_ramcfg(struct drm_device *dev, u32 freq, u8 *ver, u8 *len) | 144 | nouveau_perf_ramcfg(struct drm_device *dev, u32 freq, u8 *ver, u8 *len) |
144 | { | 145 | { |
145 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 146 | struct nouveau_device *device = nouveau_dev(dev); |
146 | struct nvbios *bios = &dev_priv->vbios; | 147 | struct nouveau_drm *drm = nouveau_drm(dev); |
148 | struct nvbios *bios = &drm->vbios; | ||
147 | u8 strap, hdr, cnt; | 149 | u8 strap, hdr, cnt; |
148 | u8 *rammap; | 150 | u8 *rammap; |
149 | 151 | ||
150 | strap = (nv_rd32(dev, 0x101000) & 0x0000003c) >> 2; | 152 | strap = (nv_rd32(device, 0x101000) & 0x0000003c) >> 2; |
151 | if (bios->ram_restrict_tbl_ptr) | 153 | if (bios->ram_restrict_tbl_ptr) |
152 | strap = bios->data[bios->ram_restrict_tbl_ptr + strap]; | 154 | strap = bios->data[bios->ram_restrict_tbl_ptr + strap]; |
153 | 155 | ||
@@ -161,8 +163,8 @@ nouveau_perf_ramcfg(struct drm_device *dev, u32 freq, u8 *ver, u8 *len) | |||
161 | u8 * | 163 | u8 * |
162 | nouveau_perf_timing(struct drm_device *dev, u32 freq, u8 *ver, u8 *len) | 164 | nouveau_perf_timing(struct drm_device *dev, u32 freq, u8 *ver, u8 *len) |
163 | { | 165 | { |
164 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 166 | struct nouveau_drm *drm = nouveau_drm(dev); |
165 | struct nvbios *bios = &dev_priv->vbios; | 167 | struct nvbios *bios = &drm->vbios; |
166 | struct bit_entry P; | 168 | struct bit_entry P; |
167 | u8 *perf, *timing = NULL; | 169 | u8 *perf, *timing = NULL; |
168 | u8 i = 0, hdr, cnt; | 170 | u8 i = 0, hdr, cnt; |
@@ -202,20 +204,21 @@ nouveau_perf_timing(struct drm_device *dev, u32 freq, u8 *ver, u8 *len) | |||
202 | static void | 204 | static void |
203 | legacy_perf_init(struct drm_device *dev) | 205 | legacy_perf_init(struct drm_device *dev) |
204 | { | 206 | { |
205 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 207 | struct nouveau_device *device = nouveau_dev(dev); |
206 | struct nvbios *bios = &dev_priv->vbios; | 208 | struct nouveau_drm *drm = nouveau_drm(dev); |
207 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; | 209 | struct nvbios *bios = &drm->vbios; |
210 | struct nouveau_pm *pm = nouveau_pm(dev); | ||
208 | char *perf, *entry, *bmp = &bios->data[bios->offset]; | 211 | char *perf, *entry, *bmp = &bios->data[bios->offset]; |
209 | int headerlen, use_straps; | 212 | int headerlen, use_straps; |
210 | 213 | ||
211 | if (bmp[5] < 0x5 || bmp[6] < 0x14) { | 214 | if (bmp[5] < 0x5 || bmp[6] < 0x14) { |
212 | NV_DEBUG(dev, "BMP version too old for perf\n"); | 215 | NV_DEBUG(drm, "BMP version too old for perf\n"); |
213 | return; | 216 | return; |
214 | } | 217 | } |
215 | 218 | ||
216 | perf = ROMPTR(dev, bmp[0x73]); | 219 | perf = ROMPTR(dev, bmp[0x73]); |
217 | if (!perf) { | 220 | if (!perf) { |
218 | NV_DEBUG(dev, "No memclock table pointer found.\n"); | 221 | NV_DEBUG(drm, "No memclock table pointer found.\n"); |
219 | return; | 222 | return; |
220 | } | 223 | } |
221 | 224 | ||
@@ -231,13 +234,13 @@ legacy_perf_init(struct drm_device *dev) | |||
231 | headerlen = (use_straps ? 8 : 2); | 234 | headerlen = (use_straps ? 8 : 2); |
232 | break; | 235 | break; |
233 | default: | 236 | default: |
234 | NV_WARN(dev, "Unknown memclock table version %x.\n", perf[0]); | 237 | NV_WARN(drm, "Unknown memclock table version %x.\n", perf[0]); |
235 | return; | 238 | return; |
236 | } | 239 | } |
237 | 240 | ||
238 | entry = perf + headerlen; | 241 | entry = perf + headerlen; |
239 | if (use_straps) | 242 | if (use_straps) |
240 | entry += (nv_rd32(dev, NV_PEXTDEV_BOOT_0) & 0x3c) >> 1; | 243 | entry += (nv_rd32(device, NV_PEXTDEV_BOOT_0) & 0x3c) >> 1; |
241 | 244 | ||
242 | sprintf(pm->perflvl[0].name, "performance_level_0"); | 245 | sprintf(pm->perflvl[0].name, "performance_level_0"); |
243 | pm->perflvl[0].memory = ROM16(entry[0]) * 20; | 246 | pm->perflvl[0].memory = ROM16(entry[0]) * 20; |
@@ -247,7 +250,7 @@ legacy_perf_init(struct drm_device *dev) | |||
247 | static void | 250 | static void |
248 | nouveau_perf_voltage(struct drm_device *dev, struct nouveau_pm_level *perflvl) | 251 | nouveau_perf_voltage(struct drm_device *dev, struct nouveau_pm_level *perflvl) |
249 | { | 252 | { |
250 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 253 | struct nouveau_drm *drm = nouveau_drm(dev); |
251 | struct bit_entry P; | 254 | struct bit_entry P; |
252 | u8 *vmap; | 255 | u8 *vmap; |
253 | int id; | 256 | int id; |
@@ -258,7 +261,7 @@ nouveau_perf_voltage(struct drm_device *dev, struct nouveau_pm_level *perflvl) | |||
258 | /* boards using voltage table version <0x40 store the voltage | 261 | /* boards using voltage table version <0x40 store the voltage |
259 | * level directly in the perflvl entry as a multiple of 10mV | 262 | * level directly in the perflvl entry as a multiple of 10mV |
260 | */ | 263 | */ |
261 | if (dev_priv->engine.pm.voltage.version < 0x40) { | 264 | if (drm->pm->voltage.version < 0x40) { |
262 | perflvl->volt_min = id * 10000; | 265 | perflvl->volt_min = id * 10000; |
263 | perflvl->volt_max = perflvl->volt_min; | 266 | perflvl->volt_max = perflvl->volt_min; |
264 | return; | 267 | return; |
@@ -268,14 +271,14 @@ nouveau_perf_voltage(struct drm_device *dev, struct nouveau_pm_level *perflvl) | |||
268 | * vbios table containing a min/max voltage value for the perflvl | 271 | * vbios table containing a min/max voltage value for the perflvl |
269 | */ | 272 | */ |
270 | if (bit_table(dev, 'P', &P) || P.version != 2 || P.length < 34) { | 273 | if (bit_table(dev, 'P', &P) || P.version != 2 || P.length < 34) { |
271 | NV_DEBUG(dev, "where's our volt map table ptr? %d %d\n", | 274 | NV_DEBUG(drm, "where's our volt map table ptr? %d %d\n", |
272 | P.version, P.length); | 275 | P.version, P.length); |
273 | return; | 276 | return; |
274 | } | 277 | } |
275 | 278 | ||
276 | vmap = ROMPTR(dev, P.data[32]); | 279 | vmap = ROMPTR(dev, P.data[32]); |
277 | if (!vmap) { | 280 | if (!vmap) { |
278 | NV_DEBUG(dev, "volt map table pointer invalid\n"); | 281 | NV_DEBUG(drm, "volt map table pointer invalid\n"); |
279 | return; | 282 | return; |
280 | } | 283 | } |
281 | 284 | ||
@@ -289,9 +292,9 @@ nouveau_perf_voltage(struct drm_device *dev, struct nouveau_pm_level *perflvl) | |||
289 | void | 292 | void |
290 | nouveau_perf_init(struct drm_device *dev) | 293 | nouveau_perf_init(struct drm_device *dev) |
291 | { | 294 | { |
292 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 295 | struct nouveau_drm *drm = nouveau_drm(dev); |
293 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; | 296 | struct nouveau_pm *pm = nouveau_pm(dev); |
294 | struct nvbios *bios = &dev_priv->vbios; | 297 | struct nvbios *bios = &drm->vbios; |
295 | u8 *perf, ver, hdr, cnt, len; | 298 | u8 *perf, ver, hdr, cnt, len; |
296 | int ret, vid, i = -1; | 299 | int ret, vid, i = -1; |
297 | 300 | ||
@@ -301,8 +304,6 @@ nouveau_perf_init(struct drm_device *dev) | |||
301 | } | 304 | } |
302 | 305 | ||
303 | perf = nouveau_perf_table(dev, &ver); | 306 | perf = nouveau_perf_table(dev, &ver); |
304 | if (ver >= 0x20 && ver < 0x40) | ||
305 | pm->fan.pwm_divisor = ROM16(perf[6]); | ||
306 | 307 | ||
307 | while ((perf = nouveau_perf_entry(dev, ++i, &ver, &hdr, &cnt, &len))) { | 308 | while ((perf = nouveau_perf_entry(dev, ++i, &ver, &hdr, &cnt, &len))) { |
308 | struct nouveau_pm_level *perflvl = &pm->perflvl[pm->nr_perflvl]; | 309 | struct nouveau_pm_level *perflvl = &pm->perflvl[pm->nr_perflvl]; |
@@ -328,8 +329,8 @@ nouveau_perf_init(struct drm_device *dev) | |||
328 | perflvl->shader = ROM16(perf[6]) * 1000; | 329 | perflvl->shader = ROM16(perf[6]) * 1000; |
329 | perflvl->core = perflvl->shader; | 330 | perflvl->core = perflvl->shader; |
330 | perflvl->core += (signed char)perf[8] * 1000; | 331 | perflvl->core += (signed char)perf[8] * 1000; |
331 | if (dev_priv->chipset == 0x49 || | 332 | if (nv_device(drm->device)->chipset == 0x49 || |
332 | dev_priv->chipset == 0x4b) | 333 | nv_device(drm->device)->chipset == 0x4b) |
333 | perflvl->memory = ROM16(perf[11]) * 1000; | 334 | perflvl->memory = ROM16(perf[11]) * 1000; |
334 | else | 335 | else |
335 | perflvl->memory = ROM16(perf[11]) * 2000; | 336 | perflvl->memory = ROM16(perf[11]) * 2000; |
@@ -356,7 +357,7 @@ nouveau_perf_init(struct drm_device *dev) | |||
356 | #define subent(n) ((ROM16(perf[hdr + (n) * len]) & 0xfff) * 1000) | 357 | #define subent(n) ((ROM16(perf[hdr + (n) * len]) & 0xfff) * 1000) |
357 | perflvl->fanspeed = 0; /*XXX*/ | 358 | perflvl->fanspeed = 0; /*XXX*/ |
358 | perflvl->volt_min = perf[2]; | 359 | perflvl->volt_min = perf[2]; |
359 | if (dev_priv->card_type == NV_50) { | 360 | if (nv_device(drm->device)->card_type == NV_50) { |
360 | perflvl->core = subent(0); | 361 | perflvl->core = subent(0); |
361 | perflvl->shader = subent(1); | 362 | perflvl->shader = subent(1); |
362 | perflvl->memory = subent(2); | 363 | perflvl->memory = subent(2); |
@@ -382,7 +383,7 @@ nouveau_perf_init(struct drm_device *dev) | |||
382 | if (pm->voltage.supported && perflvl->volt_min) { | 383 | if (pm->voltage.supported && perflvl->volt_min) { |
383 | vid = nouveau_volt_vid_lookup(dev, perflvl->volt_min); | 384 | vid = nouveau_volt_vid_lookup(dev, perflvl->volt_min); |
384 | if (vid < 0) { | 385 | if (vid < 0) { |
385 | NV_DEBUG(dev, "perflvl %d, bad vid\n", i); | 386 | NV_DEBUG(drm, "perflvl %d, bad vid\n", i); |
386 | continue; | 387 | continue; |
387 | } | 388 | } |
388 | } | 389 | } |
@@ -391,7 +392,7 @@ nouveau_perf_init(struct drm_device *dev) | |||
391 | ret = nouveau_mem_timing_calc(dev, perflvl->memory, | 392 | ret = nouveau_mem_timing_calc(dev, perflvl->memory, |
392 | &perflvl->timing); | 393 | &perflvl->timing); |
393 | if (ret) { | 394 | if (ret) { |
394 | NV_DEBUG(dev, "perflvl %d, bad timing: %d\n", i, ret); | 395 | NV_DEBUG(drm, "perflvl %d, bad timing: %d\n", i, ret); |
395 | continue; | 396 | continue; |
396 | } | 397 | } |
397 | 398 | ||