All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmk+kernel@arm.linux.org.uk (Russell King)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC v3 3/4] DRM: Armada: convert Armada hardware cursor support to RGB+transparency
Date: Mon, 10 Jun 2013 23:50:52 +0100	[thread overview]
Message-ID: <E1UmAvM-0006Eb-OL@rmk-PC.arm.linux.org.uk> (raw)
In-Reply-To: <20130609190612.GM18614@n2100.arm.linux.org.uk>

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 drivers/gpu/drm/armada/Kconfig       |    6 +-
 drivers/gpu/drm/armada/armada_crtc.c |  186 +++++++++++++++++++++++----------
 drivers/gpu/drm/armada/armada_crtc.h |    5 +-
 3 files changed, 135 insertions(+), 62 deletions(-)

diff --git a/drivers/gpu/drm/armada/Kconfig b/drivers/gpu/drm/armada/Kconfig
index 6f64642..c401339 100644
--- a/drivers/gpu/drm/armada/Kconfig
+++ b/drivers/gpu/drm/armada/Kconfig
@@ -15,8 +15,8 @@ config DRM_ARMADA
 	  kernel mode setting and buffer management to userspace.
 
 config DRM_ARMADA_CURSOR
-	bool "Enable hardware cursor support for Marvell Armada DRM"
+	bool "Enable hardware RGB+T cursor support for Marvell Armada DRM"
 	depends on DRM_ARMADA != n
 	help
-	  Add support for hardware cursor support on the Marvell
-	  Armada devices.
+	  Add support for RGB+transparency hardware cursor support on
+	  the Marvell Armada devices.
diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
index 4a71ba0..b833014 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -369,8 +369,19 @@ void armada_drm_crtc_irq(struct armada_crtc *dcrtc, u32 stat)
 		val = readl_relaxed(base + LCD_SPU_ADV_REG);
 		val &= ~(0xfff << 20 | 0xfff);
 		val |= dcrtc->v[i].spu_adv_reg;
-		writel_relaxed(val, dcrtc->base + LCD_SPU_ADV_REG);
+		writel_relaxed(val, base + LCD_SPU_ADV_REG);
 	}
+
+	if (stat & DUMB_FRAMEDONE && dcrtc->cursor_update) {
+		writel_relaxed(dcrtc->cursor_hw_pos, base + LCD_SPU_HWC_OVSA_HPXL_VLN);
+		writel_relaxed(dcrtc->cursor_hw_sz, base + LCD_SPU_HWC_HPXL_VLN);
+		armada_updatel(CFG_HWC_ENA,
+			     CFG_HWC_ENA | CFG_HWC_1BITMOD | CFG_HWC_1BITENA,
+			     base + LCD_SPU_DMA_CTRL0);
+		dcrtc->cursor_update = false;
+		armada_drm_crtc_disable_irq(dcrtc, DUMB_FRAMEDONE_ENA);
+	}
+
 	spin_unlock(&dcrtc->irq_lock);
 
 	/* Only on frame 0 IRQs (start of progressive / odd frame) */
@@ -481,6 +492,9 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc,
 	val = adj->crtc_hsync_start;
 	dcrtc->v[1].spu_adv_reg = val << 20 | val;
 
