[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-video-openchrome: Changes to 'upstream-unstable'



 .gitignore           |    1 
 configure.ac         |    2 
 src/Makefile.am      |    2 
 src/via_3d.c         |    8 
 src/via_3d.h         |    1 
 src/via_bandwidth.c  |    9 
 src/via_display.c    |   34 ++-
 src/via_dri.c        |   13 +
 src/via_driver.c     |  131 +++++-------
 src/via_driver.h     |   10 
 src/via_drm.h        |   91 +++++---
 src/via_exa.c        |    7 
 src/via_i2c.c        |  162 ++++++++++++--
 src/via_id.c         |   98 +++++----
 src/via_kms.c        |    1 
 src/via_lvds.c       |   53 +++-
 src/via_memcpy.c     |   12 -
 src/via_memmgr.c     |    7 
 src/via_outputs.c    |  553 ++++++++++++++++++++++++++++++---------------------
 src/via_priv.h       |    3 
 src/via_regs.h       |    3 
 src/via_ums.c        |   28 +-
 src/via_vt1632.c     |  275 +++++++++++++++++++++++++
 src/via_vt1632.h     |   54 ++++
 src/via_xv.c         |    8 
 src/via_xv_overlay.c |   20 -
 tools/registers.c    |   80 +++----
 27 files changed, 1153 insertions(+), 513 deletions(-)

New commits:
commit babf51f887554743a46a5078832fe4013f02a018
Author: Kevin Brace <kevinbrace@gmx.com>
Date:   Thu Mar 10 02:47:40 2016 -0800

    Removing via_dp_* functions
    
    Removing via_dp_* functions inside via_outputs.c. These functions are
    not really doing anything useful, so they will be deleted. Apparently,
    they were originally meant for CX700, VX800, VX855, and VX900 chipsets.
    via_lvds_* functions are already handling integrated TMDS and LVDS
    transmitters for the above chipsets.
    
    Signed-off-by: Kevin Brace <kevinbrace@gmx.com>

diff --git a/src/via_outputs.c b/src/via_outputs.c
index f6fc2ad..9e715fc 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -520,172 +520,6 @@ via_tv_init(ScrnInfoPtr pScrn)
     return TRUE;
 }
 
-static void
-via_dp_create_resources(xf86OutputPtr output)
-{
-}
-
-#ifdef RANDR_12_INTERFACE
-static Bool
-via_dp_set_property(xf86OutputPtr output, Atom property,
-                    RRPropertyValuePtr value)
-{
-    return TRUE;
-}
-
-static Bool
-via_dp_get_property(xf86OutputPtr output, Atom property)
-{
-    return FALSE;
-}
-#endif
-
-static void
-via_dp_dpms(xf86OutputPtr output, int mode)
-{
-    ScrnInfoPtr pScrn = output->scrn;
-
-    switch (mode) {
-    case DPMSModeOn:
-        ViaDFPPower(pScrn, TRUE);
-        break;
-
-    case DPMSModeStandby:
-    case DPMSModeSuspend:
-    case DPMSModeOff:
-        ViaDFPPower(pScrn, FALSE);
-        break;
-    }
-}
-
-static void
-via_dp_save(xf86OutputPtr output)
-{
-}
-
-static void
-via_dp_restore(xf86OutputPtr output)
-{
-}
-
-static int
-via_dp_mode_valid(xf86OutputPtr output, DisplayModePtr pMode)
-{
-    ScrnInfoPtr pScrn = output->scrn;
-
-    if (!ViaModeDotClockTranslate(pScrn, pMode))
-        return MODE_NOCLOCK;
-    return MODE_OK;
-}
-
-static Bool
-via_dp_mode_fixup(xf86OutputPtr output, DisplayModePtr mode,
-                  DisplayModePtr adjusted_mode)
-{
-    return TRUE;
-}
-
-static void
-via_dp_prepare(xf86OutputPtr output)
-{
-}
-
-static void
-via_dp_commit(xf86OutputPtr output)
-{
-}
-
-static void
-via_dp_mode_set(xf86OutputPtr output, DisplayModePtr mode,
-                DisplayModePtr adjusted_mode)
-{
-    ScrnInfoPtr pScrn = output->scrn;
-
-    if (output->crtc) {
-        drmmode_crtc_private_ptr iga = output->crtc->driver_private;
-        CARD8 value = 0x00; /* Value for IGA 1 */
-        vgaHWPtr hwp = VGAHWPTR(pScrn);
-
-        /* IGA 2 */
-        if (iga->index)
-            value = 0x10;
-        ViaSeqMask(hwp, 0x99, value, 0x10);
-    }
-    ViaDFPPower(pScrn, TRUE);
-}
-
-static xf86OutputStatus
-via_dp_detect(xf86OutputPtr output)
-{
-    xf86OutputStatus status = XF86OutputStatusDisconnected;
-    ScrnInfoPtr pScrn = output->scrn;
-    VIAPtr pVia = VIAPTR(pScrn);
-    xf86MonPtr mon;
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered via_dp_detect.\n"));
-
-    mon = xf86OutputGetEDID(output, pVia->pI2CBus2);
-    if (mon && DIGITAL(mon->features.input_type)) {
-        xf86OutputSetEDID(output, mon);
-        xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
-                    "I2C Bus 2 detected a DP.\n");
-        status = XF86OutputStatusConnected;
-    }
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting via_dp_detect.\n"));
-    return status;
-}
-
-static void
-via_dp_destroy(xf86OutputPtr output)
-{
-}
-
-static const xf86OutputFuncsRec via_dp_funcs = {
-    .create_resources   = via_dp_create_resources,
-#ifdef RANDR_12_INTERFACE
-    .set_property       = via_dp_set_property,
-#endif
-#ifdef RANDR_13_INTERFACE
-    .get_property       = via_dp_get_property,
-#endif
-    .dpms               = via_dp_dpms,
-    .save               = via_dp_save,
-    .restore            = via_dp_restore,
-    .mode_valid         = via_dp_mode_valid,
-    .mode_fixup         = via_dp_mode_fixup,
-    .prepare            = via_dp_prepare,
-    .commit             = via_dp_commit,
-    .mode_set           = via_dp_mode_set,
-    .detect             = via_dp_detect,
-    .get_modes          = xf86OutputGetEDIDModes,
-    .destroy            = via_dp_destroy,
-};
-
-void
-via_dp_init(ScrnInfoPtr pScrn)
-{
-    VIAPtr pVia = VIAPTR(pScrn);
-    xf86OutputPtr output = NULL;
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered via_dp_init.\n"));
-
-    if (pVia->pI2CBus2)
-        output = xf86OutputCreate(pScrn, &via_dp_funcs, "DP-1");
-    if (output) {
-        output->possible_crtcs = 0x1;
-        output->possible_clones = 0;
-        output->interlaceAllowed = TRUE;
-        output->doubleScanAllowed = FALSE;
-    }
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting via_dp_init.\n"));
-}
-
 /*
  * Enables CRT using DPMS registers.
  */
