Bug 96633

Summary: Odd Resolutions on DVI output
Product: xorg Reporter: Eric <knoppix1337>
Component: Driver/openchromeAssignee: Openchrome development list <openchrome-devel>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: medium CC: kevinbrace
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Photo showing 1921x1081
none
Xorg.0.log after using ARandR to change both VGA and DVI to 1920x1080
none
Xorg.0.log 0.4.901 Cx0 DVI only boot.
none
Proposed Patch IGA2 CrtcHDisplay and CrtcVDisplay Both - 2 none

Description Eric 2016-06-22 09:54:12 UTC
Current Setup: Wyse Cx0
Lubuntu 12.04
OpenChrome 0.4.901
Various Monitors using both VGA and DVI(to HDMI adapter) via 'Y' splitter cable

Literally ODD resolutions on DVI

Was testing 1900x1080 since I had access to an HDTV.

When the HDTV's OSD shows the resolution on HDMI (via DVI) it always shows the resolution as +1 on both the X and Y directions.

For example: 1921x1081

on another monitor it would show: 1440x901 and would bring up a nag box on the OSD saying "use 1440x900" 

Attached Xorg.0.log switching both DVI and VGA to 1920x1080, using ARandR on HDTV.
Comment 1 Eric 2016-06-22 09:58:35 UTC
Created attachment 124661 [details]
Photo showing 1921x1081
Comment 2 Eric 2016-06-22 10:00:22 UTC
Created attachment 124662 [details]
Xorg.0.log after using ARandR to change both VGA and DVI to 1920x1080
Comment 3 Kevin Brace 2016-06-23 23:09:04 UTC
Hi Eric,

I will need to reduce the scope of this bug so that I can have some control of the situation.
Is it possible that if you can limit the use to VGA only or DVI only for now.
This is because it is quite possible that DVI is being assigned to IGA2 (display controller 2) which is more flexible in terms of the screen resolution it can support compared to IGA1.
For IGA1, screen resolution has to be in increments of 8 dots due to the way it is designed (it is a legacy carryover from IBM VGA era).
However, IGA2 can be in 1 dot increment, and maybe that is contributing to this goofy "native resolution + 1" bug you are seeing right now.
Unfortunately, I do not own a monitor that can give that much detailed information like the one you own, so this is the likely reason why this happened in the first place.
If I have noticed this beforehand, I would have dealt with it.
If you do not see this bug with IGA1 (i.e., VGA) but with IGA2 (i.e., DVI), then what I will likely do is to subtract 1 extra when IGA2 display controller screen timing registers are set.
Hopefully that will solve the bug.
Let me know if you can confirm the setup I am describing here (whether or not this is with VGA or DVI).
Comment 4 Eric 2016-06-24 03:02:45 UTC
The odd resolution is only on the DVI monitor (both with DVI only, and dual DVI/VGA) The VGA always shows the correct resolution.

This seems to be related to the Cx0 only, because I didn't see this phenomenon when I was playing with the Vx0. 

Here is the Xorg.0.log from only booting with DVI.
Comment 5 Eric 2016-06-24 03:05:12 UTC
Created attachment 124693 [details]
Xorg.0.log 0.4.901 Cx0 DVI only boot.
Comment 6 Eric 2016-06-24 03:35:38 UTC
Prior to 0.4.173, on the Vx0, the DVI resolutions would show, for example 1608x1201, and sometimes a blue line would show up at the right (and faint blue line on the bottom) they seemed to be 8 and 1 pixels respectively. I wasn't sure if it was my equipment at the time, but I made a comment about it when you mentioned a blue line. Maybe this will help narrow the playing field. 

I re-checked to make sure and the Vx0 Shows the correct resolution and the Cx0 doesn't.
Comment 7 Kevin Brace 2016-06-25 05:05:40 UTC
Created attachment 124712 [details] [review]
Proposed Patch IGA2 CrtcHDisplay and CrtcVDisplay Both - 2
Comment 8 Kevin Brace 2016-06-25 05:22:15 UTC
Hi Eric,

