Re: [Openchrome-devel] xf86-video-openchrome: src/via_display.c src/via_driver.h

2017-01-07 Thread Luc Verhaegen
On Fri, Jan 06, 2017 at 10:18:24AM +, Kevin Brace wrote:
>  src/via_display.c |  244 
> --
>  src/via_driver.h  |3 
>  2 files changed, 203 insertions(+), 44 deletions(-)
> 
> New commits:
> commit f8551e0e07366a70cf6aa8c3801d2965a86e170f
> Author: Kevin Brace 
> Date:   Fri Jan 6 04:17:32 2017 -0600
> 
> Preparation for the partial fix of save / restore functions
> 
> Signed-off-by: Kevin Brace 
> 
> diff --git a/src/via_display.c b/src/via_display.c
> index a405ce2..9f3920a 100644
> --- a/src/via_display.c
> +++ b/src/via_display.c
> @@ -3342,41 +3342,111 @@ viaIGA2Save(ScrnInfoPtr pScrn)
>  DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
>  "Saving IGA2 registers.\n"));
>  
> -/* Unlock and save extended registers. */
> +/* Unlock extended registers. */
>  hwp->writeSeq(hwp, 0x10, 0x01);
>  
> -/* Save LCD control registers (from CR 0x50 to 0x93). */
> -for (i = 0; i < 68; i++)
> -Regs->CRTCRegs[i] = hwp->readCrtc(hwp, i + 0x50);
> -
> -if (pVia->Chipset != VIA_CLE266 && pVia->Chipset != VIA_KM400) {
> -/* LVDS Channel 2 Function Select 0 / DVI Function Select */
> -Regs->CR97 = hwp->readCrtc(hwp, 0x97);
> -/* LVDS Channel 1 Function Select 0 */
> -Regs->CR99 = hwp->readCrtc(hwp, 0x99);
> -/* Digital Video Port 1 Function Select 0 */
> -Regs->CR9B = hwp->readCrtc(hwp, 0x9B);
> -/* Power Now Control 4 */
> -Regs->CR9F = hwp->readCrtc(hwp, 0x9F);
> -
> -/* Horizontal Scaling Initial Value */
> -Regs->CRA0 = hwp->readCrtc(hwp, 0xA0);
> -/* Vertical Scaling Initial Value */
> -Regs->CRA1 = hwp->readCrtc(hwp, 0xA1);
> -/* Scaling Enable Bit */
> -Regs->CRA2 = hwp->readCrtc(hwp, 0xA2);
> +for (i = 0; i < (0x88 - 0x50 + 1); i++) {
> +Regs->CR[i + 0x50] = hwp->readCrtc(hwp, i + 0x50);
> +}
> +
> +for (i = 0; i < (0x92 - 0x8A + 1); i++) {
> +Regs->CR[i + 0x8A] = hwp->readCrtc(hwp, i + 0x8A);
> +}
> +
> +for (i = 0; i < (0xA3 - 0x94 + 1); i++) {
> +Regs->CR[i + 0x94] = hwp->readCrtc(hwp, i + 0x94);
>  }

This is a mistake, and a very slippery slope you started. I had some 
very good reasons for not doing tables for save/restore.
1) Direct typed registers requires you to think very carefully about 
which registers to restore. They require you to have very acute 
knowledge of the display engine you are working with. Direct type 
register names do not allow you to take shortcuts.
2) Synchronicity with a the real modesetting code. A missed register 
in save/restore will usually also mean a missed register in the proper 
modeset. Direct typed forces you to think about things more in depth and 
makes it more natural to keep both the save/restore as the actual 
modeset in sync.
2) what about timing and ordering? How are you going to deal with that 
with the next abstraction step after you've introduced a table?

The fact that you missed CR6A/6B clearly shows that you missed something 
big in save/restore. What did you do to stop saving restoring these 
registers, which are very ordering critical.

My most recent customer was using register tables both in the capture 
chip setup and for their poor excuse for a bootloader. In 2016. It was 
amazing. Besides the fact that they were poor developers who couldn't 
find or fix anything without JTAG, it also made it impossible for proper 
developers to see the forest through the trees, or to try to use logic 
to figure things out, and it was impossible to try to fix (apart from 
the fact that the poor developers would have to change their idiotic 
ways, which is impossible in itself).

Luc Verhaegen.
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] xf86-video-openchrome: src/via_display.c

2017-01-06 Thread Kevin Brace
 src/via_display.c |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit f6b06ec8aab825eb5bdc65d27f8ebecb557a3919
Author: Kevin Brace 
Date:   Fri Jan 6 04:20:25 2017 -0600

Minor adjustments to viaIGA1Restore function

Signed-off-by: Kevin Brace 

diff --git a/src/via_display.c b/src/via_display.c
index d1ff972..771c38a 100644
--- a/src/via_display.c
+++ b/src/via_display.c
@@ -2302,11 +2302,14 @@ viaIGA1Restore(ScrnInfoPtr pScrn)
 
 vgaHWProtect(pScrn, TRUE);
 
+vgaHWRestore(pScrn, >SavedReg, VGA_SR_ALL);
+
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Restoring sequencer registers.\n"));
+
 /* Unlock extended registers. */
 hwp->writeSeq(hwp, 0x10, 0x01);
 
-vgaHWRestore(pScrn, >SavedReg, VGA_SR_ALL);
-
 hwp->writeSeq(hwp, 0x15, Regs->SR[0x15]);
 ViaSeqMask(hwp, 0x16, Regs->SR[0x16], 0xBF);
 hwp->writeSeq(hwp, 0x17, Regs->SR[0x17]);
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] xf86-video-openchrome: src/via_display.c

2017-01-06 Thread Kevin Brace
 src/via_display.c |4 
 1 file changed, 4 insertions(+)

New commits:
commit 6f1191c56f31f6ed851ef28c1eca237eae994a4c
Author: Kevin Brace 
Date:   Fri Jan 6 04:19:07 2017 -0600

Partial fix for save / restore functions

The fix is still not perfect, but not restoring 3X5.6A, 3X5.6B,
and 3X5.6C was the reason why the screen was getting messed up
when switching to virtual terminal.

Signed-off-by: Kevin Brace 

diff --git a/src/via_display.c b/src/via_display.c
index 9f3920a..d1ff972 100644
--- a/src/via_display.c
+++ b/src/via_display.c
@@ -3483,6 +3483,10 @@ viaIGA2Restore(ScrnInfoPtr pScrn)
 hwp->writeCrtc(hwp, i + 0x62, Regs->CR[i + 0x62]);
 }
 
+hwp->writeCrtc(hwp, 0x6A, Regs->CR[0x6A]);
+hwp->writeCrtc(hwp, 0x6B, Regs->CR[0x6B]);
+hwp->writeCrtc(hwp, 0x6C, Regs->CR[0x6C]);
+
 for (i = 0; i < (0x88 - 0x6D + 1); i++) {
 hwp->writeCrtc(hwp, i + 0x6D, Regs->CR[i + 0x6D]);
 }
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] xf86-video-openchrome: src/via_display.c src/via_driver.h