@@ -1188,16 +1022,6 @@ ViaOutputsDetect(ScrnInfoPtr pScrn)
 
     via_dvi_init(pScrn);
 
-    if (pVia->ActiveDevice & VIA_DEVICE_DFP) {
-        switch (pVia->Chipset) {
-        case VIA_CX700:
-        case VIA_VX800:
-        case VIA_VX855:
-        case VIA_VX900:
-            via_dp_init(pScrn);
-            break;
-        }
-    }
 }
 
 #ifdef HAVE_DEBUG

commit 0a2f6f3d229f93f29a5112bef635ff4b62d774e8
Author: Kevin Brace <kevinbrace@gmx.com>
Date:   Wed Mar 9 20:26:25 2016 -0800

    Added debug messages to via_dp_detect
    
    Added debug messages to via_dp_detect function inside via_outputs.c.
    
    Signed-off-by: Kevin Brace <kevinbrace@gmx.com>

diff --git a/src/via_outputs.c b/src/via_outputs.c
index c4ebebe..f6fc2ad 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -622,6 +622,9 @@ via_dp_detect(xf86OutputPtr output)
     VIAPtr pVia = VIAPTR(pScrn);
     xf86MonPtr mon;
 
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered via_dp_detect.\n"));
+
     mon = xf86OutputGetEDID(output, pVia->pI2CBus2);
     if (mon && DIGITAL(mon->features.input_type)) {
         xf86OutputSetEDID(output, mon);
@@ -629,6 +632,9 @@ via_dp_detect(xf86OutputPtr output)
                     "I2C Bus 2 detected a DP.\n");
         status = XF86OutputStatusConnected;
     }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting via_dp_detect.\n"));
     return status;
 }
 

commit 47323aab2d3b406845dc35ef474a3855c1df1aa7
Author: Kevin Brace <kevinbrace@gmx.com>
Date:   Wed Mar 9 17:32:54 2016 -0800

    Modified a debug message within via_vt1632_probe
    
    Modified a debug message within via_vt1632_probe function inside
    via_vt1632.c.
    
    Signed-off-by: Kevin Brace <kevinbrace@gmx.com>

diff --git a/src/via_vt1632.c b/src/via_vt1632.c
index 911eee7..3c507cb 100644
--- a/src/via_vt1632.c
+++ b/src/via_vt1632.c
@@ -262,8 +262,8 @@ via_vt1632_init(ScrnInfoPtr pScrn, I2CDevPtr pDev)
     xf86I2CReadByte(pDev, 0x07, &buf);
     Private->DotclockMax = (buf + 65) * 1000;
 