+	/* Always enable RGB hardware cursor mode */
+	dcrtc->v[1].spu_adv_reg |= ADV_HWC32ENABLE;
+
 	if (interlaced) {
 		/* Odd interlaced frame */
 		dcrtc->v[0].spu_v_h_total = dcrtc->v[1].spu_v_h_total +
@@ -627,6 +641,103 @@ static const struct drm_crtc_helper_funcs armada_crtc_helper_funcs = {
 };
 
 #ifdef CONFIG_DRM_ARMADA_CURSOR
+static void armada_load_cursor_rgb(void __iomem *base, uint32_t *pix,
+	unsigned stride, unsigned width, unsigned height)
+{
+	uint32_t r, g, b, addr;
+	unsigned y, n;
+
+	for (r = g = b = addr = n = y = 0; y < height; y++) {
+		uint32_t *p = &pix[y * stride];
+		unsigned x;
+
+		for (x = 0; x < width; x++, p++) {
+			r >>= 8;
+			r |= 0xff000000 & (*p << 8);
+			g >>= 8;
+			g |= 0xff000000 & (*p << 16);
+			b >>= 8;
+			b |= 0xff000000 & (*p << 24);
+			if (x == 0 || y == 0) {
+				b |= 0xff000000;
+				g |= 0xff000000;
+				r &= ~0xff000000;
+			}
+			if (++n == 4) {
+				writel_relaxed(r,
+					       base + LCD_SPU_SRAM_WRDAT);
+				writel_relaxed(addr |
+					       SRAM_WRITE | SRAM_HWC32_RAMR,
+					       base + LCD_SPU_SRAM_CTRL);
+				writel_relaxed(g,
+					       base + LCD_SPU_SRAM_WRDAT);
+				writel_relaxed(addr |
+					       SRAM_WRITE | SRAM_HWC32_RAMG,
+					       base + LCD_SPU_SRAM_CTRL);
+				writel_relaxed(b,
+					       base + LCD_SPU_SRAM_WRDAT);
+				writel_relaxed(addr |
+					       SRAM_WRITE | SRAM_HWC32_RAMB,
+					       base + LCD_SPU_SRAM_CTRL);
+				addr += 1;
+				if ((addr & 255) == 0)
+					addr += 0xf00;
+				n = 0;
+			}
+		}
+	}
+	if (n) {
+		r >>= 8 * (4 - n);
+		g >>= 8 * (4 - n);
+		b >>= 8 * (4 - n);
+		writel_relaxed(r, base + LCD_SPU_SRAM_WRDAT);
+		writel_relaxed(addr | SRAM_WRITE | SRAM_HWC32_RAMR,
+			       base + LCD_SPU_SRAM_CTRL);
+		writel_relaxed(g, base + LCD_SPU_SRAM_WRDAT);
+		writel_relaxed(addr | SRAM_WRITE | SRAM_HWC32_RAMG,
+			       base + LCD_SPU_SRAM_CTRL);
+		writel_relaxed(b, base + LCD_SPU_SRAM_WRDAT);
+		writel_relaxed(addr | SRAM_WRITE | SRAM_HWC32_RAMB,
+			       base + LCD_SPU_SRAM_CTRL);
+	}
+}
+
+static void armada_load_cursor_alpha(void __iomem *base, uint32_t *pix,
+	unsigned stride, unsigned width, unsigned height)
+{
+	uint32_t data, addr, ram_cmd = SRAM_WRITE | SRAM_HWC32_TRAN;
+	unsigned y, n;
+
+	for (data = addr = n = y = 0; y < height; y++) {
+		uint32_t *p = &pix[y * stride];
+		unsigned x;
+
+		for (x = 0; x < width; x++, p++) {
+			data >>= 2;
+			if (*p >= 0x80000000)
+				data |= 0x40000000;
+			if (x == 0 || y == 0)
+				data |= 0x40000000;
+			if (++n == 16) {
+				writel_relaxed(data,
+					       base + LCD_SPU_SRAM_WRDAT);
+				writel_relaxed(addr |
+					       SRAM_WRITE | SRAM_HWC32_TRAN,
+					       base + LCD_SPU_SRAM_CTRL);
+				addr += 1;
+				if ((addr & 255) == 0)
+					addr += 0xf00;
+				n = 0;
+			}
+		}
+	}
+	if (n) {
+		data >>= 2 * (16 - n);
+		writel_relaxed(data, base + LCD_SPU_SRAM_WRDAT);
+		writel_relaxed(addr | ram_cmd, base + LCD_SPU_SRAM_CTRL);
+	}
+}
+
 static int armada_drm_crtc_cursor_update(struct armada_crtc *dcrtc, bool reload)
 {
 	uint32_t xoff, xscr, w = dcrtc->cursor_w, s;
@@ -672,6 +783,8 @@ static int armada_drm_crtc_cursor_update(struct armada_crtc *dcrtc, bool reload)
 
 	if (!dcrtc->cursor_obj || !h || !w) {
 		spin_lock_irq(&dcrtc->irq_lock);
+		armada_drm_crtc_disable_irq(dcrtc, DUMB_FRAMEDONE_ENA);
+		dcrtc->cursor_update = false;
 		armada_updatel(0, CFG_HWC_ENA, dcrtc->base + LCD_SPU_DMA_CTRL0);
 		spin_unlock_irq(&dcrtc->irq_lock);
 		return 0;
@@ -680,70 +793,29 @@ static int armada_drm_crtc_cursor_update(struct armada_crtc *dcrtc, bool reload)
 	armada_updatel(CFG_CSB_256x32, CFG_PDWN256x32,
 		     dcrtc->base + LCD_SPU_SRAM_PARA1);
 
-	if (dcrtc->cursor_lw != w || dcrtc->cursor_lh != h || reload) {
+	if (dcrtc->cursor_hw_sz != (h << 16 | w) || reload) {
 		struct armada_gem_object *obj = dcrtc->cursor_obj;
-		uint32_t *pix, *p, col2 = 0, col3 = 0;
-		unsigned x, y, d, n, a;
-
-		dcrtc->cursor_lw = w;
-		dcrtc->cursor_lh = h;
+		uint32_t *pix;
 
-		pix = obj->addr;
+		spin_lock_irq(&dcrtc->irq_lock);
+		armada_drm_crtc_disable_irq(dcrtc, DUMB_FRAMEDONE_ENA);
+		dcrtc->cursor_update = false;
+		armada_updatel(0, CFG_HWC_ENA, dcrtc->base + LCD_SPU_DMA_CTRL0);
+		spin_unlock_irq(&dcrtc->irq_lock);
 
 		/* Set the top-left corner of the cursor image */
+		pix = obj->addr;
 		pix += yoff * s + xoff;
-
-		a = 2 << 14 | 15 << 8;
-		for (d = n = y = 0; y < h; y++) {
-			for (x = 0, p = &pix[y * s]; x < w; x++, p++) {
-				uint32_t v = *p;
-				unsigned b;
-
-				if ((v & 0xff000000) != 0xff000000) {
-					b = 0;	/* transparent */
-				} else if (col2 == v) {
-					b = 2;	/* color 2 */
-				} else if (col3 == v) {
-					b = 3;	/* color 3 */
-				} else if (col2 == 0) {
-					col2 = v;
-					b = 2;	/* alloc color 2 */
-				} else if (col3 == 0) {
-					col3 = v;
-					b = 3;	/* alloc color 3 */
-				} else {
-					/* fail */
-					b = 1;	/* inverse (!) */
-				}
-
-				d |= b << n;
-				n += 2;
-
-				if (n == 32) {
-					writel_relaxed(d, dcrtc->base + LCD_SPU_SRAM_WRDAT);
-					writel_relaxed(a, dcrtc->base + LCD_SPU_SRAM_CTRL);
-					a++;
-					d = n = 0;
-				}
-			}
-		}
-
-		if (n) {
-			writel_relaxed(d, dcrtc->base + LCD_SPU_SRAM_WRDAT);
-			writel_relaxed(a, dcrtc->base + LCD_SPU_SRAM_CTRL);
-		}
-
-		writel_relaxed(col2, dcrtc->base + LCD_SPU_ALPHA_COLOR1);
-		writel_relaxed(col3, dcrtc->base + LCD_SPU_ALPHA_COLOR2);
-		writel_relaxed(h << 16 | w, dcrtc->base + LCD_SPU_HWC_HPXL_VLN);
+		armada_load_cursor_rgb(dcrtc->base, pix, s, w, h);
+		armada_load_cursor_alpha(dcrtc->base, pix, s, w, h);
 	}
 
-	writel_relaxed(yscr << 16 | xscr, dcrtc->base + LCD_SPU_HWC_OVSA_HPXL_VLN);
-
+	/* Reload the cursor position, size and enable in the IRQ handler */
 	spin_lock_irq(&dcrtc->irq_lock);
-	armada_updatel(CFG_HWC_ENA,
-		     CFG_HWC_ENA | CFG_HWC_1BITMOD | CFG_HWC_1BITENA,
-		     dcrtc->base + LCD_SPU_DMA_CTRL0);
+	dcrtc->cursor_hw_pos = yscr << 16 | xscr;
+	dcrtc->cursor_hw_sz = h << 16 | w;
+	dcrtc->cursor_update = true;
+	armada_drm_crtc_enable_irq(dcrtc, DUMB_FRAMEDONE_ENA);
 	spin_unlock_irq(&dcrtc->irq_lock);
 
 	return 0;
diff --git a/drivers/gpu/drm/armada/armada_crtc.h b/drivers/gpu/drm/armada/armada_crtc.h
index 16e9d93..817f29e 100644
--- a/drivers/gpu/drm/armada/armada_crtc.h
+++ b/drivers/gpu/drm/armada/armada_crtc.h
@@ -45,16 +45,17 @@ struct armada_crtc {
 		uint32_t	spu_adv_reg;
 	} v[2];
 	bool			interlaced;
+	bool			cursor_update;
 
 	struct armada_overlay	*overlay;
 
 	struct armada_gem_object	*cursor_obj;
 	int			cursor_x;
 	int			cursor_y;
+	uint32_t		cursor_hw_pos;
+	uint32_t		cursor_hw_sz;
 	uint32_t		cursor_w;
 	uint32_t		cursor_h;
-	uint32_t		cursor_lw;
-	uint32_t		cursor_lh;
 
 	int			dpms;
 	uint32_t		cfg_dma_ctrl0;
-- 
1.7.4.4

WARNING: multiple messages have this Message-ID (diff)
From: Russell King <rmk+kernel@arm.linux.org.uk>
To: linux-arm-kernel@lists.infradead.org
Cc: Jason Cooper <jason@lakedaemon.net>,
	David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org, Rob Clark <robdclark@gmail.com>,
	Darren Etheridge <darren.etheridge@gmail.com>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Subject: [PATCH RFC v3 3/4] DRM: Armada: convert Armada hardware cursor support to RGB+transparency
Date: Mon, 10 Jun 2013 23:50:52 +0100	[thread overview]
Message-ID: <E1UmAvM-0006Eb-OL@rmk-PC.arm.linux.org.uk> (raw)
In-Reply-To: <20130609190612.GM18614@n2100.arm.linux.org.uk>

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 drivers/gpu/drm/armada/Kconfig       |    6 +-
 drivers/gpu/drm/armada/armada_crtc.c |  186 +++++++++++++++++++++++----------
 drivers/gpu/drm/armada/armada_crtc.h |    5 +-
 3 files changed, 135 insertions(+), 62 deletions(-)

diff --git a/drivers/gpu/drm/armada/Kconfig b/drivers/gpu/drm/armada/Kconfig
index 6f64642..c401339 100644
--- a/drivers/gpu/drm/armada/Kconfig
+++ b/drivers/gpu/drm/armada/Kconfig
@@ -15,8 +15,8 @@ config DRM_ARMADA
 	  kernel mode setting and buffer management to userspace.
 
 config DRM_ARMADA_CURSOR
-	bool "Enable hardware cursor support for Marvell Armada DRM"
+	bool "Enable hardware RGB+T cursor support for Marvell Armada DRM"
 	depends on DRM_ARMADA != n
 	help
-	  Add support for hardware cursor support on the Marvell
-	  Armada devices.
+	  Add support for RGB+transparency hardware cursor support on
+	  the Marvell Armada devices.
diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
index 4a71ba0..b833014 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -369,8 +369,19 @@ void armada_drm_crtc_irq(struct armada_crtc *dcrtc, u32 stat)
 		val = readl_relaxed(base + LCD_SPU_ADV_REG);
 		val &= ~(0xfff << 20 | 0xfff);
 		val |= dcrtc->v[i].spu_adv_reg;
-		writel_relaxed(val, dcrtc->base + LCD_SPU_ADV_REG);
+		writel_relaxed(val, base + LCD_SPU_ADV_REG);
 	}
+
+	if (stat & DUMB_FRAMEDONE && dcrtc->cursor_update) {
+		writel_relaxed(dcrtc->cursor_hw_pos, base + LCD_SPU_HWC_OVSA_HPXL_VLN);
+		writel_relaxed(dcrtc->cursor_hw_sz, base + LCD_SPU_HWC_HPXL_VLN);
+		armada_updatel(CFG_HWC_ENA,
+			     CFG_HWC_ENA | CFG_HWC_1BITMOD | CFG_HWC_1BITENA,
+			     base + LCD_SPU_DMA_CTRL0);
+		dcrtc->cursor_update = false;
+		armada_drm_crtc_disable_irq(dcrtc, DUMB_FRAMEDONE_ENA);
+	}
+
 	spin_unlock(&dcrtc->irq_lock);
 
 	/* Only on frame 0 IRQs (start of progressive / odd frame) */
@@ -481,6 +492,9 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc,
 	val = adj->crtc_hsync_start;
 	dcrtc->v[1].spu_adv_reg = val << 20 | val;
 
+	/* Always enable RGB hardware cursor mode */
+	dcrtc->v[1].spu_adv_reg |= ADV_HWC32ENABLE;
+
 	if (interlaced) {
 		/* Odd interlaced frame */
 		dcrtc->v[0].spu_v_h_total = dcrtc->v[1].spu_v_h_total +
@@ -627,6 +641,103 @@ static const struct drm_crtc_helper_funcs armada_crtc_helper_funcs = {
 };
 
 #ifdef CONFIG_DRM_ARMADA_CURSOR
+static void armada_load_cursor_rgb(void __iomem *base, uint32_t *pix,
+	unsigned stride, unsigned width, unsigned height)
+{
+	uint32_t r, g, b, addr;
+	unsigned y, n;
+
+	for (r = g = b = addr = n = y = 0; y < height; y++) {
+		uint32_t *p = &pix[y * stride];
+		unsigned x;
+
+		for (x = 0; x < width; x++, p++) {
+			r >>= 8;
+			r |= 0xff000000 & (*p << 8);
+			g >>= 8;
+			g |= 0xff000000 & (*p << 16);
+			b >>= 8;
+			b |= 0xff000000 & (*p << 24);
+			if (x == 0 || y == 0) {
+				b |= 0xff000000;
+				g |= 0xff000000;
+				r &= ~0xff000000;
+			}
+			if (++n == 4) {
+				writel_relaxed(r,
+					       base + LCD_SPU_SRAM_WRDAT);
+				writel_relaxed(addr |
+					       SRAM_WRITE | SRAM_HWC32_RAMR,
+					       base + LCD_SPU_SRAM_CTRL);
+				writel_relaxed(g,
+					       base + LCD_SPU_SRAM_WRDAT);
+				writel_relaxed(addr |
+					       SRAM_WRITE | SRAM_HWC32_RAMG,
+					       base + LCD_SPU_SRAM_CTRL);
+				writel_relaxed(b,
+					       base + LCD_SPU_SRAM_WRDAT);
+				writel_relaxed(addr |
+					       SRAM_WRITE | SRAM_HWC32_RAMB,
+					       base + LCD_SPU_SRAM_CTRL);
+				addr += 1;
+				if ((addr & 255) == 0)
+					addr += 0xf00;
+				n = 0;
+			}
+		}
+	}
+	if (n) {
+		r >>= 8 * (4 - n);
+		g >>= 8 * (4 - n);
+		b >>= 8 * (4 - n);
+		writel_relaxed(r, base + LCD_SPU_SRAM_WRDAT);
+		writel_relaxed(addr | SRAM_WRITE | SRAM_HWC32_RAMR,
+			       base + LCD_SPU_SRAM_CTRL);
+		writel_relaxed(g, base + LCD_SPU_SRAM_WRDAT);
+		writel_relaxed(addr | SRAM_WRITE | SRAM_HWC32_RAMG,
+			       base + LCD_SPU_SRAM_CTRL);
+		writel_relaxed(b, base + LCD_SPU_SRAM_WRDAT);
+		writel_relaxed(addr | SRAM_WRITE | SRAM_HWC32_RAMB,
+			       base + LCD_SPU_SRAM_CTRL);
+	}
+}
+
+static void armada_load_cursor_alpha(void __iomem *base, uint32_t *pix,
+	unsigned stride, unsigned width, unsigned height)
+{
+	uint32_t data, addr, ram_cmd = SRAM_WRITE | SRAM_HWC32_TRAN;
+	unsigned y, n;
+
+	for (data = addr = n = y = 0; y < height; y++) {
+		uint32_t *p = &pix[y * stride];
+		unsigned x;
+
+		for (x = 0; x < width; x++, p++) {
+			data >>= 2;
+			if (*p >= 0x80000000)
+				data |= 0x40000000;
+			if (x == 0 || y == 0)
+				data |= 0x40000000;
+			if (++n == 16) {
+				writel_relaxed(data,
+					       base + LCD_SPU_SRAM_WRDAT);
+				writel_relaxed(addr |
+					       SRAM_WRITE | SRAM_HWC32_TRAN,
+					       base + LCD_SPU_SRAM_CTRL);
+				addr += 1;
+				if ((addr & 255) == 0)
+					addr += 0xf00;
+				n = 0;
+			}
+		}
+	}
+	if (n) {
+		data >>= 2 * (16 - n);
+		writel_relaxed(data, base + LCD_SPU_SRAM_WRDAT);
+		writel_relaxed(addr | ram_cmd, base + LCD_SPU_SRAM_CTRL);
+	}
+}
+
 static int armada_drm_crtc_cursor_update(struct armada_crtc *dcrtc, bool reload)
 {
 	uint32_t xoff, xscr, w = dcrtc->cursor_w, s;
@@ -672,6 +783,8 @@ static int armada_drm_crtc_cursor_update(struct armada_crtc *dcrtc, bool reload)
 
 	if (!dcrtc->cursor_obj || !h || !w) {
 		spin_lock_irq(&dcrtc->irq_lock);
+		armada_drm_crtc_disable_irq(dcrtc, DUMB_FRAMEDONE_ENA);
+		dcrtc->cursor_update = false;
 		armada_updatel(0, CFG_HWC_ENA, dcrtc->base + LCD_SPU_DMA_CTRL0);
 		spin_unlock_irq(&dcrtc->irq_lock);
 		return 0;
@@ -680,70 +793,29 @@ static int armada_drm_crtc_cursor_update(struct armada_crtc *dcrtc, bool reload)
 	armada_updatel(CFG_CSB_256x32, CFG_PDWN256x32,
 		     dcrtc->base + LCD_SPU_SRAM_PARA1);
 
-	if (dcrtc->cursor_lw != w || dcrtc->cursor_lh != h || reload) {
+	if (dcrtc->cursor_hw_sz != (h << 16 | w) || reload) {
 		struct armada_gem_object *obj = dcrtc->cursor_obj;
-		uint32_t *pix, *p, col2 = 0, col3 = 0;
-		unsigned x, y, d, n, a;
-
-		dcrtc->cursor_lw = w;
-		dcrtc->cursor_lh = h;
+		uint32_t *pix;
 
-		pix = obj->addr;
+		spin_lock_irq(&dcrtc->irq_lock);
+		armada_drm_crtc_disable_irq(dcrtc, DUMB_FRAMEDONE_ENA);
+		dcrtc->cursor_update = false;
+		armada_updatel(0, CFG_HWC_ENA, dcrtc->base + LCD_SPU_DMA_CTRL0);
+		spin_unlock_irq(&dcrtc->irq_lock);
 
 		/* Set the top-left corner of the cursor image */
+		pix = obj->addr;
 		pix += yoff * s + xoff;
-
-		a = 2 << 14 | 15 << 8;
-		for (d = n = y = 0; y < h; y++) {
-			for (x = 0, p = &pix[y * s]; x < w; x++, p++) {
-				uint32_t v = *p;
-				unsigned b;
-
-				if ((v & 0xff000000) != 0xff000000) {
-					b = 0;	/* transparent */
-				} else if (col2 == v) {
-					b = 2;	/* color 2 */
-				} else if (col3 == v) {
-					b = 3;	/* color 3 */
-				} else if (col2 == 0) {
-					col2 = v;
-					b = 2;	/* alloc color 2 */
-				} else if (col3 == 0) {
-					col3 = v;
-					b = 3;	/* alloc color 3 */
-				} else {
-					/* fail */
-					b = 1;	/* inverse (!) */
-				}
-
-				d |= b << n;
-				n += 2;
-
-				if (n == 32) {
-					writel_relaxed(d, dcrtc->base + LCD_SPU_SRAM_WRDAT);
-					writel_relaxed(a, dcrtc->base + LCD_SPU_SRAM_CTRL);
-					a++;
-					d = n = 0;
-				}
-			}
-		}
-
-		if (n) {
-			writel_relaxed(d, dcrtc->base + LCD_SPU_SRAM_WRDAT);
-			writel_relaxed(a, dcrtc->base + LCD_SPU_SRAM_CTRL);
-		}
-
-		writel_relaxed(col2, dcrtc->base + LCD_SPU_ALPHA_COLOR1);
-		writel_relaxed(col3, dcrtc->base + LCD_SPU_ALPHA_COLOR2);
-		writel_relaxed(h << 16 | w, dcrtc->base + LCD_SPU_HWC_HPXL_VLN);
+		armada_load_cursor_rgb(dcrtc->base, pix, s, w, h);
+		armada_load_cursor_alpha(dcrtc->base, pix, s, w, h);
 	}
 
-	writel_relaxed(yscr << 16 | xscr, dcrtc->base + LCD_SPU_HWC_OVSA_HPXL_VLN);
-
+	/* Reload the cursor position, size and enable in the IRQ handler */
 	spin_lock_irq(&dcrtc->irq_lock);
-	armada_updatel(CFG_HWC_ENA,
-		     CFG_HWC_ENA | CFG_HWC_1BITMOD | CFG_HWC_1BITENA,
-		     dcrtc->base + LCD_SPU_DMA_CTRL0);
+	dcrtc->cursor_hw_pos = yscr << 16 | xscr;
+	dcrtc->cursor_hw_sz = h << 16 | w;
+	dcrtc->cursor_update = true;
+	armada_drm_crtc_enable_irq(dcrtc, DUMB_FRAMEDONE_ENA);
 	spin_unlock_irq(&dcrtc->irq_lock);
 
 	return 0;
diff --git a/drivers/gpu/drm/armada/armada_crtc.h b/drivers/gpu/drm/armada/armada_crtc.h
index 16e9d93..817f29e 100644
--- a/drivers/gpu/drm/armada/armada_crtc.h
+++ b/drivers/gpu/drm/armada/armada_crtc.h
@@ -45,16 +45,17 @@ struct armada_crtc {
 		uint32_t	spu_adv_reg;
 	} v[2];
 	bool			interlaced;
+	bool			cursor_update;
 
 	struct armada_overlay	*overlay;
 
 	struct armada_gem_object	*cursor_obj;
 	int			cursor_x;
 	int			cursor_y;
+	uint32_t		cursor_hw_pos;
+	uint32_t		cursor_hw_sz;
 	uint32_t		cursor_w;
 	uint32_t		cursor_h;
-	uint32_t		cursor_lw;
-	uint32_t		cursor_lh;
 
 	int			dpms;
 	uint32_t		cfg_dma_ctrl0;
-- 
1.7.4.4

  parent reply	other threads:[~2013-06-10 22:50 UTC|newest]

Thread overview: 120+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-09 19:06 [RFC v2 0/8] rmk's Dove DRM/TDA19988 Cubox driver Russell King - ARM Linux
2013-06-09 19:06 ` Russell King - ARM Linux
2013-06-09 19:29 ` [PATCH RFC 2/8] DRM: Armada: Add Armada DRM driver Russell King
2013-06-09 19:32   ` Russell King
2013-06-10 11:10   ` Sebastian Hesselbarth
2013-06-10 11:10     ` Sebastian Hesselbarth
2013-06-10 21:48     ` Russell King - ARM Linux
2013-06-10 21:48       ` Russell King - ARM Linux
2013-06-10 21:56       ` Sebastian Hesselbarth
2013-06-10 21:56         ` Sebastian Hesselbarth
2013-06-10 15:57   ` Rob Clark
2013-06-10 15:57     ` Rob Clark
2013-06-10 17:06     ` Russell King - ARM Linux
2013-06-10 17:06       ` Russell King - ARM Linux
2013-06-10 19:59       ` Rob Clark
2013-06-10 19:59         ` Rob Clark
2013-06-10 20:08         ` Russell King - ARM Linux
2013-06-10 20:08           ` Russell King - ARM Linux
2013-06-10 21:01           ` Rob Clark
2013-06-10 21:01             ` Rob Clark
2013-06-10 21:15             ` Russell King - ARM Linux
2013-06-10 21:15               ` Russell King - ARM Linux
2013-06-10 22:49               ` Rob Clark
2013-06-10 22:49                 ` Rob Clark
2013-06-10 22:56                 ` Russell King - ARM Linux
2013-06-10 22:56                   ` Russell King - ARM Linux
2013-06-10 23:17                   ` Rob Clark
2013-06-10 23:17                     ` Rob Clark
2013-06-10 23:24                     ` Dave Airlie
2013-06-10 23:24                       ` Dave Airlie
2013-06-10 23:35                       ` Rob Clark
2013-06-10 23:35                         ` Rob Clark
2013-06-10 23:36                       ` Russell King - ARM Linux
2013-06-10 23:36                         ` Russell King - ARM Linux
2013-06-10 23:48                         ` Dave Airlie
2013-06-10 23:48                           ` Dave Airlie
2013-06-10 23:56                           ` Russell King - ARM Linux
2013-06-10 23:56                             ` Russell King - ARM Linux
2013-06-12 13:48                           ` Russell King - ARM Linux
2013-06-12 13:48                             ` Russell King - ARM Linux
2013-06-12 13:56                             ` Rob Clark
2013-06-12 13:56                               ` Rob Clark
2013-06-12 16:49                               ` Russell King - ARM Linux
2013-06-12 16:49                                 ` Russell King - ARM Linux
2013-06-12 17:05                                 ` Russell King - ARM Linux
2013-06-12 17:05                                   ` Russell King - ARM Linux
2013-06-12 19:40                                   ` Russell King - ARM Linux
2013-06-12 19:40                                     ` Russell King - ARM Linux
2013-06-12 23:00                                     ` Russell King - ARM Linux
2013-06-12 23:00                                       ` Russell King - ARM Linux
2013-06-13  0:17                                       ` Rob Clark
2013-06-13  0:17                                         ` Rob Clark
2013-06-13 11:19                                       ` Russell King - ARM Linux
2013-06-13 11:19                                         ` Russell King - ARM Linux
2013-06-13 11:50                                         ` Russell King - ARM Linux
2013-06-13 11:50                                           ` Russell King - ARM Linux
2013-06-13 13:03                                           ` Russell King - ARM Linux
2013-06-13 13:03                                             ` Russell King - ARM Linux
2013-06-14 14:23                                             ` Daniel Vetter
2013-06-14 14:23                                               ` Daniel Vetter
2013-06-14 14:42                                               ` Russell King - ARM Linux
2013-06-14 14:42                                                 ` Russell King - ARM Linux
2013-06-14 19:50                                                 ` Daniel Vetter
2013-06-14 19:50                                                   ` Daniel Vetter
2013-06-14 22:15                                                   ` Russell King - ARM Linux
2013-06-14 22:15                                                     ` Russell King - ARM Linux
2013-06-14 22:36                                                     ` Daniel Vetter
2013-06-14 22:36                                                       ` Daniel Vetter
2013-06-14 13:53                                           ` Daniel Vetter
2013-06-14 13:53                                             ` Daniel Vetter
2013-06-14 14:27                                             ` Russell King - ARM Linux
2013-06-14 14:27                                               ` Russell King - ARM Linux
2013-06-13 12:52                                         ` Rob Clark
2013-06-13 12:52                                           ` Rob Clark
2013-06-13 12:58                                           ` Daniel Vetter
2013-06-13 12:58                                             ` Daniel Vetter
2013-06-12 20:04                                   ` Rob Clark
2013-06-12 20:04                                     ` Rob Clark
2013-06-10 23:38                     ` Russell King - ARM Linux
2013-06-10 23:38                       ` Russell King - ARM Linux
2013-06-10 23:49                       ` Rob Clark
2013-06-10 23:49                         ` Rob Clark
2013-06-10 22:01         ` Daniel Vetter
2013-06-10 22:01           ` Daniel Vetter
2013-06-10 22:32           ` Russell King - ARM Linux
2013-06-10 22:32             ` Russell King - ARM Linux
2013-06-10 23:12             ` Rob Clark
2013-06-10 23:12               ` Rob Clark
2013-06-11  7:33             ` Daniel Vetter
2013-06-11  7:33               ` Daniel Vetter
2013-06-11  8:08           ` Ville Syrjälä
2013-06-11  8:08             ` Ville Syrjälä
2013-06-10 21:38     ` Russell King - ARM Linux
2013-06-10 21:38       ` Russell King - ARM Linux
2013-06-09 19:30 ` [PATCH RFC 3/8] drm/i2c: nxp-tda998x: fix EDID reading on TDA19988 devices Russell King
2013-06-09 19:30   ` Russell King
2013-06-09 19:31 ` [PATCH RFC 4/8] drm/i2c: nxp-tda998x: ensure VIP output mux is properly set Russell King
2013-06-09 19:31   ` Russell King
2013-06-09 19:32 ` [PATCH RFC 5/8] drm/i2c: nxp-tda998x: fix npix/nline programming Russell King
2013-06-09 19:32   ` Russell King
2013-06-09 20:02   ` Sebastian Hesselbarth
2013-06-09 20:02     ` Sebastian Hesselbarth
2013-06-09 19:34 ` [PATCH RFC 6/8] drm/i2c: nxp-tda998x: prepare for video input configuration Russell King
2013-06-09 19:34   ` Russell King
2013-06-09 19:35 ` [PATCH RFC 7/8] drm/i2c: nxp-tda998x: add video and audio " Russell King
2013-06-09 19:35   ` Russell King
2013-06-09 19:36 ` [PATCH RFC 8/8] DRM: Armada: add support for drm tda19988 driver Russell King
2013-06-09 19:36   ` Russell King
2013-06-09 19:43 ` [RFC v2 0/8] rmk's Dove DRM/TDA19988 Cubox driver Russell King - ARM Linux
2013-06-09 19:43   ` Russell King - ARM Linux
2013-06-10 22:47 ` [RFC v3 0/4] " Russell King - ARM Linux
2013-06-10 22:47   ` Russell King - ARM Linux
2013-06-10 22:48 ` [PATCH RFC v3 1/4] DRM: Armada: Add Armada DRM driver Russell King
2013-06-10 22:51   ` Russell King
2013-06-10 22:49 ` [PATCH RFC v3 2/4] DRM: Armada: Add support for hardware cursors Russell King
2013-06-10 22:49   ` Russell King
2013-06-10 22:50 ` Russell King [this message]
2013-06-10 22:50   ` [PATCH RFC v3 3/4] DRM: Armada: convert Armada hardware cursor support to RGB+transparency Russell King
2013-06-10 22:51 ` [PATCH RFC v3 4/4] DRM: Armada: convert hardware cursor support to 64x32 or 32x64 ARGB Russell King
2013-06-10 22:51   ` Russell King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1UmAvM-0006Eb-OL@rmk-PC.arm.linux.org.uk \
    --to=rmk+kernel@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.