Module Name: xsrc
Committed By: mrg
Date: Fri Aug 19 23:37:39 UTC 2016
Modified Files:
xsrc/external/mit/xf86-video-geode/dist/src: geode.h geode_msr.c
gx_accel.c lx_driver.c
xsrc/external/mit/xf86-video-openchrome/dist/src: via_display.c
via_dri.c via_driver.c via_driver.h via_lvds.c
xsrc/external/mit/xf86-video-openchrome/include: config.h
xsrc/external/mit/xf86-video-rendition/dist/src: rendition.c
rendition.h
xsrc/external/mit/xf86-video-s3virge/dist/src: s3v_driver.c
Removed Files:
xsrc/external/mit/xf86-video-openchrome/dist/src: via_vbe.c
Log Message:
merge xf86-video-geode 2.11.18, xf86-video-openchrome 0.4.0,
xf86-video-rendition 4.2.6, and xf86-video-s3virge 1.10.7.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 xsrc/external/mit/xf86-video-geode/dist/src/geode.h
cvs rdiff -u -r1.5 -r1.6 \
xsrc/external/mit/xf86-video-geode/dist/src/geode_msr.c
cvs rdiff -u -r1.2 -r1.3 \
xsrc/external/mit/xf86-video-geode/dist/src/gx_accel.c \
xsrc/external/mit/xf86-video-geode/dist/src/lx_driver.c
cvs rdiff -u -r1.2 -r1.3 \
xsrc/external/mit/xf86-video-openchrome/dist/src/via_display.c \
xsrc/external/mit/xf86-video-openchrome/dist/src/via_driver.c \
xsrc/external/mit/xf86-video-openchrome/dist/src/via_lvds.c
cvs rdiff -u -r1.3 -r1.4 \
xsrc/external/mit/xf86-video-openchrome/dist/src/via_dri.c
cvs rdiff -u -r1.5 -r1.6 \
xsrc/external/mit/xf86-video-openchrome/dist/src/via_driver.h
cvs rdiff -u -r1.1.1.2 -r0 \
xsrc/external/mit/xf86-video-openchrome/dist/src/via_vbe.c
cvs rdiff -u -r1.2 -r1.3 \
xsrc/external/mit/xf86-video-openchrome/include/config.h
cvs rdiff -u -r1.2 -r1.3 \
xsrc/external/mit/xf86-video-rendition/dist/src/rendition.c \
xsrc/external/mit/xf86-video-rendition/dist/src/rendition.h
cvs rdiff -u -r1.4 -r1.5 \
xsrc/external/mit/xf86-video-s3virge/dist/src/s3v_driver.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: xsrc/external/mit/xf86-video-geode/dist/src/geode.h
diff -u xsrc/external/mit/xf86-video-geode/dist/src/geode.h:1.3 xsrc/external/mit/xf86-video-geode/dist/src/geode.h:1.4
--- xsrc/external/mit/xf86-video-geode/dist/src/geode.h:1.3 Tue Aug 16 07:39:45 2016
+++ xsrc/external/mit/xf86-video-geode/dist/src/geode.h Fri Aug 19 23:37:39 2016
@@ -27,10 +27,10 @@
#ifndef _GEODE_H_
#define _GEODE_H_
-#include "geode_pcirename.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#include "geode_pcirename.h"
#include "xorg-server.h"
#ifdef HAVE_XAA_H
@@ -442,6 +442,10 @@ void GXAccelSync(ScrnInfoPtr pScrni);
/* gx_video.c */
void GXInitVideo(ScreenPtr pScrn);
+/* lx_display.c */
+void lx_enable_dac_power(ScrnInfoPtr pScrni, int option);
+void lx_disable_dac_power(ScrnInfoPtr pScrni, int option);
+
/* lx_driver.c */
void LXSetupChipsetFPtr(ScrnInfoPtr pScrn);
Index: xsrc/external/mit/xf86-video-geode/dist/src/geode_msr.c
diff -u xsrc/external/mit/xf86-video-geode/dist/src/geode_msr.c:1.5 xsrc/external/mit/xf86-video-geode/dist/src/geode_msr.c:1.6
--- xsrc/external/mit/xf86-video-geode/dist/src/geode_msr.c:1.5 Mon Jul 20 00:10:28 2015
+++ xsrc/external/mit/xf86-video-geode/dist/src/geode_msr.c Fri Aug 19 23:37:39 2016
@@ -39,12 +39,19 @@
#include <machine/amdmsr.h>
#endif
+#ifdef __FreeBSD__
+#include <sys/ioctl.h>
+#include <sys/cpuctl.h>
+#endif
+
#include "os.h"
#include "geode.h"
#ifdef __OpenBSD__
#define _PATH_MSRDEV "/dev/amdmsr"
#define X_PRIVSEP
+#elif defined __FreeBSD__
+#define _PATH_MSRDEV "/dev/cpuctl0"
#else
#define _PATH_MSRDEV "/dev/cpu/0/msr"
#endif
@@ -83,6 +90,18 @@ GeodeReadMSR(unsigned long addr, unsigne
*hi = req.val >> 32;
*lo = req.val & 0xffffffff;
+#elif defined __FreeBSD__
+ cpuctl_msr_args_t args;
+ int fd = _msr_open();
+
+ args.msr = addr;
+
+ if (ioctl(fd, CPUCTL_RDMSR, &args) == -1)
+ FatalError("Unable to read MSR at address %0x06x: %s\n", addr,
+ strerror(errno));
+
+ *hi = args.data >> 32;
+ *lo = args.data & 0xffffffff;
#else
unsigned int data[2];
int fd = _msr_open();
@@ -120,6 +139,16 @@ GeodeWriteMSR(unsigned long addr, unsign
if (ioctl(fd, WRMSR, &req) == -1)
FatalError("Unable to write MSR at address 0x%06x: %s\n", addr,
strerror(errno));
+#elif defined __FreeBSD__
+ cpuctl_msr_args_t args;
+ int fd = _msr_open();
+
+ args.msr = addr;
+ args.data = (u_int64_t) hi << 32 | (u_int64_t)lo;
+
+ if (ioctl(fd, CPUCTL_WRMSR, &args) == -1)
+ FatalError("Unable to write MSR at address 0x%06x: %s\n", addr,
+ strerror(errno));
#else
unsigned int data[2];
int fd = _msr_open();
Index: xsrc/external/mit/xf86-video-geode/dist/src/gx_accel.c
diff -u xsrc/external/mit/xf86-video-geode/dist/src/gx_accel.c:1.2 xsrc/external/mit/xf86-video-geode/dist/src/gx_accel.c:1.3
--- xsrc/external/mit/xf86-video-geode/dist/src/gx_accel.c:1.2 Tue Aug 16 07:39:45 2016
+++ xsrc/external/mit/xf86-video-geode/dist/src/gx_accel.c Fri Aug 19 23:37:39 2016
@@ -1490,7 +1490,8 @@ static Bool
amd_gx_exa_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
char *src, int src_pitch)
{
- char *dst = pDst->devPrivate.ptr;
+ GeodeRec *pGeode = GEODEPTR_FROM_PIXMAP(pDst);
+ char *dst = pGeode->pExa->memoryBase + exaGetPixmapOffset(pDst);
int dst_pitch = exaGetPixmapPitch(pDst);
int bpp = pDst->drawable.bitsPerPixel;
@@ -1505,7 +1506,8 @@ static Bool
amd_gx_exa_DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h,
char *dst, int dst_pitch)
{
- char *src = pSrc->devPrivate.ptr;
+ GeodeRec *pGeode = GEODEPTR_FROM_PIXMAP(pSrc);
+ char *src = pGeode->pExa->memoryBase + exaGetPixmapOffset(pSrc);
int src_pitch = exaGetPixmapPitch(pSrc);
int bpp = pSrc->drawable.bitsPerPixel;
@@ -1741,6 +1743,7 @@ amd_gx_exa_PrepareComposite(int op, Pict
PixmapPtr pxDst)
{
int srcPitch;
+ if (!pxSrc || !pSrc->pDrawable) return FALSE;
GeodeRec *pGeode = GEODEPTR_FROM_PIXMAP(pxDst);
amd_gx_exa_fmt_t *sfp, *dfp;
Index: xsrc/external/mit/xf86-video-geode/dist/src/lx_driver.c
diff -u xsrc/external/mit/xf86-video-geode/dist/src/lx_driver.c:1.2 xsrc/external/mit/xf86-video-geode/dist/src/lx_driver.c:1.3
--- xsrc/external/mit/xf86-video-geode/dist/src/lx_driver.c:1.2 Tue Aug 16 07:39:45 2016
+++ xsrc/external/mit/xf86-video-geode/dist/src/lx_driver.c Fri Aug 19 23:37:39 2016
@@ -683,6 +683,8 @@ LXLeaveGraphics(ScrnInfoPtr pScrni)
gp_wait_until_idle();
+ lx_disable_dac_power(pScrni, DF_CRT_DISABLE);
+
vg_set_custom_mode(&(pGeode->FBcimdisplaytiming.vgDisplayMode),
pGeode->FBcimdisplaytiming.wBpp);
@@ -711,6 +713,7 @@ LXLeaveGraphics(ScrnInfoPtr pScrni)
vg_delay_milliseconds(3);
}
+ lx_enable_dac_power(pScrni, 1);
pScrni->vtSema = FALSE;
}
Index: xsrc/external/mit/xf86-video-openchrome/dist/src/via_display.c
diff -u xsrc/external/mit/xf86-video-openchrome/dist/src/via_display.c:1.2 xsrc/external/mit/xf86-video-openchrome/dist/src/via_display.c:1.3
--- xsrc/external/mit/xf86-video-openchrome/dist/src/via_display.c:1.2 Mon Jun 3 22:44:40 2013
+++ xsrc/external/mit/xf86-video-openchrome/dist/src/via_display.c Fri Aug 19 23:37:39 2016
@@ -1,5 +1,6 @@
/*
- * Copyright 2005-2011 The Openchrome Project [openchrome.org]
+ * Copyright 2005-2015 The Openchrome Project
+ * [http://www.freedesktop.org/wiki/Openchrome]
* Copyright 2004-2005 The Unichrome Project [unichrome.sf.net]
* Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
* Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
@@ -312,8 +313,8 @@ ViaFirstCRTCSetMode(ScrnInfoPtr pScrn, D
}
switch (pVia->ChipId) {
- case VIA_K8M890:
case VIA_CX700:
+ case VIA_K8M890:
case VIA_P4M900:
case VIA_VX800:
case VIA_VX855:
@@ -323,7 +324,7 @@ ViaFirstCRTCSetMode(ScrnInfoPtr pScrn, D
ViaSeqMask(hwp, 0x16, 0x08, 0xBF);
ViaSeqMask(hwp, 0x17, 0x1F, 0xFF);
ViaSeqMask(hwp, 0x18, 0x4E, 0xFF);
- ViaSeqMask(hwp, 0x1A, 0x08, 0xFD);
+ ViaSeqMask(hwp, 0x1A, 0x08, 0xF9);
break;
}
@@ -417,8 +418,8 @@ ViaFirstCRTCSetMode(ScrnInfoPtr pScrn, D
/* FIXME: check if this is really necessary here */
switch (pVia->ChipId) {
- case VIA_K8M890:
case VIA_CX700:
+ case VIA_K8M890:
case VIA_P4M900:
case VIA_VX800:
case VIA_VX855:
@@ -454,8 +455,8 @@ ViaFirstCRTCSetMode(ScrnInfoPtr pScrn, D
ViaSeqMask(hwp, 0x1D, temp >> 9, 0x03);
switch (pVia->ChipId) {
- case VIA_K8M890:
case VIA_CX700:
+ case VIA_K8M890:
case VIA_P4M900:
case VIA_VX800:
case VIA_VX855:
@@ -582,8 +583,8 @@ ViaSecondCRTCSetMode(ScrnInfoPtr pScrn,
}
switch (pVia->ChipId) {
- case VIA_K8M890:
case VIA_CX700:
+ case VIA_K8M890:
case VIA_P4M900:
case VIA_VX800:
case VIA_VX855:
@@ -593,7 +594,7 @@ ViaSecondCRTCSetMode(ScrnInfoPtr pScrn,
ViaSeqMask(hwp, 0x16, 0x08, 0xBF);
ViaSeqMask(hwp, 0x17, 0x1F, 0xFF);
ViaSeqMask(hwp, 0x18, 0x4E, 0xFF);
- ViaSeqMask(hwp, 0x1A, 0x08, 0xFD);
+ ViaSeqMask(hwp, 0x1A, 0x08, 0xF9);
break;
}
@@ -668,8 +669,8 @@ ViaSecondCRTCSetMode(ScrnInfoPtr pScrn,
ViaCrtcMask(hwp, 0x5F, temp, 0x1F);
switch (pVia->ChipId) {
- case VIA_K8M890:
case VIA_CX700:
+ case VIA_K8M890:
case VIA_P4M900:
case VIA_VX800:
case VIA_VX855:
@@ -826,29 +827,26 @@ iga1_crtc_dpms(xf86CrtcPtr crtc, int mod
VIAPtr pVia = VIAPTR(pScrn);
VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
- if (pVia->pVbe) {
- ViaVbeDPMS(pScrn, mode);
- } else {
- switch (mode) {
- case DPMSModeOn:
- if (pBIOSInfo->SimultaneousEnabled)
- ViaDisplayEnableSimultaneous(pScrn);
- break;
-
- case DPMSModeStandby:
- case DPMSModeSuspend:
- case DPMSModeOff:
- if (pBIOSInfo->SimultaneousEnabled)
- ViaDisplayDisableSimultaneous(pScrn);
- break;
-
- default:
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Invalid DPMS mode %d\n",
- mode);
- break;
- }
- //vgaHWSaveScreen(pScrn->pScreen, mode);
+ switch (mode) {
+ case DPMSModeOn:
+ if (pBIOSInfo->SimultaneousEnabled)
+ ViaDisplayEnableSimultaneous(pScrn);
+ break;
+
+ case DPMSModeStandby:
+ case DPMSModeSuspend:
+ case DPMSModeOff:
+ if (pBIOSInfo->SimultaneousEnabled)
+ ViaDisplayDisableSimultaneous(pScrn);
+ break;
+
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Invalid DPMS mode %d\n",
+ mode);
+ break;
}
+ //vgaHWSaveScreen(pScrn->pScreen, mode);
+
}
static void
@@ -858,12 +856,7 @@ iga1_crtc_save(xf86CrtcPtr crtc)
vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
- if (pVia->pVbe && pVia->vbeSR) {
- ViaVbeSaveRestore(pScrn, MODE_SAVE);
- } else {
- VIASave(pScrn);
- }
-
+ VIASave(pScrn);
vgaHWUnlock(hwp);
}
@@ -874,10 +867,7 @@ iga1_crtc_restore(xf86CrtcPtr crtc)
vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
- if (pVia->pVbe && pVia->vbeSR)
- ViaVbeSaveRestore(pScrn, MODE_RESTORE);
- else
- VIARestore(pScrn);
+ VIARestore(pScrn);
/* A soft reset helps to avoid a 3D hang on VT switch. */
switch (pVia->Chipset) {
@@ -915,9 +905,6 @@ iga1_crtc_mode_fixup(xf86CrtcPtr crtc, D
CARD32 temp;
ModeStatus modestatus;
- if (pVia->pVbe)
- return TRUE;
-
if ((mode->Clock < pScrn->clockRanges->minClock) ||
(mode->Clock > pScrn->clockRanges->maxClock)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -956,11 +943,7 @@ iga1_crtc_set_origin(xf86CrtcPtr crtc, i
ScrnInfoPtr pScrn = crtc->scrn;
VIAPtr pVia = VIAPTR(pScrn);
- if (pVia->pVbe) {
- ViaVbeAdjustFrame(pScrn, x, y);
- } else {
- ViaFirstCRTCSetStartingAddress(crtc, x, y);
- }
+ ViaFirstCRTCSetStartingAddress(crtc, x, y);
VIAVidAdjustFrame(pScrn, x, y);
}
@@ -972,25 +955,17 @@ iga1_crtc_mode_set(xf86CrtcPtr crtc, Dis
ScrnInfoPtr pScrn = crtc->scrn;
VIAPtr pVia = VIAPTR(pScrn);
- if (!pVia->pVbe) {
- if (!vgaHWInit(pScrn, adjusted_mode))
- return;
+ if (!vgaHWInit(pScrn, adjusted_mode))
+ return;
- if (pVia->UseLegacyModeSwitch) {
- ViaModePrimaryLegacy(crtc, adjusted_mode);
- } else {
- ViaCRTCInit(pScrn);
- ViaModeFirstCRTC(pScrn, adjusted_mode);
+ ViaCRTCInit(pScrn);
+ ViaModeFirstCRTC(pScrn, adjusted_mode);
+
+ if (pVia->pBIOSInfo->SimultaneousEnabled)
+ ViaDisplayEnableSimultaneous(pScrn);
+ else
+ ViaDisplayDisableSimultaneous(pScrn);
- if (pVia->pBIOSInfo->SimultaneousEnabled)
- ViaDisplayEnableSimultaneous(pScrn);
- else
- ViaDisplayDisableSimultaneous(pScrn);
- }
- } else {
- if (!ViaVbeSetMode(pScrn, adjusted_mode))
- return;
- }
iga1_crtc_set_origin(crtc, crtc->x, crtc->y);
}
@@ -1245,7 +1220,7 @@ static const xf86CrtcFuncsRec iga1_crtc_
.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,
@@ -1258,29 +1233,25 @@ iga2_crtc_dpms(xf86CrtcPtr crtc, int mod
VIAPtr pVia = VIAPTR(pScrn);
VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
- if (pVia->pVbe) {
- ViaVbeDPMS(pScrn, mode);
- } else {
- switch (mode) {
- case DPMSModeOn:
- if (pBIOSInfo->SimultaneousEnabled)
- ViaDisplayEnableSimultaneous(pScrn);
- break;
+ switch (mode) {
+ case DPMSModeOn:
+ if (pBIOSInfo->SimultaneousEnabled)
+ ViaDisplayEnableSimultaneous(pScrn);
+ break;
- case DPMSModeStandby:
- case DPMSModeSuspend:
- case DPMSModeOff:
- if (pBIOSInfo->SimultaneousEnabled)
- ViaDisplayDisableSimultaneous(pScrn);
- break;
+ case DPMSModeStandby:
+ case DPMSModeSuspend:
+ case DPMSModeOff:
+ if (pBIOSInfo->SimultaneousEnabled)
+ ViaDisplayDisableSimultaneous(pScrn);
+ break;
- default:
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Invalid DPMS mode %d\n",
- mode);
- break;
- }
- //vgaHWSaveScreen(pScrn->pScreen, mode);
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Invalid DPMS mode %d\n",
+ mode);
+ break;
}
+ //vgaHWSaveScreen(pScrn->pScreen, mode);
}
static void
@@ -1290,11 +1261,8 @@ iga2_crtc_save(xf86CrtcPtr crtc)
vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
- if (pVia->pVbe && pVia->vbeSR)
- ViaVbeSaveRestore(pScrn, MODE_SAVE);
- else
- VIASave(pScrn);
- vgaHWUnlock(hwp);
+ VIASave(pScrn);
+ vgaHWUnlock(hwp);
}
static void
@@ -1304,10 +1272,7 @@ iga2_crtc_restore(xf86CrtcPtr crtc)
vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
- if (pVia->pVbe && pVia->vbeSR)
- ViaVbeSaveRestore(pScrn, MODE_RESTORE);
- else
- VIARestore(pScrn);
+ VIARestore(pScrn);
vgaHWLock(hwp);
}
@@ -1331,9 +1296,6 @@ iga2_crtc_mode_fixup(xf86CrtcPtr crtc, D
CARD32 temp;
ModeStatus modestatus;
- if (pVia->pVbe)
- return TRUE;
-
if ((mode->Clock < pScrn->clockRanges->minClock) ||
(mode->Clock > pScrn->clockRanges->maxClock)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -1372,11 +1334,7 @@ iga2_crtc_set_origin(xf86CrtcPtr crtc, i
ScrnInfoPtr pScrn = crtc->scrn;
VIAPtr pVia = VIAPTR(pScrn);
- if (pVia->pVbe) {
- ViaVbeAdjustFrame(pScrn, x, y);
- } else {
- ViaSecondCRTCSetStartingAddress(crtc, x, y);
- }
+ ViaSecondCRTCSetStartingAddress(crtc, x, y);
VIAVidAdjustFrame(pScrn, x, y);
}
@@ -1387,26 +1345,18 @@ iga2_crtc_mode_set(xf86CrtcPtr crtc, Dis
ScrnInfoPtr pScrn = crtc->scrn;
VIAPtr pVia = VIAPTR(pScrn);
- if (pVia->pVbe) {
- if (!ViaVbeSetMode(pScrn, adjusted_mode))
- return;
- } else {
- if (!vgaHWInit(pScrn, adjusted_mode))
- return;
+ if (!vgaHWInit(pScrn, adjusted_mode))
+ return;
- if (pVia->UseLegacyModeSwitch) {
- ViaModeSecondaryLegacy(crtc, adjusted_mode);
- } else {
- ViaCRTCInit(pScrn);
- ViaModeSecondCRTC(pScrn, adjusted_mode);
- ViaSecondDisplayChannelEnable(pScrn);
+ ViaCRTCInit(pScrn);
+ ViaModeSecondCRTC(pScrn, adjusted_mode);
+ ViaSecondDisplayChannelEnable(pScrn);
+
+ if (pVia->pBIOSInfo->SimultaneousEnabled)
+ ViaDisplayEnableSimultaneous(pScrn);
+ else
+ ViaDisplayDisableSimultaneous(pScrn);
- if (pVia->pBIOSInfo->SimultaneousEnabled)
- ViaDisplayEnableSimultaneous(pScrn);
- else
- ViaDisplayDisableSimultaneous(pScrn);
- }
- }
iga2_crtc_set_origin(crtc, crtc->x, crtc->y);
}
@@ -1667,7 +1617,7 @@ static const xf86CrtcFuncsRec iga2_crtc_
.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,
@@ -1679,7 +1629,11 @@ UMSCrtcInit(ScrnInfoPtr pScrn)
drmmode_crtc_private_ptr iga1_rec = NULL, iga2_rec = NULL;
vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,8,0,0,0)
ClockRangePtr clockRanges;
+#else
+ ClockRangesPtr clockRanges;
+#endif
int max_pitch, max_height;
VIABIOSInfoPtr pBIOSInfo;
xf86CrtcPtr iga1, iga2;
@@ -1722,28 +1676,16 @@ UMSCrtcInit(ScrnInfoPtr pScrn)
if (!xf86LoadSubModule(pScrn, "ddc"))
return FALSE;
- pVia->pVbe = NULL;
- if (pVia->useVBEModes) {
- /* VBE doesn't properly initialise int10 itself. */
- if (xf86LoadSubModule(pScrn, "int10") &&
- xf86LoadSubModule(pScrn, "vbe")) {
- pVia->pVbe = VBEExtendedInit(NULL, pVia->EntityIndex,
- SET_BIOS_SCRATCH |
- RESTORE_BIOS_SCRATCH);
- }
-
- if (!pVia->pVbe)
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "VBE initialisation failed."
- " Using builtin code to set modes.\n");
- else
- ConfiguredMonitor = vbeDoEDID(pVia->pVbe, NULL);
- }
-
/*
* Set up ClockRanges, which describe what clock ranges are
* available, and what sort of modes they can be used for.
*/
+
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,8,0,0,0)
clockRanges = xnfalloc(sizeof(ClockRange));
+#else
+ clockRanges = xnfalloc(sizeof(ClockRanges));
+#endif
clockRanges->next = NULL;
clockRanges->minClock = 20000;
clockRanges->maxClock = 230000;
@@ -1807,14 +1749,14 @@ UMSCrtcInit(ScrnInfoPtr pScrn)
case VIA_KM400:
case VIA_K8M800:
case VIA_PM800:
- case VIA_VM800:
+ case VIA_P4M800PRO:
max_pitch = 3344;
max_height = 2508;
break;
case VIA_CX700:
- case VIA_K8M890:
case VIA_P4M890:
+ case VIA_K8M890:
case VIA_P4M900:
max_pitch = 8192/(pScrn->bitsPerPixel >> 3)-1;
max_height = max_pitch;
@@ -1860,9 +1802,5 @@ UMSCrtcInit(ScrnInfoPtr pScrn)
ViaOutputsDetect(pScrn);
- if (pVia->pVbe) {
- if (!ViaVbeModePreInit(pScrn))
- return FALSE;
- }
return TRUE;
}
Index: xsrc/external/mit/xf86-video-openchrome/dist/src/via_driver.c
diff -u xsrc/external/mit/xf86-video-openchrome/dist/src/via_driver.c:1.2 xsrc/external/mit/xf86-video-openchrome/dist/src/via_driver.c:1.3
--- xsrc/external/mit/xf86-video-openchrome/dist/src/via_driver.c:1.2 Fri Jun 28 16:53:55 2013
+++ xsrc/external/mit/xf86-video-openchrome/dist/src/via_driver.c Fri Aug 19 23:37:39 2016
@@ -1,5 +1,6 @@
/*
- * Copyright 2005-2007 The Openchrome Project [openchrome.org]
+ * Copyright 2005-2015 The Openchrome Project
+ * [http://www.freedesktop.org/wiki/Openchrome]
* Copyright 2004-2006 Luc Verhaegen.
* Copyright 2004-2005 The Unichrome Project [unichrome.sf.net]
* Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
@@ -41,6 +42,7 @@
#include "version.h"
#include "via_driver.h"
+#include "drm_fourcc.h"
#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
#include "xf86RAC.h"
@@ -49,6 +51,8 @@
#ifdef HAVE_DRI
#include "dri.h"
+#else
+#include "drm_fourcc.h"
#endif
/* RandR support */
@@ -123,36 +127,36 @@ _X_EXPORT DriverRec VIA = {
/* Supported chipsets */
static SymTabRec VIAChipsets[] = {
- {VIA_CLE266, "CLE266"},
- {VIA_KM400, "KM400/KN400"},
- {VIA_K8M800, "K8M800/K8N800"},
- {VIA_PM800, "PM800/PM880/CN400"},
- {VIA_VM800, "VM800/P4M800Pro/VN800/CN700"},
- {VIA_CX700, "CX700/VX700"},
- {VIA_K8M890, "K8M890/K8N890"},
- {VIA_P4M890, "P4M890"},
- {VIA_P4M900, "P4M900/VN896/CN896"},
- {VIA_VX800, "VX800/VX820"},
- {VIA_VX855, "VX855/VX875"},
- {VIA_VX900, "VX900"},
- {-1, NULL }
+ {VIA_CLE266, "CLE266"},
+ {VIA_KM400, "KM400 / KM400A / KN400 / P4M800"},
+ {VIA_K8M800, "K8M800 / K8N800"},
+ {VIA_PM800, "PM800 / PN800 / PM880 / CN333 / CN400"},
+ {VIA_P4M800PRO, "P4M800 Pro / VN800 / CN700"},
+ {VIA_CX700, "CX700 / VX700"},
+ {VIA_P4M890, "P4M890 / VN890 / CN800"},
+ {VIA_K8M890, "K8M890 / K8N890"},
+ {VIA_P4M900, "P4M900 / VN896 / CN896"},
+ {VIA_VX800, "VX800 / VX820"},
+ {VIA_VX855, "VX855 / VX875"},
+ {VIA_VX900, "VX900"},
+ {-1, NULL}
};
/* Mapping a PCI device ID to a chipset family identifier. */
static PciChipsets VIAPciChipsets[] = {
- {VIA_CLE266, PCI_CHIP_CLE3122, VIA_RES_SHARED},
- {VIA_KM400, PCI_CHIP_VT3205, VIA_RES_SHARED},
- {VIA_K8M800, PCI_CHIP_VT3204, VIA_RES_SHARED},
- {VIA_PM800, PCI_CHIP_VT3259, VIA_RES_SHARED},
- {VIA_VM800, PCI_CHIP_VT3314, VIA_RES_SHARED},
- {VIA_CX700, PCI_CHIP_VT3324, VIA_RES_SHARED},
- {VIA_K8M890, PCI_CHIP_VT3336, VIA_RES_SHARED},
- {VIA_P4M890, PCI_CHIP_VT3327, VIA_RES_SHARED},
- {VIA_P4M900, PCI_CHIP_VT3364, VIA_RES_SHARED},
- {VIA_VX800, PCI_CHIP_VT3353, VIA_RES_SHARED},
- {VIA_VX855, PCI_CHIP_VT3409, VIA_RES_SHARED},
- {VIA_VX900, PCI_CHIP_VT3410, VIA_RES_SHARED},
- {-1, -1, VIA_RES_UNDEF}
+ {VIA_CLE266, PCI_CHIP_CLE3122, VIA_RES_SHARED},
+ {VIA_KM400, PCI_CHIP_VT3205, VIA_RES_SHARED},
+ {VIA_K8M800, PCI_CHIP_VT3204, VIA_RES_SHARED},
+ {VIA_PM800, PCI_CHIP_VT3259, VIA_RES_SHARED},
+ {VIA_P4M800PRO, PCI_CHIP_VT3314, VIA_RES_SHARED},
+ {VIA_CX700, PCI_CHIP_VT3324, VIA_RES_SHARED},
+ {VIA_P4M890, PCI_CHIP_VT3327, VIA_RES_SHARED},
+ {VIA_K8M890, PCI_CHIP_VT3336, VIA_RES_SHARED},
+ {VIA_P4M900, PCI_CHIP_VT3364, VIA_RES_SHARED},
+ {VIA_VX800, PCI_CHIP_VT3353, VIA_RES_SHARED},
+ {VIA_VX855, PCI_CHIP_VT3409, VIA_RES_SHARED},
+ {VIA_VX900, PCI_CHIP_VT3410, VIA_RES_SHARED},
+ {-1, -1, VIA_RES_UNDEF}
};
typedef enum
@@ -162,7 +166,6 @@ typedef enum
OPTION_PRINTTVREGS,
OPTION_I2CSCAN,
#endif
- OPTION_VBEMODES,
OPTION_NOACCEL,
OPTION_ACCELMETHOD,
OPTION_EXA_NOCOMPOSITE,
@@ -172,12 +175,9 @@ typedef enum
OPTION_ROTATION_TYPE,
OPTION_ROTATE,
OPTION_VIDEORAM,
- OPTION_ACTIVEDEVICE,
OPTION_I2CDEVICES,
OPTION_BUSWIDTH,
OPTION_CENTER,
- OPTION_PANELSIZE,
- OPTION_FORCEPANEL,
OPTION_TVDOTCRAWL,
OPTION_TVTYPE,
OPTION_TVOUTPUT,
@@ -188,11 +188,9 @@ typedef enum
OPTION_AGP_DMA,
OPTION_2D_DMA,
OPTION_XV_DMA,
- OPTION_VBE_SAVERESTORE,
OPTION_MAX_DRIMEM,
OPTION_AGPMEM,
- OPTION_DISABLE_XV_BW_CHECK,
- OPTION_MODE_SWITCH_METHOD
+ OPTION_DISABLE_XV_BW_CHECK
} VIAOpts;
static OptionInfoRec VIAOptions[] = {
@@ -201,7 +199,6 @@ static OptionInfoRec VIAOptions[] = {
{OPTION_PRINTTVREGS, "PrintTVRegs", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_I2CSCAN, "I2CScan", OPTV_BOOLEAN, {0}, FALSE},
#endif
- {OPTION_VBEMODES, "VBEModes", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_ACCELMETHOD, "AccelMethod", OPTV_STRING, {0}, FALSE},
{OPTION_EXA_NOCOMPOSITE, "ExaNoComposite", OPTV_BOOLEAN, {0}, FALSE},
@@ -211,7 +208,6 @@ static OptionInfoRec VIAOptions[] = {
{OPTION_ROTATION_TYPE, "RotationType", OPTV_ANYSTR, {0}, FALSE},
{OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE},
{OPTION_VIDEORAM, "VideoRAM", OPTV_INTEGER, {0}, FALSE},
- {OPTION_ACTIVEDEVICE, "ActiveDevice", OPTV_ANYSTR, {0}, FALSE},
{OPTION_TVDOTCRAWL, "TVDotCrawl", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_TVDEFLICKER, "TVDeflicker", OPTV_INTEGER, {0}, FALSE},
{OPTION_TVTYPE, "TVType", OPTV_ANYSTR, {0}, FALSE},
@@ -222,9 +218,7 @@ static OptionInfoRec VIAOptions[] = {
{OPTION_AGP_DMA, "EnableAGPDMA", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_2D_DMA, "NoAGPFor2D", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_XV_DMA, "NoXVDMA", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_VBE_SAVERESTORE, "VbeSaveRestore", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_DISABLE_XV_BW_CHECK, "DisableXvBWCheck", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_MODE_SWITCH_METHOD, "ModeSwitchMethod", OPTV_ANYSTR, {0}, FALSE},
{OPTION_MAX_DRIMEM, "MaxDRIMem", OPTV_INTEGER, {0}, FALSE},
{OPTION_AGPMEM, "AGPMem", OPTV_INTEGER, {0}, FALSE},
{OPTION_I2CDEVICES, "I2CDevices", OPTV_ANYSTR, {0}, FALSE},
@@ -236,7 +230,7 @@ static MODULESETUPPROTO(VIASetup);
static XF86ModuleVersionInfo VIAVersRec = {
"openchrome",
- "http://openchrome.org/",
+ "http://www.freedesktop.org/wiki/Openchrome/",
MODINFOSTRING1,
MODINFOSTRING2,
#ifdef XORG_VERSION_CURRENT
@@ -426,13 +420,10 @@ VIAFreeRec(ScrnInfoPtr pScrn)
free(pBIOSInfo);
}
- if (VIAPTR(pScrn)->pVbe)
- vbeFree(VIAPTR(pScrn)->pVbe);
-
if (pVia->VideoRegs)
free(pVia->VideoRegs);
- VIAUnmapMem(pScrn);
+ VIAUnmapMMIO(pScrn);
free(pScrn->driverPrivate);
pScrn->driverPrivate = NULL;
@@ -450,9 +441,6 @@ VIAFreeScreen(FREE_SCREEN_ARGS_DECL)
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAFreeScreen\n"));
- if (pVia->directRenderingType != DRI_2)
- VIAUnmapMem(pScrn);
-
VIAFreeRec(pScrn);
if (!pVia->KMS && xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
@@ -496,7 +484,8 @@ via_pci_probe(DriverPtr driver, int enti
xf86Msg(X_NOTICE,
"VIA Technologies does not support this driver in any way.\n");
xf86Msg(X_NOTICE,
- "For support, please refer to http://www.openchrome.org/.\n");
+ "For support, please refer to"
+ " http://www.freedesktop.org/wiki/Openchrome/.\n");
#ifdef BUILDCOMMENT
xf86Msg(X_NOTICE, BUILDCOMMENT"\n");
#endif
@@ -536,7 +525,8 @@ VIAProbe(DriverPtr drv, int flags)
xf86Msg(X_NOTICE,
"VIA Technologies does not support this driver in any way.\n");
- xf86Msg(X_NOTICE, "For support, please refer to http://openchrome.org/.\n");
+ xf86Msg(X_NOTICE, "For support, please refer to"
+ " http://www.freedesktop.org/wiki/Openchrome/.\n");
#ifdef BUILDCOMMENT
xf86Msg(X_NOTICE, BUILDCOMMENT"\n");
@@ -659,14 +649,11 @@ VIASetupDefaultOptions(ScrnInfoPtr pScrn
pVia->agpEnable = TRUE;
pVia->dma2d = TRUE;
pVia->dmaXV = TRUE;
- pVia->useVBEModes = FALSE;
- pVia->vbeSR = FALSE;
#ifdef HAVE_DEBUG
pVia->disableXvBWCheck = FALSE;
#endif
pVia->maxDriSize = 0;
pVia->agpMem = AGP_SIZE / 1024;
- pVia->ActiveDevice = 0x00;
pVia->I2CDevices = VIA_I2C_BUS1 | VIA_I2C_BUS2 | VIA_I2C_BUS3;
pVia->VideoEngine = VIDEO_ENGINE_CLE;
#ifdef HAVE_DEBUG
@@ -677,15 +664,12 @@ VIASetupDefaultOptions(ScrnInfoPtr pScrn
/* line buffer (limited to 800) is too small to do interpolation. */
pVia->swov.maxWInterp = 800;
pVia->swov.maxHInterp = 600;
- pVia->useLegacyVBE = TRUE;
- pVia->UseLegacyModeSwitch = FALSE;
pBIOSInfo->TVDIPort = VIA_DI_PORT_DVP1;
switch (pVia->Chipset) {
case VIA_CLE266:
pBIOSInfo->TVDIPort = VIA_DI_PORT_DVP0;
- pVia->UseLegacyModeSwitch = TRUE;
break;
case VIA_KM400:
/* IRQ is not broken on KM400A, but testing (pVia->ChipRev < 0x80)
@@ -697,32 +681,27 @@ VIASetupDefaultOptions(ScrnInfoPtr pScrn
pVia->DRIIrqEnable = FALSE;
break;
case VIA_PM800:
- /* Use new mode switch to resolve many resolution and display bugs (switch to console) */
- /* FIXME The video playing (XV) is not working correctly after turn on new mode switch */
pVia->VideoEngine = VIDEO_ENGINE_CME;
break;
- case VIA_VM800:
- /* New mode switch resolve bug with gamma set #282 */
- /* and with Xv after hibernate #240 */
+ case VIA_P4M800PRO:
break;
case VIA_CX700:
pVia->VideoEngine = VIDEO_ENGINE_CME;
pVia->swov.maxWInterp = 1920;
pVia->swov.maxHInterp = 1080;
break;
- case VIA_K8M890:
+ case VIA_P4M890:
pVia->VideoEngine = VIDEO_ENGINE_CME;
- pVia->agpEnable = FALSE;
pVia->dmaXV = FALSE;
break;
- case VIA_P4M890:
+ case VIA_K8M890:
pVia->VideoEngine = VIDEO_ENGINE_CME;
+ pVia->agpEnable = FALSE;
pVia->dmaXV = FALSE;
break;
case VIA_P4M900:
pVia->VideoEngine = VIDEO_ENGINE_CME;
pVia->agpEnable = FALSE;
- pVia->useLegacyVBE = FALSE;
/* FIXME: this needs to be tested */
pVia->dmaXV = FALSE;
pBIOSInfo->TVDIPort = VIA_DI_PORT_DVP0;
@@ -806,8 +785,8 @@ via_xf86crtc_resize(ScrnInfoPtr scrn, in
{
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;
@@ -849,7 +828,6 @@ via_xf86crtc_resize(ScrnInfoPtr scrn, in
#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;
@@ -859,44 +837,38 @@ via_xf86crtc_resize(ScrnInfoPtr scrn, in
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) {
@@ -922,7 +894,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;
@@ -1032,7 +1004,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;
@@ -1110,7 +1084,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
*/
if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support32bppFb)) {
- free(pEnt);
VIAFreeRec(pScrn);
return FALSE;
} else {
@@ -1125,7 +1098,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;
}
@@ -1141,7 +1113,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
rgb zeros = { 0, 0, 0 };
if (!xf86SetWeight(pScrn, zeros, zeros)) {
- free(pEnt);
VIAFreeRec(pScrn);
return FALSE;
} else {
@@ -1158,7 +1129,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;
}
@@ -1184,36 +1154,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"Setting amount of VideoRAM to %d kB\n", pScrn->videoRam);
- if ((s = xf86GetOptValString(VIAOptions, OPTION_MODE_SWITCH_METHOD))) {
- if (!xf86NameCmp(s, "legacy")) {
- if (pVia->UseLegacyModeSwitch) {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Already using \"legacy\" as ModeSwitchMethod, "
- "did not force anything.\n");
- } else {
- pVia->UseLegacyModeSwitch = TRUE;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Forced ModeSwitchMethod to \"legacy\".\n");
- }
- }
- else if (!xf86NameCmp(s, "new")) {
- if (pVia->UseLegacyModeSwitch) {
- pVia->UseLegacyModeSwitch = FALSE;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Forced ModeSwitchMethod to \"new\".\n");
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Already using \"new\" as ModeSwitchMethod, "
- "did not force anything.\n");
- }
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid"
- "value for Option \"ModeSwitchMethod\".\n", s);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Valid options are \"legacy\" or \"new\".\n");
- }
- }
-
/* When rotating, switch shadow framebuffer on and acceleration off. */
if ((s = xf86GetOptValString(VIAOptions, OPTION_ROTATION_TYPE))) {
if (!xf86NameCmp(s, "SWRandR")) {
@@ -1382,19 +1322,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
"image transfer if DRI is enabled.\n",
(pVia->dmaXV) ? "" : "not ");
- //pVia->useVBEModes = FALSE;
- from = xf86GetOptValBool(VIAOptions, OPTION_VBEMODES, &pVia->useVBEModes)
- ? X_CONFIG : X_DEFAULT;
- xf86DrvMsg(pScrn->scrnIndex, from, "Will %senable VBE modes.\n",
- (pVia->useVBEModes) ? "" : "not ");
-
- //pVia->vbeSR = FALSE;
- from = xf86GetOptValBool(VIAOptions, OPTION_VBE_SAVERESTORE, &pVia->vbeSR)
- ? X_CONFIG : X_DEFAULT;
- xf86DrvMsg(pScrn->scrnIndex, from, "VBE VGA register save & restore "
- "will %sbe used\n\tif VBE modes are enabled.\n",
- (pVia->vbeSR) ? "" : "not ");
-
#ifdef HAVE_DEBUG
//pVia->disableXvBWCheck = FALSE;
from = xf86GetOptValBool(VIAOptions, OPTION_DISABLE_XV_BW_CHECK,
@@ -1427,19 +1354,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, from,
"Will try to allocate %d kB of AGP memory.\n", pVia->agpMem);
- /* ActiveDevice Option for device selection */
- //pVia->ActiveDevice = 0x00;
- if ((s = xf86GetOptValString(VIAOptions, OPTION_ACTIVEDEVICE))) {
- if (strstr(s, "CRT"))
- pVia->ActiveDevice |= VIA_DEVICE_CRT;
- if (strstr(s, "LCD"))
- pVia->ActiveDevice |= VIA_DEVICE_LCD;
- if (strstr(s, "DFP"))
- pVia->ActiveDevice |= VIA_DEVICE_DFP;
- if (strstr(s, "TV"))
- pVia->ActiveDevice |= VIA_DEVICE_TV;
- }
-
pBIOSInfo = pVia->pBIOSInfo;
pBIOSInfo->TVDotCrawl = FALSE;
from = xf86GetOptValBool(VIAOptions, OPTION_TVDOTCRAWL,
@@ -1555,7 +1469,15 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"...Finished parsing config file options.\n");
- ViaCheckCardId(pScrn);
+ /* Checking for OLPC XO-1.5. */
+ if ((pVia->Chipset == VIA_VX855) &&
+ (SUBVENDOR_ID(pVia->PciInfo) == 0x152D) &&
+ (SUBSYS_ID(pVia->PciInfo) == 0x0833)) {
+
+ pVia->IsOLPCXO15 = TRUE;
+ } else {
+ pVia->IsOLPCXO15 = FALSE;
+ }
/* I2CDevices Option for I2C Initialization */
if ((s = xf86GetOptValString(VIAOptions, OPTION_I2CDEVICES))) {
@@ -1568,8 +1490,9 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
pVia->I2CDevices |= VIA_I2C_BUS3;
}
- if (!xf86NameCmp(pVia->Id->String, "OLPC XO 1.5"))
+ if (pVia->IsOLPCXO15) {
pVia->I2CDevices &= ~VIA_I2C_BUS2;
+ }
/* CRTC handling */
xf86CrtcConfigInit(pScrn, &via_xf86crtc_config_funcs);
Index: xsrc/external/mit/xf86-video-openchrome/dist/src/via_lvds.c
diff -u xsrc/external/mit/xf86-video-openchrome/dist/src/via_lvds.c:1.2 xsrc/external/mit/xf86-video-openchrome/dist/src/via_lvds.c:1.3
--- xsrc/external/mit/xf86-video-openchrome/dist/src/via_lvds.c:1.2 Tue Jun 4 00:19:24 2013
+++ xsrc/external/mit/xf86-video-openchrome/dist/src/via_lvds.c Fri Aug 19 23:37:39 2016
@@ -1,5 +1,6 @@
/*
- * Copyright 2007 The Openchrome Project [openchrome.org]
+ * Copyright 2007-2015 The Openchrome Project
+ * [http://www.freedesktop.org/wiki/Openchrome]
* Copyright 1998-2007 VIA Technologies, Inc. All Rights Reserved.
* Copyright 2001-2007 S3 Graphics, Inc. All Rights Reserved.
*
@@ -40,17 +41,13 @@
*/
enum ViaPanelOpts {
OPTION_BUSWIDTH,
- OPTION_CENTER,
- OPTION_FORCEPANEL,
- OPTION_PANELSIZE
+ OPTION_CENTER
};
static OptionInfoRec ViaPanelOptions[] =
{
{OPTION_BUSWIDTH, "BusWidth", OPTV_ANYSTR, {0}, FALSE},
{OPTION_CENTER, "Center", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_FORCEPANEL, "ForcePanel", OPTV_BOOLEAN, {0}, FALSE}, /* last resort */
- {OPTION_PANELSIZE, "PanelSize", OPTV_ANYSTR, {0}, FALSE},
{-1, NULL, OPTV_NONE, {0}, FALSE}
};
@@ -380,38 +377,34 @@ via_lvds_dpms(xf86OutputPtr output, int
ScrnInfoPtr pScrn = output->scrn;
VIAPtr pVia = VIAPTR(pScrn);
- if (pVia->pVbe) {
- ViaVbePanelPower(pVia->pVbe, (mode == DPMSModeOn));
- } else {
- switch (mode) {
- case DPMSModeOn:
- switch (pVia->Chipset) {
- case VIA_P4M900:
- case VIA_CX700:
- case VIA_VX800:
- case VIA_VX855:
- case VIA_VX900:
- ViaLVDSPower(pScrn, TRUE);
- break;
- }
- ViaLCDPower(output, TRUE);
+ switch (mode) {
+ case DPMSModeOn:
+ switch (pVia->Chipset) {
+ case VIA_P4M900:
+ case VIA_CX700:
+ case VIA_VX800:
+ case VIA_VX855:
+ case VIA_VX900:
+ ViaLVDSPower(pScrn, TRUE);
break;
+ }
+ ViaLCDPower(output, TRUE);
+ break;
- case DPMSModeStandby:
- case DPMSModeSuspend:
- case DPMSModeOff:
- switch (pVia->Chipset) {
- case VIA_P4M900:
- case VIA_CX700:
- case VIA_VX800:
- case VIA_VX855:
- case VIA_VX900:
- ViaLVDSPower(pScrn, FALSE);
- break;
- }
- ViaLCDPower(output, FALSE);
+ case DPMSModeStandby:
+ case DPMSModeSuspend:
+ case DPMSModeOff:
+ switch (pVia->Chipset) {
+ case VIA_P4M900:
+ case VIA_CX700:
+ case VIA_VX800:
+ case VIA_VX855:
+ case VIA_VX900:
+ ViaLVDSPower(pScrn, FALSE);
break;
}
+ ViaLCDPower(output, FALSE);
+ break;
}
}
@@ -484,78 +477,55 @@ ViaPanelGetSizeFromDDCv1(xf86OutputPtr o
VIAPtr pVia = VIAPTR(pScrn);
xf86MonPtr pMon;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAGetPanelSizeFromDDCv1\n"));
-
- if (!(pVia->I2CDevices & VIA_I2C_BUS2))
- return FALSE;
-
- if (!xf86I2CProbeAddress(pVia->pI2CBus2, 0xA0))
- return FALSE;
-
- pMon = xf86DoEEDID(XF86_SCRN_ARG(pScrn), pVia->pI2CBus2, TRUE);
- if (!pMon)
- return FALSE;
-
- xf86OutputSetEDID(output, pMon);
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Entered VIAGetPanelSizeFromDDCv1.\n"));
- if (!ViaPanelGetSizeFromEDID(pScrn, pMon, width, height)) {
+ if (!pVia->pI2CBus2) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Unable to read PanelSize from EDID information\n");
+ "I2C Bus 2 does not exist.\n");
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting VIAGetPanelSizeFromDDCv1.\n"));
return FALSE;
}
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "VIAGetPanelSizeFromDDCv1: (%dx%d)\n", *width, *height));
- return TRUE;
-}
-
-/* Currently only used by Legacy Mode Setting */
-static Bool
-ViaPanelGetSizeFromDDCv2(ScrnInfoPtr pScrn, int *width)
-{
- VIAPtr pVia = VIAPTR(pScrn);
- CARD8 W_Buffer[1];
- CARD8 R_Buffer[4];
- I2CDevPtr dev;
-
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAGetPanelSizeFromDDCv2\n"));
-
- if (!xf86I2CProbeAddress(pVia->pI2CBus2, 0xA2))
+ 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;
+ }
- dev = xf86CreateI2CDevRec();
- if (!dev)
+ /* 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;
- dev->DevName = "EDID2";
- dev->SlaveAddr = 0xA2;
- dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */
- dev->StartTimeout = 550;
- dev->BitTimeout = 40;
- dev->ByteTimeout = 40;
- dev->AcknTimeout = 40;
- dev->pI2CBus = pVia->pI2CBus2;
-
- if (!xf86I2CDevInit(dev)) {
- xf86DestroyI2CDevRec(dev, TRUE);
- return FALSE;
}
- xf86I2CReadByte(dev, 0x00, R_Buffer);
- if (R_Buffer[0] != 0x20) {
- xf86DestroyI2CDevRec(dev, TRUE);
+ if (!ViaPanelGetSizeFromEDID(pScrn, pMon, width, height)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Unable to obtain panel size from EDID information.\n");
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting VIAGetPanelSizeFromDDCv1.\n"));
return FALSE;
}
- /* Found EDID2 Table */
- W_Buffer[0] = 0x76;
- xf86I2CWriteRead(dev, W_Buffer, 1, R_Buffer, 2);
- xf86DestroyI2CDevRec(dev, TRUE);
-
- *width = R_Buffer[0] | (R_Buffer[1] << 8);
-
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "VIAGetPanelSizeFromDDCv2: %d\n", *width));
+ "VIAGetPanelSizeFromDDCv1: (%d X %d)\n",
+ *width, *height));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting VIAGetPanelSizeFromDDCv1.\n"));
return TRUE;
}
@@ -629,180 +599,25 @@ ViaPanelGetNativeModeFromScratchPad(xf86
panel->NativeWidth, panel->NativeHeight);
}
-/* Used only for Legacy Mode Setting */
-static xf86OutputStatus
-VIAGetPanelSize(xf86OutputPtr output)
-{
- xf86OutputStatus status = XF86OutputStatusDisconnected;
- ViaPanelInfoPtr Panel = output->driver_private;
- ScrnInfoPtr pScrn = output->scrn;
- char *PanelSizeString[7] = { "640x480", "800x480", "800x600", "1024x768", "1280x768"
- "1280x1024", "1400x1050", "1600x1200" };
- int width = 0;
- int height = 0;
- Bool ret;
-
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAGetPanelSize (UseLegacyModeSwitch)\n"));
-
- ret = ViaPanelGetSizeFromDDCv1(output, &width, &height);
- if (!ret)
- ret = ViaPanelGetSizeFromDDCv2(pScrn, &width);
-
- if (ret) {
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EDID returned resolution %d x %d \n", width, height));
- switch (width) {
- case 640:
- Panel->NativeModeIndex = VIA_PANEL6X4;
- break;
- case 800:
- if (height == 480)
- Panel->NativeModeIndex = VIA_PANEL8X4;
- else
- Panel->NativeModeIndex = VIA_PANEL8X6;
- break;
- case 1024:
- Panel->NativeModeIndex = VIA_PANEL10X7;
- break;
- case 1280:
- Panel->NativeModeIndex = VIA_PANEL12X10;
- break;
- case 1400:
- Panel->NativeModeIndex = VIA_PANEL14X10;
- break;
- case 1600:
- Panel->NativeModeIndex = VIA_PANEL16X12;
- break;
- default:
- Panel->NativeModeIndex = VIA_PANEL_INVALID;
- break;
- }
- } else {
- ViaPanelGetNativeModeFromScratchPad(output);
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Unable to get information from EDID. Resolution from Scratchpad: %d \n", Panel->NativeModeIndex));
- if (Panel->NativeModeIndex == 0) {
- /* VIA_PANEL6X4 == 0, but that value equals unset */
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unable to "
- "retrieve PanelSize: using default (1024x768)\n");
- Panel->NativeModeIndex = VIA_PANEL10X7;
- }
- }
-
- if (Panel->NativeModeIndex < 7) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using panel at %s.\n",
- PanelSizeString[Panel->NativeModeIndex]);
- status = XF86OutputStatusConnected;
- } else
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unknown panel size "
- "detected: %d.\n", Panel->NativeModeIndex);
- return status;
-}
-
-/*
- * ViaResolutionTable[i].PanelIndex is pBIOSInfo->PanelSize
- * Panel->PanelIndex is the index to lcdTable.
- * Only used by Legacy Mode Setting.
- */
-static Bool
-ViaPanelGetIndex(xf86OutputPtr output, DisplayModePtr mode)
-{
- ScrnInfoPtr pScrn = output->scrn;
- ViaPanelInfoPtr Panel = output->driver_private;
- int i;
-
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelGetIndex\n"));
-
- Panel->PanelIndex = VIA_BIOS_NUM_PANEL;
-
- if (VIAGetPanelSize(output) == XF86OutputStatusDisconnected) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "ViaPanelGetIndex: Panel not detected.\n");
- return FALSE;
- }
-
- if (!ViaGetResolutionIndex(pScrn, Panel, mode)) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel does not support this"
- " resolution: %s\n", mode->name);
- return FALSE;
- }
-
- for (i = 0; ViaResolutionTable[i].Index != VIA_RES_INVALID; i++) {
- if (ViaResolutionTable[i].PanelIndex == Panel->NativeModeIndex) {
- Panel->NativeWidth = ViaResolutionTable[i].X;
- Panel->NativeHeight = ViaResolutionTable[i].Y;
- break;
- }
- }
-
- if (ViaResolutionTable[i].Index == VIA_RES_INVALID) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelGetIndex: Unable"
- " to find matching PanelSize in ViaResolutionTable.\n");
- return FALSE;
- }
-
- if ((Panel->NativeWidth != mode->CrtcHDisplay) ||
- (Panel->NativeHeight != mode->CrtcVDisplay)) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelGetIndex: Non-native"
- " resolutions are broken.\n");
- return FALSE;
- }
-
- for (i = 0; i < VIA_BIOS_NUM_PANEL; i++) {
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelGetIndex:"
- "Match Debug: %d == %d)\n", Panel->NativeModeIndex,
- lcdTable[i].fpSize));
- if (lcdTable[i].fpSize == Panel->NativeModeIndex) {
- int modeNum, tmp;
-
- modeNum = ViaGetVesaMode(pScrn, mode);
- if (modeNum == 0xFFFF) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaPanelGetIndex: "
- "Unable to determine matching VESA modenumber.\n");
- return FALSE;
- }
-
- tmp = 0x01 << (modeNum & 0xF);
- if ((CARD16) tmp & lcdTable[i].SuptMode[(modeNum >> 4)]) {
- Panel->PanelIndex = i;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelGetIndex:"
- "index: %d (%dx%d)\n", Panel->PanelIndex,
- Panel->NativeWidth, Panel->NativeHeight));
- return TRUE;
- }
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelGetIndex: Unable"
- " to match given mode with this PanelSize.\n");
- return FALSE;
- }
- }
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelGetIndex: Unable"
- " to match PanelSize with an lcdTable entry.\n");
- return FALSE;
-}
-
static int
via_lvds_mode_valid(xf86OutputPtr output, DisplayModePtr pMode)
{
ScrnInfoPtr pScrn = output->scrn;
VIAPtr pVia = VIAPTR(pScrn);
- if (pVia->UseLegacyModeSwitch) {
- if (!ViaPanelGetIndex(output, pMode))
- return MODE_BAD;
- } else {
- ViaPanelInfoPtr Panel = output->driver_private;
+ ViaPanelInfoPtr Panel = output->driver_private;
- if (Panel->NativeWidth < pMode->HDisplay ||
- Panel->NativeHeight < pMode->VDisplay)
- return MODE_PANEL;
-
- if (!Panel->Scale && Panel->NativeHeight != pMode->VDisplay &&
- Panel->NativeWidth != pMode->HDisplay)
- return MODE_PANEL;
+ if (Panel->NativeWidth < pMode->HDisplay ||
+ Panel->NativeHeight < pMode->VDisplay)
+ return MODE_PANEL;
+
+ if (!Panel->Scale && Panel->NativeHeight != pMode->VDisplay &&
+ Panel->NativeWidth != pMode->HDisplay)
+ return MODE_PANEL;
+
+ if (!ViaModeDotClockTranslate(pScrn, pMode))
+ return MODE_NOCLOCK;
- if (!ViaModeDotClockTranslate(pScrn, pMode))
- return MODE_NOCLOCK;
- }
return MODE_OK;
}
@@ -878,236 +693,6 @@ via_lvds_commit(xf86OutputPtr output)
via_lvds_dpms(output, DPMSModeOn);
}
-/*
- * Broken, only does native mode decently. I (Luc) personally broke this.
- * Only for LegacyModeSetting.
- */
-static void
-VIASetLCDMode(xf86OutputPtr output, DisplayModePtr mode)
-{
- ViaPanelInfoPtr Panel = output->driver_private;
- ScrnInfoPtr pScrn = output->scrn;
- vgaHWPtr hwp = VGAHWPTR(pScrn);
- VIAPtr pVia = VIAPTR(pScrn);
- VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
- VIALCDModeTableRec Table = lcdTable[Panel->PanelIndex];
- int resIdx, port, offset, data, misc, i, j;
- CARD8 modeNum = 0;
-
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIASetLCDMode\n"));
-
- if (Panel->NativeModeIndex == VIA_PANEL12X10)
- hwp->writeCrtc(hwp, 0x89, 0x07);
-
- /* LCD Expand Mode Y Scale Flag */
- Panel->scaleY = FALSE;
-
- /* Set LCD InitTb Regs */
- if (Panel->BusWidth == VIA_DI_12BIT) {
- if (pVia->IsSecondary)
- pBIOSInfo->Clock = Table.InitTb.LCDClk_12Bit;
- else {
- pBIOSInfo->Clock = Table.InitTb.VClk_12Bit;
- /* for some reason still to be defined this is necessary */
- ViaSetSecondaryDotclock(pScrn, Table.InitTb.LCDClk_12Bit);
- }
- } else {
- if (pVia->IsSecondary)
- pBIOSInfo->Clock = Table.InitTb.LCDClk;
- else {
- pBIOSInfo->Clock = Table.InitTb.VClk;
- ViaSetSecondaryDotclock(pScrn, Table.InitTb.LCDClk);
- }
-
- }
-
- ViaSetUseExternalClock(hwp);
-
- for (i = 0; i < Table.InitTb.numEntry; i++) {
- port = Table.InitTb.port[i];
- offset = Table.InitTb.offset[i];
- data = Table.InitTb.data[i];
- ViaVgahwWrite(hwp, 0x300 + port, offset, 0x301 + port, data);
- }
-
- if ((mode->CrtcHDisplay != Panel->NativeWidth) ||
- (mode->CrtcVDisplay != Panel->NativeHeight)) {
- VIALCDModeEntryPtr Main;
- VIALCDMPatchEntryPtr Patch1, Patch2;
- int numPatch1, numPatch2;
-
- resIdx = VIA_RES_INVALID;
-
- /* Find MxxxCtr & MxxxExp Index and
- * HWCursor Y Scale (PanelSize Y / Res. Y) */
- Panel->resY = mode->CrtcVDisplay;
- switch (Panel->ResolutionIndex) {
- case VIA_RES_640X480:
- resIdx = 0;
- break;
- case VIA_RES_800X600:
- resIdx = 1;
- break;
- case VIA_RES_1024X768:
- resIdx = 2;
- break;
- case VIA_RES_1152X864:
- resIdx = 3;
- break;
- case VIA_RES_1280X768:
- case VIA_RES_1280X960:
- case VIA_RES_1280X1024:
- if (Panel->NativeModeIndex == VIA_PANEL12X10)
- resIdx = VIA_RES_INVALID;
- else
- resIdx = 4;
- break;
- default:
- resIdx = VIA_RES_INVALID;
- break;
- }
-
- if ((mode->CrtcHDisplay == 640) && (mode->CrtcVDisplay == 400))
- resIdx = 0;
-
- if (resIdx == VIA_RES_INVALID) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "VIASetLCDMode: Failed "
- "to find a suitable Panel Size index.\n");
- return;
- }
-
- if (Panel->Center) {
- Main = &(Table.MCtr[resIdx]);
- Patch1 = Table.MPatchDP1Ctr;
- numPatch1 = Table.numMPatchDP1Ctr;
- Patch2 = Table.MPatchDP2Ctr;
- numPatch2 = Table.numMPatchDP2Ctr;
- } else { /* expand! */
- /* LCD Expand Mode Y Scale Flag */
- Panel->scaleY = TRUE;
- Main = &(Table.MExp[resIdx]);
- Patch1 = Table.MPatchDP1Exp;
- numPatch1 = Table.numMPatchDP1Exp;
- Patch2 = Table.MPatchDP2Exp;
- numPatch2 = Table.numMPatchDP2Exp;
- }
-
- /* Set Main LCD Registers */
- for (i = 0; i < Main->numEntry; i++) {
- ViaVgahwWrite(hwp, 0x300 + Main->port[i], Main->offset[i],
- 0x301 + Main->port[i], Main->data[i]);
- }
-
- if (Panel->BusWidth == VIA_DI_12BIT) {
- if (pVia->IsSecondary)
- pBIOSInfo->Clock = Main->LCDClk_12Bit;
- else
- pBIOSInfo->Clock = Main->VClk_12Bit;
- } else {
- if (pVia->IsSecondary)
- pBIOSInfo->Clock = Main->LCDClk;
- else
- pBIOSInfo->Clock = Main->VClk;
- }
-
- j = ViaGetVesaMode(pScrn, mode);
- if (j == 0xFFFF) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "VIASetLCDMode: "
- "Unable to determine matching VESA modenumber.\n");
- return;
- }
- for (i = 0; i < modeFix.numEntry; i++) {
- if (modeFix.reqMode[i] == j) {
- modeNum = modeFix.fixMode[i];
- break;
- }
- }
-
- /* Set LCD Mode patch registers. */
- for (i = 0; i < numPatch2; i++, Patch2++) {
- if (Patch2->Mode == modeNum) {
- if (!Panel->Center && (mode->CrtcHDisplay == Panel->NativeWidth))
- Panel->scaleY = FALSE;
-
- for (j = 0; j < Patch2->numEntry; j++) {
- ViaVgahwWrite(hwp, 0x300 + Patch2->port[j],
- Patch2->offset[j], 0x301 + Patch2->port[j],
- Patch2->data[j]);
- }
-
- if (Panel->BusWidth == VIA_DI_12BIT) {
- if (pVia->IsSecondary)
- pBIOSInfo->Clock = Patch2->LCDClk_12Bit;
- else
- pBIOSInfo->Clock = Patch2->VClk_12Bit;
- } else {
- if (pVia->IsSecondary)
- pBIOSInfo->Clock = Patch2->LCDClk;
- else
- pBIOSInfo->Clock = Patch2->VClk;
- }
- break;
- }
- }
-
- /* Set LCD Secondary Mode Patch registers. */
- if (pVia->IsSecondary) {
- for (i = 0; i < numPatch1; i++, Patch1++) {
- if (Patch1->Mode == modeNum) {
- for (j = 0; j < Patch1->numEntry; j++) {
- ViaVgahwWrite(hwp, 0x300 + Patch1->port[j],
- Patch1->offset[j],
- 0x301 + Patch1->port[j], Patch1->data[j]);
- }
- break;
- }
- }
- }
- }
-
- /* LCD patch 3D5.02 */
- misc = hwp->readCrtc(hwp, 0x01);
- hwp->writeCrtc(hwp, 0x02, misc);
-
- /* Enable LCD */
- if (!pVia->IsSecondary) {
- /* CRT Display Source Bit 6 - 0: CRT, 1: LCD */
- ViaSeqMask(hwp, 0x16, 0x40, 0x40);
-
- /* Enable Simultaneous */
- if (Panel->BusWidth == VIA_DI_12BIT) {
- hwp->writeCrtc(hwp, 0x6B, 0xA8);
-
- if ((pVia->Chipset == VIA_CLE266)
- && CLE266_REV_IS_AX(pVia->ChipRev))
- hwp->writeCrtc(hwp, 0x93, 0xB1);
- else
- hwp->writeCrtc(hwp, 0x93, 0xAF);
- } else {
- ViaCrtcMask(hwp, 0x6B, 0x08, 0x08);
- hwp->writeCrtc(hwp, 0x93, 0x00);
- }
- hwp->writeCrtc(hwp, 0x6A, 0x48);
- } else {
- /* CRT Display Source Bit 6 - 0: CRT, 1: LCD */
- ViaSeqMask(hwp, 0x16, 0x00, 0x40);
-
- /* Enable SAMM */
- if (Panel->BusWidth == VIA_DI_12BIT) {
- ViaCrtcMask(hwp, 0x6B, 0x20, 0x20);
- if ((pVia->Chipset == VIA_CLE266)
- && CLE266_REV_IS_AX(pVia->ChipRev))
- hwp->writeCrtc(hwp, 0x93, 0xB1);
- else
- hwp->writeCrtc(hwp, 0x93, 0xAF);
- } else {
- hwp->writeCrtc(hwp, 0x6B, 0x00);
- hwp->writeCrtc(hwp, 0x93, 0x00);
- }
- hwp->writeCrtc(hwp, 0x6A, 0xC8);
- }
-}
-
static void
ViaPanelScale(ScrnInfoPtr pScrn, int resWidth, int resHeight,
int panelWidth, int panelHeight)
@@ -1218,60 +803,12 @@ via_lvds_mode_set(xf86OutputPtr output,
ScrnInfoPtr pScrn = output->scrn;
VIAPtr pVia = VIAPTR(pScrn);
- /*
- * FIXME: pVia->IsSecondary is not working here. We should be able
- * to detect when the display is using the secondary head.
- * TODO: This should be enabled for other chipsets as well.
- */
- if (pVia->pVbe) {
- if (!pVia->useLegacyVBE) {
- /*
- * FIXME: Should we always set the panel expansion?
- * Does it depend on the resolution?
- */
- if (!ViaVbeSetPanelMode(pScrn, !Panel->Center)) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Unable to set the panel mode.\n");
- }
- }
-
- switch (pVia->Chipset) {
- case VIA_P4M900:
- case VIA_VX800:
- case VIA_VX855:
- case VIA_VX900:
- /*
- * Since we are using virtual, we need to adjust
- * the offset to match the framebuffer alignment.
- */
- if (pScrn->displayWidth != adjusted_mode->CrtcHDisplay)
- ViaSecondCRTCHorizontalOffset(pScrn);
- break;
- }
+ if (Panel->Scale) {
+ ViaPanelScale(pScrn, mode->HDisplay, mode->VDisplay,
+ Panel->NativeWidth,
+ Panel->NativeHeight);
} else {
- if (!pVia->UseLegacyModeSwitch) {
- if (Panel->Scale) {
- ViaPanelScale(pScrn, mode->HDisplay, mode->VDisplay,
- Panel->NativeWidth,
- Panel->NativeHeight);
- } else
- ViaPanelScaleDisable(pScrn);
- } else {
- xf86CrtcPtr crtc = output->crtc;
- drmmode_crtc_private_ptr iga = crtc->driver_private;
-
- if (iga->index) {
- /* IGA 2 */
- if (Panel->PanelIndex != VIA_BIOS_NUM_PANEL) {
- Panel->SetDVI = TRUE;
- VIASetLCDMode(output, mode);
- }
- } else {
- /* IGA 1 */
- if (ViaPanelGetIndex(output, adjusted_mode))
- VIASetLCDMode(output, adjusted_mode);
- }
- }
+ ViaPanelScaleDisable(pScrn);
}
}
@@ -1295,100 +832,94 @@ ViaPanelLookUpModeIndex(int width, int h
static xf86OutputStatus
via_lvds_detect(xf86OutputPtr output)
{
- static const char xoId[] = "OLPC XO 1.5";
xf86OutputStatus status = XF86OutputStatusDisconnected;
ViaPanelInfoPtr panel = output->driver_private;
ScrnInfoPtr pScrn = output->scrn;
VIAPtr pVia = VIAPTR(pScrn);
vgaHWPtr hwp = VGAHWPTR(pScrn);
+ CARD8 cr3b = 0x00;
+ CARD8 cr3b_mask = 0x00;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Entered via_lvds_detect.\n"));
/* Hardcode panel size for the XO */
- if(strcmp(pVia->Id->String, xoId) == 0) {
+ if (pVia->IsOLPCXO15) {
panel->NativeWidth = 1200;
panel->NativeHeight = 900;
status = XF86OutputStatusConnected;
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Setting up OLPC XO-1.5 flat panel.\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Detected Flat Panel Screen Resolution: "
+ "%dx%d\n",
+ panel->NativeWidth, panel->NativeHeight));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting via_lvds_detect.\n"));
return status;
}
- if (!pVia->UseLegacyModeSwitch) {
- /* First try to get the mode from EDID. */
- if (!panel->NativeWidth || !panel->NativeHeight) {
- int width, height;
- Bool ret;
-
- ret = ViaPanelGetSizeFromDDCv1(output, &width, &height);
- if (ret) {
- panel->NativeModeIndex = ViaPanelLookUpModeIndex(width, height);
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelLookUpModeIndex, Width %d, Height %d, NativeModeIndex%d\n", width, height, panel->NativeModeIndex));
- if (panel->NativeModeIndex != VIA_PANEL_INVALID) {
- panel->NativeWidth = width;
- panel->NativeHeight = height;
- status = XF86OutputStatusConnected;
- }
+ if (!panel->NativeWidth || !panel->NativeHeight) {
+ int width, height;
+ Bool ret;
+
+ ret = ViaPanelGetSizeFromDDCv1(output, &width, &height);
+ if (ret) {
+ panel->NativeModeIndex = ViaPanelLookUpModeIndex(width, height);
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "ViaPanelLookUpModeIndex: Width %d, "
+ "Height %d, NativeModeIndex%d\n",
+ width, height, panel->NativeModeIndex));
+ if (panel->NativeModeIndex != VIA_PANEL_INVALID) {
+ panel->NativeWidth = width;
+ panel->NativeHeight = height;
+ status = XF86OutputStatusConnected;
+ }
+ } else {
+ /* Apparently this is the way VIA Technologies passes */
+ /* the presence of a flat panel to the device driver */
+ /* via BIOS setup. */
+ if (pVia->Chipset == VIA_CLE266) {
+ cr3b_mask = 0x08;
} else {
- CARD8 CR6A = hwp->readCrtc(hwp, 0x6A);
- CARD8 CR6B = hwp->readCrtc(hwp, 0x6B);
- CARD8 CR97 = hwp->readCrtc(hwp, 0x97);
- CARD8 CR99 = hwp->readCrtc(hwp, 0x99);
-
- /* First test CRTC2 is out of reset and if its enabled or
- * simultaneous mode is enabled. Also avoid the secondary
- * DFP source */
- if ((((CR6A & 0xC0) == 0xC0) || (((CR6A & 0xC0) == 0x40) &&
- (CR6B & 0x08))) && (CR97 & 0x10) && (CR99 & 0x10)) {
- /* Use Vertical addreess register of IGA 2 */
- panel->NativeWidth = (hwp->readCrtc(hwp, 0x51) |
- ((hwp->readCrtc(hwp, 0x55) & 0x70) << 4)) + 1;
- panel->NativeHeight = (hwp->readCrtc(hwp, 0x59) |
- ((hwp->readCrtc(hwp, 0x5D) & 0x38) << 5)) + 1;
- panel->NativeModeIndex = VIA_PANEL6X4;
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel Mode probed %dx%d from IGA 2\n",
- panel->NativeWidth, panel->NativeHeight);
-
- status = XF86OutputStatusConnected;
- } else if (!(CR97 & 0x10) && !(CR99 & 0x10)) {
- CARD8 val;
-
- /* IGA1 Horizontal Overscan register */
- panel->NativeWidth = (hwp->readCrtc(hwp, 0x01) + 1) * 8;
- /* IGA1 default Vertical Overscan register is
- * incorrect on some devices so use VBlank start */
- panel->NativeHeight = (hwp->readCrtc(hwp, 0x15) + 1);
- val = hwp->readCrtc(hwp, 0x07);
- panel->NativeHeight |= ((val >> 3) & 0x1) << 8;
- panel->NativeHeight |= ((val >> 5) & 0x1) << 9;
- val = hwp->readCrtc(hwp, 0x35);
- panel->NativeHeight |= ((val >> 3) & 0x1) << 10;
- panel->NativeModeIndex = VIA_PANEL6X4;
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel Mode probed %dx%d from IGA 1\n",
- panel->NativeWidth,
- panel->NativeHeight);
- status = XF86OutputStatusConnected;
- }
+ cr3b_mask = 0x02;
+ }
+
+ cr3b = hwp->readCrtc(hwp, 0x3B) & cr3b_mask;
- if (!panel->NativeWidth || !panel->NativeHeight)
- ViaPanelGetNativeModeFromScratchPad(output);
+ if (cr3b) {
+ ViaPanelGetNativeModeFromScratchPad(output);
- if (panel->NativeWidth && panel->NativeHeight)
+ if (panel->NativeWidth && panel->NativeHeight) {
status = XF86OutputStatusConnected;
+ }
}
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NativeMode: %d %d\n",
- panel->NativeWidth, panel->NativeHeight));
- } else
- status = XF86OutputStatusConnected;
- } else
- status = VIAGetPanelSize(output);
+ }
+
+ if (status == XF86OutputStatusConnected) {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Detected Flat Panel Screen Resolution: "
+ "%dx%d\n",
+ panel->NativeWidth, panel->NativeHeight));
+ }
+ } else {
+ status = XF86OutputStatusConnected;
+ }
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting via_lvds_detect.\n"));
return status;
}
static DisplayModePtr
via_lvds_get_modes(xf86OutputPtr output)
{
- ViaPanelInfoPtr Panel = output->driver_private;
+ ViaPanelInfoPtr pPanel = output->driver_private;
ScrnInfoPtr pScrn = output->scrn;
- DisplayModePtr p = NULL;
+ DisplayModePtr pDisplay_Mode = NULL;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Entered via_lvds_get_modes.\n"));
if (output->status == XF86OutputStatusConnected) {
if (!output->MonInfo) {
@@ -1396,44 +927,49 @@ via_lvds_get_modes(xf86OutputPtr output)
* Generates a display mode for the native panel resolution,
* using CVT.
*/
- if (Panel->NativeWidth && Panel->NativeHeight) {
+ if (pPanel->NativeWidth && pPanel->NativeHeight) {
VIAPtr pVia = VIAPTR(pScrn);
- if (!xf86NameCmp(pVia->Id->String, "OLPC XO 1.5"))
- p = xf86DuplicateMode(&OLPCMode);
- else
- p = xf86CVTMode(Panel->NativeWidth, Panel->NativeHeight,
+ if (pVia->IsOLPCXO15) {
+ pDisplay_Mode = xf86DuplicateMode(&OLPCMode);
+ } else {
+ pDisplay_Mode = xf86CVTMode(pPanel->NativeWidth, pPanel->NativeHeight,
60.0f, FALSE, FALSE);
- if (p) {
- p->CrtcHDisplay = p->HDisplay;
- p->CrtcHSyncStart = p->HSyncStart;
- p->CrtcHSyncEnd = p->HSyncEnd;
- p->CrtcHTotal = p->HTotal;
- p->CrtcHSkew = p->HSkew;
- p->CrtcVDisplay = p->VDisplay;
- p->CrtcVSyncStart = p->VSyncStart;
- p->CrtcVSyncEnd = p->VSyncEnd;
- p->CrtcVTotal = p->VTotal;
-
- p->CrtcVBlankStart = min(p->CrtcVSyncStart, p->CrtcVDisplay);
- p->CrtcVBlankEnd = max(p->CrtcVSyncEnd, p->CrtcVTotal);
- p->CrtcHBlankStart = min(p->CrtcHSyncStart, p->CrtcHDisplay);
- p->CrtcHBlankEnd = max(p->CrtcHSyncEnd, p->CrtcHTotal);
- p->type = M_T_DRIVER | M_T_PREFERRED;
+ }
+
+ if (pDisplay_Mode) {
+ pDisplay_Mode->CrtcHDisplay = pDisplay_Mode->HDisplay;
+ pDisplay_Mode->CrtcHSyncStart = pDisplay_Mode->HSyncStart;
+ pDisplay_Mode->CrtcHSyncEnd = pDisplay_Mode->HSyncEnd;
+ pDisplay_Mode->CrtcHTotal = pDisplay_Mode->HTotal;
+ pDisplay_Mode->CrtcHSkew = pDisplay_Mode->HSkew;
+ pDisplay_Mode->CrtcVDisplay = pDisplay_Mode->VDisplay;
+ pDisplay_Mode->CrtcVSyncStart = pDisplay_Mode->VSyncStart;
+ pDisplay_Mode->CrtcVSyncEnd = pDisplay_Mode->VSyncEnd;
+ pDisplay_Mode->CrtcVTotal = pDisplay_Mode->VTotal;
+
+ pDisplay_Mode->CrtcVBlankStart = min(pDisplay_Mode->CrtcVSyncStart, pDisplay_Mode->CrtcVDisplay);
+ pDisplay_Mode->CrtcVBlankEnd = max(pDisplay_Mode->CrtcVSyncEnd, pDisplay_Mode->CrtcVTotal);
+ pDisplay_Mode->CrtcHBlankStart = min(pDisplay_Mode->CrtcHSyncStart, pDisplay_Mode->CrtcHDisplay);
+ pDisplay_Mode->CrtcHBlankEnd = max(pDisplay_Mode->CrtcHSyncEnd, pDisplay_Mode->CrtcHTotal);
+ pDisplay_Mode->type = M_T_DRIVER | M_T_PREFERRED;
} else {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Out of memory. Size: %zu bytes\n", sizeof(DisplayModeRec));
}
} else {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Invalid panel dimension (%dx%d)\n",
- Panel->NativeWidth, Panel->NativeHeight);
+ "Invalid Flat Panel Screen Resolution: "
+ "%dx%d\n",
+ pPanel->NativeWidth, pPanel->NativeHeight);
}
} else {
- p = xf86OutputGetEDIDModes(output);
+ pDisplay_Mode = xf86OutputGetEDIDModes(output);
}
}
- return p;
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting via_lvds_get_modes.\n"));
+ return pDisplay_Mode;
}
static void
@@ -1448,6 +984,8 @@ static const xf86OutputFuncsRec via_lvds
.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,
@@ -1463,33 +1001,6 @@ static const xf86OutputFuncsRec via_lvds
.destroy = via_lvds_destroy,
};
-/*
- * Sets the panel dimensions from the configuration
- * using name with format "9999x9999".
- */
-static void
-ViaPanelGetNativeModeFromOption(ScrnInfoPtr pScrn, ViaPanelInfoPtr panel, char *name)
-{
- char aux[256];
- CARD8 length, index;
-
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "ViaPanelGetNativeModeFromOption\n"));
-
- panel->NativeModeIndex = VIA_PANEL_INVALID;
- length = sizeof(ViaPanelNativeModes) / sizeof(ViaPanelModeRec);
-
- for (index = 0; index < length; index++) {
- snprintf(aux, sizeof(aux), "%dx%d", ViaPanelNativeModes[index].Width,
- ViaPanelNativeModes[index].Height);
- if (!xf86NameCmp(name, aux)) {
- panel->NativeModeIndex = index;
- panel->NativeWidth = ViaPanelNativeModes[index].Width;
- panel->NativeHeight = ViaPanelNativeModes[index].Height;
- break;
- }
- }
-}
void
via_lvds_init(ScrnInfoPtr pScrn)
@@ -1497,14 +1008,31 @@ via_lvds_init(ScrnInfoPtr pScrn)
ViaPanelInfoPtr Panel = (ViaPanelInfoPtr) xnfcalloc(sizeof(ViaPanelInfoRec), 1);
OptionInfoPtr Options = xnfalloc(sizeof(ViaPanelOptions));
MessageType from = X_DEFAULT;
+ const char *s = NULL;
VIAPtr pVia = VIAPTR(pScrn);
xf86OutputPtr output = NULL;
- Bool ForcePanel = FALSE;
- char *s = NULL;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ CARD8 cr3b = 0x00;
+ CARD8 cr3b_mask = 0x00;
if (!Panel)
return;
+ /* Apparently this is the way VIA Technologies passes */
+ /* the presence of a flat panel to the device driver */
+ /* via BIOS setup. */
+ if (pVia->Chipset == VIA_CLE266) {
+ cr3b_mask = 0x08;
+ } else {
+ cr3b_mask = 0x02;
+ }
+
+ cr3b = hwp->readCrtc(hwp, 0x3B) & cr3b_mask;
+
+ if (!cr3b) {
+ return;
+ }
+
memcpy(Options, ViaPanelOptions, sizeof(ViaPanelOptions));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, Options);
@@ -1529,39 +1057,7 @@ via_lvds_init(ScrnInfoPtr pScrn)
xf86DrvMsg(pScrn->scrnIndex, from, "LVDS-0 : DVI Center is %s.\n",
Panel->Center ? "enabled" : "disabled");
- /* Force the use of the Panel? */
- from = xf86GetOptValBool(Options, OPTION_FORCEPANEL,
- &ForcePanel)
- ? X_CONFIG : X_DEFAULT;
- xf86DrvMsg(pScrn->scrnIndex, from, "LVDS Panel will %sbe forced.\n",
- ForcePanel ? "" : "not ");
-
- /* Panel Size Option */
- if ((s = xf86GetOptValString(Options, OPTION_PANELSIZE))) {
- ViaPanelGetNativeModeFromOption(pScrn, Panel, s);
- if (Panel->NativeModeIndex != VIA_PANEL_INVALID) {
- DEBUG(xf86DrvMsg
- (pScrn->scrnIndex, X_CONFIG, "LVDS Panel mode index is %d\n",
- Panel->NativeModeIndex));
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Selected Panel Size is %dx%d\n", Panel->NativeWidth,
- Panel->NativeHeight);
- } else
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "%s is not a valid panel size.\n", s);
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT,
- "Panel size is not selected from config file.\n");
- }
-
- if (ForcePanel) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Enabling panel from config.\n");
- output = xf86OutputCreate(pScrn, &via_lvds_funcs, "LVDS-1");
- } else if (pVia->Id && (pVia->Id->Outputs & VIA_DEVICE_LCD)) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Enabling panel from PCI-subsystem ID information.\n");
- output = xf86OutputCreate(pScrn, &via_lvds_funcs, "LVDS-1");
- }
+ output = xf86OutputCreate(pScrn, &via_lvds_funcs, "LVDS-1");
if (output) {
output->driver_private = Panel;
@@ -1574,7 +1070,7 @@ via_lvds_init(ScrnInfoPtr pScrn)
output->interlaceAllowed = FALSE;
output->doubleScanAllowed = FALSE;
- if (!xf86NameCmp(pVia->Id->String, "OLPC XO 1.5")) {
+ if (pVia->IsOLPCXO15) {
output->mm_height = 152;
output->mm_width = 114;
}
Index: xsrc/external/mit/xf86-video-openchrome/dist/src/via_dri.c
diff -u xsrc/external/mit/xf86-video-openchrome/dist/src/via_dri.c:1.3 xsrc/external/mit/xf86-video-openchrome/dist/src/via_dri.c:1.4
--- xsrc/external/mit/xf86-video-openchrome/dist/src/via_dri.c:1.3 Sat Jun 1 21:11:27 2013
+++ xsrc/external/mit/xf86-video-openchrome/dist/src/via_dri.c Fri Aug 19 23:37:39 2016
@@ -1,5 +1,6 @@
/*
- * Copyright 2005-2008 The Openchrome Project [openchrome.org]
+ * Copyright 2005-2015 The Openchrome Project
+ * [http://www.freedesktop.org/wiki/Openchrome]
* Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
* Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
*
@@ -478,6 +479,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;
}
}
@@ -926,7 +935,7 @@ viaDRIOffscreenSave(ScrnInfoPtr pScrn)
if (pVia->driOffScreenSave) {
void *dst, *src = drm_bo_map(pScrn, pVia->driOffScreenMem);
- dst = pVia->driOffScreenSave;
+ dst = (void *) ALIGN_TO((unsigned long) pVia->driOffScreenSave, 16);
if ((pVia->drmVerMajor == 2) && (pVia->drmVerMinor >= 8)) {
err = viaDRIFBMemcpy(pVia->drmmode.fd, pVia->driOffScreenMem, dst, FALSE);
if (!err)
Index: xsrc/external/mit/xf86-video-openchrome/dist/src/via_driver.h
diff -u xsrc/external/mit/xf86-video-openchrome/dist/src/via_driver.h:1.5 xsrc/external/mit/xf86-video-openchrome/dist/src/via_driver.h:1.6
--- xsrc/external/mit/xf86-video-openchrome/dist/src/via_driver.h:1.5 Tue Jun 4 16:59:25 2013
+++ xsrc/external/mit/xf86-video-openchrome/dist/src/via_driver.h Fri Aug 19 23:37:39 2016
@@ -54,7 +54,6 @@
#include "xf86Crtc.h"
#include "xf86RandR12.h"
#include "xf86cmap.h"
-#include "vbe.h"
#ifdef HAVE_DRI
#define _XF86DRI_SERVER_
@@ -86,6 +85,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)
@@ -212,15 +213,6 @@ typedef struct _twodContext {
int clipY2;
} ViaTwodContext;
-typedef struct{
- /* textMode */
- CARD8 *state, *pstate; /* SVGA state */
- int statePage, stateSize, stateMode;
-
- /* vbe version */
- int major, minor;
-} ViaVbeModeInfo;
-
typedef struct _VIA {
VIARegRec SavedReg;
int Bpp, Bpl;
@@ -253,7 +245,6 @@ typedef struct _VIA {
Bool NoAccel;
Bool shadowFB;
Rotation rotate;
- Bool vbeSR;
int agpMem;
CreateScreenResourcesProcPtr CreateScreenResources;
@@ -269,12 +260,6 @@ typedef struct _VIA {
int ChipRev;
int EntityIndex;
- /* vbe */
- vbeInfoPtr pVbe;
- ViaVbeModeInfo vbeMode;
- Bool useVBEModes;
- Bool useLegacyVBE;
-
/* Support for shadowFB and rotation */
unsigned char* ShadowPtr;
@@ -317,7 +302,9 @@ typedef struct _VIA {
/* BIOS Info Ptr */
VIABIOSInfoPtr pBIOSInfo;
- struct ViaCardIdStruct* Id;
+
+ /* OLPC XO-1.5 */
+ Bool IsOLPCXO15;
/* I2C & DDC */
I2CBusPtr pI2CBus1;
@@ -356,8 +343,6 @@ typedef struct _VIA {
Bool dma2d;
Bool dmaXV;
- CARD8 ActiveDevice; /* Option */
-
/* Video */
int VideoEngine;
swovRec swov;
@@ -387,7 +372,6 @@ typedef struct _VIA {
Bool I2CScan;
#endif /* HAVE_DEBUG */
- Bool UseLegacyModeSwitch;
video_via_regs* VideoRegs;
} VIARec, *VIAPtr;
@@ -520,6 +504,10 @@ 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 ViaDisplayEnableSimultaneous(ScrnInfoPtr pScrn);
Index: xsrc/external/mit/xf86-video-openchrome/include/config.h
diff -u xsrc/external/mit/xf86-video-openchrome/include/config.h:1.2 xsrc/external/mit/xf86-video-openchrome/include/config.h:1.3
--- xsrc/external/mit/xf86-video-openchrome/include/config.h:1.2 Sat Jun 1 21:21:25 2013
+++ xsrc/external/mit/xf86-video-openchrome/include/config.h Fri Aug 19 23:37:39 2016
@@ -63,8 +63,7 @@
/* xextproto 7.1 available */
#define HAVE_XEXTPROTO_71 1
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
- */
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"
/* Name of package */
@@ -77,7 +76,7 @@
#define PACKAGE_NAME "xf86-video-openchrome"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "xf86-video-openchrome 0.3.3"
+#define PACKAGE_STRING "xf86-video-openchrome 0.4.0"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "xf86-video-openchrome"
@@ -86,7 +85,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
-#define PACKAGE_VERSION "0.3.3"
+#define PACKAGE_VERSION "0.4.0"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
@@ -95,16 +94,16 @@
/* #undef TOOLS */
/* Version number of package */
-#define VERSION "0.3.3"
+#define VERSION "0.4.0"
/* Major version */
#define VIA_MAJOR_VERSION 0
/* Minor version */
-#define VIA_MINOR_VERSION 3
+#define VIA_MINOR_VERSION 4
/* Patch version */
-#define VIA_PATCHLEVEL 3
+#define VIA_PATCHLEVEL 0
/* Enable DRI driver support */
#define XF86DRI 1
Index: xsrc/external/mit/xf86-video-rendition/dist/src/rendition.c
diff -u xsrc/external/mit/xf86-video-rendition/dist/src/rendition.c:1.2 xsrc/external/mit/xf86-video-rendition/dist/src/rendition.c:1.3
--- xsrc/external/mit/xf86-video-rendition/dist/src/rendition.c:1.2 Tue Aug 16 01:27:47 2016
+++ xsrc/external/mit/xf86-video-rendition/dist/src/rendition.c Fri Aug 19 23:37:39 2016
@@ -1371,6 +1371,18 @@ renditionMapMem(ScrnInfoPtr pScreenInfo)
/* Override on users request */
WriteCombine
= xf86ReturnOptValBool(pRendition->Options, OPTION_FBWC, WriteCombine);
+#ifdef XSERVER_LIBPCIACCESS
+ mapOption = PCI_DEV_MAP_FLAG_WRITABLE;
+ if (WriteCombine)
+ mapOption |= PCI_DEV_MAP_FLAG_WRITE_COMBINE;
+
+ err = pci_device_map_range(pRendition->PciInfo,
+ pRendition->PciInfo->regions[0].base_addr,
+ pRendition->PciInfo->regions[0].size,
+ mapOption, (void *)&pRendition->board.vmem_base);
+
+ return (err == 0);
+#else
if (WriteCombine) {
xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG,
("Requesting Write-Combined memory access\n"));
@@ -1381,12 +1393,6 @@ renditionMapMem(ScrnInfoPtr pScreenInfo)
mapOption = VIDMEM_MMIO;
}
-#ifdef XSERVER_LIBPCIACCESS
- err = pci_device_map_region(pRendition->PciInfo, 0, TRUE);
- pRendition->board.vmem_base = pRendition->PciInfo->regions[0].memory;
-
- return (err == 0);
-#else
pRendition->board.vmem_base=
xf86MapPciMem(pScreenInfo->scrnIndex, mapOption,
pRendition->pcitag,
@@ -1415,7 +1421,7 @@ renditionUnmapMem(ScrnInfoPtr pScreenInf
#else
pci_device_unmap_range(pRendition->PciInfo,
pRendition->board.vmem_base,
- pScreenInfo->videoRam * 1024);
+ pRendition->PciInfo->regions[0].size);
#endif
return TRUE;
#ifdef DEBUG0
Index: xsrc/external/mit/xf86-video-rendition/dist/src/rendition.h
diff -u xsrc/external/mit/xf86-video-rendition/dist/src/rendition.h:1.2 xsrc/external/mit/xf86-video-rendition/dist/src/rendition.h:1.3
--- xsrc/external/mit/xf86-video-rendition/dist/src/rendition.h:1.2 Tue Aug 16 01:27:47 2016
+++ xsrc/external/mit/xf86-video-rendition/dist/src/rendition.h Fri Aug 19 23:37:39 2016
@@ -14,9 +14,6 @@
/* Everything using inb/outb, etc needs "compiler.h" */
#include "compiler.h"
-/* Drivers for PCI hardware need this */
-#include "xf86PciInfo.h"
-
/* Drivers that need to access the PCI config space directly need this */
#include "xf86Pci.h"
@@ -66,4 +63,8 @@
#include "compat-api.h"
/* end of __RENDITION_H__ */
+
+#define PCI_CHIP_V1000 0x0001
+#define PCI_CHIP_V2x00 0x2000
+
#endif
Index: xsrc/external/mit/xf86-video-s3virge/dist/src/s3v_driver.c
diff -u xsrc/external/mit/xf86-video-s3virge/dist/src/s3v_driver.c:1.4 xsrc/external/mit/xf86-video-s3virge/dist/src/s3v_driver.c:1.5
--- xsrc/external/mit/xf86-video-s3virge/dist/src/s3v_driver.c:1.4 Tue Aug 16 01:27:47 2016
+++ xsrc/external/mit/xf86-video-s3virge/dist/src/s3v_driver.c Fri Aug 19 23:37:39 2016
@@ -3514,7 +3514,7 @@ S3VEnableMmio(ScrnInfoPtr pScrn)
{
vgaHWPtr hwp;
S3VPtr ps3v;
- IOADDRESS vgaCRIndex, vgaCRReg;
+ unsigned int vgaCRIndex, vgaCRReg;
unsigned char val;
unsigned int PIOOffset = 0;
@@ -3583,7 +3583,7 @@ S3VDisableMmio(ScrnInfoPtr pScrn)
{
vgaHWPtr hwp;
S3VPtr ps3v;
- IOADDRESS vgaCRIndex, vgaCRReg;
+ unsigned int vgaCRIndex, vgaCRReg;
PVERB5(" S3VDisableMmio\n");
@@ -3759,6 +3759,12 @@ S3Vddc1Read(ScrnInfoPtr pScrn)
return ((unsigned int) (tmp & 0x08));
}
+static void
+S3Vddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed)
+{
+ vgaHWddc1SetSpeed(pScrn, speed);
+}
+
static Bool
S3Vddc1(ScrnInfoPtr pScrn)
{
@@ -3772,7 +3778,7 @@ S3Vddc1(ScrnInfoPtr pScrn)
OUTREG(DDC_REG,(tmp | 0x12));
if ((pMon = xf86PrintEDID(
- xf86DoEDID_DDC1(XF86_SCRN_ARG(pScrn),vgaHWddc1SetSpeedWeak(),
+ xf86DoEDID_DDC1(XF86_SCRN_ARG(pScrn), S3Vddc1SetSpeed,
S3Vddc1Read))) != NULL)
success = TRUE;
xf86SetDDCproperties(pScrn,pMon);