-    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632A: Dot Clock Range: %d "
-                "to %d MHz.\n",
+    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632A Dot Clock Range: "
+                "%d to %d MHz\n",
                 Private->DotclockMin / 1000,
                 Private->DotclockMax / 1000);
 

commit a2def1ce285c7329ec3ae9491b63b5f880141d88
Author: Kevin Brace <kevinbrace@gmx.com>
Date:   Wed Mar 9 17:30:47 2016 -0800

    Added debug messages to via_vt1632_probe
    
    Added debug messages to via_vt1632_probe function inside via_vt1632.c.
    
    Signed-off-by: Kevin Brace <kevinbrace@gmx.com>

diff --git a/src/via_vt1632.c b/src/via_vt1632.c
index 8b9edf8..911eee7 100644
--- a/src/via_vt1632.c
+++ b/src/via_vt1632.c
@@ -211,13 +211,17 @@ via_vt1632_probe(ScrnInfoPtr pScrn, I2CDevPtr pDev) {
     VendorID = buf;
     xf86I2CReadByte(pDev, 1, &buf);
     VendorID |= buf << 8;
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Vendor ID: 0x%04x\n", VendorID));
 
     xf86I2CReadByte(pDev, 2, &buf);
     DeviceID = buf;
     xf86I2CReadByte(pDev, 3, &buf);
     DeviceID |= buf << 8;
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Device ID: %04x\n", DeviceID));
 
-    if (VendorID != 0x1106 || DeviceID != 0x3192) {
+    if ((VendorID != 0x1106) || (DeviceID != 0x3192)) {
         xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
                     "VT1632A DVI transmitter not detected.\n");
         DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,

commit 74e95a634506ab92b4c31ee1423bf9349067e0b5
Author: Kevin Brace <kevinbrace@gmx.com>
Date:   Wed Mar 9 00:05:44 2016 -0800

    set_origin callback of xf86CrtcFuncsRec compilation error
    
    It appears that set_origin callback function of xf86CrtcFuncsRec
    structure is available only if ABI_VIDEODRV_VERSION is greater than 2.
    
    Signed-off-by: Kevin Brace <kevinbrace@gmx.com>

diff --git a/src/via_display.c b/src/via_display.c
index be1bebe..15289e9 100644
--- a/src/via_display.c
+++ b/src/via_display.c
@@ -1241,7 +1241,7 @@ static const xf86CrtcFuncsRec iga1_crtc_funcs = {
     .show_cursor            = iga1_crtc_show_cursor,
     .hide_cursor            = iga1_crtc_hide_cursor,
     .load_cursor_argb       = iga_crtc_load_cursor_argb,
-#ifdef RANDR_12_INTERFACE
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) > 2
     .set_origin             = iga1_crtc_set_origin,
 #endif
     .destroy                = iga_crtc_destroy,
@@ -1658,7 +1658,7 @@ static const xf86CrtcFuncsRec iga2_crtc_funcs = {
     .show_cursor            = iga2_crtc_show_cursor,
     .hide_cursor            = iga2_crtc_hide_cursor,
     .load_cursor_argb       = iga_crtc_load_cursor_argb,
-#ifdef RANDR_12_INTERFACE
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) > 2
     .set_origin             = iga2_crtc_set_origin,
 #endif
     .destroy                = iga_crtc_destroy,

commit 8e95e6919263763f64e8e034a88132f71c5b6783
Author: Kevin Brace <kevinbrace@gmx.com>
Date:   Tue Mar 8 23:26:01 2016 -0800

    get_property callback of xf86OutputFuncsRec and RandR compilation error
    
    get_property callback of xf86OutputFuncsRec structure is supported by
    RandR version 1.3, not version 1.2.
    
    Signed-off-by: Kevin Brace <kevinbrace@gmx.com>

diff --git a/src/via_lvds.c b/src/via_lvds.c
index 09c5763..fd5d4b9 100644
--- a/src/via_lvds.c
+++ b/src/via_lvds.c
@@ -1476,6 +1476,8 @@ static const xf86OutputFuncsRec via_lvds_funcs = {
     .create_resources   = via_lvds_create_resources,
 #ifdef RANDR_12_INTERFACE
     .set_property       = via_lvds_set_property,
+#endif
+#ifdef RANDR_13_INTERFACE
     .get_property       = via_lvds_get_property,
 #endif
     .dpms               = via_lvds_dpms,

commit aed2e6648e9d1b95855c64b3a1edf6c0bcc18c9c
Author: Kevin Brace <kevinbrace@gmx.com>
Date:   Tue Mar 8 21:07:11 2016 -0800

    get_property callback of xf86OutputFuncsRec and RandR compilation error
    
    get_property callback of xf86OutputFuncsRec structure is supported by
    RandR version 1.3, not version 1.2.
    
    Signed-off-by: Kevin Brace <kevinbrace@gmx.com>

diff --git a/src/via_outputs.c b/src/via_outputs.c
index d97d585..c4ebebe 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -375,6 +375,8 @@ static const xf86OutputFuncsRec via_tv_funcs = {
     .create_resources   = via_tv_create_resources,
 #ifdef RANDR_12_INTERFACE
     .set_property       = via_tv_set_property,
+#endif
+#ifdef RANDR_13_INTERFACE
     .get_property       = via_tv_get_property,
 #endif
     .dpms               = via_tv_dpms,
@@ -639,6 +641,8 @@ static const xf86OutputFuncsRec via_dp_funcs = {
     .create_resources   = via_dp_create_resources,
 #ifdef RANDR_12_INTERFACE
     .set_property       = via_dp_set_property,
+#endif
+#ifdef RANDR_13_INTERFACE
     .get_property       = via_dp_get_property,
 #endif
     .dpms               = via_dp_dpms,
@@ -888,6 +892,8 @@ static const xf86OutputFuncsRec via_analog_funcs = {
     .create_resources   = via_analog_create_resources,
 #ifdef RANDR_12_INTERFACE
     .set_property       = via_analog_set_property,
+#endif
+#ifdef RANDR_13_INTERFACE
     .get_property       = via_analog_get_property,
 #endif
     .dpms               = via_analog_dpms,
@@ -1047,6 +1053,8 @@ static const xf86OutputFuncsRec via_dvi_funcs = {
     .create_resources   = via_dvi_create_resources,
 #ifdef RANDR_12_INTERFACE
     .set_property       = via_dvi_set_property,
+#endif
+#ifdef RANDR_13_INTERFACE
     .get_property       = via_dvi_get_property,
 #endif
     .dpms               = via_dvi_dpms,

commit 9dbd0359a98f5010e3f8fcf6ad411404b434901b
Author: Kevin Brace <kevinbrace@gmx.com>
Date:   Tue Mar 8 02:15:17 2016 -0800

    Fixing P4M800 chipset detection code compilation error
    
    Likely due to an overlook, the code to detect P4M800 chipset did not
    compile correctly if the code was being compiled against an older
    version of x.org X Server.
    
    Signed-off-by: Kevin Brace <kevinbrace@gmx.com>

diff --git a/src/via_ums.c b/src/via_ums.c
index 95a171e..ae0393e 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -707,20 +707,21 @@ UMSPreInit(ScrnInfoPtr pScrn)
             pScrn->videoRam = (1 << ((videoRam & 0x70) >> 4)) << 10;
             break;
         case VIA_KM400:
-            /* P4M800 */
-            if (DEVICE_ID(bridge) == 0x0296) {
 #ifdef HAVE_PCIACCESS
+            /* P4M800 Host Bridge PCI Device ID */
+            if (DEVICE_ID(bridge) == 0x0296) {
                 pci_device_cfg_read_u8(vgaDevice, &videoRam, 0xA1);
-#else
-                videoRam = pciReadByte(pciTag(0, 0, 3), 0xA1) & 0x70;
-#endif
             } else {
-#ifdef HAVE_PCIACCESS
                 pci_device_cfg_read_u8(bridge, &videoRam, 0xE1);
+            }
 #else
+            /* P4M800 Host Bridge PCI Device ID */
+            if (pciReadWord(pciTag(0, 0, 0), 0x02) == 0x0296) {
+                videoRam = pciReadByte(pciTag(0, 0, 3), 0xA1) & 0x70;
+            } else {
                 videoRam = pciReadByte(pciTag(0, 0, 0), 0xE1) & 0x70;
-#endif
             }
+#endif
             pScrn->videoRam = (1 << ((videoRam & 0x70) >> 4)) << 10;
             break;
         case VIA_PM800:

commit e73fa19fec23d6ec5be836f698d323f89ae48611
Author: Kevin Brace <kevinbrace@gmx.com>
Date:   Tue Mar 8 01:17:05 2016 -0800

    Fixing header file compilation errors with an older version gcc
    
    It was observed with an older version gcc where including xf86Crtc.h and
    xf86fbman.h inside via_ums.c causes compilation errors. It appears that
    via_driver.h includes necessary header files to correctly compile ums.c,
    therefore, xf86Crtc.h and xf86fbman.h will no longer be explicitly included
    inside via_ums.c.
    
    Signed-off-by: Kevin Brace <kevinbrace@gmx.com>

diff --git a/src/via_ums.c b/src/via_ums.c
index dfb6511..95a171e 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -25,8 +25,6 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
-#include "xf86Crtc.h"
-#include "xf86fbman.h"
 
 #include "globals.h"
 #include "via_driver.h"

commit 7dd217502d91ffecfc857c4337893e826ffd00bd
Author: Kevin Brace <kevinbrace@gmx.com>
Date:   Sun Mar 6 02:27:28 2016 -0800

    Fixing the misdetection of NanoBook flat panel
    
    It was observed in a VIA Technologies NanoBook based laptop computer
    that the flat panel it contains is not connected to an I2C bus, hence
    the supported screen resolution cannot be determined via an I2C bus.
    Furthermore, the code was obtaining EDID information via I2C bus 2, but
    it was not scrutinizing the interface type. Hence, if a VGA monitor
    is connected to the computer, the code was determining the flat panel
    screen resolution based on the EDID information obtained from the VGA
    monitor via I2C bus 2. Due to all of these issues, the flat panel
    screen color was going completely white, making the flat panel
    completely useless. Thanks to this fix, the flat panel and a VGA
    monitor can now be detected correctly.
    
    Signed-off-by: Kevin Brace <kevinbrace@gmx.com>

diff --git a/src/via_lvds.c b/src/via_lvds.c
index 073cef6..09c5763 100644
--- a/src/via_lvds.c
+++ b/src/via_lvds.c
@@ -485,28 +485,55 @@ ViaPanelGetSizeFromDDCv1(xf86OutputPtr output, int *width, int *height)
     VIAPtr pVia = VIAPTR(pScrn);
     xf86MonPtr pMon;
 
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAGetPanelSizeFromDDCv1\n"));
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered VIAGetPanelSizeFromDDCv1.\n"));
 
-    if (!(pVia->I2CDevices & VIA_I2C_BUS2))
+    if (!pVia->pI2CBus2) {
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                    "I2C Bus 2 does not exist.\n");
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting VIAGetPanelSizeFromDDCv1.\n"));
         return FALSE;
+    }
 
-    if (!xf86I2CProbeAddress(pVia->pI2CBus2, 0xA0))
+    if (!xf86I2CProbeAddress(pVia->pI2CBus2, 0xA0)) {
+        xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                    "I2C device on I2C Bus 2 does not support EDID.\n");
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting VIAGetPanelSizeFromDDCv1.\n"));
         return FALSE;
+    }
 
-    pMon = xf86DoEEDID(XF86_SCRN_ARG(pScrn), pVia->pI2CBus2, TRUE);
-    if (!pMon)
+    /* Probe I2C Bus 2 to see if a flat panel is connected. */
+    xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                "Probing for a flat panel on I2C Bus 2.\n");
+    pMon = xf86OutputGetEDID(output, pVia->pI2CBus2);
+    if (pMon && DIGITAL(pMon->features.input_type)) {
+        xf86OutputSetEDID(output, pMon);
+        xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                    "Detected a flat panel on I2C Bus 2.\n");
+    } else {
+        xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                    "Did not detect a flat panel on I2C Bus 2.\n");
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting VIAGetPanelSizeFromDDCv1.\n"));
         return FALSE;
 
-    xf86OutputSetEDID(output, pMon);
+    }
 
     if (!ViaPanelGetSizeFromEDID(pScrn, pMon, width, height)) {
         xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                   "Unable to read PanelSize from EDID information\n");
+                    "Unable to obtain panel size from EDID information.\n");
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting VIAGetPanelSizeFromDDCv1.\n"));
         return FALSE;
     }
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                     "VIAGetPanelSizeFromDDCv1: (%dx%d)\n", *width, *height));
+                        "VIAGetPanelSizeFromDDCv1: (%d X %d)\n",
+                        *width, *height));
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting VIAGetPanelSizeFromDDCv1.\n"));
     return TRUE;
 }
 