2017-01-06 Thread Kevin Brace
 src/via_display.c |  244 --
 src/via_driver.h  |3 
 2 files changed, 203 insertions(+), 44 deletions(-)

New commits:
commit f8551e0e07366a70cf6aa8c3801d2965a86e170f
Author: Kevin Brace 
Date:   Fri Jan 6 04:17:32 2017 -0600

Preparation for the partial fix of save / restore functions

Signed-off-by: Kevin Brace 

diff --git a/src/via_display.c b/src/via_display.c
index a405ce2..9f3920a 100644
--- a/src/via_display.c
+++ b/src/via_display.c
@@ -3342,41 +3342,111 @@ viaIGA2Save(ScrnInfoPtr pScrn)
 DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 "Saving IGA2 registers.\n"));
 
-/* Unlock and save extended registers. */
+/* Unlock extended registers. */
 hwp->writeSeq(hwp, 0x10, 0x01);
 
-/* Save LCD control registers (from CR 0x50 to 0x93). */
-for (i = 0; i < 68; i++)
-Regs->CRTCRegs[i] = hwp->readCrtc(hwp, i + 0x50);
-
-if (pVia->Chipset != VIA_CLE266 && pVia->Chipset != VIA_KM400) {
-/* LVDS Channel 2 Function Select 0 / DVI Function Select */
-Regs->CR97 = hwp->readCrtc(hwp, 0x97);
-/* LVDS Channel 1 Function Select 0 */
-Regs->CR99 = hwp->readCrtc(hwp, 0x99);
-/* Digital Video Port 1 Function Select 0 */
-Regs->CR9B = hwp->readCrtc(hwp, 0x9B);
-/* Power Now Control 4 */
-Regs->CR9F = hwp->readCrtc(hwp, 0x9F);
-
-/* Horizontal Scaling Initial Value */
-Regs->CRA0 = hwp->readCrtc(hwp, 0xA0);
-/* Vertical Scaling Initial Value */
-Regs->CRA1 = hwp->readCrtc(hwp, 0xA1);
-/* Scaling Enable Bit */
-Regs->CRA2 = hwp->readCrtc(hwp, 0xA2);
+for (i = 0; i < (0x88 - 0x50 + 1); i++) {
+Regs->CR[i + 0x50] = hwp->readCrtc(hwp, i + 0x50);
+}
+
+for (i = 0; i < (0x92 - 0x8A + 1); i++) {
+Regs->CR[i + 0x8A] = hwp->readCrtc(hwp, i + 0x8A);
+}
+
+for (i = 0; i < (0xA3 - 0x94 + 1); i++) {
+Regs->CR[i + 0x94] = hwp->readCrtc(hwp, i + 0x94);
 }
 
-/* Save TMDS status */
+Regs->CR[0xA4] = hwp->readCrtc(hwp, 0xA4);
+
+for (i = 0; i < (0xAC - 0xA5 + 1); i++) {
+Regs->CR[i + 0xA5] = hwp->readCrtc(hwp, i + 0xA5);
+}
+
+/* Chrome 9 */
 switch (pVia->Chipset) {
+case VIA_K8M890:
+case VIA_P4M900:
+case VIA_VX800:
+case VIA_VX855:
+case VIA_VX900:
+Regs->CR[0xAF] = hwp->readCrtc(hwp, 0xAF);
+break;
+default:
+break;
+}
+
+/* Chrome 9, Chrome 9 HC, and Chrome 9 HC3 */
+switch (pVia->Chipset) {
+case VIA_K8M890:
+case VIA_P4M900:
+case VIA_VX800:
+for (i = 0; i < (0xCD - 0xB0 + 1); i++) {
+Regs->CR[i + 0xB0] = hwp->readCrtc(hwp, i + 0xB0);
+}
+
+break;
+default:
+break;
+}
+
+switch (pVia->Chipset) {
+
+/* UniChrome Pro and UniChrome Pro II */
+case VIA_PM800:
+case VIA_K8M800:
+case VIA_P4M800PRO:
 case VIA_CX700:
+case VIA_P4M890:
+for (i = 0; i < (0xD7 - 0xD0 + 1); i++) {
+Regs->CR[i + 0xD0] = hwp->readCrtc(hwp, i + 0xD0);
+}
+
+break;
+
+/* Chrome 9 */
+case VIA_K8M890:
+case VIA_P4M900:
 case VIA_VX800:
 case VIA_VX855:
 case VIA_VX900:
-Regs->CRD2 = hwp->readCrtc(hwp, 0xD2);
+for (i = 0; i < (0xEC - 0xD0 + 1); i++) {
+Regs->CR[i + 0xD0] = hwp->readCrtc(hwp, i + 0xD0);
+}
+
+break;
+default:
 break;
 }
 
+/* Chrome 9 */
+switch (pVia->Chipset) {
+case VIA_K8M890:
+case VIA_P4M900:
+case VIA_VX800:
+case VIA_VX855:
+case VIA_VX900:
+for (i = 0; i < (0xF5 - 0xF0 + 1); i++) {
+Regs->CR[i + 0xF0] = hwp->readCrtc(hwp, i + 0xF0);
+}
+
+break;
+default:
+break;
+}
+
+/* Chrome 9 HCM and Chrome 9 HD */
+if ((pVia->Chipset == VIA_VX855) || (pVia->Chipset == VIA_VX900)) {
+for (i = 0; i < (0xFC - 0xF6 + 1); i++) {
+Regs->CR[i + 0xF6] = hwp->readCrtc(hwp, i + 0xF6);
+}
+}
+
+/* Chrome 9 HD */
+if (pVia->Chipset == VIA_VX900) {
+Regs->CR[0xFD] = hwp->readCrtc(hwp, 0xFD);
+}
+
 DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 "Finished saving IGA2 registers.\n"));
 
@@ -3405,32 +3475,124 @@ viaIGA2Restore(ScrnInfoPtr pScrn)
 /* Unlock extended registers. */
 hwp->writeSeq(hwp, 0x10, 0x01);
 
