Re: [Intel-gfx] [PATCH 1/5] drm/i915: downgrade non-lethal BUG_ONs

2011-04-20 Thread Chris Wilson
On Tue, 19 Apr 2011 22:46:00 +0200, Daniel Vetter wrote: > If it's a simple gem accounting error that won't lead to immediate harm > (like a NULL-deref) or is a simple violation of a required invariant > that the caller should always check/ensure, downgrade the BUG_ON to > a WARN_ON and hope the

[Intel-gfx] Remove dead code from intel_get_load_detect_pipe

2011-04-20 Thread Chris Wilson
One of the original chores for intel_get_load_detect_pipe() was to steal a CRTC from an active output for the transient purpose of load detection. Understandably this code was removed some time ago, but its legacy remains. In order to fix a real bug, where we failed to attach a fb, I first had to r

[Intel-gfx] [PATCH 4/6] drm/i915: Pass the saved adjusted_mode when adding to the load-detect crtc

2011-04-20 Thread Chris Wilson
Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/intel_display.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 0d8d5e2..61fa02f 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++

[Intel-gfx] [PATCH 6/6] drm/i915: Attach a fb to the load-detect pipe

2011-04-20 Thread Chris Wilson
We need to ensure that we feed valid memory into the display plane attached to the pipe when switching the pipe on. Otherwise, the display engine may read through an invalid PTE and so throw an PGTBL_ER exception. For bonus amusement value, we perform the first load detect before even establishing

[Intel-gfx] [PATCH 5/6] drm/i915: Remove dead code from intel_get_load_detect_pipe()

2011-04-20 Thread Chris Wilson
As we only allow the use of a disabled CRTC, we don't need to handle the case we are reusing an already enabled pipe. Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/intel_display.c | 28 ++-- 1 files changed, 10 insertions(+), 18 deletions(-) diff --git a/drivers

[Intel-gfx] [PATCH 3/6] drm/i915: Remove unused supported_crtc from intel_load_detect_pipe

2011-04-20 Thread Chris Wilson
... and the no longer relevant comment. The code ceased stealing a pipe for load detection a long time ago. Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/intel_display.c |7 ++- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/

[Intel-gfx] [PATCH 2/6] drm/i915: Don't store temporary load-detect variables in the generic encoder

2011-04-20 Thread Chris Wilson
Keep all the state required for undoing and restoring the previous pipe configuration together in a single struct passed from intel_get_load_detect_pipe() to intel_release_load_detect_pipe() rather than stuffing them inside the common encoder structure. Signed-off-by: Chris Wilson --- drivers/gp

[Intel-gfx] [PATCH 1/6] drm/i915: Simplify return value from intel_get_load_detect_pipe

2011-04-20 Thread Chris Wilson
... and so remove the confusion as to whether to use the returned crtc or intel_encoder->base.crtc with the subsequent load-detection. Even though they were the same, the two instances of load-detection code disagreed over which was the more correct. Signed-off-by: Chris Wilson --- drivers/gpu/d

Re: [Intel-gfx] [PATCH 2/3] drm/i915: Attach a fb to the load-detect pipe

2011-04-20 Thread Chris Wilson
On Tue, 19 Apr 2011 14:26:04 -0700, Keith Packard wrote: > On Tue, 19 Apr 2011 21:32:02 +0100, Chris Wilson > wrote: > > > We need to ensure that we feed valid memory into the display plane > > attached to the pipe when switching the pipe on. Otherwise, the display > > engine may read through a

Re: [Intel-gfx] [PATCH 1/5] drm/i915: downgrade non-lethal BUG_ONs

2011-04-20 Thread Ben Widawsky
On Wed, Apr 20, 2011 at 09:18:03AM +0100, Chris Wilson wrote: > > diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c > > b/drivers/gpu/drm/i915/i915_gem_execbuffer.c > > index 316603e..8cac87c 100644 > > --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c > > +++ b/drivers/gpu/drm/i915/i915_gem

Re: [Intel-gfx] [PATCH 1/5] drm/i915: downgrade non-lethal BUG_ONs