commit 802544370dd827ed3488965e39804e3cb630888a
Author: Kevin Brace <kevinbrace@gmx.com>
Date:   Sat Mar 5 19:48:33 2016 -0800

    Checking the validity of I2C buses before initializing VGA output
    
    The validity of I2C buses is checked before VGA output is registered
    with X Server.
    
    Reported-by: Christopher Havel <laserhawk64@gmail.com>
    Tested-by: Justin Chevrier <jchevrier@gmail.com>
    Signed-off-by: Kevin Brace <kevinbrace@gmx.com>

diff --git a/src/via_outputs.c b/src/via_outputs.c
index 31013a4..d97d585 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -913,16 +913,22 @@ via_analog_init(ScrnInfoPtr pScrn)
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Entered via_analog_init.\n"));
 
-    if (pVia->pI2CBus1) {
-        output = xf86OutputCreate(pScrn, &via_analog_funcs, "VGA-1");
-
-        output->possible_crtcs = 0x3;
-        output->possible_clones = 0;
-        output->interlaceAllowed = TRUE;
-        output->doubleScanAllowed = FALSE;
-        pBIOSInfo->analog = output;
+    if (!pVia->pI2CBus1 || !pVia->pI2CBus2) {
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                    "I2C Bus 1 or I2C Bus 2 does not exist.\n");
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting via_analog_init.\n"));
+        return;
     }
 
