[Intel-gfx] [PATCH] drm/i915: fixup the plane->pipe fixup code

2012-09-11 Thread Daniel Vetter
We need to check whether the _other plane is on our pipe, not whether
our plane is on the other pipe. Otherwise if not both pipes/planes are
active, we won't properly clean up the mess and set up our desired
plane->pipe mapping.

v2: Fixup the logic, I've totally fumbled it. Noticed by Chris Wilson.

v3: I've checked Bspec, and the flexible plane->pipe mapping is a
gen2/3 feature, so test for that instead of PCH_SPLIT

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51265
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49838
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/intel_display.c | 28 ++--
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index fd9c275..7454df6 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7994,11 +7994,27 @@ static void intel_enable_pipe_a(struct drm_device *dev)
 
 }
 
+static bool
+intel_check_plane_mapping(struct intel_crtc *crtc)
+{
+   struct drm_i915_private *dev_priv = crtc->base.dev->dev_private;
+   u32 reg, val;
+
+   reg = DSPCNTR(!crtc->plane);
+   val = I915_READ(reg);
+
+   if ((val & DISPLAY_PLANE_ENABLE) &&
+   (!!(val & DISPPLANE_SEL_PIPE_MASK) == crtc->pipe))
+   return false;
+
+   return true;
+}
+
 static void intel_sanitize_crtc(struct intel_crtc *crtc)
 {
struct drm_device *dev = crtc->base.dev;
struct drm_i915_private *dev_priv = dev->dev_private;
-   u32 reg, val;
+   u32 reg;
 
/* Clear any frame start delays used for debugging left by the BIOS */
reg = PIPECONF(crtc->pipe);
@@ -8006,17 +8022,10 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
 
/* We need to sanitize the plane -> pipe mapping first because this will
 * disable the crtc (and hence change the state) if it is wrong. */
-   if (!HAS_PCH_SPLIT(dev)) {
+   if (INTEL_INFO(dev)->gen < 4 && !intel_check_plane_mapping(crtc)) {
struct intel_connector *connector;
bool plane;
 
-   reg = DSPCNTR(crtc->plane);
-   val = I915_READ(reg);
-
-   if ((val & DISPLAY_PLANE_ENABLE) == 0 &&
-   (!!(val & DISPPLANE_SEL_PIPE_MASK) == crtc->pipe))
-   goto ok;
-
DRM_DEBUG_KMS("[CRTC:%d] wrong plane connection detected!\n",
  crtc->base.base.id);
 
@@ -8040,7 +8049,6 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
WARN_ON(crtc->active);
crtc->base.enabled = false;
}
-ok:
 
if (dev_priv->quirks & QUIRK_PIPEA_FORCE &&
crtc->pipe == PIPE_A && !crtc->active) {
-- 
1.7.11.2

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm/i915: enable lvds pin pairs before dpll on gen2

2012-09-11 Thread Daniel Vetter
Otherwise things migt not work too well.

Breakage introduced in

commit eb1cbe4848b01f9f073064377875bc7d71eb401b
Author: Daniel Vetter 
Date:   Wed Mar 28 23:12:16 2012 +0200

drm/i915: split PLL update code out of i9xx_crtc_mode_set

Cc: Jesse Barnes 
Cc: sta...@vger.kernel.org (for 3.5 only)
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/intel_display.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 6be59cf..4c4a88b 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4227,12 +4227,6 @@ static void i8xx_update_pll(struct drm_crtc *crtc,
POSTING_READ(DPLL(pipe));
udelay(150);
 
-   I915_WRITE(DPLL(pipe), dpll);
-
-   /* Wait for the clocks to stabilize. */
-   POSTING_READ(DPLL(pipe));
-   udelay(150);
-
/* The LVDS pin pair needs to be on before the DPLLs are enabled.
 * This is an exception to the general rule that mode_set doesn't turn
 * things on.
@@ -4240,6 +4234,12 @@ static void i8xx_update_pll(struct drm_crtc *crtc,
if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
intel_update_lvds(crtc, clock, adjusted_mode);
 
+   I915_WRITE(DPLL(pipe), dpll);
+
+   /* Wait for the clocks to stabilize. */
+   POSTING_READ(DPLL(pipe));
+   udelay(150);
+
/* The pixel multiplier can only be updated once the
 * DPLL is enabled and the clocks are stable.
 *
-- 
1.7.11.2

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/3] drm/i915: fix up the IBX transcoder B check

2012-09-11 Thread Paulo Zanoni
2012/9/10 Daniel Vetter :
> This has been added in
>
> commit de9a35abb3b343a25065449234e47a76c4f3454a
> Author: Daniel Vetter 
> Date:   Tue Jun 5 11:03:40 2012 +0200
>
> drm/i915: assert that the IBX port transcoder select w/a is implemented
>
> Unfortunately I've failed to notice that these checks are not just
> called for the port that is about to be disabled, but for all (which
> makes sense for an assert ...), and the WARN missfired when disabling
> another pipe than the one with the dp port.
>
> Hence also check whether the port is actually disabled.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54688
> Signed-Off-by: Daniel Vetter 

Looks fine:
Reviewed-by: Paulo Zanoni 


> ---
>  drivers/gpu/drm/i915/intel_display.c |6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c 
> b/drivers/gpu/drm/i915/intel_display.c
> index f26fb3f..b8e5a51 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -1376,7 +1376,8 @@ static void assert_pch_dp_disabled(struct 
> drm_i915_private *dev_priv,
>  "PCH DP (0x%08x) enabled on transcoder %c, should be disabled\n",
>  reg, pipe_name(pipe));
>
> -   WARN(HAS_PCH_IBX(dev_priv->dev) && (val & SDVO_PIPE_B_SELECT),
> +   WARN(HAS_PCH_IBX(dev_priv->dev) && (val & DP_PORT_EN) == 0
> +&& (val & DP_PIPEB_SELECT),
>  "IBX PCH dp port still using transcoder B\n");
>  }
>
> @@ -1388,7 +1389,8 @@ static void assert_pch_hdmi_disabled(struct 
> drm_i915_private *dev_priv,
>  "PCH HDMI (0x%08x) enabled on transcoder %c, should be 
> disabled\n",
>  reg, pipe_name(pipe));
>
> -   WARN(HAS_PCH_IBX(dev_priv->dev) && (val & SDVO_PIPE_B_SELECT),
> +   WARN(HAS_PCH_IBX(dev_priv->dev) && (val & PORT_ENABLE) == 0
> +&& (val & SDVO_PIPE_B_SELECT),
>  "IBX PCH hdmi port still using transcoder B\n");
>  }
>
> --
> 1.7.10.4
>
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Paulo Zanoni
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/3] drm/i915: fix up the IBX transcoder B check

2012-09-11 Thread Daniel Vetter
On Tue, Sep 11, 2012 at 11:57:56AM -0300, Paulo Zanoni wrote:
> 2012/9/10 Daniel Vetter :
> > This has been added in
> >
> > commit de9a35abb3b343a25065449234e47a76c4f3454a
> > Author: Daniel Vetter 
> > Date:   Tue Jun 5 11:03:40 2012 +0200
> >
> > drm/i915: assert that the IBX port transcoder select w/a is implemented
> >
> > Unfortunately I've failed to notice that these checks are not just
> > called for the port that is about to be disabled, but for all (which
> > makes sense for an assert ...), and the WARN missfired when disabling
> > another pipe than the one with the dp port.
> >
> > Hence also check whether the port is actually disabled.
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54688
> > Signed-Off-by: Daniel Vetter 
> 
> Looks fine:
> Reviewed-by: Paulo Zanoni 
Picked up for -fixes, thanks for the review.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [pull] drm-intel-fixes

2012-09-11 Thread Daniel Vetter
On Mon, Sep 10, 2012 at 09:34:36PM +0200, Daniel Vetter wrote:
> On Mon, Sep 10, 2012 at 09:28:17AM +0200, Daniel Vetter wrote:
> > Hi Dave,
> > 
> > You're pull just reminded me that I've been sitting on a few small -fixes,
> > too. Nothing really major at all:
> > - fixup edp setup sequence (Dave)
> > - disable sdvo hotplug for real, this is a fixup for a messed-up
> >   regression fixer (Jani)
> > - don't expose dysfunctional backlight driver (Jani)
> > - properly init spinlock (only used by hsw/vlv code) from Alexander
> >   Shishkin
> 
> Added one more:
> - fix a regression in the gen3 pageflip complete irq handling after resume
>   (only affects some configurations, we've forgotten to restore a reg
>   value).
And another small patch to shut up an overzealous WARN.


The following changes since commit 4cbe5a555fa58a79b6ecbb6c531b8bab0650778d:

  Linux 3.6-rc4 (2012-09-01 10:39:58 -0700)

are available in the git repository at:

  git://people.freedesktop.org/~danvet/drm-intel drm-intel-fixes

for you to fetch changes up to 75c5da279e06577190abba52cabf0dc2a56edb97:

  drm/i915: fix up the IBX transcoder B check (2012-09-11 17:25:14 +0200)


Alexander Shishkin (1):
  drm/i915: initialize dpio_lock spin lock

Daniel Vetter (2):
  drm/i915: set the right gen3 flip_done mode also at resume
  drm/i915: fix up the IBX transcoder B check

Dave Airlie (1):
  drm/i915/edp: get the panel delay before powering up

Jani Nikula (2):
  drm/i915: only enable sdvo hotplug irq if needed
  drm/i915: do not expose a dysfunctional backlight interface to userspace

 drivers/gpu/drm/i915/i915_dma.c  |1 +
 drivers/gpu/drm/i915/i915_irq.c  |3 ---
 drivers/gpu/drm/i915/intel_display.c |6 --
 drivers/gpu/drm/i915/intel_dp.c  |   11 +++
 drivers/gpu/drm/i915/intel_panel.c   |   31 ++-
 drivers/gpu/drm/i915/intel_pm.c  |3 +++
 drivers/gpu/drm/i915/intel_sdvo.c|   15 ++-
 7 files changed, 43 insertions(+), 27 deletions(-)
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] Fighting tearing

2012-09-11 Thread Ben Widawsky
On Mon, 10 Sep 2012 16:09:18 +0200
Roberth Sjonøy  wrote:

> With the WM I use (xfce WM 4.10.0) with it's compositor, the tearing
> is much less, but the little tearing who exist is very noticable.

Your option is SNA + TearFree, or use a real composited desktop. I know
it sucks. Or maybe complain to the XFCE guys to use real pageflips in their
compositor?

> 
> On Sun, Sep 9, 2012 at 8:00 PM, Chris Wilson  wrote:
> > On Sun, 09 Sep 2012 10:55:46 -0700, Ben Widawsky  wrote:
> >> On 2012-09-09 08:48, Roberth Sjonøy wrote:
> >> > Hello
> >> >
> >> > I run Arch Linux, with it's latest x.org and kernel, and I have
> >> > compiled libdrm and the intel driver from git, and I update it today.
> >> >
> >> > Buit this is issue exists even with the releases.
> >> >
> >> > WIth UXA, rendering of the windows in my XFCE4-desktop goes just
> >> > fines, good performance, windows (exspecially GTK+) doesn't hang
> >> > after
> >> > if I drag them over the screen, but there is lot of small tearing.
> >> > And I want this to go away, I do not use any kind of composition, and
> >> > I am using XFCEs window manager.
> >> >
> >> > Here is my xorg.conf
> >> >
> >> >
> >> > Section "ServerFlags"
> >> > Option "AutoAddDevices" "Off"
> >> > EndSection
> >> >
> >> > Section "InputDevice"
> >> > Identifier "Keyboard0"
> >> > Driver "keyboard"
> >> > Option "XkbLayout" "no"
> >> > EndSection
> >> >
> >> > Section "Device"
> >> > Identifier  "Card0"
> >> > Driver  "intel"
> >> > Option  "AccelMethod" "UXA"
> >> > Option  "TearFree" "true"
> >> > Option  "MigrationHeuristic" "greedy"
> >> > Option  "TripleBuffer" "true"
> >> > EndSection
> >> >
> >> > With SNA, the performance of the applications is muc much worse. If I
> >> > just replace UXA with SNA.
> >> >
> >> > Thanks in advance for any help.
> >> >
> >> > Regards,
> >> >
> >> > Roberth Sjonøy0
> >>
> >> Unfortunately it's often the case that tearing is pretty much
> >> unavoidable without a compositor. AFAIK you'd just be getting lucky with
> >> SNA, as opposed to UXA.
> >
> > Not so. He is explicitly asking for slow tear-free rendering with
> > Option "TearFree" "true". On my machines that takes about a 50%
> > performance hit which suggests pebkac which is reinforced by the lack
> > of information.
> > -Chris
> >
> > --
> > Chris Wilson, Intel Open Source Technology Centre



-- 
Ben Widawsky, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm/i915: placeholder getparam

2012-09-11 Thread Ben Widawsky
There are internal patches for a feature which require a parameter to
query whether support exists . These patches cannot be made external
yet. In order to keep existing tests and userspace happy and free from
conflicts, reserve a number for it.

Signed-off-by: Ben Widawsky 
---
 include/drm/i915_drm.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 05e24d3..c883300 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -313,6 +313,7 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_HAS_WAIT_TIMEOUT 19
 #define I915_PARAM_HAS_SEMAPHORES   20
 #define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21
+#define I915_PARAM_RSVD_FOR_FUTURE_USE  22
 
 typedef struct drm_i915_getparam {
int param;
-- 
1.7.12

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: placeholder getparam

2012-09-11 Thread Daniel Vetter
On Tue, Sep 11, 2012 at 05:13:05PM -0700, Ben Widawsky wrote:
> There are internal patches for a feature which require a parameter to
> query whether support exists . These patches cannot be made external
> yet. In order to keep existing tests and userspace happy and free from
> conflicts, reserve a number for it.
> 
> Signed-off-by: Ben Widawsky 
Queued for -next, thanks for the patch.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx