Bug 94528 - HDMI port is not working on current KMS driver with VX900 platform
Summary: HDMI port is not working on current KMS driver with VX900 platform
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/openchrome (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium major
Assignee: Openchrome development list
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-14 06:56 UTC by HuangRan
Modified: 2016-04-20 07:13 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Xorg log for HDMI port (30.34 KB, text/plain)
2016-03-14 06:56 UTC, HuangRan
no flags Details
Patch to fix this HDMI no display issue (1.40 KB, text/plain)
2016-04-18 08:25 UTC, HuangRan
no flags Details
Re-attach the patch per Berno's suggestion (1.40 KB, text/plain)
2016-04-19 01:40 UTC, HuangRan
no flags Details
Re-attach again per Kevin's suggestion. (1.41 KB, text/plain)
2016-04-20 03:42 UTC, HuangRan
no flags Details

Description HuangRan 2016-03-14 06:56:26 UTC
Created attachment 122272 [details]
Xorg log for HDMI port

The board ID-PDM9W which is based on VIA's C7 + VX900 platform, the board has a "HDMI+VGA" ports and with a serial port on the board.
With VGA port, the KMS driver can be booted up successfully. But for HDMI port, the driver can not enter into desktop.
Attached is the Xorg log.


Thanks,
Frank
Comment 1 Kevin Brace 2016-03-14 18:53:21 UTC
Hi Frank,

Interesting that the DRM or DDX is recognizing the HDMI monitor.

________________________________________________________________
. . .

[    91.005] (II) CHROME(0): EDID for output DVI-0
[    91.005] (II) CHROME(0): Output VGA-0 disconnected
[    91.005] (II) CHROME(0): Output HDMI-0 connected
[    91.005] (II) CHROME(0): Output DVI-0 disconnected
[    91.005] (II) CHROME(0): Using exact sizes for initial modes
[    91.005] (II) CHROME(0): Output HDMI-0 using initial mode 1920x1080 +0+0
. . .
________________________________________________________________
Comment 2 HuangRan 2016-03-15 01:40:13 UTC
(In reply to Kevin Brace from comment #1)
> Hi Frank,
> 
> Interesting that the DRM or DDX is recognizing the HDMI monitor.
> 
> ________________________________________________________________
> . . .
> 
> [    91.005] (II) CHROME(0): EDID for output DVI-0
> [    91.005] (II) CHROME(0): Output VGA-0 disconnected
> [    91.005] (II) CHROME(0): Output HDMI-0 connected
> [    91.005] (II) CHROME(0): Output DVI-0 disconnected
> [    91.005] (II) CHROME(0): Using exact sizes for initial modes
> [    91.005] (II) CHROME(0): Output HDMI-0 using initial mode 1920x1080 +0+0
> . . .
> ________________________________________________________________

Yup, Kevin. I see that. And I found EDID information is probed out by the driver. So we need see what happened that lead no display on the monitor.

Thanks,
Frank
Comment 3 Kevin Brace 2016-03-17 13:30:40 UTC
(In reply to HuangRan from comment #2)

Hi Frank,

> (In reply to Kevin Brace from comment #1)
> > Hi Frank,
> > 
> > Interesting that the DRM or DDX is recognizing the HDMI monitor.
> > 
> > ________________________________________________________________
> > . . .
> > 
> > [    91.005] (II) CHROME(0): EDID for output DVI-0
> > [    91.005] (II) CHROME(0): Output VGA-0 disconnected
> > [    91.005] (II) CHROME(0): Output HDMI-0 connected
> > [    91.005] (II) CHROME(0): Output DVI-0 disconnected
> > [    91.005] (II) CHROME(0): Using exact sizes for initial modes
> > [    91.005] (II) CHROME(0): Output HDMI-0 using initial mode 1920x1080 +0+0
> > . . .
> > ________________________________________________________________
> 
> Yup, Kevin. I see that. And I found EDID information is probed out by the
> driver. So we need see what happened that lead no display on the monitor.
> 
> Thanks,
> Frank

The weird thing about VX900 chipset hardware programming documentation is that it contains register information for DisplayPort, but not HDMI.
I do not know how James Simmons wrote the code, if the above assumption is true.
That being said, VIA Technologies does have a quasi-open source 2D device driver code on their website for Chrome 9 family.

http://download.viatech.com/en/support/driversSelect.jsp

Select "Linux (current)" and VX900 chipset.
At least for the DRM module which supports KMS, it is open source.
Check out via_chrome9_hdac_renew.c where it is apparently accessing the registers related to HDMI.
Comment 4 HuangRan 2016-03-18 03:04:52 UTC
Hi Kevin, 

> 
> The weird thing about VX900 chipset hardware programming documentation is
> that it contains register information for DisplayPort, but not HDMI.
> I do not know how James Simmons wrote the code, if the above assumption is
> true.
Yup, I see the same problem with Chrome9 HD OGPM PartI document, there is no introduction for HDMI registers. By contrast, there is a group of registers for DVI/DP/LVDS.
But from VIA's website link, there is a diagram which shows HDMI/DP is supported.(http://www.viatech.com/en/silicon/chipsets/vx900/)

> That being said, VIA Technologies does have a quasi-open source 2D device
> driver code on their website for Chrome 9 family.
> 
> http://download.viatech.com/en/support/driversSelect.jsp
> 
> Select "Linux (current)" and VX900 chipset.
> At least for the DRM module which supports KMS, it is open source.
> Check out via_chrome9_hdac_renew.c where it is apparently accessing the
> registers related to HDMI.
That is very interesting:). I have not gotten this link before to download binary linux driver for VX700/VX855/VX900 chipset integrated graphics card.
After I download the driver for VX900, I see in via_chrome9_hdac_renew.c file, including via_chrome9_connector.c, via_chrome9_encoder.c files, there are HDMI related settings with mode setting work.
So does it mean current OPGM is not enough for all chipset registers? I doubt it...
By the way, so can I understand that current code in https://cgit.freedesktop.org/openchrome/drm-openchrome/tree/drivers/gpu/drm/via is coming from here for mode setting?
But it seems 2D/Xv part is in binary format and the driver can not support 3D acceleration(OpenGL/ES).

Thanks,
Frank
Comment 5 HuangRan 2016-03-21 10:39:17 UTC
Hi Kevin,

  I tried VX900 closed driver from the download link you provided and see HDMI port and VGA port are working fine on my platform. So I believe the closed driver can also work for your VX900 board at least for HDMI port. You can give a try on that. 
  Currently I see via_chrome9.ko file from close driver is used by kernel. And this ko file are compiled from close driver source files.

Thanks,
Frank
Comment 6 HuangRan 2016-03-21 11:14:56 UTC
(In reply to HuangRan from comment #5)
> Hi Kevin,
> 
>   I tried VX900 closed driver from the download link you provided and see
> HDMI port and VGA port are working fine on my platform. So I believe the
> closed driver can also work for your VX900 board at least for HDMI port. You
> can give a try on that. 
>   Currently I see via_chrome9.ko file from close driver is used by kernel.
> And this ko file are compiled from close driver source files.
> 
> Thanks,
> Frank

Hi Kevin,

A correction for my comments above, I can see when VGA port is used, the Xserver can go into desktop and X log shows everything is working fine. For HDMI, it can do mode setting correctly only enter into command mode instead of graphics mode and X log shows it still probing VGA edid information which is not correct.
If you have time to give a try on closed driver, let's see what happens at your side, especially for DP port and HDMI port.
By the way, you should use a old kernel, i.e., 3.1.10 to compile the closed driver for VX900 which is a requirement for that driver.

Thanks,
Frank
Comment 7 HuangRan 2016-03-21 11:23:45 UTC
> A correction for my comments above, I can see when VGA port is used, the
> Xserver can go into desktop and X log shows everything is working fine. For
> HDMI, it can do mode setting correctly only enter into command mode instead
> of graphics mode and X log shows it still probing VGA edid information which
> is not correct.
> If you have time to give a try on closed driver, let's see what happens at
> your side, especially for DP port and HDMI port.
> By the way, you should use a old kernel, i.e., 3.1.10 to compile the closed
> driver for VX900 which is a requirement for that driver.
> 
> Thanks,
> Frank

Okay...
when I modify the xorg.conf file to enable HDMI, HDMI port is working too!


Thanks,
Frank
Comment 8 Kevin Brace 2016-03-25 00:00:07 UTC
(In reply to HuangRan from comment #7)

Hi Frank,

> Okay...
> when I modify the xorg.conf file to enable HDMI, HDMI port is working too!
> 
> 
> Thanks,
> Frank

Is this with VIA Technologies "partial open source" device driver, or with James Simmons' developmental DRM module that supports KMS (and has HDMI support code in it)?
Comment 9 HuangRan 2016-03-25 01:48:10 UTC
(In reply to Kevin Brace from comment #8)
> (In reply to HuangRan from comment #7)
> 
> Hi Frank,
> 
> > Okay...
> > when I modify the xorg.conf file to enable HDMI, HDMI port is working too!
> > 
> > 
> > Thanks,
> > Frank
> 
> Is this with VIA Technologies "partial open source" device driver, or with
> James Simmons' developmental DRM module that supports KMS (and has HDMI
> support code in it)?

Hi Kevin,

  The working one is from VIA Technologies's partial open source driver.
  James's DRM driver is not working properly with HDMI as I reported in this bug although it does have the code to support HDMI.

Thanks,
Frank
Comment 10 Kevin Brace 2016-03-25 06:11:01 UTC
(In reply to HuangRan from comment #9)

Hi Frank,

> Hi Kevin,
> 
>   The working one is from VIA Technologies's partial open source driver.
>   James's DRM driver is not working properly with HDMI as I reported in this
> bug although it does have the code to support HDMI.
> 
> Thanks,
> Frank

Okay, I now know what to expect.
I will probably install Xubuntu 15.10, and then upgrade to Xubuntu 16.04 LTS eventually.
I will compile James Simmons' DRM module against whatever Linux kernel Xubuntu 15.10 comes with.
I will probably spend some time on this next week.
Comment 11 HuangRan 2016-03-26 03:52:29 UTC
Hi Kevin,

   Okay. Please feel free to let me know any issue you met when you are compiling the kernel.

Thanks,
Frank

(In reply to Kevin Brace from comment #10)
> (In reply to HuangRan from comment #9)
> 
> Hi Frank,
> 
> > Hi Kevin,
> > 
> >   The working one is from VIA Technologies's partial open source driver.
> >   James's DRM driver is not working properly with HDMI as I reported in this
> > bug although it does have the code to support HDMI.
> > 
> > Thanks,
> > Frank
> 
> Okay, I now know what to expect.
> I will probably install Xubuntu 15.10, and then upgrade to Xubuntu 16.04 LTS
> eventually.
> I will compile James Simmons' DRM module against whatever Linux kernel
> Xubuntu 15.10 comes with.
> I will probably spend some time on this next week.
Comment 12 HuangRan 2016-03-28 03:06:33 UTC
I found a link in OpenChrome:

https://www.freedesktop.org/wiki/Openchrome/TtmGemKms/

It is said that:

(kernel) KMS for VGA is working nicely.
(kernel) KMS for LVDS is mostly working.
(kernel) KMS for HDMI/DVI is in the works.
(kernel) KMS for DP is not started.

I think that can explain why HDMI has issue right now with current KMS driver. Although I am not sure how it goes after this wiki page is edited, but till now with latest drm code, the HDMI is still not working(by the way, DP is not working too).

So next step should be reviewing current VIA's close driver KMS code and see what has been done in that driver which can make HDMI working.

Thanks,
Frank
Comment 13 HuangRan 2016-04-14 07:43:20 UTC
With my past two weeks' work, I have finished analyzing HDMI port mode setting mode in via open source KMS driver.
Actually the whole mode setting process phases can be divided into several phases:
   1) EDID probe and EDID processing to generate a list of modes(CEA, EST, DTL, STD), then select the best mode to do the mode set. At the same time, in this phase, encoder and connector are chose out for HDMI port(that should be TMDS for encoder and HDMIA for the connector). 
     And for via open source driver, it probes out the VBIOS information from the BIOS and get DI port informaiton(including VCP information) and get supported devices list and then I2C ping pang probe(For my VX900 board, it is S3_CRT|S3_DVI|S3_HDMI|S3_DP). 
    After that it uses 0xC0C4, 0C0C8 registers to ask if the HDMI monitor is present, if that is so, probe 256 bytes EDID information and do analysis.
   2) If we are using fb device, it will pick up correct crtc device for the HDMI encoder and connector.
   3) then the control is given back to fb device, and real mode setting will be done. encoder and crtc funcs(prepare, mode_set, commit) will be done in this process. Especially some HDMI PHY registers are set and Info Frame registers are set(although audio registers are set)
   4)after the commit of encoder is done, the monitor will be lighten up.

So right now with the X logs for OpenChrome KMS driver, the EDID is probed out but the monitor is not showning anything, I thought the issue should be in the process 3). So I will begin to check OpenChrome KMS HDMI mode setting function to see if HDMI PHY and INFO Frame registers are set properly.

The most difficult thing is that in VX900 OGPM, there is no registers definition for HDMI port and VIA does not plan to release it because of the IP protection. So I have to figure it out by my debugging and understanding.

Thanks,
Frank
Comment 14 HuangRan 2016-04-15 09:24:40 UTC
I think we have found the root cause for this bug. The driver is trying to write a RO bit which causes no display for the HDMI monitor.
Next Monday, we'll release a patch to fix this bug.

@Kevin, please help give a try on your VX900 platform which I know it has an HDMI port.

Thanks,
Frank
Comment 15 HuangRan 2016-04-18 08:00:19 UTC
Please review and verify the patch i just send, I'll do commit to mainstream in two days.

Thanks,
Frank
Comment 16 HuangRan 2016-04-18 08:22:54 UTC
Note that I don't intend to send this patch to dri-devel mail list because our DRM driver has not been merged to main stream Linux kernel.

Thanks,
Frank
Comment 17 HuangRan 2016-04-18 08:25:13 UTC
Created attachment 123022 [details]
Patch to fix this HDMI no display issue
Comment 18 HuangRan 2016-04-18 08:39:58 UTC
Mark this issue as fixed.
Comment 19 HuangRan 2016-04-19 01:40:52 UTC
Created attachment 123040 [details]
Re-attach the patch per Berno's suggestion
Comment 20 Kevin Brace 2016-04-19 07:43:27 UTC
(In reply to HuangRan from comment #14)

Hi Frank,

> I think we have found the root cause for this bug. The driver is trying to
> write a RO bit which causes no display for the HDMI monitor.
> Next Monday, we'll release a patch to fix this bug.
> 
> @Kevin, please help give a try on your VX900 platform which I know it has an
> HDMI port.
> 
> Thanks,
> Frank

Yeah, I have been discouraged from trying out ZOTAC ZBOX nano VD01 further for the past 3 weeks.
I have not had a success compiling the DRM module supporting KMS with Linux 4.2 kernel source.
Anyway, I am surprised that you have control of the computer with the DRM module's Linux 3.19 RC6 kernel and Ubuntu / Lubutu 12.04 since I had no luck with that one.
I honestly think the best approach is to figure out how to compile the DRM module supporting KMS with Linux 4.2 kernel.
Comment 21 HuangRan 2016-04-19 10:00:46 UTC
Hi Kevin,

(In reply to Kevin Brace from comment #20)
> Yeah, I have been discouraged from trying out ZOTAC ZBOX nano VD01 further
> for the past 3 weeks.
> I have not had a success compiling the DRM module supporting KMS with Linux
> 4.2 kernel source.
> Anyway, I am surprised that you have control of the computer with the DRM
> module's Linux 3.19 RC6 kernel and Ubuntu / Lubutu 12.04 since I had no luck
> with that one.
> I honestly think the best approach is to figure out how to compile the DRM
> module supporting KMS with Linux 4.2 kernel.

As I said before, that need back porting work because from 3.19 kernel to 4.2 kernel, DRM/TTM has changes a lot. And I remember few days ago, you wrote a email to collect ideas for KMS driver, I have mentioned this viewpoint that if we want to make openchrome into linux kernel mainstream, we have to do this.


Thanks,
Frank
Comment 22 Kevin Brace 2016-04-20 03:21:26 UTC
Hi Frank,

Small things.

> Signed-off-by: Hu, Yi<huyi@iscas.ac.cn>
> Signed-off-by: Huang, Ran<huangranbj@126.com>

You may want to put a space between your name and '<'.
It "should" look like this.

> Signed-off-by: Hu, Yi <huyi@iscas.ac.cn>
> Signed-off-by: Huang, Ran <huangranbj@126.com>

It will be nice if you can correct this minor imperfection.
You should be able to use "git commit --amend" to make the adjustment.
Comment 23 Kevin Brace 2016-04-20 03:28:48 UTC
Hi Frank,

Sorry, I should have told you about the special kind of Git repository you need for doing commits.
I got this information from here.

https://wiki.openoffice.org/wiki/Ooo-build

Basically, when you clone the Git repository, you need to do it this way.

git clone ssh://huangran@git.freedesktop.org/git/openchrome/drm-openchrome

Of course, you will probably like to do the same for the OpenChrome DDX as well.

git clone ssh://huangran@git.freedesktop.org/git/openchrome/xf86-video-openchrome
Comment 24 Kevin Brace 2016-04-20 03:39:38 UTC
Hi Frank,

You can probably move the commit you made to the cloned drm-openchrome anonymous Git repository by creating a patch file.
If you have not yet committed the change, you can save the 

git diff > ("name of the .patch file")
git diff > change.patch

You can apply the patch this way.

patch -p1 < ("name of the .patch file")
patch -p1 < change.patch

You likely already did a commit, so this is probably how you will get the .patch file ready.

git format-patch origin

or 

git format-patch HEAD~1

Now apply the patch to the newly cloned repository.

patch -p1 < change.patch
git commit -a

Here, just copy the text body of the patch "git format-patch origin" just created.
To make changes to the current head

git commit --amend

I hope it works.
Let me know if something goes wrong.
Comment 25 HuangRan 2016-04-20 03:41:42 UTC
Comment on attachment 123040 [details]
Re-attach the patch per Berno's suggestion

>From e9b4b43fe2ec157f7d402c1efb855679711d47fc Mon Sep 17 00:00:00 2001
>From: HuangRan <huangranbj@126.com>
>Date: Tue, 19 Apr 2016 09:34:41 +0800
>Subject: [PATCH] Fix VX900 HDMI port no display issue
>
>Remove the write of bit6 for VGA/SVGA CRT Controller Register 0xFD
>(IGA1 Scaling Up and Timing Control). Bit6 of CRTC 0xFD is RO bit
>which can't be written. Verfied on VX900 board for HDMI port.
>
>Signed-off-by: Hu, Yi<huyi@iscas.ac.cn>
>Signed-off-by: Huang, Ran<huangranbj@126.com>
>---
> drivers/gpu/drm/via/via_crtc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/gpu/drm/via/via_crtc.c b/drivers/gpu/drm/via/via_crtc.c
>index fa29270..a50e654 100644
>--- a/drivers/gpu/drm/via/via_crtc.c
>+++ b/drivers/gpu/drm/via/via_crtc.c
>@@ -468,7 +468,7 @@ void via_load_crtc_pixel_timing(struct drm_crtc *crtc, struct drm_display_mode *
> 		svga_wcrt_mask(VGABASE, 0x32, 0x00, BIT(2));
> 
> 	}
>-	svga_wcrt_mask(VGABASE, 0xFD, BIT(5) | BIT(6), BIT(5) | BIT(6));
>+	svga_wcrt_mask(VGABASE, 0xFD, BIT(5), BIT(5));
> }
> 
> /* Load CRTC timing registers */
>@@ -484,7 +484,7 @@ void via_load_crtc_timing(struct via_crtc *iga, struct drm_display_mode *mode)
> 			svga_wcrt_mask(VGABASE, 0x45, 0x00, BIT(0));
> 
> 			/* Disable IGA1 pixel timing */
>-			svga_wcrt_mask(VGABASE, 0xFD, 0x00, BIT(6) | BIT(5));
>+			svga_wcrt_mask(VGABASE, 0xFD, 0x00, BIT(5));
> 		}
> 
> 		reg_value = IGA1_HOR_TOTAL_FORMULA(mode->crtc_htotal);
>-- 
>1.9.1
>
Comment 26 HuangRan 2016-04-20 03:42:12 UTC
Created attachment 123083 [details]
Re-attach again per Kevin's suggestion.
Comment 27 HuangRan 2016-04-20 03:43:19 UTC
Hi Kevin,

  Thanks for the suggestion. Change the format and re-attach it again.

Thanks,
Frank

(In reply to Kevin Brace from comment #22)
> Hi Frank,
> 
> Small things.
> 
> > Signed-off-by: Hu, Yi<huyi@iscas.ac.cn>
> > Signed-off-by: Huang, Ran<huangranbj@126.com>
> 
> You may want to put a space between your name and '<'.
> It "should" look like this.
> 
> > Signed-off-by: Hu, Yi <huyi@iscas.ac.cn>
> > Signed-off-by: Huang, Ran <huangranbj@126.com>
> 
> It will be nice if you can correct this minor imperfection.
> You should be able to use "git commit --amend" to make the adjustment.
Comment 28 HuangRan 2016-04-20 03:46:04 UTC
Hi Kevin,

  Thanks again. Right now I am doing "git clone" again for drm-openchrome repository with ssh protocol per your suggestion.
  Then I'll try the commit again and see if it works.

Thanks,
Frank

(In reply to Kevin Brace from comment #24)
> Hi Frank,
> 
> You can probably move the commit you made to the cloned drm-openchrome
> anonymous Git repository by creating a patch file.
> If you have not yet committed the change, you can save the 
> 
> git diff > ("name of the .patch file")
> git diff > change.patch
> 
> You can apply the patch this way.
> 
> patch -p1 < ("name of the .patch file")
> patch -p1 < change.patch
> 
> You likely already did a commit, so this is probably how you will get the
> .patch file ready.
> 
> git format-patch origin
> 
> or 
> 
> git format-patch HEAD~1
> 
> Now apply the patch to the newly cloned repository.
> 
> patch -p1 < change.patch
> git commit -a
> 
> Here, just copy the text body of the patch "git format-patch origin" just
> created.
> To make changes to the current head
> 
> git commit --amend
> 
> I hope it works.
> Let me know if something goes wrong.
Comment 29 HuangRan 2016-04-20 07:13:01 UTC
Hi Kevin,

  I have seen the commit is successful now!
  Thanks for your help on this. Now we can close this thread now.


Thanks,
Frank


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.