[Openchrome-devel] xf86-video-openchrome: 4 commits - configure.ac src/via_display.c src/via_tmds.c src/via_ums.c

Kevin Brace kevinbrace at kemper.freedesktop.org
Fri Aug 26 05:06:19 UTC 2016


 configure.ac      |    2 
 src/via_display.c |  479 ++++++++++++++++++++++++++++++++++++------------------
 src/via_tmds.c    |    1 
 src/via_ums.c     |   30 ---
 4 files changed, 322 insertions(+), 190 deletions(-)

New commits:
commit 4b62252c5a2839b82013a3d21407ac0269679fb5
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Aug 25 08:22:26 2016 -0700

    Version bumped to 0.5.144
    
    For initial testing of Silicon Image SiI 164, please use this
    version rather than the older versions.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/configure.ac b/configure.ac
index 1b8016a..cfe33e3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ(2.57)
 AC_INIT([xf86-video-openchrome],
-        [0.5.143],
+        [0.5.144],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
         [xf86-video-openchrome])
 
commit 60f27a179bfa3ea8943cfa2c8416d1a35e30f17f
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Aug 25 08:20:54 2016 -0700

    Forgot to include via_sii164.h inside via_tmds.c
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_tmds.c b/src/via_tmds.c
index 7f38164..f5bf30f 100644
--- a/src/via_tmds.c
+++ b/src/via_tmds.c
@@ -40,6 +40,7 @@
 #include <unistd.h>
 #include "via_driver.h"
 #include "via_vt1632.h"
