drivers/gpu/drm/openchrome/via_crtc.c |  174 +++++++++++++++++++++++++++-------
 drivers/gpu/drm/openchrome/via_drv.h  |    4 
 2 files changed, 144 insertions(+), 34 deletions(-)

New commits:
commit 5782e3a6a90963459c79b789cc72541592a486e6
Author: Kevin Brace <kevinbr...@gmx.com>
Date:   Sun Feb 4 12:39:53 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 <kevinbr...@gmx.com>

diff --git a/drivers/gpu/drm/openchrome/via_drv.h 
b/drivers/gpu/drm/openchrome/via_drv.h
index dd226148462d..119aa9aa46ac 100644
--- a/drivers/gpu/drm/openchrome/via_drv.h
+++ b/drivers/gpu/drm/openchrome/via_drv.h
@@ -30,11 +30,11 @@
 #define DRIVER_AUTHOR       "OpenChrome Project"
 #define DRIVER_NAME         "openchrome"
 #define DRIVER_DESC         "OpenChrome DRM for VIA Technologies Chrome IGP"
-#define DRIVER_DATE         "20180128"
+#define DRIVER_DATE         "20180204"
 
 #define DRIVER_MAJOR           3
 #define DRIVER_MINOR           0
-#define DRIVER_PATCHLEVEL      71
+#define DRIVER_PATCHLEVEL      72
 
 #include <linux/module.h>
 
commit 89f324e71edb949030640611a950f741324d6fb8
Author: Kevin Brace <kevinbr...@gmx.com>
Date:   Sun Feb 4 12:36:30 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, if 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 <kevinbr...@gmx.com>

diff --git a/drivers/gpu/drm/openchrome/via_crtc.c 
b/drivers/gpu/drm/openchrome/via_crtc.c
index 6367c0d0f908..84dcb8cc973d 100644
--- a/drivers/gpu/drm/openchrome/via_crtc.c
+++ b/drivers/gpu/drm/openchrome/via_crtc.c
@@ -151,52 +151,141 @@ static void via_iga2_set_color_depth(struct via_device 
*dev_priv,
 
 static void via_hide_cursor(struct drm_crtc *crtc)
 {
-       struct via_crtc *iga = container_of(crtc,
-                                               struct via_crtc, base);
+       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 via_crtc *iga = container_of(crtc,
-                                               struct via_crtc, base);
+       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,
@@ -211,6 +300,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;
 
@@ -256,12 +347,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;
@@ -277,12 +372,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;
 }
_______________________________________________
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel

Reply via email to