Hi Xavier,

Sorry for the implicit function death traps.
I fixed the problem, and the second version patch should not have the issue.

Regards,

Kevin Brace
The OpenChrome Project maintainer / developer


> Sent: Tuesday, March 14, 2017 at 3:53 PM
> From: "Xavier Bachelot" <xav...@bachelot.org>
> To: "Kevin Brace" <kevinbr...@gmx.com>, openchrome-devel@lists.freedesktop.org
> Subject: Re: [Openchrome-devel] openchrome 0.6.0 regressions on VX900 laptop
>
> On 14/03/2017 23:24, Xavier Bachelot wrote:
> > Hi Kevin,
> > 
> > On 14/03/2017 22:33, Kevin Brace wrote:
> >> Hi Xavier,
> >>
> >> Okay, at least some progress.
> >> I was guessing that LVDS1 was still at IGA1, so switching to IGA2 will 
> >> correct the problem, but I guess there were still some missing pieces.
> >> Based on what you reported, I wrote a patch that should now correctly 
> >> initialize LVDS1 for VX855 and VX900 chipsets.
> >> It appears that these only have one LVDS channel as opposed to CX700/VX700 
> >> and VX800 chipsets which appear to have two LVDS channels, to which one of 
> >> them can be used as DVI.
> >> I hope the patch works.
> >>
> > Thanks for the patch. It may or may not work, I can't tell, as both LVDS
> > channels are powered down and thus the screen is black.
> > I've attached the X log and regs dump.
> > 
> I guess that explains :
> 
> via_fp.c: In function ‘via_lvds_mode_set’:
> via_fp.c:1300:13: warning: implicit declaration of function
> ‘viaLVDS1SetDithering’ [-Wimplicit-function-declaration]
>              viaLVDS1SetDithering(pScrn, Panel->useDithering ? TRUE :
> FALSE);
>              ^~~~~~~~~~~~~~~~~~~~
> via_fp.c:1303:13: warning: implicit declaration of function
> ‘viaLVDS1SetOutputFormat’ [-Wimplicit-function-declaration]
>              viaLVDS1SetOutputFormat(pScrn, 0x01);
>              ^~~~~~~~~~~~~~~~~~~~~~~
> 
> Xavier
>
diff --git a/src/via_fp.c b/src/via_fp.c
index dea6ec9..4ef4914 100644
--- a/src/via_fp.c
+++ b/src/via_fp.c
@@ -179,6 +179,57 @@ viaLVDS1SetFormat(ScrnInfoPtr pScrn, CARD8 format)
 }
 
 /*
+ * Turns LVDS1 output color dithering on or off. (18-bit color display vs.
+ * 24-bit color display)
+ */
+static void
+viaLVDS1SetDithering(ScrnInfoPtr pScrn, CARD8 ditheringStatus)
+{
+    vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered viaLVDS1SetDithering.\n"));
+
+    /* Set LVDS1 output color dithering bit. */
+    /* 3X5.88[0] - LVDS Channel 1 Output Bits
+     *             0: 24 bits (dithering off)
+     *             1: 18 bits (dithering on) */
+    ViaCrtcMask(hwp, 0x88, ditheringStatus ? 0x01 : 0x00, 0x01);
+
+    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                "LVDS1 Output Color Dithering: %s\n",
+                ditheringStatus ? "On (18 bit)" : "Off (24 bit)");
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting viaLVDS1SetDithering.\n"));
+}
+
+/*
+ * Sets output format of LVDS1 to rotation or sequential mode.
+ */
+static void
+viaLVDS1SetOutputFormat(ScrnInfoPtr pScrn, CARD8 outputFormat)
+{
+    vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered viaLVDS1SetOutputFormat.\n"));
+
+    /* Set LVDS1 output format. */
+    /* 3X5.88[6] - LVDS Channel 1 Output Format
+     *             0: Rotation
+     *             1: Sequential */
+    ViaCrtcMask(hwp, 0x88, outputFormat ? 0x40 : 0x00, 0x40);
+
+    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                "LVDS1 Output Format: %s\n",
+                outputFormat ? "Sequential" : "Rotation");
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting viaLVDS1SetOutputFormat.\n"));
+}
+
+/*
  * Sets CX700 or later single chipset's LVDS2 I/O pad state.
  */
 static void
@@ -1281,8 +1332,6 @@ via_lvds_mode_set(xf86OutputPtr output, DisplayModePtr mode,
             break;
         case VIA_CX700:
         case VIA_VX800:
-        case VIA_VX855:
-        case VIA_VX900:
             viaLVDS2SetDisplaySource(pScrn, iga->index ? 0x01 : 0x00);
 
             /* Set LVDS2 output color dithering. */
@@ -1294,6 +1343,19 @@ via_lvds_mode_set(xf86OutputPtr output, DisplayModePtr mode,
             /* Set LVDS2 output to OPENLDI mode. */
             viaLVDS2SetFormat(pScrn, 0x01);
             break;
+        case VIA_VX855:
+        case VIA_VX900:
+            viaLVDS1SetDisplaySource(pScrn, iga->index ? 0x01 : 0x00);
+
+            /* Set LVDS1 output color dithering. */
+            viaLVDS1SetDithering(pScrn, Panel->useDithering ? TRUE : FALSE);
+
+            /* Set LVDS1 output format to sequential mode. */
+            viaLVDS1SetOutputFormat(pScrn, 0x01);
+
+            /* Set LVDS1 output to OPENLDI mode. */
+            viaLVDS1SetFormat(pScrn, 0x01);
+            break;
         default:
             break;
         }
_______________________________________________
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel

Reply via email to