+    output = xf86OutputCreate(pScrn, &via_analog_funcs, "VGA-1");
+
+    output->possible_crtcs = 0x3;
+    output->possible_clones = 0;
+    output->interlaceAllowed = TRUE;
+    output->doubleScanAllowed = FALSE;
+    pBIOSInfo->analog = output;
+
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Exiting via_analog_init.\n"));
 }

commit 7a98f6584fec8dd7d6f516d6718839b5c96342cc
Author: Kevin Brace <kevinbrace@gmx.com>
Date:   Sat Mar 5 11:33:08 2016 -0800

    Using I2C bus 2 to detect a VGA monitor
    
    Previously, it was assumed that I2C bus 1 is used to detect only a VGA
    monitor. It was also assumed that I2C bus 2 is used to detect a DVI
    monitor or TV encoder. However, for devices with a DVI-I connector,
    VGA signals come out of the connector as well. What this means is that
    I2C bus 2 also has to be used to detect a VGA monitor, in addition to
    I2C bus 1. Furthermore, EDID obtained from the monitor via I2C bus
    will be used to determine whether or not it is an analog type
    (i.e., VGA monitor).
    
    Reported-by: Christopher Havel <laserhawk64@gmail.com>
    Tested-by: Justin Chevrier <jchevrier@gmail.com>
    Signed-off-by: Kevin Brace <kevinbrace@gmx.com>

diff --git a/src/via_outputs.c b/src/via_outputs.c
index 8034911..31013a4 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -804,50 +804,78 @@ via_analog_detect(xf86OutputPtr output)
     VIAPtr pVia = VIAPTR(pScrn);
     xf86MonPtr mon;
 
+    /* Probe I2C Bus 1 to see if a VGA monitor is connected. */
+    xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                "Probing for a VGA monitor on I2C Bus 1.\n");
     mon = xf86OutputGetEDID(output, pVia->pI2CBus1);
-    if (mon) {
+    if (mon && (!mon->features.input_type)) {
         xf86OutputSetEDID(output, mon);
-        xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
-                    "I2C Bus 1 detected a VGA monitor.\n");
         status = XF86OutputStatusConnected;
+        xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                    "Detected a VGA monitor on I2C Bus 1.\n");
     } else {
-        vgaHWPtr hwp = VGAHWPTR(pScrn);
-        CARD8 SR01 = hwp->readSeq(hwp, 0x01);
-        CARD8 SR40 = hwp->readSeq(hwp, 0x40);
-        CARD8 CR36 = hwp->readCrtc(hwp, 0x36);
-
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
-                         "Test for CRT with VSYNC\n"));
-        /* We have to power on the display to detect it */
-        ViaSeqMask(hwp, 0x01, 0x00, 0x20);
-        ViaCrtcMask(hwp, 0x36, 0x00, 0xF0);
-
-        /* Wait for vblank */
-        usleep(16);
-
-        /* Detect the load on pins */
-        ViaSeqMask(hwp, 0x40, 0x80, 0x80);
-
-        if ((VIA_CX700 == pVia->Chipset) ||
-            (VIA_VX800 == pVia->Chipset) ||
-            (VIA_VX855 == pVia->Chipset) ||
-            (VIA_VX900 == pVia->Chipset))
-            ViaSeqMask(hwp, 0x40, 0x00, 0x80);
+        xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                    "Did not detect a VGA monitor on I2C Bus 1.\n");
 
-        if (ViaVgahwIn(hwp, 0x3C2) & 0x20)
+        /* Probe I2C Bus 2 to see if a VGA monitor is connected. */
+        xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                    "Probing for a VGA monitor on I2C Bus 2.\n");
+        mon = xf86OutputGetEDID(output, pVia->pI2CBus2);
+        if (mon && (!mon->features.input_type)) {
+            xf86OutputSetEDID(output, mon);
             status = XF86OutputStatusConnected;
+            xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                        "Detected a VGA monitor on I2C Bus 2.\n");
+        } else {
+            xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                        "Did not detect a VGA monitor on I2C Bus 2.\n");
+
+            /* Perform manual detection of a VGA monitor since */
+            /* it was not detected via I2C buses. */
+            xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                        "Now perform manual detection of a VGA "
+                        "monitor.\n");
+            vgaHWPtr hwp = VGAHWPTR(pScrn);
+            CARD8 SR01 = hwp->readSeq(hwp, 0x01);
+            CARD8 SR40 = hwp->readSeq(hwp, 0x40);
+            CARD8 CR36 = hwp->readCrtc(hwp, 0x36);
+
+            /* We have to power on the display to detect it */
+            ViaSeqMask(hwp, 0x01, 0x00, 0x20);
+            ViaCrtcMask(hwp, 0x36, 0x00, 0xF0);
+
+            /* Wait for vblank */
+            usleep(16);
+
+            /* Detect the load on pins */
+            ViaSeqMask(hwp, 0x40, 0x80, 0x80);
+
+            if ((VIA_CX700 == pVia->Chipset) ||
+                (VIA_VX800 == pVia->Chipset) ||
+                (VIA_VX855 == pVia->Chipset) ||
+                (VIA_VX900 == pVia->Chipset))
+                ViaSeqMask(hwp, 0x40, 0x00, 0x80);
+
+            if (ViaVgahwIn(hwp, 0x3C2) & 0x20) {
+                status = XF86OutputStatusConnected;
+                xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                            "Detected a VGA monitor using manual "
+                            "detection method.\n");
+            }
 