-/* Restore LCD control registers. */
-for (i = 0; i < 68; i++)
-hwp->writeCrtc(hwp, i + 0x50, Regs->CRTCRegs[i]);
-
-if (pVia->Chipset != VIA_CLE266 && pVia->Chipset != VIA_KM400) {
-/* Scaling Initial values */
-hwp->writeCrtc(hwp, 0xA0, Regs->CRA0);
-hwp->writeCrtc(hwp, 0xA1, Regs->CRA1);
-hwp->writeCrtc(hwp, 0xA2, Regs->CRA2);
-
-/* LVDS Channels Functions Selection */
-hwp->writeCrtc(hwp, 0x97, 

[Openchrome-devel] xf86-video-openchrome: src/via_display.c

2016-06-13 Thread Kevin Brace
 src/via_display.c |   14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 16a698e920d41b853995db3407fbdd6a258fe365
Author: Kevin Brace 
Date:   Mon Jun 13 12:06:54 2016 -0500

No early horizontal synchronization for IGA1

This setting is now set to VIA Technologies recommended setting.
This setting affects display screen horizontal alignment to the
right side edge.

Signed-off-by: Kevin Brace 

diff --git a/src/via_display.c b/src/via_display.c
index d156121..912d6a4 100644
--- a/src/via_display.c
+++ b/src/via_display.c
@@ -682,8 +682,9 @@ viaIGA1Init(ScrnInfoPtr pScrn)
  *   1: Flip by each scan line */
 ViaCrtcMask(hwp, 0x32, 0x04, 0xEF);
 
-/*
- * 3X5.33[7]   - Primary Display Gamma Correction
+/* Keep interlace mode off.
+ * No shift for HSYNC.*/
+/* 3X5.33[7]   - Primary Display Gamma Correction
  *   0: Disable
  *   1: Enable
  * 3X5.33[6]   - Primary Display Interlace Mode
@@ -705,7 +706,7 @@ viaIGA1Init(ScrnInfoPtr pScrn)
  *(Non-VGA mode suggested value)
  *   110: Shift to early time by 1 character
  *   111: Shift to early time by 2 characters */
-ViaCrtcMask(hwp, 0x33, 0x00, 0xCF);
+ViaCrtcMask(hwp, 0x33, 0x05, 0xCF);
 
 /* For UniChrome Pro and Chrome9. */
 if ((pVia->Chipset != VIA_CLE266)
@@ -936,8 +937,9 @@ viaIGA1SetDisplayRegister(ScrnInfoPtr pScrn, DisplayModePtr 
mode)
  *   1: Flip by each scan line */
 ViaCrtcMask(hwp, 0x32, 0x04, 0xEC);
 
-/*
- * 3X5.33[7]   - Primary Display Gamma Correction
+/* Keep interlace mode off.
+ * No shift for HSYNC.*/
+/* 3X5.33[7]   - Primary Display Gamma Correction
  *   0: Disable
  *   1: Enable
  * 3X5.33[6]   - Primary Display Interlace Mode
@@ -959,7 +961,7 @@ viaIGA1SetDisplayRegister(ScrnInfoPtr pScrn, DisplayModePtr 
mode)
  *(Non-VGA mode suggested value)
  *   110: Shift to early time by 1 character
  *   111: Shift to early time by 2 characters */
-ViaCrtcMask(hwp, 0x33, 0x00, 0x4F);
+ViaCrtcMask(hwp, 0x33, 0x05, 0x4F);
 
 /* Set IGA1 to linear mode */
 /* 3X5.43[2]  - IGA1 Address Mode Selection
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] xf86-video-openchrome: src/via_display.c

2016-05-19 Thread Kevin Brace
 src/via_display.c |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 2d4067621722c7755351665ae436657c865c0abd
Author: Kevin Brace 
Date:   Thu May 19 20:46:27 2016 -0700

Added debug messages to viaIGA1SetDisplayRegister

This function is located inside via_display.c.

Signed-off-by: Kevin Brace 

diff --git a/src/via_display.c b/src/via_display.c
index bc68147..db61209 100644
--- a/src/via_display.c
+++ b/src/via_display.c
@@ -358,9 +358,11 @@ viaIGA1SetDisplayRegister(ScrnInfoPtr pScrn, 
DisplayModePtr mode)
 VIAPtr pVia = VIAPTR(pScrn);
 CARD16 temp;
 
-DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "viaIGA1SetDisplayRegister\n"));
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Entered viaIGA1SetDisplayRegister.\n"));
 
-DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting up %s\n", mode->name));
+xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"IGA1 Requested Screen Mode: %s\n", mode->name);
 
 ViaCrtcMask(hwp, 0x11, 0x00, 0x80); /* modify starting address */
 ViaCrtcMask(hwp, 0x03, 0x80, 0x80); /* enable vertical retrace access */
@@ -554,6 +556,9 @@ viaIGA1SetDisplayRegister(ScrnInfoPtr pScrn, DisplayModePtr 
mode)
 ViaCrtcMask(hwp, 0x33, 0, 0xC8);
 break;
 }
+
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Exiting viaIGA1SetDisplayRegister.\n"));
 }
 
 void
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] xf86-video-openchrome: src/via_display.c src/via_ums.h

2016-05-09 Thread Kevin Brace
 src/via_display.c |   24 
 src/via_ums.h |2 +-
 2 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit ce962f0dc1c2dacb2854164b10975f29372a571f
Author: Kevin Brace 
Date:   Mon May 9 21:51:46 2016 -0700

Changing viaIGA2Screen to viaIGA2DisplayOutput

Based on the feedback I received from other developers, the function
name is changing. Furthermore, other small changes were made to the
function's code. This function is located inside via_display.c.

Suggested-by: Bartosz Kosiorek 
Suggested-by: Luc Verhaegen 
Signed-off-by: Kevin Brace 

diff --git a/src/via_display.c b/src/via_display.c
index 832a1da..f1bdc83 100644
--- a/src/via_display.c
+++ b/src/via_display.c
@@ -50,23 +50,23 @@ viaIGA1DPMSControl(ScrnInfoPtr pScrn, CARD8 DPMS_Control)
 }
 
 /*
- * Controls IGA2 screen state.
+ * Controls IGA2 display output on or off state.
  */
 void
-viaIGA2Screen(ScrnInfoPtr pScrn, Bool Screen_State)
+viaIGA2DisplayOutput(ScrnInfoPtr pScrn, Bool OutputEnable)
 {
 vgaHWPtr hwp = VGAHWPTR(pScrn);
 
 DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-"Entered viaIGA2Screen.\n"));
+"Entered viaIGA2DisplayOutput.\n"));
 
-/* 3X5.6B[2]: IGA2 Screen Off
- * 0 = Screen on
- * 1 = Screen off */
-ViaCrtcMask(hwp, 0x6B, Screen_State ? 0x00 : 0x04, 0x04);
+/* 3X5.6B[2] - IGA2 Screen Off
+ * 0: Screen on
+ * 1: Screen off */
+ViaCrtcMask(hwp, 0x6B, OutputEnable ? 0x00 : 0x04, 0x04);
 
 DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-"Exiting viaIGA2Screen.\n"));
+"Exiting viaIGA2DisplayOutput.\n"));
 }
 
 /*
@@ -2486,7 +2486,7 @@ iga2_crtc_dpms(xf86CrtcPtr crtc, int mode)
 
 switch (mode) {
 case DPMSModeOn:
-viaIGA2Screen(pScrn, TRUE);
+viaIGA2DisplayOutput(pScrn, TRUE);
 
 if (pBIOSInfo->SimultaneousEnabled)
 ViaDisplayEnableSimultaneous(pScrn);
@@ -2495,7 +2495,7 @@ iga2_crtc_dpms(xf86CrtcPtr crtc, int mode)
 case DPMSModeStandby:
 case DPMSModeSuspend:
 case DPMSModeOff:
-viaIGA2Screen(pScrn, FALSE);
+viaIGA2DisplayOutput(pScrn, FALSE);
 
 if (pBIOSInfo->SimultaneousEnabled)
 ViaDisplayDisableSimultaneous(pScrn);
@@ -2626,7 +2626,7 @@ iga2_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
 }
 
 /* Turn off IGA2 during mode setting. */
-viaIGA2Screen(pScrn, FALSE);
+viaIGA2DisplayOutput(pScrn, FALSE);
 
 viaIGAInitCommon(pScrn);
 ViaCRTCInit(pScrn);
@@ -2641,7 +2641,7 @@ iga2_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
 iga2_crtc_set_origin(crtc, crtc->x, crtc->y);
 
 /* Turn on IGA2 now that mode setting is done. */
-viaIGA2Screen(pScrn, TRUE);
+viaIGA2DisplayOutput(pScrn, TRUE);
 
 DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 "Exiting iga2_crtc_mode_set.\n"));
diff --git a/src/via_ums.h b/src/via_ums.h
index 30665e0..541757b 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -209,7 +209,7 @@ void ViaSetUseExternalClock(vgaHWPtr hwp);
 
 /* via_display.c */
 void viaIGA1DPMSControl(ScrnInfoPtr pScrn, CARD8 DPMS_Control);
-void viaIGA2Screen(ScrnInfoPtr pScrn, Bool Screen_State);
+void viaIGA2DisplayOutput(ScrnInfoPtr pScrn, Bool OutputEnable);
 void viaIGA2DisplayChannel(ScrnInfoPtr pScrn, Bool Channel_State);
 void viaDisplayInit(ScrnInfoPtr pScrn);
 void ViaDisplayEnableSimultaneous(ScrnInfoPtr pScrn);
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


Re: [Openchrome-devel] xf86-video-openchrome: src/via_display.c src/via_ums.h

2016-04-27 Thread Luc Verhaegen
On Wed, Apr 27, 2016 at 05:19:41AM +0200, Bartosz Kosiorek wrote:
> Wow.
> The new funtion version is much more simple and clean.
> 
> You don't need any commment to the function, because the name of the
> function is describing by ownself.
> (the comment will only repeat what was already written in function name)
> 
> So every invocation of this function will be fully undestandable.
> 
> Nice catch.

One could even be fooled to think that there is a reason why i was on my 
own with modesetting for so long, and why structured display driver 
development is today the law ;)

Luc Verhaegen.
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


Re: [Openchrome-devel] xf86-video-openchrome: src/via_display.c src/via_ums.h

2016-04-26 Thread Bartosz Kosiorek
Wow.
The new funtion version is much more simple and clean.

You don't need any commment to the function, because the name of the
function is describing by ownself.
(the comment will only repeat what was already written in function name)

So every invocation of this function will be fully undestandable.

Nice catch.

Small nitpick: Screen_State variable is using underscore for word
separation. In future it will be great to be consistent with the rest part
of the code and separate it with camel case. So in that case it could be:
ScreenState

Also what do you think about convention:
- variable names starts from small letter
- Type names starts from capital letter
?

Best Regards
Bartosz

W dniu wtorek, 26 kwietnia 2016 Luc Verhaegen  napisaƂ(a):
> On Tue, Apr 26, 2016 at 09:38:52AM -0700, Kevin Brace wrote:
>>  src/via_display.c |   24 
>>  src/via_ums.h |1 +
>>  2 files changed, 25 insertions(+)
>>
>> New commits:
>> commit 479b2ab119d05c22e1541f4cf25fe816419a86e9
>> Author: Kevin Brace 
>> Date:   Tue Apr 26 09:31:58 2016 -0700
>>
>> Turning off IGA2 correctly
>>
>> Added viaIGA2Screen function to via_display.c.
>>
>> Signed-off-by: Kevin Brace 
>>
>> diff --git a/src/via_display.c b/src/via_display.c
>> index 0fe0c13..8dbfeea 100644
>> --- a/src/via_display.c
>> +++ b/src/via_display.c
>> @@ -49,6 +49,26 @@ viaIGA1DPMSControl(ScrnInfoPtr pScrn, CARD8
DPMS_Control)
>>  }
>>
>>  /*
>> + * Controls IGA2 screen state.
>> + */
>> +void
>> +viaIGA2Screen(ScrnInfoPtr pScrn, Bool Screen_State)
>> +{
>> +vgaHWPtr hwp = VGAHWPTR(pScrn);
>> +
>> +DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
>> +"Entered viaIGA2Screen.\n"));
>> +
>> +/* 3X5.6B[2]: IGA2 Screen Off
>> + * 0 = Screen on
>> + * 1 = Screen off */
>> +ViaCrtcMask(hwp, 0x6B, Screen_State ? 0x00 : 0x04, 0x04);
>
> I wrote the mask functions to aid readability.
>
> By naming the variable "Screen_State" with a bool, you removed
> readability. If you had named it "Enabled", things would be clearer.
>
> If you had called the function viaIGA2Enable, things would be
> clearer as well.
>
> You would then not need to add a snippet of datasheet information.
>
> Also, by using Mask, you improve readability several orders of
> magnitude, but by using the ? : construct, you remove readability.
>
> This here
>
> void
> viaIGA2Enable(ScrnInfoPtr pScrn, Bool Enable)
> {
> vgaHWPtr hwp = VGAHWPTR(pScrn);
>
> DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s().\n", __FUNC__));
>
> if (Enable)
> ViaCrtcMask(hwp, 0x6B, 0, 0x04);
> else
> ViaCrtcMask(hwp, 0x6B, 0x04, 0x04);
> }
>
> requires absolutely no mental arithmetic and needs no comment.
>
> Less is more.
>
> Note that i am, after almost a decade, no longer sure whether 0x6B 0x04
> was Crtc enable, or Crtc scanout enable. But that only means that your
> previous version was not verbose enough, or was anti-verbose.
>
> Luc Verhaegen
> ___
> Openchrome-devel mailing list
> Openchrome-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/openchrome-devel
>
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] xf86-video-openchrome: src/via_display.c

2016-04-26 Thread Kevin Brace
 src/via_display.c |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 76d221b2a21d3a2948426e5022e0ecbb6e9fac8a
Author: Kevin Brace 
Date:   Tue Apr 26 09:38:59 2016 -0700

Added debug messages to iga2_crtc_dpms

This function is located inside via_display.c.

Signed-off-by: Kevin Brace 

diff --git a/src/via_display.c b/src/via_display.c
index 8dbfeea..9e841ec 100644
--- a/src/via_display.c
+++ b/src/via_display.c
@@ -1538,6 +1538,9 @@ iga2_crtc_dpms(xf86CrtcPtr crtc, int mode)
 VIAPtr pVia = VIAPTR(pScrn);
 VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
 
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Entered iga2_crtc_dpms.\n"));
+
 switch (mode) {
 case DPMSModeOn:
 viaIGA2Screen(pScrn, TRUE);
@@ -1556,11 +1559,14 @@ iga2_crtc_dpms(xf86CrtcPtr crtc, int mode)
 break;
 
 default:
-xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Invalid DPMS mode %d\n",
+xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Invalid DPMS mode: %d\n",
 mode);
 break;
 }
 //vgaHWSaveScreen(pScrn->pScreen, mode);
+
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Exiting iga2_crtc_dpms.\n"));
 }
 
 static void
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] xf86-video-openchrome: src/via_display.c src/via_ums.h

2016-04-26 Thread Kevin Brace
 src/via_display.c |   24 
 src/via_ums.h |1 +
 2 files changed, 25 insertions(+)

New commits:
commit 479b2ab119d05c22e1541f4cf25fe816419a86e9
Author: Kevin Brace 
Date:   Tue Apr 26 09:31:58 2016 -0700

Turning off IGA2 correctly

Added viaIGA2Screen function to via_display.c.

Signed-off-by: Kevin Brace 

diff --git a/src/via_display.c b/src/via_display.c
index 0fe0c13..8dbfeea 100644
--- a/src/via_display.c
+++ b/src/via_display.c
@@ -49,6 +49,26 @@ viaIGA1DPMSControl(ScrnInfoPtr pScrn, CARD8 DPMS_Control)
 }
 
 /*
+ * Controls IGA2 screen state.
+ */
+void
+viaIGA2Screen(ScrnInfoPtr pScrn, Bool Screen_State)
+{
+vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Entered viaIGA2Screen.\n"));
+
+/* 3X5.6B[2]: IGA2 Screen Off
+ * 0 = Screen on
+ * 1 = Screen off */
+ViaCrtcMask(hwp, 0x6B, Screen_State ? 0x00 : 0x04, 0x04);
+
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Exiting viaIGA2Screen.\n"));
+}
+
+/*
  * Controls IGA2 display channel state.
  */
 void
@@ -1520,6 +1540,8 @@ iga2_crtc_dpms(xf86CrtcPtr crtc, int mode)
 
 switch (mode) {
 case DPMSModeOn:
+viaIGA2Screen(pScrn, TRUE);
+
 if (pBIOSInfo->SimultaneousEnabled)
 ViaDisplayEnableSimultaneous(pScrn);
 break;
@@ -1527,6 +1549,8 @@ iga2_crtc_dpms(xf86CrtcPtr crtc, int mode)
 case DPMSModeStandby:
 case DPMSModeSuspend:
 case DPMSModeOff:
+viaIGA2Screen(pScrn, FALSE);
+
 if (pBIOSInfo->SimultaneousEnabled)
 ViaDisplayDisableSimultaneous(pScrn);
 break;
diff --git a/src/via_ums.h b/src/via_ums.h
index 78e5837..78f94cf 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -205,6 +205,7 @@ void ViaSetUseExternalClock(vgaHWPtr hwp);
 
 /* via_display.c */
 void viaIGA1DPMSControl(ScrnInfoPtr pScrn, CARD8 DPMS_Control);
+void viaIGA2Screen(ScrnInfoPtr pScrn, Bool Screen_State);
 void viaIGA2DisplayChannel(ScrnInfoPtr pScrn, Bool Channel_State);
 void viaDisplayInit(ScrnInfoPtr pScrn);
 void ViaDisplayEnableSimultaneous(ScrnInfoPtr pScrn);
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] xf86-video-openchrome: src/via_display.c

2016-04-13 Thread Kevin Brace
 src/via_display.c |   13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit cb33c33ea12af82193a1cb84eb82730f5ef00496
Author: Kevin Brace 
Date:   Wed Apr 13 16:04:23 2016 -0700

Added debug messages to iga2_crtc_mode_set

This function is located inside via_display.c.

Signed-off-by: Kevin Brace 

diff --git a/src/via_display.c b/src/via_display.c
index 3a092ab..c5541f9 100644
--- a/src/via_display.c
+++ b/src/via_display.c
@@ -1351,8 +1351,16 @@ iga2_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
 ScrnInfoPtr pScrn = crtc->scrn;
 VIAPtr pVia = VIAPTR(pScrn);
 
-if (!vgaHWInit(pScrn, adjusted_mode))
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Entered iga2_crtc_mode_set.\n"));
+
+if (!vgaHWInit(pScrn, adjusted_mode)) {
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"vgaHWInit failed.\n"));
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Exiting iga2_crtc_mode_set.\n"));
 return;
+}
 
 ViaCRTCInit(pScrn);
 ViaModeSecondCRTC(pScrn, adjusted_mode);
@@ -1364,6 +1372,9 @@ iga2_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
 ViaDisplayDisableSimultaneous(pScrn);
 
 iga2_crtc_set_origin(crtc, crtc->x, crtc->y);
+
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Exiting iga2_crtc_mode_set.\n"));
 }
 
 static void
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] xf86-video-openchrome: src/via_display.c

2016-04-13 Thread Kevin Brace
 src/via_display.c |   13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 9ff51d02d0e95fea9fbae1c59a636ebee25fc82e
Author: Kevin Brace 
Date:   Wed Apr 13 14:30:29 2016 -0700

Added debug messages to iga1_crtc_mode_set

This function is located inside via_display.c.

Signed-off-by: Kevin Brace 

diff --git a/src/via_display.c b/src/via_display.c
index fa48728..3a092ab 100644
--- a/src/via_display.c
+++ b/src/via_display.c
@@ -955,8 +955,16 @@ iga1_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
 ScrnInfoPtr pScrn = crtc->scrn;
 VIAPtr pVia = VIAPTR(pScrn);
 
-if (!vgaHWInit(pScrn, adjusted_mode))
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Entered iga1_crtc_mode_set.\n"));
+
+if (!vgaHWInit(pScrn, adjusted_mode)) {
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"vgaHWInit failed.\n"));
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Exiting iga1_crtc_mode_set.\n"));
 return;
+}
 
 ViaCRTCInit(pScrn);
 ViaModeFirstCRTC(pScrn, adjusted_mode);
@@ -967,6 +975,9 @@ iga1_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
 ViaDisplayDisableSimultaneous(pScrn);
 
 iga1_crtc_set_origin(crtc, crtc->x, crtc->y);
+
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Exiting iga1_crtc_mode_set.\n"));
 }
 
 static void
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


Re: [Openchrome-devel] xf86-video-openchrome: src/via_display.c src/via_driver.c src/via_driver.h src/via_lvds.c src/via_outputs.c

2016-04-05 Thread Kevin Brace
Hi Xavier,

> Sent: Tuesday, April 05, 2016 at 12:59 PM
> From: "Xavier Bachelot" <xav...@bachelot.org>
> To: "Kevin Brace" <kevinbr...@gmx.com>, openchrome-devel@lists.freedesktop.org
> Subject: Re: [Openchrome-devel] xf86-video-openchrome: src/via_display.c 
> src/via_driver.c src/via_driver.h src/via_lvds.c src/via_outputs.c
>
> Hi Kevin,
> 
> Will do. I just sent a note as soon as I observed the regression on my
> setup and I know this is definitely not enough to debug the issue.
> Meanwhile, I've confirmed this is the faulty commit.
> Actually, I think I already stumbled on this very bug long time ago when
> James rewrote some part of the code and that's why CLE266 was reverted
> to legacy mode setting to avoid introducing a regression. Not sure why
> we did not fully debug this, but there was so many moving parts at the
> moment, we probably ran out of time then forgot about it to concentrate
> on KMS.
> I'm probably going to ship openchrome 0.4.0 on Fedora with a patch to
> revert the legacy mode setting removal. Indeed, this is only a temporary
> workaround, I don't want to maintain out of tree patches unless
> absolutely necessary and will remove it asap.
> 