+#include "via_sii164.h"
 
 
 /*
commit f030c70f1aeb8e48a20bc6a5fc8f7f54336b602a
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Aug 25 08:15:01 2016 -0700

     Version bumped to 0.5.143
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/configure.ac b/configure.ac
index 76cc189..1b8016a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ(2.57)
 AC_INIT([xf86-video-openchrome],
-        [0.5.142],
+        [0.5.143],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
         [xf86-video-openchrome])
 
commit 73567fa0160012641e48168b8fec89d282a99462
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Aug 25 08:09:56 2016 -0700

    Moving HI access code to various functions
    
    Previously, the cursor control related callback functions were
    directly accessing HI (Hardware Icon) registers, but that will now
    be moved to various functions that are specifically designed to
    handle them.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_display.c b/src/via_display.c
index d982161..721dfe8 100644
--- a/src/via_display.c
+++ b/src/via_display.c
@@ -88,6 +88,141 @@ viaIGA1DPMSControl(ScrnInfoPtr pScrn, CARD8 dpmsControl)
                         "Exiting viaIGA1DPMSControl.\n"));
 }
 
+static void
+viaIGA1InitHI(ScrnInfoPtr pScrn)
+{
+    VIAPtr pVia = VIAPTR(pScrn);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered viaIGA1InitHI.\n"));
+
+    switch(pVia->Chipset) {
+    case VIA_PM800:
+    case VIA_CX700:
+    case VIA_P4M890:
+    case VIA_P4M900:
+    case VIA_VX800:
+    case VIA_VX855:
+    case VIA_VX900:
+        VIASETREG(PRIM_HI_TRANSCOLOR, 0x00000000);
+        VIASETREG(PRIM_HI_INVTCOLOR, 0x00FFFFFF);
+
+        /* Not setting up V327_HI_INVTCOLOR register contributes to
+         * an X Server boot time crash. */
+        VIASETREG(V327_HI_INVTCOLOR, 0x00FFFFFF);
+        VIASETREG(PRIM_HI_FIFO, 0x0D000D0F);
+        VIASETREG(PRIM_HI_CTRL, 0x36000004);
+        break;
+    default:
+        VIASETREG(HI_TRANSPARENT_COLOR, 0x00000000);
+        VIASETREG(HI_INVTCOLOR, 0x00FFFFFF);
+        VIASETREG(ALPHA_V3_PREFIFO_CONTROL, 0x000E0000);
+        VIASETREG(ALPHA_V3_FIFO_CONTROL, 0xE0F0000);
+        VIASETREG(HI_CONTROL, 0x76000004);
+        break;
+    }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting viaIGA1InitHI.\n"));
+}
+
+static void
+viaIGA1SetHIStartingAddress(xf86CrtcPtr crtc)
+{
+
+    drmmode_crtc_private_ptr iga = crtc->driver_private;
+    ScrnInfoPtr pScrn = crtc->scrn;
+    VIAPtr pVia = VIAPTR(pScrn);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered viaIGA1SetHIStartingAddress.\n"));
+
+    switch(pVia->Chipset) {
+    case VIA_PM800:
+    case VIA_CX700:
+    case VIA_P4M890:
+    case VIA_P4M900:
+    case VIA_VX800:
+    case VIA_VX855:
+    case VIA_VX900:
+        VIASETREG(PRIM_HI_FBOFFSET, iga->cursor_bo->offset);
+        break;
+    default:
+        /* Mono Cursor Display Path [bit31]: Primary */
+        VIASETREG(HI_FBOFFSET, iga->cursor_bo->offset);
+        break;
+    }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting viaIGA1SetHIStartingAddress.\n"));
+}
+
+/*
+ * This function displays or hides IGA1 hardware icon (HI).
+ */
+static void
+viaIGA1DisplayHI(ScrnInfoPtr pScrn, Bool HI_Status)
+{
+    VIAPtr pVia = VIAPTR(pScrn);
+    CARD32 temp;
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered viaIGA1DisplayHI.\n"));
+
+    switch(pVia->Chipset) {
+    case VIA_PM800:
+    case VIA_CX700:
+    case VIA_P4M890:
+    case VIA_P4M900:
+    case VIA_VX800:
+    case VIA_VX855:
+    case VIA_VX900:
+        temp = VIAGETREG(PRIM_HI_CTRL);
+        temp &= 0xFFFFFFFE;
+        temp |= HI_Status ? 0x00000001 : 0x00000000;
+
+        /* PRIM_HI_CTRL[0] - Hardware Icon (HI) Enable */
+        VIASETREG(PRIM_HI_CTRL, temp);
+        break;
+    default:
+        temp = VIAGETREG(HI_CONTROL);
+        temp &= 0xFFFFFFFE;
+        temp |= HI_Status ? 0x00000001 : 0x00000000;
+
+        /* HI_CONTROL[0] - Hardware Icon (HI) Enable */
+        VIASETREG(HI_CONTROL, temp);
+        break;
+    }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting viaIGA1DisplayHI.\n"));
+}
+
+static void
+viaIGA1SetHIDisplayLocation(ScrnInfoPtr pScrn,
+                            int x, unsigned int xoff,
+                            int y, unsigned int yoff)
+{
+    VIAPtr pVia = VIAPTR(pScrn);
+
+    switch(pVia->Chipset) {
+    case VIA_PM800:
+    case VIA_CX700:
+    case VIA_P4M890:
+    case VIA_P4M900:
+    case VIA_VX800:
+    case VIA_VX855:
+    case VIA_VX900:
+        VIASETREG(PRIM_HI_POSSTART,     ((x    << 16) | (y    & 0x07ff)));
+        VIASETREG(PRIM_HI_CENTEROFFSET, ((xoff << 16) | (yoff & 0x07ff)));
+        break;
+    default:
+        VIASETREG(HI_POSSTART,     ((x    << 16) | (y    & 0x07ff)));
+        VIASETREG(HI_CENTEROFFSET, ((xoff << 16) | (yoff & 0x07ff)));
+        break;
+    }
+}
+
 /*
  * Controls IGA2 display output on or off state.
  */
@@ -136,6 +271,123 @@ viaIGA2DisplayChannel(ScrnInfoPtr pScrn, Bool channelState)
                         "Exiting viaIGA2DisplayChannel.\n"));
 }
 