2011-04-20 Thread Chris Wilson
On Wed, 20 Apr 2011 07:27:24 -0700, Ben Widawsky wrote: > On Wed, Apr 20, 2011 at 09:18:03AM +0100, Chris Wilson wrote: > > > > diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c > > > b/drivers/gpu/drm/i915/i915_gem_execbuffer.c > > > index 316603e..8cac87c 100644 > > > --- a/drivers/gpu/d

Re: [Intel-gfx] [PATCH 1/3] drm/i915: make FDI training a display function

2011-04-20 Thread Ben Widawsky
On Thu, Apr 07, 2011 at 02:32:58PM -0700, Jesse Barnes wrote: > Rather than branching in ironlake_pch_enable, add a new train_fdi > function to the display function pointer struct and use it instead. > > Signed-off-by: Jesse Barnes > --- > drivers/gpu/drm/i915/i915_drv.h |1 + > drivers

Re: [Intel-gfx] [PATCH 1/3] drm/i915: make FDI training a display function

2011-04-20 Thread Jesse Barnes
On Wed, 20 Apr 2011 07:45:08 -0700 Ben Widawsky wrote: > > @@ -7270,6 +7267,7 @@ static void intel_init_display(struct drm_device *dev) > > "Disable CxSR\n"); > > dev_priv->display.update_wm = NULL; > > } > >

[Intel-gfx] [PATCH] drm/i915/dp: Be paranoid in case we disable a DP before it is attached

2011-04-20 Thread Chris Wilson
Given that the hardware may be left in a random condition by the BIOS, it is conceivable that we then attempt to clear the DP_PIPEB_SELECT bit without us ever enabling/attaching the DP encoder to a pipe. Thus causing a NULL deference when we attempt to wait for a vblank on that crtc. Reported-and-

Re: [Intel-gfx] [PATCH] drm/i915/dp: Be paranoid in case we disable a DP before it is attached

2011-04-20 Thread Keith Packard
On Wed, 20 Apr 2011 16:42:08 +0100, Chris Wilson wrote: > Given that the hardware may be left in a random condition by the BIOS, > it is conceivable that we then attempt to clear the DP_PIPEB_SELECT bit > without us ever enabling/attaching the DP encoder to a pipe. Thus > causing a NULL deference

Re: [Intel-gfx] [PATCH 1/6] drm/i915: Simplify return value from intel_get_load_detect_pipe

2011-04-20 Thread Keith Packard
On Wed, 20 Apr 2011 10:22:17 +0100, Chris Wilson wrote: > + > + if (!drm_crtc_helper_set_mode(crtc, mode, 0, 0, crtc->fb)) { > + DRM_DEBUG_KMS("failed to set mode on load-detect > pipe\n"); > + return false; > + } This seems like

Re: [Intel-gfx] [PATCH 2/6] drm/i915: Don't store temporary load-detect variables in the generic encoder

2011-04-20 Thread Keith Packard
On Wed, 20 Apr 2011 10:22:18 +0100, Chris Wilson wrote: > Keep all the state required for undoing and restoring the previous pipe > configuration together in a single struct passed from > intel_get_load_detect_pipe() to intel_release_load_detect_pipe() rather > than stuffing them inside the commo

Re: [Intel-gfx] [PATCH 3/6] drm/i915: Remove unused supported_crtc from intel_load_detect_pipe

2011-04-20 Thread Keith Packard
On Wed, 20 Apr 2011 10:22:19 +0100, Chris Wilson wrote: > ... and the no longer relevant comment. The code ceased stealing a pipe > for load detection a long time ago. Reviewed-by: Keith Packard -- keith.pack...@intel.com pgpo4Jr0qCdEM.pgp Description: PGP signature

Re: [Intel-gfx] [PATCH 4/6] drm/i915: Pass the saved adjusted_mode when adding to the load-detect crtc

2011-04-20 Thread Keith Packard
On Wed, 20 Apr 2011 10:22:20 +0100, Chris Wilson wrote: > Signed-off-by: Chris Wilson Reviewed-by: Keith Packard (this might be separately tested to see if it might fix some TV load detection issues?) -- keith.pack...@intel.com pgpnWymRFWXkU.pgp Description: PGP signature

[Intel-gfx] [PATCH 1/2] drm/i915: Simplify return value from intel_get_load_detect_pipe