I do not want to sound mean, but I recommend that you don't bother.
While I am committed to supporting old hardware like CLE266 in OpenChrome, it 
is very unlikely that this will affect anyone that uses Fedora.
If I am correct, Fedora official release is already AMD64 (x86-64) based, so 
one cannot physically use it with CLE266 chipset in the first place (assuming 
that stock kernel is used).
CLE266 chipset was almost always mated with VIA Technologies C3 processor, and 
C3 did not even support PAE.
In fact, my CLE266 testing was performed only on Ubuntu 10.04 LTS, since 
software cursor will not be displayed with Lubuntu 10.04 at this point 
(obviously a bug).
As far as official stock kernel is concerned, Ubuntu 10.04 LTS generation was 
the last one that supported non-PAE 32-bit x86 processors, so that is the only 
one I can do any testing.
OpenChrome does not work well with Ubuntu 8.04 LTS, so I have not been able to 
test it against it (I fixed a few bugs, so it can at least be compiled against 
it. However, it does not work.).
People who use Gentoo Linux might be able to compile OpenChrome Version 0.4.0, 
and test it without PAE.
At least this person got OpenChrome Version 0.4.0 working with CLE266.

https://lists.freedesktop.org/archives/openchrome-users/2016-April/007260.html

Besides that, I did remove every part of the code that dealt with VBE mode 
setting, "legacy" mode setting, and known device table without breaking the 
code too much (the side effect from this was also repaired before the Version 
0.4.0 release).
In some ways, 3 of these are intertwined in a really bad way, and it is not a 
good idea to bring it back.
Because it is a major break from the older broken version, I call it Version 
0.4.0 rather than Version 0.3.4.
I already crossed the Rubicon with Version 0.4.0, and nobody is going backwards.

https://en.wikipedia.org/wiki/Crossing_the_Rubicon

When I did the commit that removed the known device table, I thought about the 
above phrase when I did it.
Of course, I knew you will not really like it.


> I don't particularly care about VBE, nor legacy mode setting. Less code,
> less bug :-)

I suppose Luc Verhaegen will disagree with you on that one.
Of course, that was then (11 or so years ago) and now.
Just for the record, I have e-mailed him over the UniChrome vs. OpenChrome a 
little while ago, and told me his side of the story.


> On the other hand, the known devices table might be a bit more
> problematic for older laptops. It was used in the first place to allow
> enabling otherwise undetectable LVDS panel.

OpenChrome already had the code infrastructure to support LVDS flat panels 
without I2C bus.
It is the scratch pad register interface that can pass the panel size from the 
BIOS setup.
I personally do not like this design, but VIA frame buffer device driver code 
they donated in 2008 or 2009 uses this, and James Simmons was also using this 
in the new DRM module (drm-openchrome).
I simply got rid of the strange code that was trying to do backdoor screen 
resolution detection, and now rely on the panel value the BIOS setup writes to 
the scratch pad register.

https://cgit.freedesktop.org/openchrome/xf86-video-openchrome/commit/?id=6375a34fa3c8e413aafb6f161a19195571da1434


> That being said, I
> completely agree this is/was a maintenance burden, I've been trying to
> keep it up to date for years, and I'm more than happy to see it go.
> Hopefully the code you added is enough to handle such cases. This is
> definitely something that people with the hardware need to test, and
> that's not my case.
> 

Although I probably should not get into the e-mail I

Re: [Openchrome-devel] xf86-video-openchrome: src/via_display.c src/via_driver.c src/via_driver.h src/via_lvds.c src/via_outputs.c

2016-04-05 Thread Xavier Bachelot
Hi Kevin,

On 05/04/2016 05:56, Kevin Brace wrote:
> Hi Xavier,
> 
>> Sent: Wednesday, March 30, 2016 at 1:31 AM From: "Xavier Bachelot"
>> <xav...@bachelot.org> To: openchrome-devel@lists.freedesktop.org,
>> "Kevin Brace" <kevinbr...@gmx.com> Subject: Re: [Openchrome-devel]
>> xf86-video-openchrome: src/via_display.c src/via_driver.c
>> src/via_driver.h src/via_lvds.c src/via_outputs.c
>> 
>> Hi Kevin,
>> 
>> On 18/03/2016 13:20, Kevin Brace wrote:
>>> src/via_display.c |   35 +-- src/via_driver.c  |   40 --- 
>>> src/via_driver.h  |1 src/via_lvds.c|  613
>>> +++--- 
>>> src/via_outputs.c |  128 --- 5 files changed, 98
>>> insertions(+), 719 deletions(-)
>>> 
>>> New commits: commit b48fb4176c96b04f5de8b2ee20f55af404ba0db7 
>>> Author: Kevin Brace <kevinbr...@gmx.com> Date:   Fri Mar 18
>>> 05:11:56 2016 -0700
>>> 
>>> Removal of legacy user mode setting
>>> 
>>> OpenChrome has had multiple ways to configure the display mode.
>>> This added unnecessary code maintenance burden on the developers.
>>> Hence, the legacy user mode setting is now discontinued.
>>> 
>>> Signed-off-by: Kevin Brace <kevinbr...@gmx.com>
>>> 
>> 
>> I believe this breaks my CLE266 + VGA. No time to really
>> investigate the issue yet, and I reverted to the commit just before
>> this one mostly out of a guess.
>> 
>> I'll properly bisect and post logs and registers dumps for both the
>>  working and non-working case shortly.
>> 
>> Regards, Xavier
>> 
> 
> If you have a specific situation of OpenChrome Version 0.4.0 not
> working, please file a bug report with http://bugs.freedesktop.org. I
> typically ask everyone seeking help to do this.
Will do. I just sent a note as soon as I observed the regression on my
setup and I know this is definitely not enough to debug the issue.
Meanwhile, I've confirmed this is the faulty commit.
Actually, I think I already stumbled on this very bug long time ago when
James rewrote some part of the code and that's why CLE266 was reverted
to legacy mode setting to avoid introducing a regression. Not sure why
we did not fully debug this, but there was so many moving parts at the
moment, we probably ran out of time then forgot about it to concentrate
on KMS.
I'm probably going to ship openchrome 0.4.0 on Fedora with a patch to
revert the legacy mode setting removal. Indeed, this is only a temporary
workaround, I don't want to maintain out of tree patches unless
absolutely necessary and will remove it asap.

> Just to be very clear, I will not fix any bugs that appear in
> versions older than Version 0.4.0, and certainly, I will not revive
> VBE and legacy mode setting (and "known device table"). I did make a
> few commits that fixed a problem I observed with CLE266 (EPIA-M) and
> VX800 (EPIA-M830) chipsets before the new release.
I don't particularly care about VBE, nor legacy mode setting. Less code,
less bug :-)
On the other hand, the known devices table might be a bit more
problematic for older laptops. It was used in the first place to allow
enabling otherwise undetectable LVDS panel. That being said, I
completely agree this is/was a maintenance burden, I've been trying to
keep it up to date for years, and I'm more than happy to see it go.
Hopefully the code you added is enough to handle such cases. This is
definitely something that people with the hardware need to test, and
that's not my case.

> Please note that I did test the code with 2 CLE266 chipset mainboards
> (EPIA-CL and EPIA-M). Both of them worked without issues, although
> both of them still suffer from a standby mode resume bug even today
> (This is disclosed in the newly rewritten README file that came with
> the new release.). I used Ubuntu 10.04 LTS for testing.
One cannot test every possible hardware and software setup, and bugs
will fall through the cracks. This did happen numerous time already and
will happen again :-)

> Although I probably should not get personal, I will need to let you
> know that I sent you 4 e-mails between October 2015 to December 2015
> regarding OpenChrome. It appears that you choose to ignore all of
> them. You are under no obligation to explain why you choose to do
> this to me, but personally, I think it is very unprofessional to
> completely ignore me this way. While I sent several e-mails to James
> Simmons around the same time, at least he has completely disappeared
> since January 2015 or so.
> 
Sorry about that, but please note I did not ignore you, I was unable to
answer and I did already explain why in a private mail to you and a
couple 

[Openchrome-devel] xf86-video-openchrome: src/via_display.c src/via_driver.c src/via_driver.h src/via_lvds.c src/via_outputs.c

2016-03-19 Thread Kevin Brace
 src/via_display.c |   35 +--
 src/via_driver.c  |   40 ---
 src/via_driver.h  |1 
 src/via_lvds.c|  613 +++---
 src/via_outputs.c |  128 ---
 5 files changed, 98 insertions(+), 719 deletions(-)

New commits:
commit b48fb4176c96b04f5de8b2ee20f55af404ba0db7
Author: Kevin Brace 
Date:   Fri Mar 18 05:11:56 2016 -0700

Removal of legacy user mode setting

OpenChrome has had multiple ways to configure the display mode. This
added unnecessary code maintenance burden on the developers. Hence,
the legacy user mode setting is now discontinued.

Signed-off-by: Kevin Brace 

diff --git a/src/via_display.c b/src/via_display.c
index 15289e9..7ccb3ff 100644
--- a/src/via_display.c
+++ b/src/via_display.c
@@ -977,17 +977,14 @@ iga1_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
 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;
@@ -1390,18 +1387,14 @@ iga2_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr 
mode,
 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);
 }
diff --git a/src/via_driver.c b/src/via_driver.c
index c98fdae..14c363b 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -194,8 +194,7 @@ typedef enum
 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[] = {
@@ -227,7 +226,6 @@ static OptionInfoRec VIAOptions[] = {
 {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},
@@ -681,13 +679,11 @@ VIASetupDefaultOptions(ScrnInfoPtr pScrn)
 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)
@@ -699,13 +695,9 @@ 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_P4M800PRO:
-/* New mode switch resolve bug with gamma set #282 */
-/* and with Xv after hibernate #240*/
 break;
 case VIA_CX700:
 pVia->VideoEngine = VIDEO_ENGINE_CME;
@@ -1177,36 +1169,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,

[Openchrome-devel] xf86-video-openchrome: src/via_display.c

2016-03-09 Thread Kevin Brace
 src/via_display.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 74e95a634506ab92b4c31ee1423bf9349067e0b5
Author: Kevin Brace 
Date:   Wed Mar 9 00:05:44 2016 -0800

set_origin callback of xf86CrtcFuncsRec compilation error

It appears that set_origin callback function of xf86CrtcFuncsRec
structure is available only if ABI_VIDEODRV_VERSION is greater than 2.

Signed-off-by: Kevin Brace 

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


[Openchrome-devel] xf86-video-openchrome: src/via_display.c src/via_driver.c src/via_exa.c src/via_ums.c

2016-02-10 Thread Kevin Brace
 src/via_display.c |   12 ++--
 src/via_driver.c  |   10 +-
 src/via_exa.c |2 +-
 src/via_ums.c |6 +++---
 4 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit 3d8aa5d0be2be6e874a11e898cfc0abdf32307dc
Author: Kevin Brace 
Date:   Wed Feb 10 23:04:10 2016 -0800

VIA_K8M890 label case statement position adjustment

It is really a cosmetic change, but theoretically can cause problems.

Signed-off-by: Kevin Brace 

diff --git a/src/via_display.c b/src/via_display.c
index 0eb8b68..7e58ae5 100644
--- a/src/via_display.c
+++ b/src/via_display.c
@@ -313,8 +313,8 @@ ViaFirstCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
 }
 
 switch (pVia->ChipId) {
-case VIA_K8M890:
 case VIA_CX700:
+case VIA_K8M890:
 case VIA_P4M900:
 case VIA_VX800:
 case VIA_VX855:
@@ -418,8 +418,8 @@ ViaFirstCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
 
 /* 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:
@@ -455,8 +455,8 @@ ViaFirstCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
 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:
@@ -583,8 +583,8 @@ ViaSecondCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
 }
 
 switch (pVia->ChipId) {
-case VIA_K8M890:
 case VIA_CX700:
+case VIA_K8M890:
 case VIA_P4M900:
 case VIA_VX800:
 case VIA_VX855:
@@ -669,8 +669,8 @@ ViaSecondCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
 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:
@@ -1804,8 +1804,8 @@ UMSCrtcInit(ScrnInfoPtr pScrn)
 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;
diff --git a/src/via_driver.c b/src/via_driver.c
index 490ae9a..efe73a5 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -133,8 +133,8 @@ static SymTabRec VIAChipsets[] = {
 {VIA_PM800, "PM800 / PN800 / PM880 / CN400"},
 {VIA_P4M800PRO, "P4M800 Pro / VN800 / CN700"},
 {VIA_CX700, "CX700 / VX700"},
-{VIA_K8M890,"K8M890 / K8N890"},
 {VIA_P4M890,"P4M890 / CN800"},
+{VIA_K8M890,"K8M890 / K8N890"},
 {VIA_P4M900,"P4M900 / VN896 / CN896"},
 {VIA_VX800, "VX800 / VX820"},
 {VIA_VX855, "VX855 / VX875"},
@@ -150,8 +150,8 @@ static PciChipsets VIAPciChipsets[] = {
 {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_K8M890,PCI_CHIP_VT3336,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},
@@ -716,13 +716,13 @@ VIASetupDefaultOptions(ScrnInfoPtr pScrn)
 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:
diff --git a/src/via_exa.c b/src/via_exa.c
index 3ee4921..0e464ea 100644
--- a/src/via_exa.c
+++ b/src/via_exa.c
@@ -105,8 +105,8 @@ viaFlushPCI(ViaCommandBuffer *cb)
 (loop++ < MAXLOOP)) ;
 break;
 
-case VIA_K8M890:
 case VIA_P4M890:
+case VIA_K8M890:
 case VIA_P4M900:
 while ((VIAGETREG(VIA_REG_STATUS) &
 (VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY)) &&
diff --git a/src/via_ums.c b/src/via_ums.c
index 4724819..dfb6511 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -38,8 +38,8 @@ ViaMMIODisable(ScrnInfoPtr pScrn)
 vgaHWPtr hwp = VGAHWPTR(pScrn);
 
 switch (pVia->Chipset) {
-   

[Openchrome-devel] xf86-video-openchrome: src/via_display.c src/via_outputs.c

2016-02-09 Thread Kevin Brace
 src/via_display.c |4 ++--
 src/via_outputs.c |   19 ---
 2 files changed, 6 insertions(+), 17 deletions(-)

New commits:
commit e7be60ee371affe2e91ba8e8b2ea931e311ad26c
Author: Kevin Brace 
Date:   Mon Feb 8 21:26:02 2016 -0800

Preserving PCI Burst Write Wait State Select Bit

The code was previously setting PCI Burst Write Wait State Select bit
(0x3c5.0x1a[2]) to 1 for no good reasons. Typically, the option to enable
1 wait state PCI transaction in many VIA Technologies chipset-based
computers is provided in the BIOS setup, therefore, it is prudent for the
graphics device driver not to alter this bit.

Signed-off-by: Kevin Brace 

diff --git a/src/via_display.c b/src/via_display.c
index 4c588c8..0eb8b68 100644
--- a/src/via_display.c
+++ b/src/via_display.c
@@ -324,7 +324,7 @@ ViaFirstCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
 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;
 }
 
@@ -594,7 +594,7 @@ ViaSecondCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
 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;
 }
 
diff --git a/src/via_outputs.c b/src/via_outputs.c
index 3aa8c97..c661a4f 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -1404,8 +1404,8 @@ ViaModePrimaryLegacy(xf86CrtcPtr crtc, DisplayModePtr 
mode)
 pBIOSInfo->Clock = ViaModeDotClockTranslate(pScrn, mode);
 pBIOSInfo->ClockExternal = FALSE;
 
-/* Enable MMIO & PCI burst (1 wait state) */
-ViaSeqMask(hwp, 0x1A, 0x06, 0x06);
+/* Enable Extended Mode Memory Access. */
+ViaSeqMask(hwp, 0x1A, 0x08, 0x08);
 
 if (pBIOSInfo->analog->status == XF86OutputStatusConnected)
 ViaCrtcMask(hwp, 0x36, 0x30, 0x30);
@@ -1523,19 +1523,8 @@ ViaModeFirstCRTC(ScrnInfoPtr pScrn, DisplayModePtr mode)
 pBIOSInfo->Clock = ViaModeDotClockTranslate(pScrn, mode);
 pBIOSInfo->ClockExternal = FALSE;
 
-/* Enable MMIO & PCI burst (1 wait state) */
-switch (pVia->Chipset) {
-case VIA_CLE266:
-case VIA_KM400:
-case VIA_K8M800:
-case VIA_PM800:
-case VIA_P4M800PRO:
-ViaSeqMask(hwp, 0x1A, 0x06, 0x06);
-break;
-default:
-ViaSeqMask(hwp, 0x1A, 0x0C, 0x0C);
-break;
-}
+/* Enable Extended Mode Memory Access. */
+ViaSeqMask(hwp, 0x1A, 0x08, 0x08);
 
 ViaSetPrimaryFIFO(pScrn, mode);
 
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] xf86-video-openchrome: src/via_display.c

