All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: fix IVB cursor support
@ 2011-10-12 18:12 Jesse Barnes
  2011-10-12 18:48 ` Adam Jackson
  2011-10-12 19:37 ` Keith Packard
  0 siblings, 2 replies; 5+ messages in thread
From: Jesse Barnes @ 2011-10-12 18:12 UTC (permalink / raw)
  To: intel-gfx

The cursor regs have moved around, add the offsets and new macros for
getting at them.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/i915_reg.h      |    8 ++++++
 drivers/gpu/drm/i915/intel_display.c |   40 +++++++++++++++++++++++++++++----
 2 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 20e2299..2da7968 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -2567,10 +2567,18 @@
 #define _CURBBASE		0x700c4
 #define _CURBPOS			0x700c8
 
+#define _CURBCNTR_IVB		0x71080
+#define _CURBBASE_IVB		0x71084
+#define _CURBPOS_IVB		0x71088
+
 #define CURCNTR(pipe) _PIPE(pipe, _CURACNTR, _CURBCNTR)
 #define CURBASE(pipe) _PIPE(pipe, _CURABASE, _CURBBASE)
 #define CURPOS(pipe) _PIPE(pipe, _CURAPOS, _CURBPOS)
 
+#define CURCNTR_IVB(pipe) _PIPE(pipe, _CURACNTR, _CURBCNTR_IVB)
+#define CURBASE_IVB(pipe) _PIPE(pipe, _CURABASE, _CURBBASE_IVB)
+#define CURPOS_IVB(pipe) _PIPE(pipe, _CURAPOS, _CURBPOS_IVB)
+
 /* Display A control */
 #define _DSPACNTR                0x70180
 #define   DISPLAY_PLANE_ENABLE			(1<<31)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index bbdd9fe..c40689d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5903,6 +5903,31 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)
 	I915_WRITE(CURBASE(pipe), base);
 }
 
+static void ivb_update_cursor(struct drm_crtc *crtc, u32 base)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+	int pipe = intel_crtc->pipe;
+	bool visible = base != 0;
+
+	if (intel_crtc->cursor_visible != visible) {
+		uint32_t cntl = I915_READ(CURCNTR_IVB(pipe));
+		if (base) {
+			cntl &= ~CURSOR_MODE;
+			cntl |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE;
+		} else {
+			cntl &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE);
+			cntl |= CURSOR_MODE_DISABLE;
+		}
+		I915_WRITE(CURCNTR_IVB(pipe), cntl);
+
+		intel_crtc->cursor_visible = visible;
+	}
+	/* and commit changes on next vblank */
+	I915_WRITE(CURBASE_IVB(pipe), base);
+}
+
 /* If no-part of the cursor is visible on the framebuffer, then the GPU may hang... */
 static void intel_crtc_update_cursor(struct drm_crtc *crtc,
 				     bool on)
@@ -5950,11 +5975,16 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
 	if (!visible && !intel_crtc->cursor_visible)
 		return;
 
-	I915_WRITE(CURPOS(pipe), pos);
-	if (IS_845G(dev) || IS_I865G(dev))
-		i845_update_cursor(crtc, base);
-	else
-		i9xx_update_cursor(crtc, base);
+	if (IS_IVYBRIDGE(dev)) {
+		I915_WRITE(CURPOS_IVB(pipe), pos);
+		ivb_update_cursor(crtc, base);
+	} else {
+		I915_WRITE(CURPOS(pipe), pos);
+		if (IS_845G(dev) || IS_I865G(dev))
+			i845_update_cursor(crtc, base);
+		else
+			i9xx_update_cursor(crtc, base);
+	}
 
 	if (visible)
 		intel_mark_busy(dev, to_intel_framebuffer(crtc->fb)->obj);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: fix IVB cursor support
  2011-10-12 18:12 [PATCH] drm/i915: fix IVB cursor support Jesse Barnes
@ 2011-10-12 18:48 ` Adam Jackson
  2011-10-12 19:37 ` Keith Packard
  1 sibling, 0 replies; 5+ messages in thread
From: Adam Jackson @ 2011-10-12 18:48 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 266 bytes --]

On Wed, 2011-10-12 at 11:12 -0700, Jesse Barnes wrote:
> The cursor regs have moved around, add the offsets and new macros for
> getting at them.
> 
> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>

Tested-by: Adam Jackson <ajax@redhat.com>

- ajax

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: fix IVB cursor support
  2011-10-12 18:12 [PATCH] drm/i915: fix IVB cursor support Jesse Barnes
  2011-10-12 18:48 ` Adam Jackson
@ 2011-10-12 19:37 ` Keith Packard
  2011-10-12 20:00   ` Chris Wilson
  1 sibling, 1 reply; 5+ messages in thread
From: Keith Packard @ 2011-10-12 19:37 UTC (permalink / raw)
  To: Jesse Barnes, intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 340 bytes --]

On Wed, 12 Oct 2011 11:12:59 -0700, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:

> +#define CURCNTR_IVB(pipe) _PIPE(pipe, _CURACNTR, _CURBCNTR_IVB)
> +#define CURBASE_IVB(pipe) _PIPE(pipe, _CURABASE, _CURBBASE_IVB)
> +#define CURPOS_IVB(pipe) _PIPE(pipe, _CURAPOS, _CURBPOS_IVB)

Only two cursors?

-- 
keith.packard@intel.com

[-- Attachment #1.2: Type: application/pgp-signature, Size: 827 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: fix IVB cursor support
  2011-10-12 19:37 ` Keith Packard
@ 2011-10-12 20:00   ` Chris Wilson
  2011-10-12 21:43     ` Jesse Barnes
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2011-10-12 20:00 UTC (permalink / raw)
  To: Keith Packard, Jesse Barnes, intel-gfx

On Wed, 12 Oct 2011 13:37:53 -0600, Keith Packard <keithp@keithp.com> wrote:
Non-text part: multipart/mixed
Non-text part: multipart/signed
> On Wed, 12 Oct 2011 11:12:59 -0700, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> 
> > +#define CURCNTR_IVB(pipe) _PIPE(pipe, _CURACNTR, _CURBCNTR_IVB)
> > +#define CURBASE_IVB(pipe) _PIPE(pipe, _CURABASE, _CURBBASE_IVB)
> > +#define CURPOS_IVB(pipe) _PIPE(pipe, _CURAPOS, _CURBPOS_IVB)
> 
> Only two cursors?

They are at regular offsets (0x1000), so:

   CURCBASE = CURABASE + pipe*(CURBBASE - CURABASE);

CURABASE: 0x70084
CURBBASE: 0x71084
CURCBASE: 0x72084
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: fix IVB cursor support
  2011-10-12 20:00   ` Chris Wilson
@ 2011-10-12 21:43     ` Jesse Barnes
  0 siblings, 0 replies; 5+ messages in thread
From: Jesse Barnes @ 2011-10-12 21:43 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 975 bytes --]

On Wed, 12 Oct 2011 21:00:29 +0100
Chris Wilson <chris@chris-wilson.co.uk> wrote:

> On Wed, 12 Oct 2011 13:37:53 -0600, Keith Packard <keithp@keithp.com> wrote:
> Non-text part: multipart/mixed
> Non-text part: multipart/signed
> > On Wed, 12 Oct 2011 11:12:59 -0700, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> > 
> > > +#define CURCNTR_IVB(pipe) _PIPE(pipe, _CURACNTR, _CURBCNTR_IVB)
> > > +#define CURBASE_IVB(pipe) _PIPE(pipe, _CURABASE, _CURBBASE_IVB)
> > > +#define CURPOS_IVB(pipe) _PIPE(pipe, _CURAPOS, _CURBPOS_IVB)
> > 
> > Only two cursors?
> 
> They are at regular offsets (0x1000), so:
> 
>    CURCBASE = CURABASE + pipe*(CURBBASE - CURABASE);
> 
> CURABASE: 0x70084
> CURBBASE: 0x71084
> CURCBASE: 0x72084

Yeah as long as the hw guys aren't trying to trick is (as with the PCH
DPLL regs) we use this pattern everywhere and walk past the 'B' range to
get to the 'C' regs.

-- 
Jesse Barnes, Intel Open Source Technology Center

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-10-12 21:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-12 18:12 [PATCH] drm/i915: fix IVB cursor support Jesse Barnes
2011-10-12 18:48 ` Adam Jackson
2011-10-12 19:37 ` Keith Packard
2011-10-12 20:00   ` Chris Wilson
2011-10-12 21:43     ` Jesse Barnes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.