2011-04-20 Thread Chris Wilson
... and so remove the confusion as to whether to use the returned crtc or intel_encoder->base.crtc with the subsequent load-detection. Even though they were the same, the two instances of load-detection code disagreed over which was the more correct. Signed-off-by: Chris Wilson --- drivers/gpu/d

[Intel-gfx] [PATCH 2/2] drm/i915: Propagate failure to set mode for load-detect pipe

2011-04-20 Thread Chris Wilson
Check the return value from drm_crtc_set_mode(), report the failure via a debug message and propagate the error back to the caller. This prevents us from blissfully continuing to do the load detection on a disabled pipe. Fortunately actual failure for modesetting is very rare, and reported failures

Re: [Intel-gfx] [PATCH 5/6] drm/i915: Remove dead code from intel_get_load_detect_pipe()

2011-04-20 Thread Keith Packard
On Wed, 20 Apr 2011 10:22:21 +0100, Chris Wilson wrote: > As we only allow the use of a disabled CRTC, we don't need to handle the > case we are reusing an already enabled pipe. Reviewed-by: Keith Packard -- keith.pack...@intel.com pgpYSoJipl2cu.pgp Description: PGP signature _

Re: [Intel-gfx] [PATCH] drm/i915/dp: Be paranoid in case we disable a DP before it is attached

2011-04-20 Thread Chris Wilson
On Wed, 20 Apr 2011 10:36:29 -0700, Keith Packard wrote: > On Wed, 20 Apr 2011 16:42:08 +0100, Chris Wilson > wrote: > > Given that the hardware may be left in a random condition by the BIOS, > > it is conceivable that we then attempt to clear the DP_PIPEB_SELECT bit > > without us ever enabling

Re: [Intel-gfx] [PATCH 6/6] drm/i915: Attach a fb to the load-detect pipe

2011-04-20 Thread Keith Packard
On Wed, 20 Apr 2011 10:22:22 +0100, Chris Wilson wrote: > For bonus amusement value, we perform the first load detect before even > establishing our fbdev. It seems like we need to be able to perform load detection in this case to create a suitable frame buffer at boot time. I also don't see a

Re: [Intel-gfx] [PATCH 6/6] drm/i915: Attach a fb to the load-detect pipe

2011-04-20 Thread Chris Wilson
On Wed, 20 Apr 2011 11:43:38 -0700, Keith Packard wrote: > On Wed, 20 Apr 2011 10:22:22 +0100, Chris Wilson > wrote: > > > For bonus amusement value, we perform the first load detect before even > > establishing our fbdev. > > It seems like we need to be able to perform load detection in this

Re: [Intel-gfx] rfc: breaking old userspace gamma for 10-bit support

2011-04-20 Thread Jesse Barnes
On Tue, 27 Jul 2010 11:03:56 -0400 Adam Jackson wrote: > On Fri, 2010-07-23 at 16:29 -0400, Andrew Lutomirski wrote: > > > Does that include not breaking DirectColor? If we program the gamma > > ramp to 129 slots, old userspace submits 256 entries that are not > > monotonic, and we decimate the

Re: [Intel-gfx] rfc: breaking old userspace gamma for 10-bit support

2011-04-20 Thread Andrew Lutomirski
On Wed, Apr 20, 2011 at 3:05 PM, Jesse Barnes wrote: > On Tue, 27 Jul 2010 11:03:56 -0400 > Adam Jackson wrote: > >> On Fri, 2010-07-23 at 16:29 -0400, Andrew Lutomirski wrote: >> >> > Does that include not breaking DirectColor?  If we program the gamma >> > ramp to 129 slots, old userspace submi

Re: [Intel-gfx] rfc: breaking old userspace gamma for 10-bit support

2011-04-20 Thread Jesse Barnes
> > Andrew, do you have anything hacked together for this yet? > > Nope. I gave up because I couldn't even get the mode to set. :) Ok well you should be able to now. :) Using the patchset I posted earlier along with the two attached patches, the testdisplay program in intel-gpu-tools will set a

Re: [Intel-gfx] [PATCH 4/6] drm/i915: Pass the saved adjusted_mode when adding to the load-detect crtc

2011-04-20 Thread Chris Wilson
On Wed, 20 Apr 2011 11:23:01 -0700, Keith Packard wrote: > On Wed, 20 Apr 2011 10:22:20 +0100, Chris Wilson > wrote: > > Signed-off-by: Chris Wilson > > Reviewed-by: Keith Packard > > (this might be separately tested to see if it might fix some TV load > detection issues?) It is an old bug