2013-05-16 Thread Xavier Bachelot
 src/via_display.c |   28 
 1 file changed, 24 insertions(+), 4 deletions(-)

New commits:
commit 541a3c1765e71af91e1319a3ab165ac37a0fd17d
Author: Xavier Bachelot xav...@bachelot.org
Date:   Wed Apr 24 19:38:02 2013 +0200

make iga[12]_crtc_mode_fixup more verbose when the mode is rejected.

diff --git a/src/via_display.c b/src/via_display.c
index 267a9c1..82cd8b2 100644
--- a/src/via_display.c
+++ b/src/via_display.c
@@ -908,16 +908,26 @@ iga1_crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr 
mode,
 ScrnInfoPtr pScrn = crtc-scrn;
 VIAPtr pVia = VIAPTR(pScrn);
 CARD32 temp;
+ModeStatus modestatus;
 
 if (pVia-pVbe)
 return TRUE;
 
 if ((mode-Clock  pScrn-clockRanges-minClock) ||
-(mode-Clock  pScrn-clockRanges-maxClock))
+(mode-Clock  pScrn-clockRanges-maxClock)) {
+xf86DrvMsg(pScrn-scrnIndex, X_INFO,
+   Clock for mode \%s\ outside of allowed range (%u (%u - 
%u))\n,
+   mode-name, mode-Clock, pScrn-clockRanges-minClock,
+   pScrn-clockRanges-maxClock);
 return FALSE;
+}
 
-if (ViaFirstCRTCModeValid(pScrn, mode) != MODE_OK)
+modestatus = ViaFirstCRTCModeValid(pScrn, mode);
+if (modestatus != MODE_OK) {
+xf86DrvMsg(pScrn-scrnIndex, X_INFO, Not using mode \%s\ : %s.\n,
+   mode-name, xf86ModeStatusToString(modestatus));
 return FALSE;
+}
 
 temp = mode-CrtcHDisplay * mode-CrtcVDisplay * mode-VRefresh *
 (pScrn-bitsPerPixel  3);
@@ -1309,16 +1319,26 @@ iga2_crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr 
mode,
 ScrnInfoPtr pScrn = crtc-scrn;
 VIAPtr pVia = VIAPTR(pScrn);
 CARD32 temp;
+ModeStatus modestatus;
 
 if (pVia-pVbe)
 return TRUE;
 
 if ((mode-Clock  pScrn-clockRanges-minClock) ||
-(mode-Clock  pScrn-clockRanges-maxClock))
+(mode-Clock  pScrn-clockRanges-maxClock)) {
+xf86DrvMsg(pScrn-scrnIndex, X_INFO,
+   Clock for mode \%s\ outside of allowed range (%u (%u - 
%u))\n,
+   mode-name, mode-Clock, pScrn-clockRanges-minClock,
+   pScrn-clockRanges-maxClock);
 return FALSE;
+}
 
-if (ViaSecondCRTCModeValid(pScrn, mode) != MODE_OK)
+modestatus = ViaFirstCRTCModeValid(pScrn, mode);
+if (modestatus != MODE_OK) {
+xf86DrvMsg(pScrn-scrnIndex, X_INFO, Not using mode \%s\ : %s.\n,
+   mode-name, xf86ModeStatusToString(modestatus));
 return FALSE;
+}
 
 temp = mode-CrtcHDisplay * mode-CrtcVDisplay * mode-VRefresh *
 (pScrn-bitsPerPixel  3);
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/openchrome-devel