Just to be honest, fixing this bug is fairly tricky since I do not own a monitor that can provide very detailed screen resolution information like the one you own.
Yes, I did notice the blue line on the right side of the screen issue in CLE266 + Samsung 23" monitor I have, but it was probably due to certain IGA1 registers not being set correctly when OpenChrome took over setting up those registers (I did not handle this correctly.).
One of the big problem OpenChrome still has is the fact that it is not initializing all the registers, and this problem really can be traced back to 2005 or so when OpenChrome developers decided to rely on VBE to handle display mode setting.
Even today, many internal registers are being initialized by VGA BIOS or VIA frame buffer device driver.
I am adding more and more code to initialize all the relevant registers, but it takes time to get it right, hence, you are seeing problems in the meantime.
VIA Technologies did not release all the relevant documents to write software to properly program their hardware, hence, except for the 4 or so last devices they shipped (CX700, VX800, VX855, and VX900), no official documentation is available.
This definitely makes my job harder than it should be.
    It appears that this "bug" is specific to IGA2, and just as a test, the patch will "- 2" horizontal and vertical display count.
In order to apply the patch, you will download it to your xf86-video-openchrome folder.
From there, you will apply the patch.

patch -p1 < Proposed_Patch_IGA2_CrtcHDisplay_CrtcVDisplay_Both_Minus_2.patch

Then, compile and install OpenChrome.
I am hoping this will resolve the "1 dot off" screen resolution problem, or give me hints for different things to try.
Comment 9 Eric 2016-06-27 05:57:44 UTC
Applied patch, The DVI still has 1601x1201 on the Cx0. I also applied the patch on the Vx0 and both the DVI and VGA both show 1600x1200.

So the patch didn't change anything.
Comment 10 Eric 2016-07-02 00:35:44 UTC
Ok, tried this on another monitor that was not as tolerant as the others had been. When I boot to X it says "Signal out of range" on the DVI so it won't show 1651x1081 it only can handle a strict 1650x1080. I thought this might be an issue, but until now had not seen it. 

If I use ARandR I can drop the DVI screen to like 1440x900. The monitor then works on DVI and reports 1441x901
Comment 11 Eric 2016-07-02 04:18:05 UTC
Regarding the following patch "Proposed fix for Wyse Vx0 DVI not working" from Bug 94259 - No mouse cursor (invisible) with dual monitors and DVI/VGA "Y" cable, no display on DVI:

diff --git a/src/via_display.c b/src/via_display.c
index 71d89fb..eeb9e50 100644
--- a/src/via_display.c
+++ b/src/via_display.c
@@ -2000,6 +2000,24 @@ viaIGA2Init(ScrnInfoPtr pScrn)
      *             1: Enable */
     ViaCrtcMask(hwp, 0x79, 0x00, 0x01);
 
+    /* Set DVP0 (Digital Video Port 0) source to IGA2. */
+    /* 3X5.96[7]   - DVP0 ALPHA Enable
+     *               0: Disable
+     *               1: Enable
+     * 3X5.96[6]   - DVP0 VSYNC Polarity
+     *               0: Positive
+     *               1: Negative
+     * 3X5.96[5]   - DVP0 HSYNC Polarity
+     *               0: Positive
+     *               1: Negative
+     * 3X5.96[4]   - DVP0 Data Source Selection 0
+     *               0: Primary Display
+     *               1: Secondary Display
+     * 3X5.96[3]   - DVP0 Clock Polarity
+     * 3X5.96[2:0] - DVP0 Clock Adjust
+     *               Valid Value: 0 through 7 */
+    ViaCrtcMask(hwp, 0x96, 0x10, 0x10);
+
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Exiting viaIGA2Init.\n"));
 }


When this patch is applied to the Vx0, it causes the odd resolution bug to now appear on the Vx0 as well, ie: 1601x1201.

Hopefully this will help narrow down where the problem is coming from
Comment 12 Kevin Brace 2016-07-03 02:16:25 UTC
Hi Eric,

I really do not know what causes this +1 in X and Y direction bug you are reporting.
I do not think I can fix it immediately at this point before the Version 0.5 release.
I will think that it will have to be dealt with for the Version 0.6 release.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.