Re: [Nouveau] [PATCH 0/2] reclocking stability improvements

2011-04-29 Thread Martin Peres

Le 29/04/2011 02:56, Nigel Cunningham a écrit :

Hi.

On 29/04/11 04:35, Martin Peres wrote:

Le 28/04/2011 20:29, Maxim Levitsky a écrit :

On Thu, 2011-04-28 at 20:24 +0200, Martin Peres wrote:

Le 28/04/2011 18:58, Maxim Levitsky a écrit :

Interesting fact is that GPU temperatures rise to very high levels
(~75C) even while doing CPU only work (like compiling kernel for
example).

Let me guess, you're on a laptop? The temperature of the case goes up
when the processor is working and so, it cools the GPU less ;)

Yes, but that doesn't happen while using nvidia to this extent.
I think that GPU has many units running in endless loop doing nothing
but consuming power (~5W) difference!

I really need to have a look at this. I have a power meter now (acpi
reports me funky power consumption figures because my battery is dead).

Just been reading through your posts from last night, and wanted to let
you know I'm interested and willing to test patches too.

I have an 8600GTS based laptop, and have seen the same range of power
usage (ie have seen 14W in the page - presumably when I was using the
blob -, but can only get it down to 23W at the moment using Nouveau).

Regards,

Nigel
9W! Well, you can try downclocking the card, but this won't get you down 
to 14W. When fan management is done, I'll have a look at what the blob 
does and try to find some magic there.


Martin
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [PATCH 0/2] reclocking stability improvements

2011-04-29 Thread Nigel Cunningham
Hi.

On 29/04/11 16:54, Martin Peres wrote:
 Le 29/04/2011 02:56, Nigel Cunningham a écrit :
 Hi.

 On 29/04/11 04:35, Martin Peres wrote:
 Le 28/04/2011 20:29, Maxim Levitsky a écrit :
 On Thu, 2011-04-28 at 20:24 +0200, Martin Peres wrote:
 Le 28/04/2011 18:58, Maxim Levitsky a écrit :
 Interesting fact is that GPU temperatures rise to very high levels
 (~75C) even while doing CPU only work (like compiling kernel for
 example).
 Let me guess, you're on a laptop? The temperature of the case goes up
 when the processor is working and so, it cools the GPU less ;)
 Yes, but that doesn't happen while using nvidia to this extent.
 I think that GPU has many units running in endless loop doing nothing
 but consuming power (~5W) difference!
 I really need to have a look at this. I have a power meter now (acpi
 reports me funky power consumption figures because my battery is dead).
 Just been reading through your posts from last night, and wanted to let
 you know I'm interested and willing to test patches too.

 I have an 8600GTS based laptop, and have seen the same range of power
 usage (ie have seen 14W in the page - presumably when I was using the
 blob -, but can only get it down to 23W at the moment using Nouveau).

 Regards,

 Nigel
 9W! Well, you can try downclocking the card, but this won't get you down
 to 14W. When fan management is done, I'll have a look at what the blob
 does and try to find some magic there.

Yeah - I find 9W a bit unbelievable too. I'll try to find some time to
give the NVidia driver a run again, but I'm a chronic over-committer, so
won't promise I'll do anything real soon now!

Nigel
-- 
Evolution (n): A hypothetical process whereby improbable
events occur with alarming frequency, order arises from chaos, and
no one is given credit.
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] Problem with nouveau

2011-04-29 Thread Douglas Kaynor
I have a issue in nv50_crtc.c. My system constantly spits out messages No
native mode, forcing panel scaling

The message is output to the screen and to the kernel ring buffer at a rate
of about one every 5 seconds. I commented out line 203 and rebuilt the
kernel so that the system was usable. It now flickers every 5 seconds but is
usable.

Red Hat 6.0 or Suse 11.0 with kernel 2.6.38.4
nVidia G92 (GeForce GTS 250).

If more info is needed please ask.

-- 
Douglas B Kaynor
d...@kaynor.net
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [Bug 35901] two full hd displays (left and right) with nouveau does not work any more

2011-04-29 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=35901

--- Comment #14 from Greg Turner gmturner...@ameritech.net 2011-04-29 
14:13:43 PDT ---
One final note: (can you tell I'd really like to get this resolved?)

after some experimenting, I've figured out the precise nature of the glitch. 
When this glitch occurs, what we are seeing is the top pixel on the screen,
stretched out into screen-tall columns.  In other words, the top row of pixels
is displayed correctly, but all the other rows in the framebuffer are just
duplicates of the top row of pixels.

If anyone would like me to perform any additional experiments, I'd be glad to.

-gmt

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] (no subject)

2011-04-29 Thread Martin Peres
Sorry, forgot to add nouveau_pms.h

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [PATCH 2/2] drm/nouveau/nv50: reclock memory using PMS on nv50

2011-04-29 Thread Martin Peres
From: Martin Peres martin.pe...@ensi-bourges.fr

v2: Reclock memory after reclocking the other engines