-        if ((VIA_CX700 == pVia->Chipset) ||
-            (VIA_VX800 == pVia->Chipset) ||
-            (VIA_VX855 == pVia->Chipset) ||
-            (VIA_VX900 == pVia->Chipset))
-            ViaSeqMask(hwp, 0x40, 0x00, 0x80);
+            if ((VIA_CX700 == pVia->Chipset) ||
+                (VIA_VX800 == pVia->Chipset) ||
+                (VIA_VX855 == pVia->Chipset) ||
+                (VIA_VX900 == pVia->Chipset))
+                ViaSeqMask(hwp, 0x40, 0x00, 0x80);
 
-        /* Restore previous state */
-        hwp->writeSeq(hwp, 0x40, SR40);
-        hwp->writeSeq(hwp, 0x01, SR01);
-        hwp->writeCrtc(hwp, 0x36, CR36);
+            /* Restore previous state */
+            hwp->writeSeq(hwp, 0x40, SR40);
+            hwp->writeSeq(hwp, 0x01, SR01);
+            hwp->writeCrtc(hwp, 0x36, CR36);
+        }
     }
+
     return status;
 }
 

commit d45116a689463ada005495d7bdde5f6fc0a072a1
Author: Kevin Brace <kevinbrace@gmx.com>
Date:   Sun Feb 21 12:15:54 2016 -0800

    Adding CN333 chipset to the chipset support list
    
    It is believed to be a feature limited version of CN400 chipset.
    
    Signed-off-by: Kevin Brace <kevinbrace@gmx.com>

