[Openchrome-devel] xf86-video-openchrome: Branch 'glamor' - 34 commits - configure.ac .gitignore src/Makefile.am src/via_3d.c src/via_3d.h src/via_dri.c src/via_driver.c src/via_driver.h src/via_drm.h src/via_exa.c src/via_i2c.c src/via_id.c src/via_kms.c src/via_lvds.c src/via_memcpy.c src/via_memmgr.c src/via_outputs.c src/via_vt1632.c src/via_vt1632.h src/via_xv.c src/via_xv_overlay.c tools/registers.c

James Simmons jsimmons at kemper.freedesktop.org
Tue Jan 13 17:12:34 PST 2015


 .gitignore           |    1 
 configure.ac         |    2 
 src/Makefile.am      |    2 
 src/via_3d.c         |    8 +-
 src/via_3d.h         |    1 
 src/via_dri.c        |    8 ++
 src/via_driver.c     |   60 ++++++---------
 src/via_driver.h     |   10 ++
 src/via_drm.h        |   91 ++++++++++++++--------
 src/via_exa.c        |    5 -
 src/via_i2c.c        |   59 ++++++++++++--
 src/via_id.c         |    5 +
 src/via_kms.c        |    1 
 src/via_lvds.c       |    5 -
 src/via_memcpy.c     |   12 ---
 src/via_memmgr.c     |    7 +
 src/via_outputs.c    |  198 ++++++++++++++++++++++++++++++++++++++++++++++++-
 src/via_vt1632.c     |  204 +++++++++++++++++++++++++++++++++++++++++++++++++++
 src/via_vt1632.h     |   54 +++++++++++++
 src/via_xv.c         |    4 -
 src/via_xv_overlay.c |   16 +---
 tools/registers.c    |   80 ++++++++++----------
 22 files changed, 678 insertions(+), 155 deletions(-)

New commits:
commit d16820b7dca73e7af8ee491a917b9232ab0721c5
Merge: deaf513 33fcaa1
Author: James Simmons <jsimmons at infradead.org>
Date:   Tue Jan 13 18:11:06 2015 -0700

    Merge branch 'master' into glamor

commit 33fcaa11daeb7ca156fcdadd969ca7f950ce8401
Author: James Simmons <jsimmons at infradead.org>
Date:   Tue Jan 13 15:18:28 2015 -0700

    Fixes for various memory related problems discovered by cppcheck.
    The errors are memory leaks, NULL dereferences, and double frees.
    
    Signed-off-by: Oppen <mrugiero at gmail.com>
    Reviewed-by:   James Simmons <jsimmons at infradead.org>

diff --git a/src/via_3d.c b/src/via_3d.c
index 64f40ba..e2d04ff 100644
--- a/src/via_3d.c
+++ b/src/via_3d.c
@@ -257,8 +257,12 @@ viaSet3DCompositeOperator(Via3DState * v3d, CARD8 op)
 {
     ViaCompositeOperator *vOp = viaOperatorModes + op;
 
-    v3d->blendDirty = TRUE;
-    if (v3d && vOp->supported) {
+    if (v3d)
+        v3d->blendDirty = TRUE;
+    else
+        return;
+
+    if (vOp->supported) {
         v3d->blendCol0 = vOp->col0 << 4;
         v3d->blendCol1 = vOp->col1 << 2;
         v3d->blendAl0 = vOp->al0 << 4;
diff --git a/src/via_dri.c b/src/via_dri.c
index c8d3180..2f21a2b 100644
--- a/src/via_dri.c
+++ b/src/via_dri.c
@@ -478,6 +478,14 @@ VIAInitVisualConfigs(ScreenPtr pScreen)
         if (i != numConfigs) {
             xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[dri] Incorrect "
                        "initialization of visuals.  Disabling DRI.\n");
+
+            if (pConfigs)
+                free(pConfigs);
+            if (pVIAConfigs)
+                free(pVIAConfigs);
+            if (pVIAConfigPtrs)
+                free(pVIAConfigPtrs);
+
             return FALSE;
         }
     }
diff --git a/src/via_driver.c b/src/via_driver.c
index 0679cf2..2fd8f21 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -1028,7 +1028,9 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
         pVia->ChipRev = pciReadByte(pciTag(0, 0, 0), 0xF6);
 #endif
     }
-    free(pEnt);
+
+    if (pEnt)
+        free(pEnt);
     xf86DrvMsg(pScrn->scrnIndex, from, "Chipset revision: %d\n", pVia->ChipRev);
 
     pVia->directRenderingType = DRI_NONE;
@@ -1106,7 +1108,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
      */
 
     if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support32bppFb)) {
-        free(pEnt);
         VIAFreeRec(pScrn);
         return FALSE;
     } else {
@@ -1121,7 +1122,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
                 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
                            "Given depth (%d) is not supported by this driver\n",
                            pScrn->depth);
-                free(pEnt);
                 VIAFreeRec(pScrn);
                 return FALSE;
         }
@@ -1137,7 +1137,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
         rgb zeros = { 0, 0, 0 };
 
         if (!xf86SetWeight(pScrn, zeros, zeros)) {
-            free(pEnt);
             VIAFreeRec(pScrn);
             return FALSE;
         } else {
@@ -1154,7 +1153,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
             xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual"
                        " (%s) is not supported at depth %d.\n",
                        xf86GetVisualName(pScrn->defaultVisual), pScrn->depth);
-            free(pEnt);
             VIAFreeRec(pScrn);
             return FALSE;
         }
diff --git a/src/via_exa.c b/src/via_exa.c
index d78a770..3ee4921 100644
--- a/src/via_exa.c
+++ b/src/via_exa.c
@@ -217,9 +217,10 @@ viaSetupCBuffer(ScrnInfoPtr pScrn, ViaCommandBuffer *cb, unsigned size)
 static void
 viaTearDownCBuffer(ViaCommandBuffer *cb)
 {
-    if (cb && cb->buf)
+    if (cb && cb->buf) {
         free(cb->buf);
-    cb->buf = NULL;
+        cb->buf = NULL;
+    }
 }
 
 /*
commit 8ff8235260c035b960c3552df25a9784e1049f24
Author: Xavier Bachelot <xavier at bachelot.org>
Date:   Tue Jan 13 22:06:44 2015 +0100

    Make via_dvi_set_property return TRUE.
    Other via_*_set_property just got fixed in 271c716f2060bc04a5ca8324c0d2c27473463206

diff --git a/src/via_outputs.c b/src/via_outputs.c
index 71b059b..d488130 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -871,7 +871,7 @@ static Bool
 via_dvi_set_property(xf86OutputPtr output, Atom property,
 						RRPropertyValuePtr value)
 {
-    return FALSE;
+    return TRUE;
 }
 
 static Bool
commit bcdd1e7ef9df5dc72b9dbb2977b39e65a45f8697
Author: James Simmons <jsimmons at infradead.org>
Date:   Tue Jan 13 13:43:03 2015 -0700

    Last of the gcc warnings.
    
    Signed-off-by: James Simmons <jsimmons at infradead.org>

diff --git a/src/via_lvds.c b/src/via_lvds.c
index 0dcc64a..4f17484 100644
--- a/src/via_lvds.c
+++ b/src/via_lvds.c
@@ -1468,7 +1468,8 @@ static const xf86OutputFuncsRec via_lvds_funcs = {
  * using name with format "9999x9999".
  */
 static void
-ViaPanelGetNativeModeFromOption(ScrnInfoPtr pScrn, ViaPanelInfoPtr panel, char *name)
+ViaPanelGetNativeModeFromOption(ScrnInfoPtr pScrn, ViaPanelInfoPtr panel,
+								const char *name)
 {
     char aux[strlen(name) + 1];
     CARD8 length, index;
@@ -1500,7 +1501,7 @@ via_lvds_init(ScrnInfoPtr pScrn)
     VIAPtr pVia = VIAPTR(pScrn);
     xf86OutputPtr output = NULL;
     Bool ForcePanel = FALSE;
-    char *s = NULL;
+    const char *s = NULL;
 
     if (!Panel)
         return;
commit 18ff812145f9de95920387a811c106dd11a92865
Author: James Simmons <jsimmons at infradead.org>
Date:   Tue Jan 13 13:38:21 2015 -0700

    Silence the warning: assignment discards 'const' qualifier from
    pointer target type.
    
    Signed-off-by:  James Simmons <jsimmons at casper.infradead.org>

diff --git a/src/via_driver.c b/src/via_driver.c
index f3ad39d..0679cf2 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -918,7 +918,7 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
     VIAPtr pVia;
     VIABIOSInfoPtr pBIOSInfo;
     MessageType from = X_DEFAULT;
-    char *s = NULL;
+    const char *s = NULL;
 #ifdef HAVE_DRI
     char *busId = NULL;
     drmVersionPtr drmVer;
commit 87ca395dd87c93707140337977faa6d47874f706
Author: James Simmons <jsimmons at infradead.org>
Date:   Tue Jan 13 13:35:22 2015 -0700

    Migrate the register tool to C99 standard. Fix the overflow with
    the shift calculation.
    
    Signed-off-by:  James Simmons <jsimmons at casper.infradead.org>

diff --git a/.gitignore b/.gitignore
index cf77b11..fa1b356 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,6 +16,7 @@ config.log
 config.status
 config.sub
 configure
+compile
 depcomp
 install-sh
 libtool
diff --git a/tools/registers.c b/tools/registers.c
index 0e0a532..adb6b39 100644
--- a/tools/registers.c
+++ b/tools/registers.c
@@ -20,6 +20,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <stdint.h>
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
@@ -31,7 +32,7 @@
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
 struct bit_desc {
-	u_int8_t mask;
+	uint8_t mask;
 	char *name;
 };
 
@@ -41,8 +42,8 @@ struct io_index {
 };
 
 struct io_reg {
-	u_int16_t	io_port_addr;	/* port for address */
-	u_int16_t	io_port_data;	/* port for address */
+	uint16_t	io_port_addr;	/* port for address */
+	uint16_t	io_port_data;	/* port for address */
 	char *		name;
 	struct io_index	index[0xff];
 };
@@ -583,23 +584,23 @@ struct io_reg sequencer_regs = {
 	},
 };
 
-static u_int8_t readb_idx_reg(u_int16_t port, u_int8_t index)
+static uint8_t readb_idx_reg(uint16_t port, uint8_t index)
 {
 	outb(index, port-1);
 	return inb(port);
 }
 
-static void writeb_idx_reg(u_int16_t port, u_int8_t index,
-			   u_int8_t val)
+static void writeb_idx_reg(uint16_t port, uint8_t index,
+			   uint8_t val)
 {
 	outb(index, port-1);
 	outb(val, port);
 }
 