Signed-off-by: Martin Peres martin.pe...@ensi-bourges.fr
---
 drivers/gpu/drm/nouveau/nouveau_pm.c  |   11 +--
 drivers/gpu/drm/nouveau/nouveau_pms.h |   98 +
 drivers/gpu/drm/nouveau/nv50_pm.c |  153 ++---
 3 files changed, 242 insertions(+), 20 deletions(-)
 create mode 100644 drivers/gpu/drm/nouveau/nouveau_pms.h

diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c 
b/drivers/gpu/drm/nouveau/nouveau_pm.c
index 88f58b1..44d01bb 100644
--- a/drivers/gpu/drm/nouveau/nouveau_pm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_pm.c
@@ -45,10 +45,6 @@ nouveau_pm_clock_set(struct drm_device *dev, struct 
nouveau_pm_level *perflvl,
if (khz == 0)
return 0;
 
-   /* Do no reclock the memory if the frequencies didn't change */
-   if (id == PLL_MEMORY  pm-cur-memory == khz)
-   return 0;
-
pre_state = pm-clock_pre(dev, perflvl, id, khz);
if (IS_ERR(pre_state))
return PTR_ERR(pre_state);
@@ -100,7 +96,6 @@ nouveau_pm_perflvl_set(struct drm_device *dev, struct 
nouveau_pm_level *perflvl)
 
nouveau_pm_clock_set(dev, perflvl, PLL_CORE, perflvl-core);
nouveau_pm_clock_set(dev, perflvl, PLL_SHADER, perflvl-shader);
-   nouveau_pm_clock_set(dev, perflvl, PLL_MEMORY, perflvl-memory);
nouveau_pm_clock_set(dev, perflvl, PLL_UNK05, perflvl-unk05);
 
/* Decrease the voltage if needed*/
@@ -110,11 +105,13 @@ nouveau_pm_perflvl_set(struct drm_device *dev, struct 
nouveau_pm_level *perflvl)
/* Wait for PLLs to stabilize */
udelay(100);
 
+   pm-unpause(dev);
+
+   nouveau_pm_clock_set(dev, perflvl, PLL_MEMORY, perflvl-memory);
+
pm-cur = perflvl;
ret = 0;
 
-   pm-unpause(dev);
-
NV_DEBUG(dev, Reclocking took %lluns\n,
 (nv04_timer_read(dev) - start));
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_pms.h 
b/drivers/gpu/drm/nouveau/nouveau_pms.h
new file mode 100644
index 000..d7a445b
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nouveau_pms.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2010 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the Software),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Ben Skeggs
+ */
+
+#ifndef __NOUVEAU_PMS_H__
+#define __NOUVEAU_PMS_H__
+
+struct pms_ucode {
+   u8 data[256];
+   union {
+   u8  *u08;
+   u16 *u16;
+   u32 *u32;
+   } ptr;
+   u16 len;
+
+   u32 reg;
+   u32 val;
+};
+
+static inline void
+pms_init(struct pms_ucode *pms)
+{
+   pms-ptr.u08 = pms-data;
+   pms-reg = 0x;
+   pms-val = 0x;
+}
+
+static inline void
+pms_fini(struct pms_ucode *pms)
+{
+   do {
+   *pms-ptr.u08++ = 0x7f;
+   pms-len = pms-ptr.u08 - pms-data;
+   } while (pms-len  3);
+   pms-ptr.u08 = pms-data;
+}
+
+static inline void
+pms_unkn(struct pms_ucode *pms, u8 v0)
+{
+   *pms-ptr.u08++ = v0;
+}
+
+static inline void
+pms_op5f(struct pms_ucode *pms, u8 v0, u8 v1)
+{
+   *pms-ptr.u08++ = 0x5f;
+   *pms-ptr.u08++ = v0;
+   *pms-ptr.u08++ = v1;
+}
+
+static inline void
+pms_wr32(struct pms_ucode *pms, u32 reg, u32 val)
+{
+   if (val != pms-val) {
+   if ((val  0x) == (pms-val  0x)) {
+   *pms-ptr.u08++ = 0x42;
+   *pms-ptr.u16++ = (val  0x);
+   } else {
+   *pms-ptr.u08++ = 0xe2;
+   *pms-ptr.u32++ = val;
+   }
+
+   pms-val = val;
+   }
+
+   if ((reg  0x) == (pms-reg  0x)) {
+   *pms-ptr.u08++ = 0x40;
+   *pms-ptr.u16++ = (reg  0x);
+   } else {
+   *pms-ptr.u08++ = 0xe0;
+   *pms-ptr.u32++ = reg;
+   }
+   pms-reg = 

[Nouveau] [PATCH 1/2] drm/nouveau/pm: Add pm.(un)pause functions

2011-04-29 Thread Martin Peres
From: Martin Peres martin.pe...@ensi-bourges.fr

With this patch, cards without internal memory (IONs and other IGPs)
and cards with no memory reclock (a lot of nv40) should support
safe reclocking while gaming.

This should work on all hardware( nva3), report bugs if it doesn't.

v2: Fix missing symbol at compilation on x86_32 systems
v3: Better voltage management

Signed-off-by: Martin Peres martin.pe...@ensi-bourges.fr
---
 drivers/gpu/drm/nouveau/nouveau_drv.h   |9 ++
 drivers/gpu/drm/nouveau/nouveau_pm.c|   57 +--
 drivers/gpu/drm/nouveau/nouveau_pm.h|4 +
 drivers/gpu/drm/nouveau/nouveau_reg.h   |3 +
 drivers/gpu/drm/nouveau/nouveau_state.c |   13 ++-
 drivers/gpu/drm/nouveau/nv04_pm.c   |  126 ++
 drivers/gpu/drm/nouveau/nv50_pm.c   |  172 +++
 7 files changed, 374 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h 
b/drivers/gpu/drm/nouveau/nouveau_drv.h
index 9c56331..01167fd 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -462,6 +462,10 @@ struct nouveau_pm_memtimings {
int nr_timing;
 };
 
+struct nouveau_pm_pause_card_state {
+   u32 reg_c040;
+};
+
 struct nouveau_pm_engine {
struct nouveau_pm_voltage voltage;
struct nouveau_pm_level perflvl[NOUVEAU_PM_MAX_LEVEL];
@@ -476,6 +480,11 @@ struct nouveau_pm_engine {
struct device *hwmon;
struct notifier_block acpi_nb;
 
+   struct nouveau_pm_pause_card_state pause_state;
+
+   int (*pause)(struct drm_device *);
+   void (*unpause)(struct drm_device *);
+
int (*clock_get)(struct drm_device *, u32 id);
void *(*clock_pre)(struct drm_device *, struct nouveau_pm_level *,
   u32 id, int khz);
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c 
b/drivers/gpu/drm/nouveau/nouveau_pm.c
index da8d994..88f58b1 100644
--- a/drivers/gpu/drm/nouveau/nouveau_pm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_pm.c
@@ -45,6 +45,10 @@ nouveau_pm_clock_set(struct drm_device *dev, struct 
nouveau_pm_level *perflvl,
if (khz == 0)
return 0;
 
+   /* Do no reclock the memory if the frequencies didn't change */
+   if (id == PLL_MEMORY  pm-cur-memory == khz)
+   return 0;
+
pre_state = pm-clock_pre(dev, perflvl, id, khz);
if (IS_ERR(pre_state))
return PTR_ERR(pre_state);
@@ -55,30 +59,66 @@ nouveau_pm_clock_set(struct drm_device *dev, struct 
nouveau_pm_level *perflvl,
 }
 
 static int
+nouveau_pm_voltage_set(struct drm_device *dev, u8 voltage)
+{
+   struct drm_nouveau_private *dev_priv = dev-dev_private;
+   struct nouveau_pm_engine *pm = dev_priv-engine.pm;
+   int ret;
+
+   if (pm-voltage.supported  pm-voltage_set  voltage) {
+   ret = pm-voltage_set(dev, voltage);
+   if (ret) {
+   NV_ERROR(dev, voltage_set %d failed: %d\n,
+voltage, ret);
+   }
+
+   return ret;
+   } else
+   return -EIO;
+}
+
+static int
 nouveau_pm_perflvl_set(struct drm_device *dev, struct nouveau_pm_level 
*perflvl)
 {
struct drm_nouveau_private *dev_priv = dev-dev_private;
struct nouveau_pm_engine *pm = dev_priv-engine.pm;
int ret;
+   uint64_t start = nv04_timer_read(dev);
 
if (perflvl == pm-cur)
return 0;
 
-   if (pm-voltage.supported  pm-voltage_set  perflvl-voltage) {
-   ret = pm-voltage_set(dev, perflvl-voltage);
-   if (ret) {
-   NV_ERROR(dev, voltage_set %d failed: %d\n,
-perflvl-voltage, ret);
-   }
-   }
+   NV_INFO(dev, setting performance level: %s\n, perflvl-name);
+
+   ret = pm-pause(dev);
+   if (ret)
+   return ret;
+
+   /* Increase the voltage now if needed */
+   if (perflvl-voltage  pm-cur-voltage)
+   nouveau_pm_voltage_set(dev, perflvl-voltage);
 
nouveau_pm_clock_set(dev, perflvl, PLL_CORE, perflvl-core);
nouveau_pm_clock_set(dev, perflvl, PLL_SHADER, perflvl-shader);
nouveau_pm_clock_set(dev, perflvl, PLL_MEMORY, perflvl-memory);
nouveau_pm_clock_set(dev, perflvl, PLL_UNK05, perflvl-unk05);
 
+   /* Decrease the voltage if needed*/
+   if (perflvl-voltage  pm-cur-voltage)
+   nouveau_pm_voltage_set(dev, perflvl-voltage);
+
+   /* Wait for PLLs to stabilize */
+   udelay(100);
+
pm-cur = perflvl;
-   return 0;
+   ret = 0;
+
+   pm-unpause(dev);
+
+   NV_DEBUG(dev, Reclocking took %lluns\n,
+(nv04_timer_read(dev) - start));
+
+   return ret;
 }
 
 static int
@@ -112,7 +152,6 @@ nouveau_pm_profile_set(struct drm_device *dev, const char 
*profile)
return -EINVAL;
}
 
-   NV_INFO(dev,