diff --git a/src/via_driver.c b/src/via_driver.c
index 3e5122a..330d5a2 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -130,7 +130,7 @@ static SymTabRec VIAChipsets[] = {
     {VIA_CLE266,        "CLE266"},
     {VIA_KM400,         "KM400 / KM400A / KN400 / P4M800"},
     {VIA_K8M800,        "K8M800 / K8N800"},
-    {VIA_PM800,         "PM800 / PN800 / PM880 / CN400"},
+    {VIA_PM800,         "PM800 / PN800 / PM880 / CN333 / CN400"},
     {VIA_P4M800PRO,     "P4M800 Pro / VN800 / CN700"},
     {VIA_CX700,         "CX700 / VX700"},
     {VIA_P4M890,        "P4M890 / VN890 / CN800"},
diff --git a/src/via_id.c b/src/via_id.c
index 90ddc28..ce891e9 100644
--- a/src/via_id.c
+++ b/src/via_id.c
@@ -122,7 +122,7 @@ static struct ViaCardIdStruct ViaCardId[] = {
     {"ASRock K8Upgrade-VM800",                VIA_K8M800,  0x1849, 0x3108, VIA_DEVICE_CRT},
     {"Axper XP-M8VM800",                      VIA_K8M800,  0x1940, 0xD000, VIA_DEVICE_CRT},
 
-    /*** PM800, PM880, PN800, CN400 ***/
+    /*** PM800, PM880, PN800, CN333, CN400 ***/
     {"VIA VT3118 (PM800)",                    VIA_PM800,   0x1106, 0x3118, VIA_DEVICE_CRT}, /* borrowed by ECS PM800-M2 */
     {"Hasee F700C",                           VIA_PM800,   0x1071, 0x8650, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
     {"Mitac 8666",                            VIA_PM800,   0x1071, 0x8666, VIA_DEVICE_CRT | VIA_DEVICE_LCD | VIA_DEVICE_TV},

commit ab2e08b571ca803d3460b7ec4154f96471673615
Author: Kevin Brace <kevinbrace@gmx.com>
Date:   Sun Feb 21 12:00:19 2016 -0800

    Adding VN890 chipset to the chipset support list
    
    It is believed to be a mobile version of P4M890 chipset.
    
    Signed-off-by: Kevin Brace <kevinbrace@gmx.com>

diff --git a/src/via_driver.c b/src/via_driver.c
index efe73a5..3e5122a 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -133,7 +133,7 @@ static SymTabRec VIAChipsets[] = {
     {VIA_PM800,         "PM800 / PN800 / PM880 / CN400"},
     {VIA_P4M800PRO,     "P4M800 Pro / VN800 / CN700"},
     {VIA_CX700,         "CX700 / VX700"},
-    {VIA_P4M890,        "P4M890 / CN800"},
+    {VIA_P4M890,        "P4M890 / VN890 / CN800"},
     {VIA_K8M890,        "K8M890 / K8N890"},
     {VIA_P4M900,        "P4M900 / VN896 / CN896"},
     {VIA_VX800,         "VX800 / VX820"},

commit 277ee3e2eb000682df419958f78511da7078c613
Author: Kevin Brace <kevinbrace@gmx.com>
Date:   Sun Feb 21 02:23:15 2016 -0800

    Added debug messages to via_dp_init
    
    Added debug messages to via_dp_init function inside via_outputs.c.
    
    Signed-off-by: Kevin Brace <kevinbrace@gmx.com>

diff --git a/src/via_outputs.c b/src/via_outputs.c
index c2a68aa..8034911 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -660,6 +660,9 @@ via_dp_init(ScrnInfoPtr pScrn)
     VIAPtr pVia = VIAPTR(pScrn);
     xf86OutputPtr output = NULL;
 
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered via_dp_init.\n"));
+
     if (pVia->pI2CBus2)
         output = xf86OutputCreate(pScrn, &via_dp_funcs, "DP-1");
     if (output) {
@@ -668,6 +671,9 @@ via_dp_init(ScrnInfoPtr pScrn)
         output->interlaceAllowed = TRUE;
         output->doubleScanAllowed = FALSE;
     }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting via_dp_init.\n"));
 }
 
 /*

commit 39503b8a0265330769b43a748b49f7201e52c76b
Author: Kevin Brace <kevinbrace@gmx.com>
Date:   Sun Feb 21 01:46:27 2016 -0800

    Added debug messages to via_analog_init
    
    Added debug messages to via_analog_init function inside via_outputs.c.
    
    Signed-off-by: Kevin Brace <kevinbrace@gmx.com>

diff --git a/src/via_outputs.c b/src/via_outputs.c
index fefe698..c2a68aa 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -876,6 +876,9 @@ via_analog_init(ScrnInfoPtr pScrn)
     VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
     xf86OutputPtr output = NULL;
 
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered via_analog_init.\n"));
+
     if (pVia->pI2CBus1) {
         output = xf86OutputCreate(pScrn, &via_analog_funcs, "VGA-1");
 
@@ -885,6 +888,9 @@ via_analog_init(ScrnInfoPtr pScrn)
         output->doubleScanAllowed = FALSE;
         pBIOSInfo->analog = output;
     }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting via_analog_init.\n"));
 }
 
 static void

commit df191b9c536a16b527df73cafe76f5527410ebd3
Author: Kevin Brace <kevinbrace@gmx.com>
Date:   Sun Feb 21 01:32:40 2016 -0800

    Added debug messages to via_i2c.c
    
    Signed-off-by: Kevin Brace <kevinbrace@gmx.com>

diff --git a/src/via_i2c.c b/src/via_i2c.c
index bde073c..7d75b29 100644
--- a/src/via_i2c.c
+++ b/src/via_i2c.c
@@ -24,7 +24,7 @@
  */
 
 /*
- * Implements three i2c busses through registers SR26, SR2c, and SR31.
+ * Implements three I2C buses through registers SR26, SR2C, and SR31.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -39,7 +39,7 @@
 #define SCL_WRITE 0x20
 
 /*
- * CRT I2C
+ * First I2C Bus: Typically used for detecting a VGA monitor.
  */
 static void
 ViaI2C1PutBits(I2CBusPtr Bus, int clock, int data)
@@ -69,15 +69,23 @@ ViaI2C1GetBits(I2CBusPtr Bus, int *clock, int *data)
 static I2CBusPtr
 ViaI2CBus1Init(ScrnInfoPtr pScrn)
 {
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered ViaI2CBus1Init.\n"));
+
     I2CBusPtr pI2CBus = xf86CreateI2CBusRec();
     vgaHWPtr hwp = VGAHWPTR(pScrn);
 
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaI2CBus1Init\n"));
-
-    if (!pI2CBus)
+    if (!pI2CBus) {
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                            "xf86CreateI2CBusRec failed.\n"));
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                            "Initialization of I2C Bus 1 failed.\n");
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting ViaI2CBus1Init.\n"));
         return NULL;
+    }
 
-    pI2CBus->BusName = "I2C bus 1";
+    pI2CBus->BusName = "I2C Bus 1";
     pI2CBus->scrnIndex = pScrn->scrnIndex;
     pI2CBus->I2CPutBits = ViaI2C1PutBits;
     pI2CBus->I2CGetBits = ViaI2C1GetBits;
@@ -88,14 +96,24 @@ ViaI2CBus1Init(ScrnInfoPtr pScrn)
     pI2CBus->BitTimeout = 40;
 
     if (!xf86I2CBusInit(pI2CBus)) {
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                            "xf86I2CBusInit failed.\n"));
         xf86DestroyI2CBusRec(pI2CBus, TRUE, FALSE);
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                    "Initialization of I2C Bus 1 failed.\n");
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting ViaI2CBus1Init.\n"));
         return NULL;
     }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,


Reply to: