[Openchrome-devel] drm-openchrome: Branch 'drm-next-4.16' - 2 commits - drivers/gpu/drm

Kevin Brace kevinbrace at kemper.freedesktop.org
Sun Feb 4 00:25:49 UTC 2018


 drivers/gpu/drm/openchrome/via_crtc.c |  167 ++++++++++++++++++++++++++++------
 drivers/gpu/drm/openchrome/via_drv.h  |    2 
 2 files changed, 141 insertions(+), 28 deletions(-)

New commits:
commit b2d1bd024f9c6074237c2ee349e631b886ae31d9
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Sat Feb 3 16:24:56 2018 -0800

    drm/openchrome: Version bumped to 3.0.72
    
    Hardware cursor display fix for single HI (Hardware Icon) Chrome IGP
    devices. The code was validated on ECS K8M890M-M mainboard.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/openchrome/via_drv.h b/drivers/gpu/drm/openchrome/via_drv.h
index 39e0eb4d40d0..bc080d99fcae 100644
--- a/drivers/gpu/drm/openchrome/via_drv.h
+++ b/drivers/gpu/drm/openchrome/via_drv.h
@@ -34,7 +34,7 @@
 
 #define DRIVER_MAJOR		3
 #define DRIVER_MINOR		0
-#define DRIVER_PATCHLEVEL	71
+#define DRIVER_PATCHLEVEL	72
 
 #include <linux/module.h>
 
commit 981d27b3a95a7df6fb6c6887b467f576bf8a8b97
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Sat Feb 3 16:14:52 2018 -0800

    drm/openchrome: Hardware cursor fix for single HI devices
    
    Older generation VIA Technologies Chrome IGP devices have only one
    hardware icon (HI). Due to the way the code was written previously, it
    was assuming the availability of two HIs, and as a result, it the user
    was using older generation devices, no mouse cursor will be displayed
    on the screen. This commit will add the necessary code to support older
    devices with only one HI. The code was validated on ECS K8M890M-M
    mainboard with K8M890 chipset.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/openchrome/via_crtc.c b/drivers/gpu/drm/openchrome/via_crtc.c