-static void writeb_idx_mask(u_int16_t reg, u_int8_t idx, u_int8_t val,
-			    u_int8_t mask)
+static void writeb_idx_mask(uint16_t reg, uint8_t idx, uint8_t val,
+			    uint8_t mask)
 {
-	u_int8_t tmp;
+	uint8_t tmp;
 
 	tmp = readb_idx_reg(reg, idx);
 	tmp &= ~ mask;
@@ -614,31 +615,31 @@ struct io_reg *io_regs[] = {
 	&graphic_regs,
 	&crtc_regs,
 	NULL
-};	
+};
 
 struct half_mode {
-	u_int16_t total;
-	u_int16_t active;
-	u_int16_t blank_start;
-	u_int16_t blank_end;
-	u_int16_t retr_start;
-	u_int16_t retr_end;
+	uint16_t total;
+	uint16_t active;
+	uint16_t blank_start;
+	uint16_t blank_end;
+	uint16_t retr_start;
+	uint16_t retr_end;
 	int n_sync;
 };
 
 struct mode {
-	struct half_mode h;	
-	struct half_mode v;	
-	u_int32_t addr_start;
-	u_int8_t bpp;
-	u_int16_t horiz_quad_count;
-	u_int16_t horiz_offset;
+	struct half_mode h;
+	struct half_mode v;
+	uint32_t addr_start;
+	uint8_t bpp;
+	uint16_t horiz_quad_count;
+	uint16_t horiz_offset;
 };
 
 static int get_mode(struct mode *m, int secondary)
 {
-	u_int8_t val;
-	
+	uint8_t val;
+
 	memset(m, 0, sizeof(*m));
 
 	if (!secondary) {
@@ -801,7 +802,7 @@ static int get_mode(struct mode *m, int secondary)
 static void dump_scaling(void)
 {
 	u_int32_t h_scaling, v_scaling;
-	u_int8_t val;
+	uint8_t val;
 
 	val = readb_idx_reg(0x3d5, 0x79);
 	if (val & 0x01) {
@@ -827,11 +828,11 @@ static void dump_scaling(void)
 
 static void dump_registers(struct io_reg *ior)
 {
-	u_int8_t idx;
+	uint8_t idx;
 
 	printf("%s register dump (IO Port address: 0x%03x): \n", ior->name, ior->io_port_addr);
 	for (idx = 0; idx < 0xff; idx++) {
-		u_int8_t val;
+		uint8_t val;
 		struct bit_desc *desc = ior->index[idx].bit_desc;
 
 		if (!ior->index[idx].name)
@@ -864,8 +865,8 @@ enum pll {
 
 static void get_vck_clock(enum pll pll, unsigned int f_ref_khz)
 {
-	u_int8_t reg_ofs = 0;
-	u_int8_t val;
+	uint8_t reg_ofs = 0;
+	uint8_t val;
 	unsigned int dm, dtz, dr, dn;
 	unsigned long f_vco, f_out;
 	char *name;
@@ -918,7 +919,7 @@ struct gpio_state {
 
 static int get_gpio_state(struct gpio_state *s)
 {
-	u_int8_t val;
+	uint8_t val;
 
 	memset(s, 0, sizeof(*s));
 
@@ -998,10 +999,10 @@ static void dump_mode(const char *pfx, struct mode *m)
 
 static void dump_sl(const char *pfx)
 {
-	u_int8_t val;
+	uint8_t val;
 	unsigned int sl_size_mb;
 	unsigned long rtsf_in_sl_addr;
-	u_int64_t sl_in_mem_addr;
+	uint64_t sl_in_mem_addr, temp;
 
 	val = readb_idx_reg(0x3c5, 0x68);
 	switch (val) {
@@ -1041,7 +1042,8 @@ static void dump_sl(const char *pfx)
 
 	sl_in_mem_addr = readb_idx_reg(0x3c5, 0x6d) << 21;
 	sl_in_mem_addr |= readb_idx_reg(0x3c5, 0x6d) << 29;
-	sl_in_mem_addr |= (readb_idx_reg(0x3c5, 0x6d) & 0x7f) << 37;
+	temp = (readb_idx_reg(0x3c5, 0x6d) & 0x7f);
+	sl_in_mem_addr |= (temp << 37);
 
 	printf("%sSL in System memory: 0x%llx, RTSF in SL: 0x%lx\n",
 		pfx, sl_in_mem_addr, rtsf_in_sl_addr);
@@ -1049,7 +1051,7 @@ static void dump_sl(const char *pfx)
 
 static int dump_lvds(void)
 {
-	u_int8_t val;
+	uint8_t val;
 	char *mode;
 
 	writeb_idx_mask(0x3c5, 0x5a, 0x01, 0x01);
@@ -1087,7 +1089,7 @@ static int dump_lvds(void)
 		val & 1 ? "OpenLDI":"SPWG", val & 0x40 ? "Down" : "Up");
 	
 }
-static int parse_ioreg(u_int16_t *reg, u_int8_t *index, char *str)
+static int parse_ioreg(uint16_t *reg, uint8_t *index, char *str)
 {
 	char *dot;
 	char buf[255];
@@ -1160,8 +1162,8 @@ int main(int argc, char **argv)
 
 	while (1) {
 		int c;
-		u_int16_t reg;
-		u_int8_t index;
+		uint16_t reg;
+		uint8_t index;
 		unsigned long val;
 		static struct option long_options[] = {
 			{ "help", 0, 0, 'h' },
commit 6d5fb459a556d720739ec4206e286fe1dbabca71
Author: Xavier Bachelot <xavier at bachelot.org>
Date:   Tue Jan 13 20:16:53 2015 +0100

    Hitachi FLORA Se210 RK1 (Reported by Shimada Hirofumi)

diff --git a/src/via_id.c b/src/via_id.c
index b298c30..a066819 100644
--- a/src/via_id.c
+++ b/src/via_id.c
@@ -145,6 +145,7 @@ static struct ViaCardIdStruct ViaCardId[] = {
     {"ECS C7VCM",                             VIA_VM800,   0x1019, 0xAA2D, VIA_DEVICE_CRT},
     {"PCChips V21G",                          VIA_VM800,   0x1019, 0xAA51, VIA_DEVICE_CRT},
     {"Hewlett Packard DX2020",                VIA_VM800,   0x103C, 0x3027, VIA_DEVICE_CRT},
+    {"Hitachi FLORA Se210 RK1",               VIA_VM800,   0x1043, 0x13E2, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
     {"Asustek P5VDC-MX",                      VIA_VM800,   0x1043, 0x3344, VIA_DEVICE_CRT},
     {"Asustek P5VDC-TVM",                     VIA_VM800,   0x1043, 0x81CE, VIA_DEVICE_CRT},
     {"Foxconn P4M800P7MB-RS2H",               VIA_VM800,   0x105B, 0x0CF0, VIA_DEVICE_CRT},
commit 2725ef2e730a930c0e7c3244c44e8738a7ea3c03
Author: Xavier Bachelot <xavier at bachelot.org>
Date:   Tue Jan 13 18:59:11 2015 +0100

    Remove extra semicolons.

diff --git a/src/via_i2c.c b/src/via_i2c.c
index 81d79bb..6c11cfd 100644
--- a/src/via_i2c.c
+++ b/src/via_i2c.c
@@ -352,7 +352,6 @@ ViaI2CBus3Init(ScrnInfoPtr pScrn)
             pI2CBus->I2CPutBits = ViaI2C3SimplePutBits;
             pI2CBus->I2CGetBits = ViaI2C3SimpleGetBits;
             break;
-        ;;
         default:
             pI2CBus->I2CAddress = ViaI2C3Address;
 #ifdef X_NEED_I2CSTART
@@ -368,7 +367,6 @@ ViaI2CBus3Init(ScrnInfoPtr pScrn)
             pI2CBus->HoldTime = 10;
             pI2CBus->StartTimeout = 10;
             break;
-        ;;
     }
 
     if (!xf86I2CBusInit(pI2CBus)) {
commit 9dd87b7ee9790fa46dfe1f4203960e3988048a0b
Author: Xavier Bachelot <xavier at bachelot.org>
Date:   Tue Jan 13 18:46:42 2015 +0100

    Move via_dvi_* functions before ViaOutputsDetect to prevent a warning.

diff --git a/src/via_outputs.c b/src/via_outputs.c
index 84a383e..71b059b 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -861,6 +861,191 @@ via_analog_init(ScrnInfoPtr pScrn)
     }
 }
 
+static void
+via_dvi_create_resources(xf86OutputPtr output)
+{
+}
+
+#ifdef RANDR_12_INTERFACE
+static Bool
+via_dvi_set_property(xf86OutputPtr output, Atom property,
+						RRPropertyValuePtr value)
+{
+    return FALSE;
+}
+
+static Bool
+via_dvi_get_property(xf86OutputPtr output, Atom property)
+{
+    return FALSE;
+}
+#endif
+
+static void
+via_dvi_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_dvi_save(xf86OutputPtr output)
+{
+	via_vt1632_save(output);
+}
+
+static void
+via_dvi_restore(xf86OutputPtr output)
+{
+	via_vt1632_restore(output);
+}
+
+static int
+via_dvi_mode_valid(xf86OutputPtr output, DisplayModePtr pMode)
+{
+	return via_vt1632_mode_valid(output, pMode);
+}
+
+static Bool
+via_dvi_mode_fixup(xf86OutputPtr output, DisplayModePtr mode,
+						DisplayModePtr adjusted_mode)
+{
+    return TRUE;
+}
+
+static void
+via_dvi_prepare(xf86OutputPtr output)
+{
+}
+
+static void
+via_dvi_commit(xf86OutputPtr output)
+{
+}
+
+static void
+via_dvi_mode_set(xf86OutputPtr output, DisplayModePtr mode,
+				DisplayModePtr adjusted_mode)
+{
+    ScrnInfoPtr pScrn = output->scrn;
+    vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+	via_vt1632_power(output, FALSE);
+	ViaModeSecondCRTC(pScrn, mode);
+	via_vt1632_mode_set(output, mode, adjusted_mode);
+	via_vt1632_power(output, TRUE);
+}
+
+static xf86OutputStatus
+via_dvi_detect(xf86OutputPtr output)
+{
+    xf86OutputStatus status = XF86OutputStatusDisconnected;
+    ScrnInfoPtr pScrn = output->scrn;
+    VIAPtr pVia = VIAPTR(pScrn);
+    xf86MonPtr mon;
+
+    mon = xf86OutputGetEDID(output, pVia->pI2CBus2);
+    if (mon && DIGITAL(mon->features.input_type)) {
+        xf86OutputSetEDID(output, mon);
+        status = XF86OutputStatusConnected;
+    } else {
+		status = via_vt1632_detect(output);
+	}
+    return status;
+}
+
+static void
+via_dvi_destroy(xf86OutputPtr output)
+{
+}
+
+static const xf86OutputFuncsRec via_dvi_funcs = {
+    .create_resources   = via_dvi_create_resources,
+#ifdef RANDR_12_INTERFACE
+    .set_property       = via_dvi_set_property,
+    .get_property       = via_dvi_get_property,
+#endif
+    .dpms               = via_dvi_dpms,
+    .save               = via_dvi_save,
+    .restore            = via_dvi_restore,
+    .mode_valid         = via_dvi_mode_valid,
+    .mode_fixup         = via_dvi_mode_fixup,
+    .prepare            = via_dvi_prepare,
+    .commit             = via_dvi_commit,
+    .mode_set           = via_dvi_mode_set,
+    .detect             = via_dvi_detect,
+    .get_modes          = xf86OutputGetEDIDModes,
+    .destroy            = via_dvi_destroy,
+};
+
+void
+via_dvi_init(ScrnInfoPtr pScrn)
+{
+    VIAPtr pVia = VIAPTR(pScrn);
+    xf86OutputPtr output = NULL;
+	struct ViaVT1632PrivateData *private_data = NULL;
+	I2CBusPtr pBus = NULL;
+	I2CDevPtr pDev = NULL;
+
+	if (!pVia->pI2CBus2 || !pVia->pI2CBus3) {
+		return;
+	}
+
+	pDev = xf86CreateI2CDevRec();
+	if (!pDev) {
+		return;
+	}
+
+	pDev->DevName = "VT1632";
+	pDev->SlaveAddr = 0x10;
+
+	if (xf86I2CProbeAddress(pVia->pI2CBus3, pDev->SlaveAddr)) {
+		pDev->pI2CBus = pVia->pI2CBus3;
+	} else if (xf86I2CProbeAddress(pVia->pI2CBus2, pDev->SlaveAddr)) {
+		pDev->pI2CBus = pVia->pI2CBus2;
+	} else {
+		xf86DestroyI2CDevRec(pDev, TRUE);
+		return;
+	}
+
+	if (!xf86I2CDevInit(pDev)) {
+		xf86DestroyI2CDevRec(pDev, TRUE);
+		return;
+	}
+
+	if (!via_vt1632_probe(pScrn, pDev)) {
+		xf86DestroyI2CDevRec(pDev, TRUE);
+		return;
+	}
+
+	private_data = via_vt1632_init(pScrn, pDev);
+	if (!private_data) {
+		xf86DestroyI2CDevRec(pDev, TRUE);
+		return;
+	}
+
+	output = xf86OutputCreate(pScrn, &via_dvi_funcs, "DVI-1");
+	if (output) {
+		output->driver_private = private_data;
+		output->possible_crtcs = 0x2;
+		output->possible_clones = 0;
+		output->interlaceAllowed = FALSE;
+		output->doubleScanAllowed = FALSE;
+	}
+}
+
 /*
  *
  */
@@ -1375,188 +1560,3 @@ ViaModeSecondCRTC(ScrnInfoPtr pScrn, DisplayModePtr mode)
     hwp->disablePalette(hwp);
 }
 
-static void
-via_dvi_create_resources(xf86OutputPtr output)
-{
-}
-
-#ifdef RANDR_12_INTERFACE
-static Bool
-via_dvi_set_property(xf86OutputPtr output, Atom property,
-						RRPropertyValuePtr value)
-{
-    return FALSE;
-}
-
-static Bool
-via_dvi_get_property(xf86OutputPtr output, Atom property)
-{
-    return FALSE;
-}
-#endif
-
-static void
-via_dvi_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_dvi_save(xf86OutputPtr output)
-{
-	via_vt1632_save(output);
-}
-
-static void
-via_dvi_restore(xf86OutputPtr output)
-{
-	via_vt1632_restore(output);
-}
-
-static int
-via_dvi_mode_valid(xf86OutputPtr output, DisplayModePtr pMode)
-{
-	return via_vt1632_mode_valid(output, pMode);
-}
-
-static Bool
-via_dvi_mode_fixup(xf86OutputPtr output, DisplayModePtr mode,
-						DisplayModePtr adjusted_mode)
-{
-    return TRUE;
-}
-
-static void
-via_dvi_prepare(xf86OutputPtr output)
-{
-}
-
-static void
-via_dvi_commit(xf86OutputPtr output)
-{
-}
-
-static void
-via_dvi_mode_set(xf86OutputPtr output, DisplayModePtr mode,
-				DisplayModePtr adjusted_mode)
-{
-    ScrnInfoPtr pScrn = output->scrn;
-    vgaHWPtr hwp = VGAHWPTR(pScrn);
-
-	via_vt1632_power(output, FALSE);
-	ViaModeSecondCRTC(pScrn, mode);
-	via_vt1632_mode_set(output, mode, adjusted_mode);
-	via_vt1632_power(output, TRUE);
-}
-
-static xf86OutputStatus
-via_dvi_detect(xf86OutputPtr output)
-{
-    xf86OutputStatus status = XF86OutputStatusDisconnected;
-    ScrnInfoPtr pScrn = output->scrn;
-    VIAPtr pVia = VIAPTR(pScrn);
-    xf86MonPtr mon;
-
-    mon = xf86OutputGetEDID(output, pVia->pI2CBus2);
-    if (mon && DIGITAL(mon->features.input_type)) {
-        xf86OutputSetEDID(output, mon);
-        status = XF86OutputStatusConnected;
-    } else {
-		status = via_vt1632_detect(output);
-	}
-    return status;
-}
-
-static void
-via_dvi_destroy(xf86OutputPtr output)
-{
-}
-
-static const xf86OutputFuncsRec via_dvi_funcs = {
-    .create_resources   = via_dvi_create_resources,
-#ifdef RANDR_12_INTERFACE
-    .set_property       = via_dvi_set_property,
-    .get_property       = via_dvi_get_property,
-#endif
-    .dpms               = via_dvi_dpms,
-    .save               = via_dvi_save,
-    .restore            = via_dvi_restore,
-    .mode_valid         = via_dvi_mode_valid,
-    .mode_fixup         = via_dvi_mode_fixup,
-    .prepare            = via_dvi_prepare,
-    .commit             = via_dvi_commit,
-    .mode_set           = via_dvi_mode_set,
-    .detect             = via_dvi_detect,
-    .get_modes          = xf86OutputGetEDIDModes,
-    .destroy            = via_dvi_destroy,
-};
-
-void
-via_dvi_init(ScrnInfoPtr pScrn)
-{
-    VIAPtr pVia = VIAPTR(pScrn);
-    xf86OutputPtr output = NULL;
-	struct ViaVT1632PrivateData *private_data = NULL;
-	I2CBusPtr pBus = NULL;
-	I2CDevPtr pDev = NULL;
-
-	if (!pVia->pI2CBus2 || !pVia->pI2CBus3) {
-		return;
-	}
-
-	pDev = xf86CreateI2CDevRec();
-	if (!pDev) {
-		return;
-	}
-
-	pDev->DevName = "VT1632";
-	pDev->SlaveAddr = 0x10;
-
-	if (xf86I2CProbeAddress(pVia->pI2CBus3, pDev->SlaveAddr)) {
-		pDev->pI2CBus = pVia->pI2CBus3;
-	} else if (xf86I2CProbeAddress(pVia->pI2CBus2, pDev->SlaveAddr)) {
-		pDev->pI2CBus = pVia->pI2CBus2;
-	} else {
-		xf86DestroyI2CDevRec(pDev, TRUE);
-		return;
-	}
-
-	if (!xf86I2CDevInit(pDev)) {
-		xf86DestroyI2CDevRec(pDev, TRUE);
-		return;
-	}
-
-	if (!via_vt1632_probe(pScrn, pDev)) {
-		xf86DestroyI2CDevRec(pDev, TRUE);
-		return;
-	}
-
-	private_data = via_vt1632_init(pScrn, pDev);
-	if (!private_data) {
-		xf86DestroyI2CDevRec(pDev, TRUE);
-		return;
-	}
-
-	output = xf86OutputCreate(pScrn, &via_dvi_funcs, "DVI-1");
-	if (output) {
-		output->driver_private = private_data;
-		output->possible_crtcs = 0x2;
-		output->possible_clones = 0;
-		output->interlaceAllowed = FALSE;
-		output->doubleScanAllowed = FALSE;
-	}
-}
-
commit 319fcdad57ebf4f1ef828c3344058ff8f6197432
Author: Xavier Bachelot <xavier at bachelot.org>
Date:   Tue Jan 13 18:34:53 2015 +0100

    Add missing header inclusion.
    Fixes https://bugs.freedesktop.org/show_bug.cgi?id=88334

diff --git a/src/via_3d.h b/src/via_3d.h
index c33228e..15be0be 100644
--- a/src/via_3d.h
+++ b/src/via_3d.h
@@ -24,6 +24,7 @@
 #ifndef VIA_3D_H
 #define VIA_3D_H
 
+#include "xorg-server.h"
 #include "xf86.h"
 #include "via_dmabuffer.h"
 
commit 180fd4e76abf15253cadc5cd98fc58e9e2c84605
Author: Xavier Bachelot <xavier at bachelot.org>
Date:   Tue Jan 13 18:10:14 2015 +0100

    Replace X_DEBUG with X_INFO.
    The former doesn't exist on older xserver and X_INFO is used in other
    places of the driver.

diff --git a/src/via_vt1632.c b/src/via_vt1632.c
index bc41128..d90320a 100644
--- a/src/via_vt1632.c
+++ b/src/via_vt1632.c
@@ -50,10 +50,10 @@ via_vt1632_dump_registers(ScrnInfoPtr pScrn, I2CDevPtr pDev)
 	int i;
 	CARD8 tmp;
 
-	DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_DEBUG, "VT1632: dumping registers:\n"));
+	DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632: dumping registers:\n"));
 	for (i = 0; i <= 0x0f; i++) {
 		xf86I2CReadByte(pDev, i, &tmp);
-		DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_DEBUG, "VT1632: 0x%02x: 0x%02x\n", i, tmp));
+		DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632: 0x%02x: 0x%02x\n", i, tmp));
 	}
 }
 
@@ -66,10 +66,10 @@ via_vt1632_power(xf86OutputPtr output, BOOL on)
 
 
 	if (on == TRUE) {
-		DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_DEBUG, "VT1632: power on\n"));
+		DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632: power on\n"));
 		xf86I2CMaskByte(Private->VT1632I2CDev, 0x08, 0x01, 0x01);
 	} else {
-		DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_DEBUG, "VT1632: power off\n"));
+		DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632: power off\n"));
 		xf86I2CMaskByte(Private->VT1632I2CDev, 0x08, 0x00, 0x01);
 	}
 }
@@ -80,7 +80,7 @@ via_vt1632_save(xf86OutputPtr output)
 	struct ViaVT1632PrivateData * Private = output->driver_private;
 	ScrnInfoPtr pScrn = output->scrn;
 
-	DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_DEBUG,
+	DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		"VT1632: saving state of registers 0x08, 0x09, 0x0A and 0x0C\n"));
 
 	xf86I2CReadByte(Private->VT1632I2CDev, 0x08, &Private->Register08);
@@ -95,7 +95,7 @@ via_vt1632_restore(xf86OutputPtr output)
 	struct ViaVT1632PrivateData * Private = output->driver_private;
 	ScrnInfoPtr pScrn = output->scrn;
 
-	DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_DEBUG,
+	DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		"VT1632: restoring register 0x08, 0x09, 0x0A and 0x0C\n"));
 	xf86I2CWriteByte(Private->VT1632I2CDev, 0x08, Private->Register08);
 	xf86I2CWriteByte(Private->VT1632I2CDev, 0x09, Private->Register09);
@@ -124,7 +124,7 @@ via_vt1632_mode_set(xf86OutputPtr output, DisplayModePtr mode,
 	struct ViaVT1632PrivateData * Private = output->driver_private;
 	ScrnInfoPtr pScrn = output->scrn;
 
-	DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_DEBUG,
+	DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		"VT1632: enabling DVI encoder\n"));
 	xf86I2CWriteByte(Private->VT1632I2CDev, 0x0C, 0x89);
 	xf86I2CWriteByte(Private->VT1632I2CDev, 0x08,
commit a68274700e2fdda49f166dd3d1c76f77a4774f57
Author: James Simmons <jsimmons at infradead.org>
Date:   Sat Jan 10 19:08:48 2015 -0700

    Small cleanup to the register dumping tool to display
    data correctly.

diff --git a/tools/registers.c b/tools/registers.c
index 32e6626..0e0a532 100644
--- a/tools/registers.c
+++ b/tools/registers.c
@@ -898,7 +898,7 @@ static void get_vck_clock(enum pll pll, unsigned int f_ref_khz)
 	dtz |= (val & 0x1) << 1;
 	dn = val >> 1;
 
-	printf("%s PLL: dm=%d, dtx=%d, dr=%d, dn=%d ", name, dm, dtz, dr, dn);
+	printf("%s PLL: dm=%u, dtx=%u, dr=%u, dn=%u ", name, dm, dtz, dr, dn);
 
 	f_vco = f_ref_khz * (dm + 2) / (dn + 2);
 	if (dr)
@@ -958,7 +958,7 @@ static int get_gpio_state(struct gpio_state *s)
 
 static void dump_gpio_state(const char *pfx, const struct gpio_state *gs)
 {
-	int i;
+	unsigned int i;
 
 	for (i = 2; i < 6; i++) {
 		printf("%sGPIO %u: function=", pfx, i);
commit fdbd9446130e58c0241bfae5ad9ee88c95e8cea2
Author: James Simmons <jsimmons at infradead.org>
Date:   Sat Jan 10 18:45:18 2015 -0700

    Fix build on Hurd. Without libdrm the build fails due to missing
    definitions. We can use the included drm_fourcc.h to ensure it
    builds.
    
    Signed-off-by: Gabriele Giacone
    Reviewed-by: James Simmons <jsimmons at infradead.org>

diff --git a/src/via_driver.c b/src/via_driver.c
index 0f24ebe..f3ad39d 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -50,6 +50,8 @@
 
 #ifdef HAVE_DRI
 #include "dri.h"
+#else
+#include "drm_fourcc.h"
 #endif
 
 /* RandR support */
diff --git a/src/via_memmgr.c b/src/via_memmgr.c
index 6cffa9c..412f618 100644
--- a/src/via_memmgr.c
+++ b/src/via_memmgr.c
@@ -38,6 +38,8 @@
 #include "via_driver.h"
 #ifdef HAVE_DRI
 #include "via_drm.h"
+#else
+#include "drm_fourcc.h"
 #endif
 
 /*
commit cbead3b200b3948bd4ddf9e2133a7f5d431f58ff
Author: Pino Toscano <toscano.pino at tiscali.it>
Date:   Sat Jan 10 18:40:33 2015 -0700

    Do not require libdrm as base pkg-config module
    
    Remove libdrm from the list of mandatory Xorg modules, as it is an
    optional component whose presence is checked later. Needed for
    Hurd support since libdrm is not present yet.
    
    Signed-off-by: Pino Toscano <toscano.pino at tiscali.it>
    Reviewed-by: James Simmons <jsimmons at infradead.org>

diff --git a/configure.ac b/configure.ac
index b13cb2c..9e77dc8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,7 +80,7 @@ XORG_DRIVER_CHECK_EXT(XF86DRI, xextproto x11)
 XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
 
 # Checks for pkg-config packages
-PKG_CHECK_MODULES(XORG, [xorg-server xproto fontsproto libdrm glproto $REQUIRED_MODULES])
+PKG_CHECK_MODULES(XORG, [xorg-server xproto fontsproto glproto $REQUIRED_MODULES])
 PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
  HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71, 1, [xextproto 7.1 available]),
  HAVE_XEXTPROTO_71="no")
commit c104fa48e8e21f0dc2444662e7c0a3df2ee5e5cb
Author: James Simmons <jsimmons at infradead.org>
Date:   Sat Jan 10 18:36:22 2015 -0700

    * while watching video following messages are endless logged
     via_xv.c : needBandwidth= 180.000000 :
     via_xv.c : totalBandwidth= 2979.199951 :
    
    So instead log a error if it fails to have enought memory
    bandwith.
    
    Signed-off-by: Robby Klehm
    Reviewed-by: James Simmons <jsimmons at infradead.org>

diff --git a/src/via_xv.c b/src/via_xv.c
index 7ad6df7..6eafb68 100644
--- a/src/via_xv.c
+++ b/src/via_xv.c
@@ -392,12 +392,12 @@ DecideOverlaySupport(xf86CrtcPtr crtc)
             DBG_DD(ErrorF(" via_xv.c : mClk= %f : \n", mClock));
             DBG_DD(ErrorF(" via_xv.c : memEfficiency= %f : \n",
                 memEfficiency));
+            if (needBandWidth < totalBandWidth)
+                return TRUE;
             ErrorF(" via_xv.c : needBandwidth= %f : \n",
                 needBandWidth);
             ErrorF(" via_xv.c : totalBandwidth= %f : \n",
                 totalBandWidth);
-            if (needBandWidth < totalBandWidth)
-                return TRUE;
         }
         return FALSE;
     }
commit a8c2f04e2ef21e64f2e91dd6f3e237f80e8c80c6
Author: JUNG, Christian <christian.jung at shsservices.org>
Date:   Sat Jan 10 17:47:48 2015 -0700

    Add support for VT1632 DVI transmitter for UMS mode.
    
    Signed-off-by: JUNG, Christian <christian.jung at shsservices.org>
    Reviewed-by: James Simmons <jsimmons at infradead.org>

diff --git a/src/Makefile.am b/src/Makefile.am
index 7f67bed..c3c38cc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -72,6 +72,8 @@ openchrome_drv_la_SOURCES = \
          via_xv.h \
          via_vt162x.c \
          via_vt162x.h \
+         via_vt1632.c \
+         via_vt1632.h \
          via_xvpriv.h
 
 if DRI
diff --git a/src/via_driver.h b/src/via_driver.h
index b1b077d..be0e73d 100644
--- a/src/via_driver.h
+++ b/src/via_driver.h
@@ -86,6 +86,8 @@
 #endif
 #include <errno.h>
 
+#include "via_vt1632.h"
+
 #include "compat-api.h"
 #define VIA_AGP_UPL_SIZE    (1024*128)
 #define VIA_DMA_DL_SIZE     (1024*128)
diff --git a/src/via_outputs.c b/src/via_outputs.c
index 1876937..84a383e 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -888,6 +888,10 @@ ViaOutputsDetect(ScrnInfoPtr pScrn)
     if ((pVia->Chipset != VIA_P4M900) || (pVia->ActiveDevice & VIA_DEVICE_TV))
         via_tv_init(pScrn);
 
+    if (pVia->Chipset == VIA_VM800) {
+		via_dvi_init(pScrn);
+	}
+
     if (pVia->ActiveDevice & VIA_DEVICE_DFP) {
         switch (pVia->Chipset) {
         case VIA_CX700:
@@ -1370,3 +1374,189 @@ ViaModeSecondCRTC(ScrnInfoPtr pScrn, DisplayModePtr mode)
 
     hwp->disablePalette(hwp);
 }
+
+static void
+via_dvi_create_resources(xf86OutputPtr output)
+{
+}
+
+#ifdef RANDR_12_INTERFACE
+static Bool
+via_dvi_set_property(xf86OutputPtr output, Atom property,
+						RRPropertyValuePtr value)
+{
+    return FALSE;
+}
+
+static Bool
+via_dvi_get_property(xf86OutputPtr output, Atom property)
+{
+    return FALSE;
+}
+#endif
+
+static void
+via_dvi_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_dvi_save(xf86OutputPtr output)
+{
+	via_vt1632_save(output);
+}
+
+static void
+via_dvi_restore(xf86OutputPtr output)
+{
+	via_vt1632_restore(output);
+}
+
+static int
+via_dvi_mode_valid(xf86OutputPtr output, DisplayModePtr pMode)
+{
+	return via_vt1632_mode_valid(output, pMode);
+}
+
+static Bool
+via_dvi_mode_fixup(xf86OutputPtr output, DisplayModePtr mode,
+						DisplayModePtr adjusted_mode)
+{
+    return TRUE;
+}
+
+static void
+via_dvi_prepare(xf86OutputPtr output)
+{
+}
+
+static void
+via_dvi_commit(xf86OutputPtr output)
+{
+}
+
+static void
+via_dvi_mode_set(xf86OutputPtr output, DisplayModePtr mode,
+				DisplayModePtr adjusted_mode)
+{
+    ScrnInfoPtr pScrn = output->scrn;
+    vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+	via_vt1632_power(output, FALSE);
+	ViaModeSecondCRTC(pScrn, mode);
+	via_vt1632_mode_set(output, mode, adjusted_mode);
+	via_vt1632_power(output, TRUE);
+}
+
+static xf86OutputStatus
+via_dvi_detect(xf86OutputPtr output)
+{
+    xf86OutputStatus status = XF86OutputStatusDisconnected;
+    ScrnInfoPtr pScrn = output->scrn;
+    VIAPtr pVia = VIAPTR(pScrn);
+    xf86MonPtr mon;
+
+    mon = xf86OutputGetEDID(output, pVia->pI2CBus2);
+    if (mon && DIGITAL(mon->features.input_type)) {
+        xf86OutputSetEDID(output, mon);
+        status = XF86OutputStatusConnected;
+    } else {
+		status = via_vt1632_detect(output);
+	}
+    return status;
+}
+
+static void
+via_dvi_destroy(xf86OutputPtr output)
+{
+}
+
+static const xf86OutputFuncsRec via_dvi_funcs = {
+    .create_resources   = via_dvi_create_resources,
+#ifdef RANDR_12_INTERFACE
+    .set_property       = via_dvi_set_property,
+    .get_property       = via_dvi_get_property,
+#endif
+    .dpms               = via_dvi_dpms,
+    .save               = via_dvi_save,
+    .restore            = via_dvi_restore,
+    .mode_valid         = via_dvi_mode_valid,
+    .mode_fixup         = via_dvi_mode_fixup,
+    .prepare            = via_dvi_prepare,
+    .commit             = via_dvi_commit,
+    .mode_set           = via_dvi_mode_set,
+    .detect             = via_dvi_detect,
+    .get_modes          = xf86OutputGetEDIDModes,
+    .destroy            = via_dvi_destroy,
+};
+
+void
+via_dvi_init(ScrnInfoPtr pScrn)
+{
+    VIAPtr pVia = VIAPTR(pScrn);
+    xf86OutputPtr output = NULL;
+	struct ViaVT1632PrivateData *private_data = NULL;
+	I2CBusPtr pBus = NULL;
+	I2CDevPtr pDev = NULL;
+
+	if (!pVia->pI2CBus2 || !pVia->pI2CBus3) {
+		return;
+	}
+
+	pDev = xf86CreateI2CDevRec();
+	if (!pDev) {
+		return;
+	}
+
+	pDev->DevName = "VT1632";
+	pDev->SlaveAddr = 0x10;
+
+	if (xf86I2CProbeAddress(pVia->pI2CBus3, pDev->SlaveAddr)) {
+		pDev->pI2CBus = pVia->pI2CBus3;
+	} else if (xf86I2CProbeAddress(pVia->pI2CBus2, pDev->SlaveAddr)) {
+		pDev->pI2CBus = pVia->pI2CBus2;
+	} else {
+		xf86DestroyI2CDevRec(pDev, TRUE);
+		return;
+	}
+
+	if (!xf86I2CDevInit(pDev)) {
+		xf86DestroyI2CDevRec(pDev, TRUE);
+		return;
+	}
+
+	if (!via_vt1632_probe(pScrn, pDev)) {
+		xf86DestroyI2CDevRec(pDev, TRUE);
+		return;
+	}
+
+	private_data = via_vt1632_init(pScrn, pDev);
+	if (!private_data) {
+		xf86DestroyI2CDevRec(pDev, TRUE);
+		return;
+	}
+
+	output = xf86OutputCreate(pScrn, &via_dvi_funcs, "DVI-1");
+	if (output) {
+		output->driver_private = private_data;
+		output->possible_crtcs = 0x2;
+		output->possible_clones = 0;
+		output->interlaceAllowed = FALSE;
+		output->doubleScanAllowed = FALSE;
+	}
+}
+
diff --git a/src/via_vt1632.c b/src/via_vt1632.c
new file mode 100644
index 0000000..bc41128
--- /dev/null
+++ b/src/via_vt1632.c
@@ -0,0 +1,204 @@
+/*
+ * Copyright 2014 SHS SERVICES GmbH
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "via_driver.h"
+#include "via_vt1632.h"
+
+static Bool
+xf86I2CMaskByte(I2CDevPtr d, I2CByte subaddr, I2CByte value, I2CByte mask)
+{
+	I2CByte tmp;
+	Bool ret;
+
+	ret = xf86I2CReadByte(d, subaddr, &tmp);
+	if (!ret)
+		return FALSE;
+
+	tmp &= ~mask;
+	tmp |= (value & mask);
+
+	return xf86I2CWriteByte(d, subaddr, tmp);
+}
+
+static void
+via_vt1632_dump_registers(ScrnInfoPtr pScrn, I2CDevPtr pDev)
+{
+	int i;
+	CARD8 tmp;
+
+	DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_DEBUG, "VT1632: dumping registers:\n"));
+	for (i = 0; i <= 0x0f; i++) {
+		xf86I2CReadByte(pDev, i, &tmp);
+		DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_DEBUG, "VT1632: 0x%02x: 0x%02x\n", i, tmp));
+	}
+}
+
+
+void
+via_vt1632_power(xf86OutputPtr output, BOOL on)
+{
+	struct ViaVT1632PrivateData * Private = output->driver_private;
+	ScrnInfoPtr pScrn = output->scrn;
+
+
+	if (on == TRUE) {
+		DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_DEBUG, "VT1632: power on\n"));
+		xf86I2CMaskByte(Private->VT1632I2CDev, 0x08, 0x01, 0x01);
+	} else {
+		DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_DEBUG, "VT1632: power off\n"));
+		xf86I2CMaskByte(Private->VT1632I2CDev, 0x08, 0x00, 0x01);
+	}
+}
+
+void
+via_vt1632_save(xf86OutputPtr output)
+{
+	struct ViaVT1632PrivateData * Private = output->driver_private;
+	ScrnInfoPtr pScrn = output->scrn;
+
+	DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_DEBUG,
+		"VT1632: saving state of registers 0x08, 0x09, 0x0A and 0x0C\n"));
+
+	xf86I2CReadByte(Private->VT1632I2CDev, 0x08, &Private->Register08);
+	xf86I2CReadByte(Private->VT1632I2CDev, 0x09, &Private->Register09);
+	xf86I2CReadByte(Private->VT1632I2CDev, 0x0A, &Private->Register0A);
+	xf86I2CReadByte(Private->VT1632I2CDev, 0x0C, &Private->Register0C);
+}
+
+void
+via_vt1632_restore(xf86OutputPtr output)
+{
+	struct ViaVT1632PrivateData * Private = output->driver_private;
+	ScrnInfoPtr pScrn = output->scrn;
+
+	DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_DEBUG,
+		"VT1632: restoring register 0x08, 0x09, 0x0A and 0x0C\n"));
+	xf86I2CWriteByte(Private->VT1632I2CDev, 0x08, Private->Register08);
+	xf86I2CWriteByte(Private->VT1632I2CDev, 0x09, Private->Register09);
+	xf86I2CWriteByte(Private->VT1632I2CDev, 0x0A, Private->Register0A);
+	xf86I2CWriteByte(Private->VT1632I2CDev, 0x0C, Private->Register0C);
+}
+
+int
+via_vt1632_mode_valid(xf86OutputPtr output, DisplayModePtr pMode)
+{
+	struct ViaVT1632PrivateData * Private = output->driver_private;
+
+	if (pMode->Clock < Private->DotclockMin)
+		return MODE_CLOCK_LOW;
+
+	if (pMode->Clock > Private->DotclockMax)
+		return MODE_CLOCK_HIGH;
+
+	return MODE_OK;
+}
+
+void
+via_vt1632_mode_set(xf86OutputPtr output, DisplayModePtr mode,
+		DisplayModePtr adjusted_mode)
+{
+	struct ViaVT1632PrivateData * Private = output->driver_private;
+	ScrnInfoPtr pScrn = output->scrn;
+
+	DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_DEBUG,
+		"VT1632: enabling DVI encoder\n"));
+	xf86I2CWriteByte(Private->VT1632I2CDev, 0x0C, 0x89);
+	xf86I2CWriteByte(Private->VT1632I2CDev, 0x08,
+		VIA_VT1632_VEN | VIA_VT1632_HEN | VIA_VT1632_EDGE |
+		VIA_VT1632_PDB);
+	via_vt1632_dump_registers(pScrn, Private->VT1632I2CDev);
+}
+
+xf86OutputStatus
+via_vt1632_detect(xf86OutputPtr output)
+{
+	struct ViaVT1632PrivateData * Private = output->driver_private;
+	xf86OutputStatus status = XF86OutputStatusDisconnected;
+	ScrnInfoPtr pScrn = output->scrn;
+	CARD8 tmp;
+
+	xf86I2CReadByte(Private->VT1632I2CDev, 0x09, &tmp);
+	if (tmp && 0x02) {
+		xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632: DVI is connected\n");
+		status = XF86OutputStatusConnected;
+	}
+
+	return status;
+}
+
+BOOL
+via_vt1632_probe(ScrnInfoPtr pScrn, I2CDevPtr pDev) {
+	CARD8 buf = 0;
+	CARD16 VendorID = 0;
+	CARD16 DeviceID = 0;
+
+	xf86I2CReadByte(pDev, 0, &buf);
+	VendorID = buf;
+	xf86I2CReadByte(pDev, 1, &buf);
+	VendorID |= buf << 8;
+
+	xf86I2CReadByte(pDev, 2, &buf);
+	DeviceID = buf;
+	xf86I2CReadByte(pDev, 3, &buf);
+	DeviceID |= buf << 8;
+
+	if (VendorID != 0x1106 || DeviceID != 0x3192) {
+		return FALSE;
+	}
+
+	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632 DVI transmitter detected\n");
+
+	return TRUE;
+}
+
+struct ViaVT1632PrivateData *
+via_vt1632_init(ScrnInfoPtr pScrn, I2CDevPtr pDev)
+{
+	VIAPtr pVia = VIAPTR(pScrn);
+	struct ViaVT1632PrivateData * Private = NULL;
+	CARD8 buf = 0;
+
+	Private = xnfcalloc(1, sizeof(struct ViaVT1632PrivateData));
+	if (!Private) {
+		return NULL;
+	}
+	Private->VT1632I2CDev = pDev;
+
+	xf86I2CReadByte(pDev, 0x06, &buf);
+	Private->DotclockMin = buf * 1000;
+
+	xf86I2CReadByte(pDev, 0x07, &buf);
+	Private->DotclockMax = (buf + 65) * 1000;
+
+	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1632: dotclock range %d-%dMHz\n",
+			Private->DotclockMin / 1000,
+			Private->DotclockMax / 1000);
+
+	via_vt1632_dump_registers(pScrn, pDev);
+
+	return Private;
+}
diff --git a/src/via_vt1632.h b/src/via_vt1632.h
new file mode 100644
index 0000000..535bf17
--- /dev/null
+++ b/src/via_vt1632.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2014 SHS SERVICES GmbH
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _VIA_VT1632_H_
+#define _VIA_VT1632_H_ 1
+
+#define VIA_VT1632_VEN  0x20
+#define VIA_VT1632_HEN  0x10
+#define VIA_VT1632_DSEL 0x08
+#define VIA_VT1632_BSEL 0x04
+#define VIA_VT1632_EDGE 0x02
+#define VIA_VT1632_PDB  0x01
+
+struct ViaVT1632PrivateData {
+	I2CDevPtr VT1632I2CDev;
+
+	int DotclockMin;
+	int DotclockMax;
+	CARD8 Register08;
+	CARD8 Register09;
+	CARD8 Register0A;
+	CARD8 Register0C;
+};
+
+void via_vt1632_power(xf86OutputPtr output, BOOL on);
+void via_vt1632_save(xf86OutputPtr output);
+void via_vt1632_restore(xf86OutputPtr output);
+int via_vt1632_mode_valid(xf86OutputPtr output, DisplayModePtr pMode);
+void via_vt1632_mode_set(xf86OutputPtr output, DisplayModePtr mode, DisplayModePtr adjusted_mode);
+xf86OutputStatus via_vt1632_detect(xf86OutputPtr output);
+BOOL via_vt1632_probe(ScrnInfoPtr pScrn, I2CDevPtr pDev);
+struct ViaVT1632PrivateData * via_vt1632_init(ScrnInfoPtr pScrn, I2CDevPtr pDev);
+
+#endif /* _VIA_VT1632_H_ */
commit 02480da73b76df500aaca8dd6eff9d56acdb58d2
Author: JUNG, Christian <christian.jung at shsservices.org>
Date:   Sat Jan 10 17:44:07 2015 -0700

    Add support to probe the I2C for bus 3. This makes it is
    possible to detect the VT1632 device.
    
    Signed-off-by: JUNG, Christian <christian.jung at shsservices.org>
    Reviewed-by: James Simmons <jsimmons at infradead.org>

diff --git a/src/via_i2c.c b/src/via_i2c.c
index 9d6cfa0..81d79bb 100644
--- a/src/via_i2c.c
+++ b/src/via_i2c.c
@@ -305,11 +305,37 @@ ViaI2C3GetByte(I2CDevPtr d, I2CByte * data, Bool last)
     return TRUE;
 }
 
+static void
+ViaI2C3SimplePutBits(I2CBusPtr Bus, int clock, int data)
+{
+    vgaHWPtr hwp = Bus->DriverPrivate.ptr;
+    CARD8 value = 0xC0;
+
+    if (clock)
+        value |= SCL_WRITE;
+
+    if (data)
+        value |= SDA_WRITE;
+
+    ViaSeqMask(hwp, 0x2C, value, 0xC0 | SCL_WRITE | SDA_WRITE);
+}
+
+static void
+ViaI2C3SimpleGetBits(I2CBusPtr Bus, int *clock, int *data)
+{
+    vgaHWPtr hwp = Bus->DriverPrivate.ptr;
+    CARD8 value = hwp->readSeq(hwp, 0x2C);
+
+    *clock = (value & SCL_READ) != 0;
+    *data = (value & SDA_READ) != 0;
+}
+
 static I2CBusPtr
 ViaI2CBus3Init(ScrnInfoPtr pScrn)
 {
     I2CBusPtr pI2CBus = xf86CreateI2CBusRec();
     vgaHWPtr hwp = VGAHWPTR(pScrn);
+    VIAPtr pVia = VIAPTR(pScrn);
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaI2CBus3Init\n"));
 
@@ -318,19 +344,32 @@ ViaI2CBus3Init(ScrnInfoPtr pScrn)
 
     pI2CBus->BusName = "I2C bus 3";
     pI2CBus->scrnIndex = pScrn->scrnIndex;
-    pI2CBus->I2CAddress = ViaI2C3Address;
-#ifdef X_NEED_I2CSTART
-    pI2CBus->I2CStart = ViaI2C3Start;
-#endif
-    pI2CBus->I2CStop = ViaI2C3Stop;
-    pI2CBus->I2CPutByte = ViaI2C3PutByte;
-    pI2CBus->I2CGetByte = ViaI2C3GetByte;
     pI2CBus->DriverPrivate.ptr = hwp;
 
-    pI2CBus->HoldTime = 10;
-    pI2CBus->BitTimeout = 10;
-    pI2CBus->ByteTimeout = 10;
-    pI2CBus->StartTimeout = 10;
+    switch (pVia->Chipset) {
+        case VIA_VM800:
+            DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "using alternative PutBits/GetBits functions for I2C Bus 3\n"));
+            pI2CBus->I2CPutBits = ViaI2C3SimplePutBits;
+            pI2CBus->I2CGetBits = ViaI2C3SimpleGetBits;
+            break;
+        ;;
+        default:
+            pI2CBus->I2CAddress = ViaI2C3Address;
+#ifdef X_NEED_I2CSTART
+            pI2CBus->I2CStart = ViaI2C3Start;
+#endif
+            pI2CBus->I2CStop = ViaI2C3Stop;
+            pI2CBus->I2CPutByte = ViaI2C3PutByte;
+            pI2CBus->I2CGetByte = ViaI2C3GetByte;
+            pI2CBus->DriverPrivate.ptr = hwp;
+
+            pI2CBus->BitTimeout = 10;
+            pI2CBus->ByteTimeout = 10;
+            pI2CBus->HoldTime = 10;
+            pI2CBus->StartTimeout = 10;
+            break;
+        ;;
+    }
 
     if (!xf86I2CBusInit(pI2CBus)) {
         xf86DestroyI2CBusRec(pI2CBus, TRUE, FALSE);
commit 271c716f2060bc04a5ca8324c0d2c27473463206
Author: Daniel Gnoutcheff <daniel at gnoutcheff.name>
Date:   Sat Jan 10 17:42:29 2015 -0700

    Make our implementation of xf86OutputFuncsRec->set_output() return TRUE.
    
    Implementations of this function are expected to return TRUE when given
    a property that they don't recognize.  Otherwise, properties set by the
    server core (e.g. EDID) will break.  (See commit 33133a1 in
    xf86-video-intel.)
    
    Since we don't support any properties ourselves,  we should always
    return TRUE.
    
    This is also needed to support clients that set custom output
    properties; i.e. gnome-shell likes to set _MUTTER_PRESENTATION_OUTPUT,
    and it works fine with other drivers but would crash with ValueError on
    openchrome.
    
    Signed-off-by: Daniel Gnoutcheff <daniel at gnoutcheff.name>
    Reviewed-by: James Simmons <jsimmons at infradead.org>

diff --git a/src/via_outputs.c b/src/via_outputs.c
index 0a23e81..1876937 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -166,7 +166,7 @@ static Bool
 via_tv_set_property(xf86OutputPtr output, Atom property,
 					RRPropertyValuePtr value)
 {
-    return FALSE;
+    return TRUE;
 }
 
 static Bool
@@ -505,7 +505,7 @@ static Bool
 via_dp_set_property(xf86OutputPtr output, Atom property,
 						RRPropertyValuePtr value)
 {
-    return FALSE;
+    return TRUE;
 }
 
 static Bool
@@ -680,7 +680,7 @@ static Bool
 via_analog_set_property(xf86OutputPtr output, Atom property,
 						RRPropertyValuePtr value)
 {
-    return FALSE;
+    return TRUE;
 }
 
 static Bool
commit 00f4d9d7fedccd1e66d98113e76cbfff15722d51
Author: James Simmons <jsimmons at infradead.org>
Date:   Sun Jan 4 16:29:46 2015 -0700

    Add pciid for ECS VX900-I motherboard

diff --git a/src/via_id.c b/src/via_id.c
index fe88114..b298c30 100644
--- a/src/via_id.c
+++ b/src/via_id.c
@@ -254,6 +254,7 @@ static struct ViaCardIdStruct ViaCardId[] = {
 
     /*** VX900 ***/
     {"Simmtronics SIMM-PC VX900i",            VIA_VX900,   0x1019, 0x3126, VIA_DEVICE_CRT},
+    {"ECS VX900-I",                           VIA_VX900,   0x1019, 0x7C8E, VIA_DEVICE_CRT},
     {"Foxconn L740",                          VIA_VX900,   0x105B, 0x0CFD, VIA_DEVICE_LCD | VIA_DEVICE_CRT},
     {"HP T5550 Thin Client",                  VIA_VX900,   0x1106, 0x7122, VIA_DEVICE_CRT},
     {"Biostar Viotech 3200+",                 VIA_VX900,   0x1565, 0x120A, VIA_DEVICE_CRT},
commit 46a4ef37a1fc793ea85950f9579783e9af3a6b36
Author: Xavier Bachelot <xavier at bachelot.org>
Date:   Fri Oct 18 18:04:50 2013 +0200

    Add pciid for Lenovo M3120C

diff --git a/src/via_id.c b/src/via_id.c
index c1ffdca..fe88114 100644
--- a/src/via_id.c
+++ b/src/via_id.c
@@ -180,6 +180,7 @@ static struct ViaCardIdStruct ViaCardId[] = {
     {"MSI K9VGM-V",                           VIA_K8M890,  0x1462, 0x7253, VIA_DEVICE_CRT},
     {"Averatec 226x",                         VIA_K8M890,  0x14FF, 0xA002, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
     {"Fujitsu/Siemens Amilo La 1703",         VIA_K8M890,  0x1734, 0x10D9, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
+    {"Lenovo M3120C",                         VIA_K8M890,  0x17AA, 0x3020, VIA_DEVICE_CRT},
 
     /*** P4M900, VN896, CN896 ***/
     {"VIA Epia SN",                           VIA_P4M900,  0x0908, 0x1975, VIA_DEVICE_CRT},
commit e53bb7bf442b03b1240445d6c9e846265bda577c
Author: Xavier Bachelot <xavier at bachelot.org>
Date:   Wed Oct 16 00:03:10 2013 +0200

    Don't check if the input is digital for VGA

diff --git a/src/via_outputs.c b/src/via_outputs.c
index 1271fc8..0a23e81 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -775,7 +775,7 @@ via_analog_detect(xf86OutputPtr output)
     xf86MonPtr mon;
 
     mon = xf86OutputGetEDID(output, pVia->pI2CBus1);
-    if (mon && !DIGITAL(mon->features.input_type)) {
+    if (mon) {
         xf86OutputSetEDID(output, mon);
         DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "DDC pI2CBus1 detected a CRT\n"));
         status = XF86OutputStatusConnected;
commit 94e5ff32de58ee66ea5588ee47050f44b914e863
Author: James Simmons <jsimmons at infradead.org>
Date:   Thu Sep 5 18:51:11 2013 -0400

    The mode passed into drmmmode_set_mode_major does not always have a name string. When xf86SetModeDefaultName is called it frees a null string which caused a segfault. No need to create a default name so remove xf86SetModeDefaultName

diff --git a/src/via_kms.c b/src/via_kms.c
index 9547d5d..2bb0a86 100644
--- a/src/via_kms.c
+++ b/src/via_kms.c
@@ -187,7 +187,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
         output_count++;
     }
 
-    xf86SetModeDefaultName(mode);
     drmmode_ConvertToKMode(crtc->scrn, &kmode, mode);
 
     if (drmmode->fb_id == 0) {
commit 3cbf8324556c56c8bcee9f1602471dc8e5d25fab
Author: James Simmons <jsimmons at infradead.org>
Date:   Thu Sep 5 17:49:48 2013 -0400

    Sync via_drm.h header with that in drm-openchrome

diff --git a/src/via_drm.h b/src/via_drm.h
index f8939be..b85b2ff 100644
--- a/src/via_drm.h
+++ b/src/via_drm.h
@@ -38,7 +38,7 @@
 #define VIA_NR_XVMC_LOCKS		5
 #define VIA_MAX_CACHELINE_SIZE		64
 #define XVMCLOCKPTR(saPriv,lockNo)					\
-	((__volatile__ struct drm_hw_lock *)(((((unsigned long) (saPriv)->XvMCLockArea) + \
+	((volatile struct drm_hw_lock *)(((((unsigned long) (saPriv)->XvMCLockArea) + \
 				      (VIA_MAX_CACHELINE_SIZE - 1)) &	\
 				     ~(VIA_MAX_CACHELINE_SIZE - 1)) +	\
 				    VIA_MAX_CACHELINE_SIZE*(lockNo)))
@@ -65,7 +65,7 @@
 #define DRM_VIA_FB_INIT		0x03
 #define DRM_VIA_MAP_INIT	0x04
 #define DRM_VIA_DEC_FUTEX	0x05
-#define DRM_VIA_GEM_CREATE	0x06
+#define DRM_VIA_OLD_GEM_CREATE	0x06
 #define DRM_VIA_DMA_INIT	0x07
 #define DRM_VIA_CMDBUFFER	0x08
 #define DRM_VIA_FLUSH		0x09
@@ -76,13 +76,20 @@
 #define DRM_VIA_DMA_BLIT	0x0e
 #define DRM_VIA_BLIT_SYNC	0x0f
 
+/* KMS ioctls */
+#define DRM_VIA_GETPARAM	0x10
+#define DRM_VIA_SETPARAM	0x11
+#define DRM_VIA_GEM_CREATE	0x12
+#define DRM_VIA_GEM_WAIT	0x13
+#define DRM_VIA_GEM_STATE	0x14
+
 #define DRM_IOCTL_VIA_ALLOCMEM	  DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_ALLOCMEM, drm_via_mem_t)
 #define DRM_IOCTL_VIA_FREEMEM	  DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_FREEMEM, drm_via_mem_t)
 #define DRM_IOCTL_VIA_AGP_INIT	  DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_AGP_INIT, drm_via_agp_t)
 #define DRM_IOCTL_VIA_FB_INIT	  DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_FB_INIT, drm_via_fb_t)
 #define DRM_IOCTL_VIA_MAP_INIT	  DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_MAP_INIT, drm_via_init_t)
 #define DRM_IOCTL_VIA_DEC_FUTEX   DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_DEC_FUTEX, drm_via_futex_t)
-#define DRM_IOCTL_VIA_GEM_CREATE  DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_GEM_CREATE, struct drm_via_gem_create)
+#define DRM_IOCTL_VIA_OLD_GEM_CREATE  DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_OLD_GEM_CREATE, struct drm_via_gem_object)
 #define DRM_IOCTL_VIA_DMA_INIT	  DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_DMA_INIT, drm_via_dma_init_t)
 #define DRM_IOCTL_VIA_CMDBUFFER	  DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_CMDBUFFER, drm_via_cmdbuffer_t)
 #define DRM_IOCTL_VIA_FLUSH	  DRM_IO(  DRM_COMMAND_BASE + DRM_VIA_FLUSH)
@@ -93,6 +100,13 @@
 #define DRM_IOCTL_VIA_DMA_BLIT    DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_DMA_BLIT, drm_via_dmablit_t)
 #define DRM_IOCTL_VIA_BLIT_SYNC   DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_BLIT_SYNC, drm_via_blitsync_t)
 
+/* KMS ioctls */
+#define DRM_IOCTL_VIA_GETPARAM    DRM_IOR(DRM_COMMAND_BASE + DRM_VIA_GETPARAM, struct drm_via_param)
+#define DRM_IOCTL_VIA_SETPARAM    DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_SETPARAM, struct drm_via_param)
+#define DRM_IOCTL_VIA_GEM_CREATE  DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_GEM_CREATE, struct drm_via_gem_object)
+#define DRM_IOCTL_VIA_GEM_WAIT    DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_GEM_WAIT, struct drm_via_gem_wait)
+#define DRM_IOCTL_VIA_GEM_STATE   DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_GEM_STATE, struct drm_via_gem_object)
+
 /* Indices into buf.Setup where various bits of state are mirrored per
  * context and per buffer.  These can be fired at the card as a unit,
  * or in a piecewise fashion as required.
@@ -114,19 +128,19 @@
 #define VIA_MEM_UNKNOWN 4
 
 typedef struct {
-	uint32_t offset;
-	uint32_t size;
+	__u32 offset;
+	__u32 size;
 } drm_via_agp_t;
 
 typedef struct {
-	uint32_t offset;
-	uint32_t size;
+	__u32 offset;
+	__u32 size;
 } drm_via_fb_t;
 
 typedef struct {
-	uint32_t context;
-	uint32_t type;
-	uint32_t size;
+	__u32 context;
+	__u32 type;
+	__u32 size;
 	unsigned long index;
 	unsigned long offset;
 } drm_via_mem_t;
@@ -148,9 +162,9 @@ typedef struct _drm_via_futex {
 		VIA_FUTEX_WAIT = 0x00,
 		VIA_FUTEX_WAKE = 0X01
 	} func;
-	uint32_t ms;
-	uint32_t lock;
-	uint32_t val;
+	__u32 ms;
+	__u32 lock;
+	__u32 val;
 } drm_via_futex_t;
 
 typedef struct _drm_via_dma_init {
@@ -211,7 +225,7 @@ typedef struct _drm_via_cmdbuf_size {
 		VIA_CMDBUF_LAG = 0x02
 	} func;
 	int wait;
-	uint32_t size;
+	__u32 size;
 } drm_via_cmdbuf_size_t;
 
 typedef enum {
@@ -223,7 +237,8 @@ typedef enum {
 
 #define VIA_IRQ_FLAGS_MASK 0xF0000000
 
-enum drm_via_irqs{drm_via_irq_hqv0 = 0,
+enum drm_via_irqs {
+	drm_via_irq_hqv0 = 0,
 	drm_via_irq_hqv1,
 	drm_via_irq_dma0_dd,
 	drm_via_irq_dma0_td,
@@ -235,8 +250,8 @@ enum drm_via_irqs{drm_via_irq_hqv0 = 0,
 struct drm_via_wait_irq_request {
 	unsigned irq;
 	via_irq_seq_type_t type;
-	uint32_t sequence;
-	uint32_t signal;
+	__u32 sequence;
+	__u32 signal;
 };
 
 typedef union drm_via_irqwait {
@@ -245,34 +260,43 @@ typedef union drm_via_irqwait {
 } drm_via_irqwait_t;
 
 typedef struct drm_via_blitsync {
-	uint32_t sync_handle;
+	__u32 sync_handle;
 	unsigned engine;
 } drm_via_blitsync_t;
 
-/*
- * Below,"flags" is currently unused but will be used for possible future
+/* - * Below,"flags" is currently unused but will be used for possible future
  * extensions like kernel space bounce buffers for bad alignments and
  * blit engine busy-wait polling for better latency in the absence of
  * interrupts.
  */
 
 typedef struct drm_via_dmablit {
-	uint32_t num_lines;
-	uint32_t line_length;
+	__u32 num_lines;
+	__u32 line_length;
 
-	uint32_t fb_addr;
-	uint32_t fb_stride;
+	__u32 fb_addr;
+	__u32 fb_stride;
 
 	unsigned char *mem_addr;
-	uint32_t  mem_stride;
+	__u32 mem_stride;
 
-	int bounce_buffer;
+	__u32 flags;
 	int to_fb;
 
 	drm_via_blitsync_t sync;
 } drm_via_dmablit_t;
 
-struct drm_via_gem_create {
+/* Ioctl to query kernel params:
+ */
+#define VIA_PARAM_CHIPSET_ID		0
+#define VIA_PARAM_REVISION_ID		1
+
+struct drm_via_param {
+	uint64_t param;
+	uint64_t value;
+};
+
+struct drm_via_gem_object {
 	/**
 	 * Requested size for the object.
 	 *
@@ -318,12 +342,15 @@ struct drm_via_gem_create {
 	uint32_t handle;
 
 	/**
-	 * Padding for future expansion.
+	 * Version to tell how to handle this data.
 	 */
-	uint32_t pad1;
-	uint64_t pad2;
-	uint64_t pad3;
-	uint64_t pad4;
+	uint32_t version;
+};
+
+struct drm_via_gem_wait {
+	/* the buffer object handle */
+	uint32_t handle;
+	uint32_t no_wait;
 };
 
 #endif				/* _VIA_DRM_H_ */
diff --git a/src/via_memmgr.c b/src/via_memmgr.c
index 1847884..6cffa9c 100644
--- a/src/via_memmgr.c
+++ b/src/via_memmgr.c
@@ -141,7 +141,7 @@ drm_bo_alloc(ScrnInfoPtr pScrn, unsigned int size, unsigned int alignment, int d
                                 obj->size, obj->offset, obj->handle));
                 }
             } else if (pVia->directRenderingType == DRI_2) {
-                struct drm_via_gem_create args;
+                struct drm_via_gem_object args;
 
                 /* Some day this will be moved to libdrm. */
                 args.domains = domain;
@@ -149,7 +149,7 @@ drm_bo_alloc(ScrnInfoPtr pScrn, unsigned int size, unsigned int alignment, int d
                 args.pitch = 0;
                 args.size = size;
                 ret = drmCommandWriteRead(pVia->drmmode.fd, DRM_VIA_GEM_CREATE,
-                                        &args, sizeof(struct drm_via_gem_create));
+                                        &args, sizeof(struct drm_via_gem_object));
                 if (!ret) {
                     /* Okay the X server expects to know the offset because
                      * of non-KMS. Once we have KMS working the offset
commit 33ff08541e5dd0804b4ca61238b85933a3d740b5
Author: Xavier Bachelot <xavier at bachelot.org>
Date:   Wed Sep 4 21:17:40 2013 +0200

    Samsung Q1EX (reported by Andrew Sabelhaus)

diff --git a/src/via_id.c b/src/via_id.c
index 785081c..c1ffdca 100644
--- a/src/via_id.c
+++ b/src/via_id.c
@@ -239,6 +239,7 @@ static struct ViaCardIdStruct ViaCardId[] = {
     {"Siragon ML-6200",                       VIA_VX800,   0x1106, 0x2211, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
     {"Guillemot-Hercules ECafe EC900B",       VIA_VX800,   0x1106, 0x3349, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
     {"VIA OpenBook",                          VIA_VX800,   0x1170, 0x0311, VIA_DEVICE_CRT | VIA_DEVICE_LCD}, /* VIA OpenBook eNote VBE8910 */
+    {"Samsung Q1EX",                          VIA_VX800,   0x144d, 0xc040, VIA_DEVICE_LCD},
     {"Samsung NC20",                          VIA_VX800,   0x144d, 0xc04e, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
     {"FIC CE2A1",                             VIA_VX800,   0x1509, 0x3002, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
     {"Quanta DreamBook Light IL1",            VIA_VX800,   0x152d, 0x0771, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
commit f5d7c881c853eb5f617c1792de3f5bb5305d5dd3
Author: James Simmons <jsimmons at infradead.org>
Date:   Sun Jul 14 15:09:41 2013 -0400

    Revert "With hotplug an output is enabled but its not attached to a crtc by default. When the display is issued a resize now when we encounter a disabled crtc a unbound ouput is then attached to it."
    
    This reverts commit c41db44466d9fc856fab1c4207483230deda6031.

diff --git a/src/via_driver.c b/src/via_driver.c
index b1b6e16..0f24ebe 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -807,7 +807,7 @@ via_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 {
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
     struct buffer_object *old_front = NULL, *new_front = NULL;
-    int cpp = (scrn->bitsPerPixel + 7) >> 3, fd, i, j;
+    int cpp = (scrn->bitsPerPixel + 7) >> 3, fd, i;
     int old_width, old_height, old_dwidth, format;
     ScreenPtr screen = scrn->pScreen;
     VIAPtr pVia = VIAPTR(scrn);
@@ -859,18 +859,8 @@ via_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
         drmmode_crtc_private_ptr drmmode_crtc;
         drmmode_ptr drmmode;
 
-        if (!xf86CrtcInUse(crtc)) {
-            for (j = 0; j < xf86_config->num_output; j++) {
-                xf86OutputPtr output = xf86_config->output[j];
-
-                if (!output->crtc) {
-                    output->crtc = crtc;
-                    ret = TRUE;
-                }
-            }
-            if (!ret)
-                continue;
-        }
+        if (!xf86CrtcInUse(crtc) || !crtc->driver_private)
+            continue;
 
         drmmode_crtc = crtc->driver_private;
         drmmode = drmmode_crtc->drmmode;
commit c41db44466d9fc856fab1c4207483230deda6031
Author: James Simmons <jsimmons at infradead.org>
Date:   Sun Jul 14 11:14:00 2013 -0400

    With hotplug an output is enabled but its not attached to a crtc by default. When the display is issued a resize now when we encounter a disabled crtc a unbound ouput is then attached to it.

diff --git a/src/via_driver.c b/src/via_driver.c
index 0f24ebe..b1b6e16 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -807,7 +807,7 @@ via_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 {
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
     struct buffer_object *old_front = NULL, *new_front = NULL;
-    int cpp = (scrn->bitsPerPixel + 7) >> 3, fd, i;
+    int cpp = (scrn->bitsPerPixel + 7) >> 3, fd, i, j;
     int old_width, old_height, old_dwidth, format;
     ScreenPtr screen = scrn->pScreen;
     VIAPtr pVia = VIAPTR(scrn);
@@ -859,8 +859,18 @@ via_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
         drmmode_crtc_private_ptr drmmode_crtc;
         drmmode_ptr drmmode;
 
-        if (!xf86CrtcInUse(crtc) || !crtc->driver_private)
-            continue;
+        if (!xf86CrtcInUse(crtc)) {
+            for (j = 0; j < xf86_config->num_output; j++) {
+                xf86OutputPtr output = xf86_config->output[j];
+
+                if (!output->crtc) {
+                    output->crtc = crtc;
+                    ret = TRUE;
+                }
+            }
+            if (!ret)
+                continue;
+        }
 
         drmmode_crtc = crtc->driver_private;
         drmmode = drmmode_crtc->drmmode;
commit f264f523ac80fc9eebec66945fe89243eabbf081
Author: James Simmons <jsimmons at infradead.org>
Date:   Sat Jul 13 15:21:01 2013 -0400

    The normal setup is two crtc are mapped to the same framebuffer. As we set each crtc we were caching the old frame buffer, but for the second crtc we end up caching the new framebuffer as the old one. So when we went to free the old framebuffer the display surface got deleted which caused our xorg driver to crash. The solution is to test if we already cached the old framebuffer. Also since only one display surface is involved we move drmModeRmFB outside the crtc loop.

diff --git a/src/via_driver.c b/src/via_driver.c
index dc956f5..0f24ebe 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -807,8 +807,8 @@ via_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 {
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
     struct buffer_object *old_front = NULL, *new_front = NULL;
+    int cpp = (scrn->bitsPerPixel + 7) >> 3, fd, i;
     int old_width, old_height, old_dwidth, format;
-    int cpp = (scrn->bitsPerPixel + 7) >> 3, i;
     ScreenPtr screen = scrn->pScreen;
     VIAPtr pVia = VIAPTR(scrn);
     void *new_pixels = NULL;
@@ -850,7 +850,6 @@ via_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,9,99,1,0)
     scrn->pixmapPrivate.ptr = ppix->devPrivate.ptr;
 #endif
-
     scrn->virtualX = width;
     scrn->virtualY = height;
     scrn->displayWidth = new_front->pitch / cpp;
@@ -860,44 +859,38 @@ via_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
         drmmode_crtc_private_ptr drmmode_crtc;
         drmmode_ptr drmmode;
 
-        if (!crtc->enabled || !crtc->driver_private)
+        if (!xf86CrtcInUse(crtc) || !crtc->driver_private)
             continue;
 
         drmmode_crtc = crtc->driver_private;
         drmmode = drmmode_crtc->drmmode;
 
-        old_front = drmmode->front_bo;
-        old_fb_id = drmmode->fb_id;
+        if (drmmode->front_bo != new_front) {
+            old_front = drmmode->front_bo;
+            old_fb_id = drmmode->fb_id;
+            fd = drmmode->fd;
 
-        drmmode->front_bo = new_front;
-        drmmode->fb_id = 0;
+            drmmode->front_bo = new_front;
+            drmmode->fb_id = 0;
+        }
 
-        ret = xf86CrtcSetMode(crtc, &crtc->mode, crtc->rotation,
+        ret = xf86CrtcSetMode(crtc, &crtc->desiredMode, crtc->rotation,
 	                          crtc->x, crtc->y);
         if (!ret) {
-            xf86DrvMsg(scrn->scrnIndex, X_INFO,
-                "SetMode !ret so we reset front_bo\n");
             drmmode->front_bo = old_front;
             drmmode->fb_id = old_fb_id;
-            break;
-#ifdef HAVE_DRI
-        } else {
-            xf86DrvMsg(scrn->scrnIndex, X_INFO,
-                "SetMode ret so we cleanup old front_bo\n");
-            if (pVia->KMS && old_fb_id)
-                drmModeRmFB(drmmode->fd, old_fb_id);
-#endif
+            xf86DrvMsg(scrn->scrnIndex, X_INFO, "xf86CrtcSetMode failed\n");
+            goto fail;
         }
     }
 
-
-    if (ret) {
-        xf86DrvMsg(scrn->scrnIndex, X_INFO,
-                   "More cleanup old front_bo\n");
-        drm_bo_unmap(scrn, old_front);
-        drm_bo_free(scrn, old_front);
-        return ret;
-    }
+#ifdef HAVE_DRI
+    if (pVia->KMS && old_fb_id)
+        drmModeRmFB(fd, old_fb_id);
+#endif
+    drm_bo_unmap(scrn, old_front);
+    drm_bo_free(scrn, old_front);
+    return ret;
 
 fail:
     if (new_front) {
commit 7e08492da289e495b8b4092f3a5eeb0c6aa46362
Author: James Simmons <jsimmons at infradead.org>
Date:   Fri Jul 5 18:18:41 2013 -0400

    Remove comparisons that cannot be true.
    
    The variables compared here are all CARD32, which is an unsigned
    type.
    
    Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
    Acked-by: James Simmons <jsimmons at infradead.org>
    
    ---
     src/via_xv_overlay.c | 16 ++++------------
     1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/src/via_xv_overlay.c b/src/via_xv_overlay.c
index bdcd383..85b2403 100644
--- a/src/via_xv_overlay.c
+++ b/src/via_xv_overlay.c
@@ -1759,24 +1759,16 @@ SetVideoWindow(ScrnInfoPtr pScrn, unsigned long videoFlag,
         }
     }*/
 
-    if (top < 0)
-        top = 0;
-    else if (top > 2047)
+    if (top > 2047)
         top = 2047;
 
-    if (bottom < 0)
-        bottom = 0;
-    else if (bottom > 2047)
+    if (bottom > 2047)
         bottom = 2047;
 
-    if (left < 0)
-        left = 0;
-    else if (left > 2047)
+    if (left > 2047)
         left = 2047;
 
-    if (right < 0)
-        right = 0;
-    else if (right > 2047)
+    if (right > 2047)
         right = 2047;
 
     if (videoFlag & VIDEO_1_INUSE) {
commit ab25ebc3d91248f0e411387e72331d102f90a386
Author: James Simmons <jsimmons at infradead.org>
Date:   Fri Jul 5 18:16:47 2013 -0400

    Use appropriate format string.
    
    The variable is an unsigned long, so use %lu.
    
    Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
    Acked-by: James Simmons <jsimmons at infradead.org>
    
    ---
     src/via_driver.c | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/via_driver.c b/src/via_driver.c
index 89e1c8c..dc956f5 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -826,7 +826,7 @@ via_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
         goto fail;
 
     xf86DrvMsg(scrn->scrnIndex, X_INFO,
-                "Allocate new frame buffer %dx%d stride %d\n",
+                "Allocate new frame buffer %dx%d stride %lu\n",
                 width, height, new_front->pitch);
 
     new_pixels = drm_bo_map(scrn, new_front);
commit 12c4cb9d393e1620bfbf2e5f9ba8c6d30d3dc534
Author: James Simmons <jsimmons at infradead.org>
Date:   Fri Jul 5 18:12:09 2013 -0400

    Add missing drm_fourcc.h header file.
    
    Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
    Acked-by: James Simmons <jsimmons at infradead.org>
    
    ---
    src/via_driver.c | 1 +
    src/via_memmgr.c | 1 +
    2 files changed, 2 insertions(+)

diff --git a/src/via_driver.c b/src/via_driver.c
index 139a0c3..89e1c8c 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -41,6 +41,7 @@
 
 #include "version.h"
 #include "via_driver.h"
+#include "drm_fourcc.h"
 
 #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
 #include "xf86RAC.h"
diff --git a/src/via_memmgr.c b/src/via_memmgr.c
index 5d4cc3f..1847884 100644
--- a/src/via_memmgr.c
+++ b/src/via_memmgr.c
@@ -34,6 +34,7 @@
 #include "xf86drm.h"
 #endif
 
+#include "drm_fourcc.h"
 #include "via_driver.h"
 #ifdef HAVE_DRI
 #include "via_drm.h"
commit c04bf57c460a6c7ddf00377ec065bb0efe188fc8
Author: Xavier Bachelot <xavier at bachelot.org>
Date:   Sat Jun 22 17:10:01 2013 +0200

    Shuttle MK40V (reported by Belkacem Houari)

diff --git a/src/via_id.c b/src/via_id.c
index 1053293..785081c 100644
--- a/src/via_id.c
+++ b/src/via_id.c
@@ -57,6 +57,7 @@ static struct ViaCardIdStruct ViaCardId[] = {
     {"Soltek SL-75MIV2",                      VIA_KM400,   0x1106, 0x0000, VIA_DEVICE_CRT}, /* VIA/0x0000 */
     {"VIA VT3205 (KM400)",                    VIA_KM400,   0x1106, 0x3205, VIA_DEVICE_CRT | VIA_DEVICE_TV}, /* borrowed by Soltek SL-B7C-FGR */
     {"VIA VT7205 (KM400A)",                   VIA_KM400,   0x1106, 0x7205, VIA_DEVICE_CRT}, /* borrowed by Biostar iDEQ 200V/Chaintech 7VIF4 */
+    {"Shuttle MK40V",                         VIA_KM400,   0x1297, 0x0240, VIA_DEVICE_CRT},
     {"Shuttle FX43",                          VIA_KM400,   0x1297, 0xF643, VIA_DEVICE_CRT | VIA_DEVICE_TV},
     {"Giga-byte 7VM400(A)M",                  VIA_KM400,   0x1458, 0xD000, VIA_DEVICE_CRT},
     {"MSI KM4(A)M-V",                         VIA_KM400,   0x1462, 0x7061, VIA_DEVICE_CRT}, /* aka "DFI KM400-MLV" */
commit 200cdb68353e638c78582c0ae571e59c96cfea64
Author: James Simmons <jsimmons at infradead.org>
Date:   Wed Jun 5 20:14:57 2013 -0400

    gcc does not like prototypes for static functions. This patch fixes that issue

diff --git a/src/via_driver.h b/src/via_driver.h
index dfe91fc..b1b077d 100644
--- a/src/via_driver.h
+++ b/src/via_driver.h
@@ -525,9 +525,6 @@ void viaHideCursor(ScrnInfoPtr pScrn);
 Bool viaHWCursorInit(ScreenPtr pScreen);
 void ViaDisplaySetStreamOnCRT(ScrnInfoPtr pScrn, Bool primary);
 void ViaDisplaySetStreamOnDFP(ScrnInfoPtr pScrn, Bool primary);
-void ViaDisplaySetStreamOnDVO(ScrnInfoPtr pScrn, int port, Bool primary);
 void ViaDisplayEnableSimultaneous(ScrnInfoPtr pScrn);
-void ViaDisplayEnableCRT(ScrnInfoPtr pScrn);
-void ViaDisplayEnableDVO(ScrnInfoPtr pScrn, int port);
 
 #endif /* _VIA_DRIVER_H_ */
commit 237233d14346604488785a9899f01df044245949
Author: Jared McNeill <jmcneill at NetBSD.org>
Date:   Mon Jun 3 20:52:47 2013 +0200

    Remove a couple '#ifdef linux's to let the driver use optimized memcpy
    functions on NetBSD for video copy. Gives nearly 2x performance on my
    test system (previously "kernel" memcpy was always used):
    
    CHROME(0): Benchmarking video copy.  Less time is better.
    CHROME(0): Timed   libc YUV420 copy... 3000272. Throughput: 315.6 MiB/s.
    CHROME(0): Timed kernel YUV420 copy... 3024946. Throughput: 313.0 MiB/s.
    CHROME(0): Timed    SSE YUV420 copy... 1591352. Throughput: 595.0 MiB/s.
    CHROME(0): Timed    MMX YUV420 copy... 2566279. Throughput: 369.0 MiB/s.
    CHROME(0): Ditching 3DNow! YUV420 copy. Not supported by CPU.
    CHROME(0): Timed   MMX2 YUV420 copy... 1696662. Throughput: 558.1 MiB/s.
    CHROME(0): Using SSE YUV42X copy for video.

diff --git a/src/via_memcpy.c b/src/via_memcpy.c
index d4eb804..8ef0e9f 100644
--- a/src/via_memcpy.c
+++ b/src/via_memcpy.c
@@ -309,8 +309,6 @@
     }
 
 
-#if !defined(__i386__) || (defined(linux) && defined(__i386__))
-
 static void
 libc_YUV42X(unsigned char *dst, const unsigned char *src,
             int dstPitch, int w, int h, int yuv422)
@@ -348,8 +346,6 @@ libc_YUV42X(unsigned char *dst, const unsigned char *src,
         }
     }
 }
-#endif
-
 
 #ifdef __i386__
 
@@ -415,7 +411,6 @@ kernel_YUV42X(unsigned char *dst, const unsigned char *src,
     }
 }
 
-#ifdef linux
 PREFETCH_FUNC(sse, SSE, SSE,, FENCE)
 PREFETCH_FUNC(mmxext, MMXEXT, SSE, EMMS, FENCEMMS)
 PREFETCH_FUNC(now, MMX, NOW, FEMMS, FEMMS)
@@ -515,7 +510,6 @@ cpuValid(const char *cpuinfo, char **flags)
     }
     return 0;
 }
-#endif /* linux */
 
 /*
  * Benchmark the video copy routines and choose the fastest.
@@ -525,7 +519,6 @@ viaVidCopyInit(char *copyType, ScreenPtr pScreen)
 {
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
 
-#ifdef linux
     char buf[BSIZ];
     unsigned char *buf1, *buf2, *buf3;
     char *tmpBuf, *endBuf;
@@ -641,11 +634,6 @@ viaVidCopyInit(char *copyType, ScreenPtr pScreen)
                "Using %s YUV42X copy for %s.\n",
                mcFunctions[bestSoFar].mName, copyType);
     return mcFunctions[bestSoFar].mFunc;
-#else
-    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-               "Using Linux kernel memcpy for video.\n");
-    return kernel_YUV42X;
-#endif /* linux */
 }
 
 #else
commit 78b9f43ca8d04383a83659619d70f61688568366
Author: Christos Zoulas <christos at NetBSD.org>
Date:   Mon Jun 3 20:50:45 2013 +0200

    Add missing prototypes

diff --git a/src/via_driver.h b/src/via_driver.h
index f82fdda..dfe91fc 100644
--- a/src/via_driver.h
+++ b/src/via_driver.h
@@ -519,4 +519,15 @@ Bool VIADRIBufferInit(ScrnInfoPtr pScrn);
 
 #endif /* HAVE_DRI */
 
+int viaOffScreenLinear(struct buffer_object *obj, ScrnInfoPtr pScrn, unsigned long size);
+void viaShowCursor(ScrnInfoPtr pScrn);
+void viaHideCursor(ScrnInfoPtr pScrn);
+Bool viaHWCursorInit(ScreenPtr pScreen);
+void ViaDisplaySetStreamOnCRT(ScrnInfoPtr pScrn, Bool primary);
+void ViaDisplaySetStreamOnDFP(ScrnInfoPtr pScrn, Bool primary);
+void ViaDisplaySetStreamOnDVO(ScrnInfoPtr pScrn, int port, Bool primary);
+void ViaDisplayEnableSimultaneous(ScrnInfoPtr pScrn);
+void ViaDisplayEnableCRT(ScrnInfoPtr pScrn);
+void ViaDisplayEnableDVO(ScrnInfoPtr pScrn, int port);
+
 #endif /* _VIA_DRIVER_H_ */


More information about the Openchrome-devel mailing list