Re: [Intel-gfx] rfc: breaking old userspace gamma for 10-bit support

2011-04-20 Thread Andrew Lutomirski
On Wed, Apr 20, 2011 at 3:38 PM, Jesse Barnes wrote: >> > Andrew, do you have anything hacked together for this yet? >> >> Nope.  I gave up because I couldn't even get the mode to set. :) > > Ok well you should be able to now. :)  Using the patchset I posted > earlier along with the two attached p

Re: [Intel-gfx] [PATCH 2/2] drm/i915/lvds: Use i915.lvds_fixed_mode= as a last resort

2011-04-20 Thread Mike Isely
Chris: I've tested this patch and it doesn't help us here. Even if I add lvds_fixed_mode=, the display still comes up with the messed up configuration from the motherboard's completely ignorant BIOS. It appears that lvds_fixed_mode is being ignored by the driver. I think there's still a mis

Re: [Intel-gfx] [PATCH 2/2] drm/i915/lvds: Use i915.lvds_fixed_mode= as a last resort

2011-04-20 Thread Chris Wilson
On Wed, 20 Apr 2011 14:48:36 -0500 (CDT), Mike Isely wrote: > > Chris: > > I've tested this patch and it doesn't help us here. Even if I add > lvds_fixed_mode=, the display still comes up with the messed > up configuration from the motherboard's completely ignorant BIOS. It > appears that l

Re: [Intel-gfx] [PATCH 2/2] drm/i915/lvds: Use i915.lvds_fixed_mode= as a last resort

2011-04-20 Thread Mike Isely
On Wed, 20 Apr 2011, Chris Wilson wrote: > On Wed, 20 Apr 2011 14:48:36 -0500 (CDT), Mike Isely wrote: > > > > Chris: > > > > I've tested this patch and it doesn't help us here. Even if I add > > lvds_fixed_mode=, the display still comes up with the messed > > up configuration from the mothe

[Intel-gfx] [PATCH] drm/i915: Attach a fb to the load-detect pipe

2011-04-20 Thread Chris Wilson
We need to ensure that we feed valid memory into the display plane attached to the pipe when switching the pipe on. Otherwise, the display engine may read through an invalid PTE and so throw an PGTBL_ER exception. As we need to perform load detection before even the first object is allocated for t

Re: [Intel-gfx] [PATCH 4/6] drm/i915: Pass the saved adjusted_mode when adding to the load-detect crtc

2011-04-20 Thread Keith Packard
On Wed, 20 Apr 2011 20:38:54 +0100, Chris Wilson wrote: > On Wed, 20 Apr 2011 11:23:01 -0700, Keith Packard wrote: > > On Wed, 20 Apr 2011 10:22:20 +0100, Chris Wilson > > wrote: > > > Signed-off-by: Chris Wilson > > > > Reviewed-by: Keith Packard > > > > (this might be separately tested t

Re: [Intel-gfx] [PATCH 6/6] drm/i915: Attach a fb to the load-detect pipe

2011-04-20 Thread Keith Packard
On Wed, 20 Apr 2011 19:55:10 +0100, Chris Wilson wrote: > I'll spin up a patch for a temporary buffer and see what you think. Ok. I'd love to be able to use that code path all of the time, but I don't like the thought of the cost of a temporary allocation every time you do load detection. --

[Intel-gfx] [PATCH] drm/i915: Attach a fb to the load-detect pipe

2011-04-20 Thread Chris Wilson
We need to ensure that we feed valid memory into the display plane attached to the pipe when switching the pipe on. Otherwise, the display engine may read through an invalid PTE and so throw an PGTBL_ER exception. As we need to perform load detection before even the first object is allocated for t

[Intel-gfx] [PATCH 2/5] drm/i915: reference counted forcewake

2011-04-20 Thread Ben Widawsky
Provide a reference count to track the forcewake state of the GPU. Which exports a mechanism to allow userspace to wake the GT. This also potentially saves a UC read if the GT is known to be awake already. The reference count is atomic, but the register access and hardware wake sequence is protect

[Intel-gfx] [PATCH 3/5] drm/i915: forcewake struct mutex locking fixes

2011-04-20 Thread Ben Widawsky
Signed-off-by: Ben Widawsky --- drivers/gpu/drm/i915/i915_debugfs.c |2 ++ drivers/gpu/drm/i915/intel_display.c | 12 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 3cb0722..94b3

[Intel-gfx] [PATCH 1/5] drm/i915: proper use of forcewake

2011-04-20 Thread Ben Widawsky
Moved the macros around to properly do reads and writes for the given GPU. This is to address special requirements for gen6 (SNB) reads and writes. Registers in the range 0-0x4 on gen6 platforms require special handling. Instead of relying on the callers to pick the registers correctly, move t

[Intel-gfx] [PATCH 4/5] drm/i915: move gen6 rps handling to workqueue

2011-04-20 Thread Ben Widawsky
The render P-state handling code requires reading from a GT register. This means that FORCEWAKE must be written to, a resource which is shared and should be protected by struct_mutex. Signed-off-by: Ben Widawsky --- drivers/gpu/drm/i915/i915_dma.c |1 + drivers/gpu/drm/i915/i915_drv.h |4

[Intel-gfx] [PATCH 5/5] drm/i915: debugfs interface for forcewake reference count

2011-04-20 Thread Ben Widawsky
forcewake is controlled by the open and close of the debugfs file. This assures that buggy applications cannot cause the GT to stay on forever. Signed-off-by: Ben Widawsky --- drivers/gpu/drm/i915/i915_debugfs.c | 80 +++ 1 files changed, 80 insertions(+), 0 del

[Intel-gfx] forcewake v5

2011-04-20 Thread Ben Widawsky
Once you're done laughing that I got up to v5 (I think I skipped a v3, and v1 was the IOCTls, so it's really more like a v3) for patches meant to simply allow register reads and wites... Back to struct_mutex since it turned out to be my mistake regarding the IIR problem. The only issue in the int

Re: [Intel-gfx] [PATCH] drm/i915: Prevent use of pages >4GiB on 965G[M]

2011-04-20 Thread Eric Anholt
On Sun, 17 Apr 2011 17:37:32 +0100, Chris Wilson wrote: > The 965G (Broadwater) and 965GM (Crestline) chipsets had many errata in > handling pages allocation above 4GiB. So we should be careful never to > allocate and attempt to pass such through to the GPU and so limit > ourselves to GFP_DMA32 o

Re: [Intel-gfx] [PATCH] drm/i915: Prevent use of pages >4GiB on 965G[M]

2011-04-20 Thread Chris Wilson
On Wed, 20 Apr 2011 17:21:03 -0700, Eric Anholt wrote: > On Sun, 17 Apr 2011 17:37:32 +0100, Chris Wilson > wrote: > > The 965G (Broadwater) and 965GM (Crestline) chipsets had many errata in > > handling pages allocation above 4GiB. So we should be careful never to > > allocate and attempt to pa

Re: [Intel-gfx] [PATCH 3/5] drm/i915: forcewake struct mutex locking fixes

2011-04-20 Thread Chris Wilson
On Wed, 20 Apr 2011 16:53:17 -0700, Ben Widawsky wrote: > > Signed-off-by: Ben Widawsky Just to annoy you, this needs to be split up into the various categories of fixes. Because... > static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) > @@ -3067,9 +3074,12 @@ static void i9xx_crt

Re: [Intel-gfx] [PATCH 4/5] drm/i915: move gen6 rps handling to workqueue

2011-04-20 Thread Chris Wilson
On Wed, 20 Apr 2011 16:53:18 -0700, Ben Widawsky wrote: > The render P-state handling code requires reading from a GT register. > This means that FORCEWAKE must be written to, a resource which is shared > and should be protected by struct_mutex. > > Signed-off-by: Ben Widawsky > --- > drivers/g

Re: [Intel-gfx] forcewake v5

2011-04-20 Thread Chris Wilson
On Wed, 20 Apr 2011 16:53:14 -0700, Ben Widawsky wrote: > > Once you're done laughing that I got up to v5 (I think I skipped a v3, > and v1 was the IOCTls, so it's really more like a v3) for patches meant > to simply allow register reads and wites... > > Back to struct_mutex since it turned out