index dde69f84d503..5c9a01eca07d 100644
--- a/drivers/gpu/drm/openchrome/via_crtc.c
+++ b/drivers/gpu/drm/openchrome/via_crtc.c
@@ -151,49 +151,141 @@ static void via_iga2_set_color_depth(struct via_device *dev_priv,
 
 static void via_hide_cursor(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
 	struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
 	struct via_device *dev_priv = crtc->dev->dev_private;
 	uint32_t temp;
 
-	if (iga->index) {
+	DRM_DEBUG_KMS("Entered %s.\n", __func__);
+
+	switch (dev->pdev->device) {
+	case PCI_DEVICE_ID_VIA_PM800:
+	case PCI_DEVICE_ID_VIA_CX700:
+	case PCI_DEVICE_ID_VIA_P4M890:
+	case PCI_DEVICE_ID_VIA_P4M900:
+	case PCI_DEVICE_ID_VIA_VX800:
+	case PCI_DEVICE_ID_VIA_VX855:
+	case PCI_DEVICE_ID_VIA_VX900:
+		if (iga->index) {
+			temp = VIA_READ(HI_CONTROL);
+			VIA_WRITE(HI_CONTROL, temp & 0xFFFFFFFA);
+		} else {
+			temp = VIA_READ(PRIM_HI_CTRL);
+			VIA_WRITE(PRIM_HI_CTRL, temp & 0xFFFFFFFA);
+		}
+
+		break;
+	default:
 		temp = VIA_READ(HI_CONTROL);
 		VIA_WRITE(HI_CONTROL, temp & 0xFFFFFFFA);
-	} else {
-		temp = VIA_READ(PRIM_HI_CTRL);
-		VIA_WRITE(PRIM_HI_CTRL, temp & 0xFFFFFFFA);
+		break;
 	}
+
+	DRM_DEBUG_KMS("Exiting %s.\n", __func__);
 }
 
 static void via_show_cursor(struct drm_crtc *crtc)
 {
+	struct drm_device *dev = crtc->dev;
 	struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
 	struct via_device *dev_priv = crtc->dev->dev_private;
 
-	if (!iga->cursor_kmap.bo)
-		return;
+	DRM_DEBUG_KMS("Entered %s.\n", __func__);
 
-	/* Program the offset and turn on Hardware icon Cursor */
-	if (iga->index) {
-		VIA_WRITE(HI_FBOFFSET, iga->cursor_kmap.bo->offset);
-		VIA_WRITE(HI_CONTROL, 0xB6000005);
-	} else {
-		VIA_WRITE(PRIM_HI_FBOFFSET, iga->cursor_kmap.bo->offset);
-		VIA_WRITE(PRIM_HI_CTRL, 0x36000005);
-	}
+	switch (dev->pdev->device) {
+	case PCI_DEVICE_ID_VIA_PM800:
+	case PCI_DEVICE_ID_VIA_CX700:
+	case PCI_DEVICE_ID_VIA_P4M890:
+	case PCI_DEVICE_ID_VIA_P4M900:
+	case PCI_DEVICE_ID_VIA_VX800:
+	case PCI_DEVICE_ID_VIA_VX855:
+	case PCI_DEVICE_ID_VIA_VX900:
+		/* Program Hardware Icon (HI) FIFO, foreground, and
+		 * background colors. */
+		if (iga->index) {
+			VIA_WRITE(HI_TRANSPARENT_COLOR, 0x00000000);
+			VIA_WRITE(HI_INVTCOLOR, 0x00FFFFFF);
+			VIA_WRITE(ALPHA_V3_PREFIFO_CONTROL, 0x000E0000);
+			VIA_WRITE(ALPHA_V3_FIFO_CONTROL, 0x0E0F0000);
+		} else {
+			VIA_WRITE(PRIM_HI_TRANSCOLOR, 0x00000000);
+			VIA_WRITE(PRIM_HI_INVTCOLOR, 0x00FFFFFF);
+			VIA_WRITE(V327_HI_INVTCOLOR, 0x00FFFFFF);
+			VIA_WRITE(PRIM_HI_FIFO, 0x0D000D0F);
+		}
 
-	/* Program Hardware Icon (HI) FIFO and foreground
-	 * and background colors. */
-	if (iga->index) {
+		break;
+	default:
 		VIA_WRITE(HI_TRANSPARENT_COLOR, 0x00000000);
 		VIA_WRITE(HI_INVTCOLOR, 0x00FFFFFF);
 		VIA_WRITE(ALPHA_V3_PREFIFO_CONTROL, 0x000E0000);
-		VIA_WRITE(ALPHA_V3_FIFO_CONTROL, 0x0E0F0000);
-	} else {
-		VIA_WRITE(PRIM_HI_TRANSCOLOR, 0x00000000);
-		VIA_WRITE(PRIM_HI_INVTCOLOR, 0x00FFFFFF);
-		VIA_WRITE(V327_HI_INVTCOLOR, 0x00FFFFFF);
-		VIA_WRITE(PRIM_HI_FIFO, 0x0D000D0F);
+		VIA_WRITE(ALPHA_V3_FIFO_CONTROL, 0xE0F0000);
+		break;
+	}
+
+	switch (dev->pdev->device) {
+	case PCI_DEVICE_ID_VIA_PM800:
+	case PCI_DEVICE_ID_VIA_CX700:
+	case PCI_DEVICE_ID_VIA_P4M890:
+	case PCI_DEVICE_ID_VIA_P4M900:
+	case PCI_DEVICE_ID_VIA_VX800:
+	case PCI_DEVICE_ID_VIA_VX855:
+	case PCI_DEVICE_ID_VIA_VX900:
+		/* Turn on Hardware icon Cursor */
+		if (iga->index) {
+			VIA_WRITE(HI_CONTROL, 0xB6000005);
+		} else {
+			VIA_WRITE(PRIM_HI_CTRL, 0x36000005);
+		}
+
+		break;
+	default:
+		if (iga->index) {
+			VIA_WRITE(HI_CONTROL, 0xB6000005);
+		} else {
+			VIA_WRITE(HI_CONTROL, 0x36000005);
+		}
+
+		break;
 	}
+
+	DRM_DEBUG_KMS("Exiting %s.\n", __func__);
+}
+
+static void via_cursor_address(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
+	struct via_device *dev_priv = crtc->dev->dev_private;
+
+	DRM_DEBUG_KMS("Entered %s.\n", __func__);
+
+	if (!iga->cursor_kmap.bo) {
+		goto exit;
+	}
+
+	switch (dev->pdev->device) {
+	case PCI_DEVICE_ID_VIA_PM800:
+	case PCI_DEVICE_ID_VIA_CX700:
+	case PCI_DEVICE_ID_VIA_P4M890:
+	case PCI_DEVICE_ID_VIA_P4M900:
+	case PCI_DEVICE_ID_VIA_VX800:
+	case PCI_DEVICE_ID_VIA_VX855:
+	case PCI_DEVICE_ID_VIA_VX900:
+		/* Program the HI offset. */
+		if (iga->index) {
+			VIA_WRITE(HI_FBOFFSET, iga->cursor_kmap.bo->offset);
+		} else {
+			VIA_WRITE(PRIM_HI_FBOFFSET, iga->cursor_kmap.bo->offset);
+		}
+		break;
+	default:
+		VIA_WRITE(HI_FBOFFSET, iga->cursor_kmap.bo->offset);
+		break;
+	}
+
+exit:
+	DRM_DEBUG_KMS("Exiting %s.\n", __func__);
 }
 
 static int via_crtc_cursor_set(struct drm_crtc *crtc,
@@ -207,6 +299,8 @@ static int via_crtc_cursor_set(struct drm_crtc *crtc,
 	struct drm_gem_object *obj = NULL;
 	struct ttm_bo_kmap_obj user_kmap;
 
+	DRM_DEBUG_KMS("Entered %s.\n", __func__);
+
 	if (!iga->cursor_kmap.bo)
 		return -ENXIO;
 
@@ -250,12 +344,16 @@ static int via_crtc_cursor_set(struct drm_crtc *crtc,
 		ttm_bo_kunmap(&user_kmap);
 	}
 	drm_gem_object_unreference_unlocked(obj);
+	via_cursor_address(crtc);
 	via_show_cursor(crtc);
+
+	DRM_DEBUG_KMS("Exiting %s.\n", __func__);
 	return ret;
 }
 
 static int via_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
 {
+	struct drm_device *dev = crtc->dev;
 	struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
 	struct via_device *dev_priv = crtc->dev->dev_private;
 	unsigned char xoff = 0, yoff = 0;
@@ -271,12 +369,27 @@ static int via_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
 		ypos = 0;
 	}
 
-	if (iga->index) {
+	switch (dev->pdev->device) {
+	case PCI_DEVICE_ID_VIA_PM800:
+	case PCI_DEVICE_ID_VIA_CX700:
+	case PCI_DEVICE_ID_VIA_P4M890:
+	case PCI_DEVICE_ID_VIA_P4M900:
+	case PCI_DEVICE_ID_VIA_VX800:
+	case PCI_DEVICE_ID_VIA_VX855:
+	case PCI_DEVICE_ID_VIA_VX900:
+		if (iga->index) {
+			VIA_WRITE(HI_POSSTART, ((xpos << 16) | (ypos & 0x07ff)));
+			VIA_WRITE(HI_CENTEROFFSET, ((xoff << 16) | (yoff & 0x07ff)));
+		} else {
+			VIA_WRITE(PRIM_HI_POSSTART, ((xpos << 16) | (ypos & 0x07ff)));
+			VIA_WRITE(PRIM_HI_CENTEROFFSET, ((xoff << 16) | (yoff & 0x07ff)));
+		}
+
+		break;
+	default:
 		VIA_WRITE(HI_POSSTART, ((xpos << 16) | (ypos & 0x07ff)));
 		VIA_WRITE(HI_CENTEROFFSET, ((xoff << 16) | (yoff & 0x07ff)));
-	} else {
-		VIA_WRITE(PRIM_HI_POSSTART, ((xpos << 16) | (ypos & 0x07ff)));
-		VIA_WRITE(PRIM_HI_CENTEROFFSET, ((xoff << 16) | (yoff & 0x07ff)));
+		break;
 	}
 
 	return 0;


More information about the Openchrome-devel mailing list