+static void
+viaIGA2InitHI(ScrnInfoPtr pScrn)
+{
+    VIAPtr pVia = VIAPTR(pScrn);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered viaIGA2InitHI.\n"));
+
+    switch(pVia->Chipset) {
+    case VIA_PM800:
+    case VIA_CX700:
+    case VIA_P4M890:
+    case VIA_P4M900:
+    case VIA_VX800:
+    case VIA_VX855:
+    case VIA_VX900:
+        VIASETREG(HI_TRANSPARENT_COLOR, 0x00000000);
+        VIASETREG(HI_INVTCOLOR, 0x00FFFFFF);
+        VIASETREG(ALPHA_V3_PREFIFO_CONTROL, 0x000E0000);
+        VIASETREG(ALPHA_V3_FIFO_CONTROL, 0x0E0F0000);
+        VIASETREG(HI_CONTROL, 0xB6000004);
+        break;
+    default:
+        VIASETREG(HI_TRANSPARENT_COLOR, 0x00000000);
+        VIASETREG(HI_INVTCOLOR, 0X00FFFFFF);
+        VIASETREG(ALPHA_V3_PREFIFO_CONTROL, 0x000E0000);
+        VIASETREG(ALPHA_V3_FIFO_CONTROL, 0xE0F0000);
+        VIASETREG(HI_CONTROL, 0xF6000004);
+        break;
+    }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting viaIGA2InitHI.\n"));
+}
+
+static void
+viaIGA2SetHIStartingAddress(xf86CrtcPtr crtc)
+{
+    drmmode_crtc_private_ptr iga = crtc->driver_private;
+    ScrnInfoPtr pScrn = crtc->scrn;
+    VIAPtr pVia = VIAPTR(pScrn);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered viaIGA2SetHIStartingAddress.\n"));
+
+    VIASETREG(HI_FBOFFSET, iga->cursor_bo->offset);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting viaIGA2SetHIStartingAddress.\n"));
+}
+
+/*
+ * This function displays or hides IGA2 hardware icon (HI).
+ */
+static void
+viaIGA2DisplayHI(ScrnInfoPtr pScrn, Bool HI_Status)
+{
+    VIAPtr pVia = VIAPTR(pScrn);
+    CARD32 temp;
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered viaIGA2DisplayHI.\n"));
+
+    switch(pVia->Chipset) {
+    case VIA_PM800:
+    case VIA_CX700:
+    case VIA_P4M890:
+    case VIA_P4M900:
+    case VIA_VX800:
+    case VIA_VX855:
+    case VIA_VX900:
+        temp = VIAGETREG(HI_CONTROL);
+        temp &= 0xFFFFFFFE;
+        temp |= HI_Status ? 0x00000001 : 0x00000000;
+
+        /* HI_CONTROL[0] - Hardware Icon (HI) Enable */
+        VIASETREG(HI_CONTROL, temp);
+        break;
+    default:
+        temp = VIAGETREG(HI_CONTROL);
+        temp &= 0xFFFFFFFE;
+        temp |= HI_Status ? 0x00000001 : 0x00000000;
+
+        /* HI_CONTROL[0] - Hardware Icon (HI) Enable */
+        VIASETREG(HI_CONTROL, temp);
+        break;
+    }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting viaIGA2DisplayHI.\n"));
+}
+
+static void
+viaIGA2SetHIDisplayLocation(ScrnInfoPtr pScrn,
+                            int x, unsigned int xoff,
+                            int y, unsigned int yoff)
+{
+    VIAPtr pVia = VIAPTR(pScrn);
+
+    switch(pVia->Chipset) {
+    case VIA_PM800:
+    case VIA_CX700:
+    case VIA_P4M890:
+    case VIA_P4M900:
+    case VIA_VX800:
+    case VIA_VX855:
+    case VIA_VX900:
+        VIASETREG(HI_POSSTART,     ((x    << 16) | (y    & 0x07FF)));
+        VIASETREG(HI_CENTEROFFSET, ((xoff << 16) | (yoff & 0x07FF)));
+        break;
+    default:
+        VIASETREG(HI_POSSTART,     ((x    << 16) | (y    & 0x07FF)));
+        VIASETREG(HI_CENTEROFFSET, ((xoff << 16) | (yoff & 0x07FF)));
+        break;
+    }
+}
+
 /*
  * Initial settings for displays.
  */
@@ -3139,12 +3391,10 @@ iga1_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
     and in all other bpps the fg and bg are in 8-8-8 RGB format.
 */
 static void
-iga1_crtc_set_cursor_colors (xf86CrtcPtr crtc, int bg, int fg)
+iga1_crtc_set_cursor_colors(xf86CrtcPtr crtc, int bg, int fg)
 {
     ScrnInfoPtr pScrn = crtc->scrn;
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
-    VIAPtr pVia = VIAPTR(pScrn);
-    CARD32 temp;
 
     if (xf86_config->cursor_fg)
         return;
@@ -3153,33 +3403,16 @@ iga1_crtc_set_cursor_colors (xf86CrtcPtr crtc, int bg, int fg)
     if (fg == xf86_config->cursor_fg && bg == xf86_config->cursor_bg)
         return;
 
-    switch(pVia->Chipset) {
-    case VIA_PM800:
-    case VIA_CX700:
-    case VIA_P4M890:
-    case VIA_P4M900:
-    case VIA_VX800:
-    case VIA_VX855:
-    case VIA_VX900:
-        temp = VIAGETREG(PRIM_HI_CTRL);
-        VIASETREG(PRIM_HI_CTRL, temp & 0xFFFFFFFE);
-        break;
-
-    default:
-        temp = VIAGETREG(HI_CONTROL);
-        VIASETREG(HI_CONTROL, temp & 0xFFFFFFFE);
-        break;
-    }
+    viaIGA1DisplayHI(pScrn, FALSE);
 
     xf86_config->cursor_fg = fg;
     xf86_config->cursor_bg = bg;
 }
 
 static void
-iga1_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
+iga1_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
 {
     ScrnInfoPtr pScrn = crtc->scrn;
-    VIAPtr pVia = VIAPTR(pScrn);
     unsigned xoff, yoff;
 
     if (x < 0) {
@@ -3196,90 +3429,57 @@ iga1_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
         yoff = 0;
     }
 
-    switch(pVia->Chipset) {
-    case VIA_PM800:
-    case VIA_CX700:
-    case VIA_P4M890:
-    case VIA_P4M900:
-    case VIA_VX800:
-    case VIA_VX855:
-    case VIA_VX900:
-        VIASETREG(PRIM_HI_POSSTART,    ((x    << 16) | (y    & 0x07ff)));
-        VIASETREG(PRIM_HI_CENTEROFFSET, ((xoff << 16) | (yoff & 0x07ff)));
-        break;
-
-    default:
-        VIASETREG(HI_POSSTART,    ((x    << 16) | (y    & 0x07ff)));
-        VIASETREG(HI_CENTEROFFSET, ((xoff << 16) | (yoff & 0x07ff)));
-        break;
-    }
+    viaIGA1SetHIDisplayLocation(pScrn, x, xoff, y, yoff);
 }
 
 static void
-iga1_crtc_show_cursor (xf86CrtcPtr crtc)
+iga1_crtc_show_cursor(xf86CrtcPtr crtc)
 {
-    drmmode_crtc_private_ptr iga = crtc->driver_private;
     ScrnInfoPtr pScrn = crtc->scrn;
-    VIAPtr pVia = VIAPTR(pScrn);
 
-    switch(pVia->Chipset) {
-    case VIA_PM800:
-    case VIA_CX700:
-    case VIA_P4M890:
-    case VIA_P4M900:
-    case VIA_VX800:
-    case VIA_VX855:
-    case VIA_VX900:
-        VIASETREG(PRIM_HI_FBOFFSET, iga->cursor_bo->offset);
-        VIASETREG(PRIM_HI_CTRL, 0x36000005);
-        break;
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered iga1_crtc_show_cursor.\n"));
 
-    default:
-        /* Mono Cursor Display Path [bit31]: Primary */
-        VIASETREG(HI_FBOFFSET, iga->cursor_bo->offset);
-        VIASETREG(HI_CONTROL, 0x76000005);
-        break;
-    }
+    viaIGA1DisplayHI(pScrn, TRUE);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting iga1_crtc_show_cursor.\n"));
 }
 
 static void
-iga1_crtc_hide_cursor (xf86CrtcPtr crtc)
+iga1_crtc_hide_cursor(xf86CrtcPtr crtc)
 {
     ScrnInfoPtr pScrn = crtc->scrn;
-    VIAPtr pVia = VIAPTR(pScrn);
-    CARD32 temp;
 
-    switch(pVia->Chipset) {
-    case VIA_PM800:
-    case VIA_CX700:
-    case VIA_P4M890:
-    case VIA_P4M900:
-    case VIA_VX800:
-    case VIA_VX855:
-    case VIA_VX900:
-        temp = VIAGETREG(PRIM_HI_CTRL);
-        VIASETREG(PRIM_HI_CTRL, temp & 0xFFFFFFFA);
-        break;
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered iga1_crtc_hide_cursor.\n"));
 
-    default:
-        temp = VIAGETREG(HI_CONTROL);
-        /* Hardware cursor disable [bit0] */
-        VIASETREG(HI_CONTROL, temp & 0xFFFFFFFA);
-        break;
-    }
+    viaIGA1DisplayHI(pScrn, FALSE);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting iga1_crtc_hide_cursor.\n"));
 }
 
 static void
-iga_crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image)
+iga1_crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image)
 {
     drmmode_crtc_private_ptr iga = crtc->driver_private;
     ScrnInfoPtr pScrn = crtc->scrn;
     void *dst;
 
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered iga1_crtc_load_cursor_argb.\n"));
+
     dst = drm_bo_map(pScrn, iga->cursor_bo);
     memset(dst, 0x00, iga->cursor_bo->size);
     memcpy(dst, image, iga->cursor_bo->size);
     drm_bo_unmap(pScrn, iga->cursor_bo);
+
+    viaIGA1InitHI(pScrn);
+    viaIGA1SetHIStartingAddress(crtc);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting iga1_crtc_load_cursor_argb.\n"));
 }
 
 static void
@@ -3317,7 +3517,7 @@ const xf86CrtcFuncsRec iga1_crtc_funcs = {
     .set_cursor_position    = iga1_crtc_set_cursor_position,
     .show_cursor            = iga1_crtc_show_cursor,
     .hide_cursor            = iga1_crtc_hide_cursor,
-    .load_cursor_argb       = iga_crtc_load_cursor_argb,
+    .load_cursor_argb       = iga1_crtc_load_cursor_argb,
 #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) > 2
     .set_origin             = iga1_crtc_set_origin,
 #endif
@@ -3598,8 +3798,7 @@ iga2_crtc_set_cursor_colors(xf86CrtcPtr crtc, int bg, int fg)
     ScrnInfoPtr pScrn = crtc->scrn;
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
     int height = 64, width = 64, i;
-    VIAPtr pVia = VIAPTR(pScrn);
-    CARD32 pixel, temp, *dst;
+    CARD32 pixel, *dst;
 
     if (xf86_config->cursor_fg)
         return;
@@ -3611,24 +3810,7 @@ iga2_crtc_set_cursor_colors(xf86CrtcPtr crtc, int bg, int fg)
     if (fg == xf86_config->cursor_fg && bg == xf86_config->cursor_bg)
         return;
 
-    switch(pVia->Chipset) {
-    case VIA_PM800:
-    case VIA_CX700:
-    case VIA_P4M890:
-    case VIA_P4M900:
-    case VIA_VX800:
-    case VIA_VX855:
-    case VIA_VX900:
-        temp = VIAGETREG(HI_CONTROL);
-        VIASETREG(HI_CONTROL, temp & 0xFFFFFFFE);
-        break;
-
-    default:
-        temp = VIAGETREG(HI_CONTROL);
-        VIASETREG(HI_CONTROL, temp & 0xFFFFFFFE);
-        height = width = 32;
-        break;
-    }
+    viaIGA2DisplayHI(pScrn, FALSE);
 
     dst = drm_bo_map(pScrn, iga->cursor_bo);
     for (i = 0; i < width * height; i++, dst++)
@@ -3644,7 +3826,6 @@ static void
 iga2_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
 {
     ScrnInfoPtr pScrn = crtc->scrn;
-    VIAPtr pVia = VIAPTR(pScrn);
     unsigned xoff, yoff;
 
     if (x < 0) {
@@ -3661,78 +3842,58 @@ iga2_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
         yoff = 0;
     }
 
-    switch(pVia->Chipset) {
-    case VIA_PM800:
-    case VIA_CX700:
-    case VIA_P4M890:
-    case VIA_P4M900:
-    case VIA_VX800:
-    case VIA_VX855:
-    case VIA_VX900:
-        VIASETREG(HI_POSSTART,    ((x    << 16) | (y    & 0x07ff)));
-        VIASETREG(HI_CENTEROFFSET, ((xoff << 16) | (yoff & 0x07ff)));
-        break;
-
-    default:
-        VIASETREG(HI_POSSTART,    ((x    << 16) | (y    & 0x07ff)));
-        VIASETREG(HI_CENTEROFFSET, ((xoff << 16) | (yoff & 0x07ff)));
-        break;
-    }
+    viaIGA2SetHIDisplayLocation(pScrn, x, xoff, y, yoff);
 }
 
 static void
 iga2_crtc_show_cursor(xf86CrtcPtr crtc)
 {
-    drmmode_crtc_private_ptr iga = crtc->driver_private;
     ScrnInfoPtr pScrn = crtc->scrn;
-    VIAPtr pVia = VIAPTR(pScrn);
 
-    switch(pVia->Chipset) {
-    case VIA_PM800:
-    case VIA_CX700:
-    case VIA_P4M890:
-    case VIA_P4M900:
-    case VIA_VX800:
-    case VIA_VX855:
-    case VIA_VX900:
-        VIASETREG(HI_FBOFFSET, iga->cursor_bo->offset);
-        VIASETREG(HI_CONTROL, 0xB6000005);
-        break;
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered iga2_crtc_show_cursor.\n"));
+
+    viaIGA2DisplayHI(pScrn, TRUE);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting iga2_crtc_show_cursor.\n"));
 
-    default:
-        /* Mono Cursor Display Path [bit31]: Secondary */
-        /* FIXME For CLE266 and KM400 try to enable 32x32 cursor size [bit1] */
-        VIASETREG(HI_FBOFFSET, iga->cursor_bo->offset);
-        VIASETREG(HI_CONTROL, 0xF6000005);
-        break;
-    }
 }
 
 static void
 iga2_crtc_hide_cursor(xf86CrtcPtr crtc)
 {
     ScrnInfoPtr pScrn = crtc->scrn;
-    VIAPtr pVia = VIAPTR(pScrn);
-    CARD32 temp;
 
-    switch(pVia->Chipset) {
-    case VIA_PM800:
-    case VIA_CX700:
-    case VIA_P4M890:
-    case VIA_P4M900:
-    case VIA_VX800:
-    case VIA_VX855:
-    case VIA_VX900:
-	    temp = VIAGETREG(HI_CONTROL);
-        VIASETREG(HI_CONTROL, temp & 0xFFFFFFFA);
-        break;
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered iga2_crtc_hide_cursor.\n"));
 
-    default:
-        temp = VIAGETREG(HI_CONTROL);
-        /* Hardware cursor disable [bit0] */
-        VIASETREG(HI_CONTROL, temp & 0xFFFFFFFA);
-        break;
-	}
+    viaIGA2DisplayHI(pScrn, FALSE);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting iga2_crtc_hide_cursor.\n"));
+}
+
+static void
+iga2_crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image)
+{
+    drmmode_crtc_private_ptr iga = crtc->driver_private;
+    ScrnInfoPtr pScrn = crtc->scrn;
+    void *dst;
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered iga2_crtc_load_cursor_argb.\n"));
+
+    dst = drm_bo_map(pScrn, iga->cursor_bo);
+    memset(dst, 0x00, iga->cursor_bo->size);
+    memcpy(dst, image, iga->cursor_bo->size);
+    drm_bo_unmap(pScrn, iga->cursor_bo);
+
+    viaIGA2InitHI(pScrn);
+    viaIGA2SetHIStartingAddress(crtc);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting iga2_crtc_load_cursor_argb.\n"));
 }
 
 const xf86CrtcFuncsRec iga2_crtc_funcs = {
@@ -3753,7 +3914,7 @@ const xf86CrtcFuncsRec iga2_crtc_funcs = {
     .set_cursor_position    = iga2_crtc_set_cursor_position,
     .show_cursor            = iga2_crtc_show_cursor,
     .hide_cursor            = iga2_crtc_hide_cursor,
-    .load_cursor_argb       = iga_crtc_load_cursor_argb,
+    .load_cursor_argb       = iga2_crtc_load_cursor_argb,
 #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) > 2
     .set_origin             = iga2_crtc_set_origin,
 #endif
diff --git a/src/via_ums.c b/src/via_ums.c
index 95b9e5b..ffd1a66 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -1015,36 +1015,6 @@ umsCrtcInit(ScrnInfoPtr pScrn)
     iga2_rec->index = 1;
     iga2->driver_private = iga2_rec;
 
-    /* Init HI_X0 for cursor */
-    switch (pVia->Chipset) {
-    case VIA_CX700:
-    /* case VIA_CN750: */
-    case VIA_P4M890:
-    case VIA_P4M900:
-    case VIA_VX800:
-    case VIA_VX855:
-    case VIA_VX900:
-        /* set 0 as transparent color key for IGA 2 */
-        VIASETREG(HI_TRANSPARENT_COLOR, 0);
-        VIASETREG(HI_INVTCOLOR, 0X00FFFFFF);
-        VIASETREG(ALPHA_V3_PREFIFO_CONTROL, 0xE0000);
-        VIASETREG(ALPHA_V3_FIFO_CONTROL, 0xE0F0000);
-
-        /* set 0 as transparent color key for IGA 1 */
-        VIASETREG(PRIM_HI_TRANSCOLOR, 0);
-        VIASETREG(PRIM_HI_FIFO, 0x0D000D0F);
-        VIASETREG(PRIM_HI_INVTCOLOR, 0x00FFFFFF);
-        VIASETREG(V327_HI_INVTCOLOR, 0x00FFFFFF);
-        break;
-
-    default:
-        VIASETREG(HI_TRANSPARENT_COLOR, 0);
-        VIASETREG(HI_INVTCOLOR, 0X00FFFFFF);
-        VIASETREG(ALPHA_V3_PREFIFO_CONTROL, 0xE0000);
-        VIASETREG(ALPHA_V3_FIFO_CONTROL, 0xE0F0000);
-        break;
-    }
-
     /*
      * CLE266A:
      *   Max Line Pitch: 4080, (FB corruption when higher, driver problem?)


More information about the Openchrome-devel mailing list