[openchrome-devel] xf86-video-openchrome: Branch 'main' - 4 commits - configure.ac src/via_driver.c src/via_ums.c src/via_ums.h
Kevin Brace
kevinbrace at kemper.freedesktop.org
Mon Aug 17 16:12:06 UTC 2020
configure.ac | 2
src/via_driver.c | 18 +--
src/via_ums.c | 263 ++++++++++++++++++++++++++++++++++---------------------
src/via_ums.h | 1
4 files changed, 170 insertions(+), 114 deletions(-)
New commits:
commit 1baf0d5bc80903b6f23542f85fb94b7451212155
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Aug 17 09:11:46 2020 -0700
Version bumped to 0.6.304
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/configure.ac b/configure.ac
index 3b3e081..ead468d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xf86-video-openchrome],
- [0.6.303],
+ [0.6.304],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
[xf86-video-openchrome])
commit f7dbb11025f07bd1f270782617954f1f1f3c750f
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Aug 17 09:11:30 2020 -0700
Merge viaUMSCrtcInit() into viaUMSPreInit()
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_driver.c b/src/via_driver.c
index 0faa349..9c50714 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -1133,23 +1133,17 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
VIAVidHWDiffInit(pScrn);
- /*
- * After viaUMSPreInit() succeeds, MMIO PCI hardware resources
- * are memory mapped. If there is an error from this point on,
- * they will need to be explicitly relinquished.
- */
- if (!pVia->KMS) {
- if (!viaUMSPreInit(pScrn)) {
- goto free_rec;
- }
- }
-
if (pVia->KMS) {
if (!drmmode_pre_init(pScrn, &pVia->drmmode)) {
goto fail;
}
} else {
- if (!viaUMSCrtcInit(pScrn)) {
+ /*
+ * After viaUMSPreInit() succeeds, MMIO PCI hardware resources
+ * are memory mapped. If there is an error from this point on,
+ * they will need to be explicitly relinquished.
+ */
+ if (!viaUMSPreInit(pScrn)) {
goto fail;
}
}
diff --git a/src/via_ums.c b/src/via_ums.c
index 4a32b20..f4c1d72 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -1159,80 +1159,6 @@ viaQuirksInit(ScrnInfoPtr pScrn)
"Exiting %s.\n", __func__));
}
-Bool
-viaUMSPreInit(ScrnInfoPtr pScrn)
-{
- VIAPtr pVia = VIAPTR(pScrn);
-
- /*
- * Initialize special flag registers to handle "quirky"
- * hardware.
- */
- viaQuirksInit(pScrn);
-
- if (!xf86LoadSubModule(pScrn, "vgahw"))
- return FALSE;
-
- if (!vgaHWGetHWRec(pScrn))
- return FALSE;
-
-#if 0
- /* Here we can alter the number of registers saved and restored by the
- * standard vgaHWSave and Restore routines.
- */
- vgaHWSetRegCounts(pScrn, VGA_NUM_CRTC, VGA_NUM_SEQ, VGA_NUM_GFX,
- VGA_NUM_ATTR);
-#endif
-
- if (!viaProbeVRAM(pScrn)) {
- return FALSE;
- }
-
- /* Split the FB for SAMM. */
- /* FIXME: For now, split the FB into two equal sections.
- * This should be user-adjustable via a config option. */
- if (pVia->IsSecondary) {
- DevUnion *pPriv;
- VIAEntPtr pVIAEnt;
- VIAPtr pVia1;
-
- pPriv = xf86GetEntityPrivate(pScrn->entityList[0], gVIAEntityIndex);
- pVIAEnt = pPriv->ptr;
- pScrn->videoRam = pScrn->videoRam >> 1;
- pVIAEnt->pPrimaryScrn->videoRam = pScrn->videoRam;
- pVia1 = VIAPTR(pVIAEnt->pPrimaryScrn);
- pVia1->videoRambytes = pScrn->videoRam << 10;
- pVia->FrameBufferBase += (pScrn->videoRam << 10);
- }
-
- pVia->videoRambytes = pScrn->videoRam << 10;
-
- /* maybe throw in some more sanity checks here */
-#ifndef HAVE_PCIACCESS
- pVia->PciTag = pciTag(pVia->PciInfo->bus, pVia->PciInfo->device,
- pVia->PciInfo->func);
-#endif
-
- /* Map PCI hardware resources to the memory map. */
- if (!viaMapMMIO(pScrn)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-void
-viaUMSPreInitExit(ScrnInfoPtr pScrn)
-{
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Entered %s.\n", __func__));
-
- viaUnmapMMIO(pScrn);
-
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Exiting %s.\n", __func__));
-}
-
static void
viaSaveOriginalRegisters(ScrnInfoPtr pScrn)
{
@@ -1395,13 +1321,16 @@ viaSaveOriginalRegisters(ScrnInfoPtr pScrn)
"Exiting %s.\n", __func__));
}
+/*
+ * VIAPreInit code path for UMS (User Mode Setting).
+ */
Bool
-viaUMSCrtcInit(ScrnInfoPtr pScrn)
+viaUMSPreInit(ScrnInfoPtr pScrn)
{
- drmmode_crtc_private_ptr iga1_rec = NULL, iga2_rec = NULL;
- vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
+ drmmode_crtc_private_ptr iga1_rec = NULL, iga2_rec = NULL;
+ vgaHWPtr hwp;
#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,7,99,3,0)
ClockRangePtr clockRanges;
#else
@@ -1411,6 +1340,71 @@ viaUMSCrtcInit(ScrnInfoPtr pScrn)
xf86CrtcPtr iga1, iga2;
Bool ret;
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Entered %s.\n", __func__));
+
+ /*
+ * Initialize special flag registers to handle "quirky"
+ * hardware.
+ */
+ viaQuirksInit(pScrn);
+
+ if (!xf86LoadSubModule(pScrn, "vgahw")) {
+ ret = FALSE;
+ goto exit;
+ }
+
+ if (!vgaHWGetHWRec(pScrn)) {
+ ret = FALSE;
+ goto exit;
+ }
+
+#if 0
+ /* Here we can alter the number of registers saved and restored by the
+ * standard vgaHWSave and Restore routines.
+ */
+ vgaHWSetRegCounts(pScrn, VGA_NUM_CRTC, VGA_NUM_SEQ, VGA_NUM_GFX,
+ VGA_NUM_ATTR);
+#endif
+
+ if (!viaProbeVRAM(pScrn)) {
+ ret = FALSE;
+ goto exit;
+ }
+
+ /* Split the FB for SAMM. */
+ /* FIXME: For now, split the FB into two equal sections.
+ * This should be user-adjustable via a config option. */
+ if (pVia->IsSecondary) {
+ DevUnion *pPriv;
+ VIAEntPtr pVIAEnt;
+ VIAPtr pVia1;
+
+ pPriv = xf86GetEntityPrivate(pScrn->entityList[0], gVIAEntityIndex);
+ pVIAEnt = pPriv->ptr;
+ pScrn->videoRam = pScrn->videoRam >> 1;
+ pVIAEnt->pPrimaryScrn->videoRam = pScrn->videoRam;
+ pVia1 = VIAPTR(pVIAEnt->pPrimaryScrn);
+ pVia1->videoRambytes = pScrn->videoRam << 10;
+ pVia->FrameBufferBase += (pScrn->videoRam << 10);
+ }
+
+ pVia->videoRambytes = pScrn->videoRam << 10;
+
+ /* maybe throw in some more sanity checks here */
+#ifndef HAVE_PCIACCESS
+ pVia->PciTag = pciTag(pVia->PciInfo->bus, pVia->PciInfo->device,
+ pVia->PciInfo->func);
+#endif
+
+ /* Map PCI hardware resources to the memory map. */
+ if (!viaMapMMIO(pScrn)) {
+ ret = FALSE;
+ goto exit;
+ }
+
+ hwp = VGAHWPTR(pScrn);
+
viaSaveOriginalRegisters(pScrn);
/* Read memory bandwidth from registers. */
@@ -1445,17 +1439,22 @@ viaUMSCrtcInit(ScrnInfoPtr pScrn)
}
if (pVia->drmmode.hwcursor) {
- if (!xf86LoadSubModule(pScrn, "ramdac"))
- return FALSE;
+ if (!xf86LoadSubModule(pScrn, "ramdac")) {
+ ret = FALSE;
+ goto exit;
+ }
}
- if (!xf86LoadSubModule(pScrn, "i2c"))
+ if (!xf86LoadSubModule(pScrn, "i2c")) {
return FALSE;
- else
+ } else {
ViaI2CInit(pScrn);
+ }
- if (!xf86LoadSubModule(pScrn, "ddc"))
- return FALSE;
+ if (!xf86LoadSubModule(pScrn, "ddc")) {
+ ret = FALSE;
+ goto exit;
+ }
/*
* Set up ClockRanges, which describe what clock ranges are
@@ -1484,15 +1483,18 @@ viaUMSCrtcInit(ScrnInfoPtr pScrn)
iga1_rec = (drmmode_crtc_private_ptr) xnfcalloc(sizeof(drmmode_crtc_private_rec), 1);
if (!iga1_rec) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "IGA1 Rec allocation failed.\n");
- return FALSE;
+ ret = FALSE;
+ goto exit;
}
iga1 = xf86CrtcCreate(pScrn, &iga1_crtc_funcs);
if (!iga1) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "xf86CrtcCreate failed.\n");
free(iga1_rec);
- return FALSE;
+ ret = FALSE;
+ goto exit;
}
+
iga1_rec->drmmode = &pVia->drmmode;
iga1_rec->index = 0;
iga1->driver_private = iga1_rec;
@@ -1501,7 +1503,8 @@ viaUMSCrtcInit(ScrnInfoPtr pScrn)
if (!iga2_rec) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "IGA1 Rec allocation failed.\n");
xf86CrtcDestroy(iga1);
- return FALSE;
+ ret = FALSE;
+ goto exit;
}
iga2 = xf86CrtcCreate(pScrn, &iga2_crtc_funcs);
@@ -1509,8 +1512,10 @@ viaUMSCrtcInit(ScrnInfoPtr pScrn)
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "xf86CrtcCreate failed.\n");
xf86CrtcDestroy(iga1);
free(iga2_rec);
- return FALSE;
+ ret = FALSE;
+ goto exit;
}
+
iga2_rec->drmmode = &pVia->drmmode;
iga2_rec->index = 1;
iga2->driver_private = iga2_rec;
@@ -1520,7 +1525,8 @@ viaUMSCrtcInit(ScrnInfoPtr pScrn)
"Detected bitsPerPixel to be 0 bit.\n");
xf86CrtcDestroy(iga2);
xf86CrtcDestroy(iga1);
- return FALSE;
+ ret = FALSE;
+ goto exit;
}
/*
@@ -1543,6 +1549,20 @@ viaUMSCrtcInit(ScrnInfoPtr pScrn)
viaInitDisplay(pScrn);
ret = xf86InitialConfiguration(pScrn, TRUE);
-
+exit:
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting %s.\n", __func__));
return ret;
}
+
+void
+viaUMSPreInitExit(ScrnInfoPtr pScrn)
+{
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Entered %s.\n", __func__));
+
+ viaUnmapMMIO(pScrn);
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting %s.\n", __func__));
+}
diff --git a/src/via_ums.h b/src/via_ums.h
index e937217..03c6cbf 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -1563,7 +1563,6 @@ void viaUMSDestroy(ScrnInfoPtr pScrn);
Bool viaUMSScreenInit(ScrnInfoPtr pScrn);
Bool viaUMSPreInit(ScrnInfoPtr pScrn);
void viaUMSPreInitExit(ScrnInfoPtr pScrn);
-Bool viaUMSCrtcInit(ScrnInfoPtr pScrn);
/* via_i2c.c */
void ViaI2CInit(ScrnInfoPtr pScrn);
commit 4915c6f9584a721b4207b729faad82ca46a1a96e
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Aug 17 09:11:16 2020 -0700
Save original hardware registers inside viaSaveOriginalRegisters()
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_ums.c b/src/via_ums.c
index 0239e17..4a32b20 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -1233,23 +1233,17 @@ viaUMSPreInitExit(ScrnInfoPtr pScrn)
"Exiting %s.\n", __func__));
}
-Bool
-viaUMSCrtcInit(ScrnInfoPtr pScrn)
+static void
+viaSaveOriginalRegisters(ScrnInfoPtr pScrn)
{
- drmmode_crtc_private_ptr iga1_rec = NULL, iga2_rec = NULL;
vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
VIARegPtr Regs = &pVIADisplay->SavedReg;
-#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,7,99,3,0)
- ClockRangePtr clockRanges;
-#else
- ClockRangesPtr clockRanges;
-#endif
- int max_pitch, max_height;
- xf86CrtcPtr iga1, iga2;
uint32_t i;
- Bool ret;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Entered %s.\n", __func__));
vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_ALL);
@@ -1397,6 +1391,28 @@ viaUMSCrtcInit(ScrnInfoPtr pScrn)
}
}
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting %s.\n", __func__));
+}
+
+Bool
+viaUMSCrtcInit(ScrnInfoPtr pScrn)
+{
+ drmmode_crtc_private_ptr iga1_rec = NULL, iga2_rec = NULL;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,7,99,3,0)
+ ClockRangePtr clockRanges;
+#else
+ ClockRangesPtr clockRanges;
+#endif
+ int max_pitch, max_height;
+ xf86CrtcPtr iga1, iga2;
+ Bool ret;
+
+ viaSaveOriginalRegisters(pScrn);
+
/* Read memory bandwidth from registers. */
pVia->MemClk = hwp->readCrtc(hwp, 0x3D) >> 4;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
commit f7412fc9d895533c07d8530be07f1eebd9b35a17
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Aug 17 09:10:54 2020 -0700
Move special handling hardware initialization code into viaQuirksInit()
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_ums.c b/src/via_ums.c
index 006425e..0239e17 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -1086,63 +1086,90 @@ exit:
return status;
}
-Bool
-viaUMSPreInit(ScrnInfoPtr pScrn)
+/*
+ * This is basically a function that lets OpenChrome DDX know that
+ * it is dealing with hardware that requires special handling.
+ */
+static void
+viaQuirksInit(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
- /* Checking for VIA Technologies NanoBook reference design.
- Examples include Everex CloudBook and Sylvania g netbook.
- It is also called FIC CE260 and CE261 by its ODM (Original
- Design Manufacturer) name.
- This device has its strapping resistors set to a wrong
- setting to handle DVI. As a result, we need to make special
- accommodations to handle DVI properly. */
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Entered %s.\n", __func__));
+
+ /*
+ * Checking for VIA Technologies NanoBook reference design.
+ * Examples include Everex CloudBook and Sylvania g netbook.
+ * It is also called FIC CE260 and CE261 by its ODM (Original
+ * Design Manufacturer) name.
+ * This device has its strapping resistors set to a wrong
+ * setting to handle DVI. As a result, we need to make special
+ * accommodations to handle DVI properly.
+ */
if ((pVia->Chipset == VIA_CX700) &&
(SUBVENDOR_ID(pVia->PciInfo) == 0x1509) &&
(SUBSYS_ID(pVia->PciInfo) == 0x2D30)) {
-
pVIADisplay->isVIANanoBook = TRUE;
} else {
pVIADisplay->isVIANanoBook = FALSE;
}
- /* Checking for Quanta IL1 netbook. This is necessary
+ /*
+ * Checking for Quanta IL1 netbook. This is necessary
* due to its flat panel connected to DVP1 (Digital
- * Video Port 1) rather than its LVDS channel. */
+ * Video Port 1) rather than its LVDS channel.
+ */
if ((pVia->Chipset == VIA_VX800) &&
(SUBVENDOR_ID(pVia->PciInfo) == 0x152D) &&
(SUBSYS_ID(pVia->PciInfo) == 0x0771)) {
-
pVIADisplay->isQuantaIL1 = TRUE;
} else {
pVIADisplay->isQuantaIL1 = FALSE;
}
- /* Samsung NC20 netbook has its FP connected to LVDS2
+ /*
+ * Samsung NC20 netbook has its FP connected to LVDS2
* rather than the more logical LVDS1, hence, a special
* flag register is needed for properly controlling its
- * FP. */
+ * FP.
+ */
if ((pVia->Chipset == VIA_VX800) &&
(SUBVENDOR_ID(pVia->PciInfo) == 0x144d) &&
(SUBSYS_ID(pVia->PciInfo) == 0xc04e)) {
-
pVIADisplay->isSamsungNC20 = TRUE;
} else {
pVIADisplay->isSamsungNC20 = FALSE;
}
- /* Checking for OLPC XO-1.5. */
+ /*
+ * OLPC XO-1.5 requires a special code path to handle
+ * its unusual FP configuration.
+ */
if ((pVia->Chipset == VIA_VX855) &&
(SUBVENDOR_ID(pVia->PciInfo) == 0x152D) &&
(SUBSYS_ID(pVia->PciInfo) == 0x0833)) {
-
pVIADisplay->isOLPCXO15 = TRUE;
} else {
pVIADisplay->isOLPCXO15 = FALSE;
}
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting %s.\n", __func__));
+}
+
+Bool
+viaUMSPreInit(ScrnInfoPtr pScrn)
+{
+ VIAPtr pVia = VIAPTR(pScrn);
+
+ /*
+ * Initialize special flag registers to handle "quirky"
+ * hardware.
+ */
+ viaQuirksInit(pScrn);
+
if (!xf86LoadSubModule(pScrn, "vgahw"))
return FALSE;
More information about the openchrome-devel
mailing list