Bug 54063 - XV video output does not work with S3 UniChrome Pro
Summary: XV video output does not work with S3 UniChrome Pro
Status: RESOLVED WONTFIX
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/openchrome (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Openchrome development list
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-25 20:17 UTC by Dominique Parisot
Modified: 2017-01-22 19:16 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Xorg log (46.26 KB, text/plain)
2012-08-26 07:04 UTC, Dominique Parisot
no flags Details
Xorg log with debug support enabled (80.15 KB, text/plain)
2012-08-26 16:26 UTC, Dominique Parisot
no flags Details
xdpyinfo command output (17.29 KB, application/octet-stream)
2012-08-26 17:35 UTC, Dominique Parisot
no flags Details
output of the xvinfo command (2.44 KB, text/plain)
2012-08-26 17:36 UTC, Dominique Parisot
no flags Details
XV video displayed on VGA screen and not on LCD screen (74.23 KB, image/jpeg)
2012-09-08 13:41 UTC, Dominique Parisot
no flags Details
Wrong colors when forcing video output on LCD screen (91.30 KB, image/jpeg)
2012-09-08 14:25 UTC, Dominique Parisot
no flags Details
Fix CN400 Xv on IGA2 (2.19 KB, patch)
2012-09-08 21:40 UTC, Xavier Bachelot
no flags Details | Splinter Review
Fix CN400 Xv on IGA2 (v2) (2.36 KB, patch)
2012-09-11 19:33 UTC, Xavier Bachelot
no flags Details | Splinter Review
Mplayer and Totem outputs (70.24 KB, image/jpeg)
2012-09-19 14:52 UTC, Dominique Parisot
no flags Details

Description Dominique Parisot 2012-08-25 20:17:08 UTC
XV video output is a black screen on my notebook (Packard Bell Easy Note R1800).

I use a Debian Squeeze distribution. I get the same bug with Ubuntu 12.04.

I have compiled the lastest release of openchrome (0.3.0) but the bug still exists.

Here is the output of the 'lscpi' command :
01:00.0 VGA compatible controller: VIA Technologies, Inc. CN400/PM800/PM880/PN800/PN880 [S3 UniChrome Pro] (rev 02)
Comment 1 Xavier Bachelot 2012-08-25 23:52:25 UTC
Can you please provide the full xorg log and the xorg conf ?
Comment 2 Dominique Parisot 2012-08-26 07:04:35 UTC
Created attachment 66125 [details]
Xorg log
Comment 3 Dominique Parisot 2012-08-26 07:06:46 UTC
Thank you for your response.
You will find the Xorg log in attachment.

Here is the Xorg configuration file :
Section "Device"
	Identifier "devname"
	Driver "openchrome"
	#Option "NoXVDMA" "false"
	#Option "EnableAGPDMA" "false"
EndSection
Comment 4 Dominique Parisot 2012-08-26 16:26:01 UTC
Created attachment 66141 [details]
Xorg log with debug support enabled

I have compiled openchrome-0.3.0 with debug support with the following commands : 
./configure  --prefix=/usr  --enable-debug --enable-xv-debug
make 
make install

You will find the Xorg log after GDM restart and video playing (with totem).

Thank you for your help :-)
Comment 5 Dominique Parisot 2012-08-26 17:35:31 UTC
Created attachment 66143 [details]
xdpyinfo command output

In attachment, you will find the output of the xdpyinfo command.
Comment 6 Dominique Parisot 2012-08-26 17:36:32 UTC
Created attachment 66144 [details]
output of the xvinfo command

In attachment, you will find the output of the xvinfo command.
Comment 7 Dominique Parisot 2012-08-26 17:50:33 UTC
Since my window manager (Metacity) is a compositing window manager, I have tried to kill its process and to play a video : I have the same bug : the content of Totem is a black window...
Comment 8 Xavier Bachelot 2012-08-28 20:06:18 UTC
ould you please try with another video player not based on gstreamer, like xine or mplayer ? This is just to make sure, as I suspect the issue is something else. I have Xv working on a similar chipset, but on the VGA port. I guess in your case, the Xv window is not enabled on the proper CRTC.
Comment 9 Dominique Parisot 2012-08-29 17:16:15 UTC
I have the same bug with Skype which can only play video with XV.

I can't try to connect a screen on the VGA port of the laptop because it's not my computer and it's 60 km far from my home...

Maybe you can add an option in the Xorg.conf to force the CRTC.
Comment 10 Dominique Parisot 2012-09-01 12:50:21 UTC
I have the same bug after adding the following options in xorg.conf : 
	Option "ForcePanel" "true"
	Option "ActiveDevice" "LCD"

I have removed VIA_DEVICE_CRT in the following line of via_id.c :
{"Packard Bell Easynote R1100",VIA_PM800,0x1631,0xC015,VIA_DEVICE_CRT|VIA_DEVICE_LCD}

After compiling and installing, it doesn't change anything...
Comment 11 Bartosz Kosiorek 2012-09-04 20:42:03 UTC
In openchrome, master source code, open src/via_xv_overlay.c file.
Then localize following code:
    /*
     * Enable video on secondary
     */
    if ((pVia->VideoEngine == VIDEO_ENGINE_CME ||
         pVia->Chipset == VIA_VM800) && iga->index) {
        /* V1_ON_SND_DISPLAY */
        vidCtl |= V1_ON_SND_DISPLAY;
        /* SECOND_DISPLAY_COLOR_KEY_ENABLE */
        compose |= SECOND_DISPLAY_COLOR_KEY_ENABLE | 0x1;
    }

Replace it with following and check if it works:

    /*
     * Enable video on secondary
     */
    if ((pVia->VideoEngine == VIDEO_ENGINE_CME ||
         pVia->Chipset == VIA_PM800 ||
         pVia->Chipset == VIA_VM800) && iga->index) {
        /* V1_ON_SND_DISPLAY */
        vidCtl |= V1_ON_SND_DISPLAY;
        /* SECOND_DISPLAY_COLOR_KEY_ENABLE */
        compose |= SECOND_DISPLAY_COLOR_KEY_ENABLE | 0x1;
    }
Comment 12 Bartosz Kosiorek 2012-09-04 21:18:04 UTC
If solution above will not work, try to comment out/delete following lines:

    /*
     * Enable video on secondary
     */
    if ((pVia->VideoEngine == VIDEO_ENGINE_CME ||
         pVia->Chipset == VIA_VM800) && iga->index) {
        /* V1_ON_SND_DISPLAY */
        vidCtl |= V1_ON_SND_DISPLAY;
        /* SECOND_DISPLAY_COLOR_KEY_ENABLE */
        compose |= SECOND_DISPLAY_COLOR_KEY_ENABLE | 0x1;
    }
Comment 13 Xavier Bachelot 2012-09-05 12:05:04 UTC
Another thing to try, add Option "ModeSwitchMethod" "legacy" to your conf file.
Comment 14 Dominique Parisot 2012-09-08 07:16:27 UTC
(In reply to comment #13)
> Another thing to try, add Option "ModeSwitchMethod" "legacy" to your conf file.

After adding this option and restarting GDM, I have a black screen.
Comment 15 Dominique Parisot 2012-09-08 08:00:30 UTC
As you suggest, I have replaced :
    if ((pVia->VideoEngine == VIDEO_ENGINE_CME ||
         pVia->Chipset == VIA_VM800) && iga->index) {
By :
    if ((pVia->VideoEngine == VIDEO_ENGINE_CME ||
         pVia->Chipset == VIA_PM800 ||
         pVia->Chipset == VIA_VM800) && iga->index) {

After compiling, installing and video playing, it's always the same thing : the content of totem is a black window...

For your information, I'm sure that this modification was successfully considered, because I have added a debug message in via_xv_overlay.c (just before the modification) and I can see this message in Xorg.0.log.

I also tried to delete the following code but it doesn't change anything : 
    if ((pVia->VideoEngine == VIDEO_ENGINE_CME ||
         pVia->Chipset == VIA_VM800) && iga->index) {
        /* V1_ON_SND_DISPLAY */
        vidCtl |= V1_ON_SND_DISPLAY;
        /* SECOND_DISPLAY_COLOR_KEY_ENABLE */
        compose |= SECOND_DISPLAY_COLOR_KEY_ENABLE | 0x1;
    }
Comment 16 Dominique Parisot 2012-09-08 13:41:50 UTC
Created attachment 66845 [details]
XV video displayed on VGA screen and not on LCD screen

When a VGA screen is plugged, the XV video is displayed on the VGA screen and not on the LCD screen (where the content of the window is a black screen).
I presume it's the same thing when VGA screen is disconnected : XV video is sended on the VGA port and not on the LCD.

With the following option, the two screen are disabled :
        Option "ModeSwitchMethod" "legacy"

With this option, the VGA screen is disabled, but the content of mplayer window on the LCD screen is a black scare.
        Option "ActiveDevice" "LCD"

The following options don't change anything : 
        Option "ForcePanel" "true"
        Option "NoXVDMA" "false"
        Option "EnableAGPDMA" "false"
Comment 17 Bartosz Kosiorek 2012-09-08 14:22:07 UTC
Thanks for information. It is very useful.

Localize following code:
    /*
     * Enable video on secondary
     */
    if ((pVia->VideoEngine == VIDEO_ENGINE_CME ||
         pVia->Chipset == VIA_VM800) && iga->index) {
        /* V1_ON_SND_DISPLAY */
        vidCtl |= V1_ON_SND_DISPLAY;
        /* SECOND_DISPLAY_COLOR_KEY_ENABLE */
        compose |= SECOND_DISPLAY_COLOR_KEY_ENABLE | 0x1;
    }

Replace it with following and check if it works:

    /*
     * Enable video on secondary
     */
    if ((pVia->VideoEngine == VIDEO_ENGINE_CME ||
         pVia->Chipset == VIA_VM800)) {
        /* V1_ON_SND_DISPLAY */
        vidCtl |= V1_ON_SND_DISPLAY;
        /* SECOND_DISPLAY_COLOR_KEY_ENABLE */
        compose |= SECOND_DISPLAY_COLOR_KEY_ENABLE | 0x1;
    }
Comment 18 Dominique Parisot 2012-09-08 14:25:00 UTC
Created attachment 66846 [details]
Wrong colors when forcing video output on LCD screen

SOME RELATIVE GOOD NEWS :
=========================

In the ViaInitVideoStatusFlag function (src/via_xv_overlay.c), I have replaced :

static unsigned long
ViaInitVideoStatusFlag(VIAPtr pVia)
{
    switch (pVia->ChipId) {
        case PCI_CHIP_VT3205:
        case PCI_CHIP_VT3204:
        case PCI_CHIP_VT3259:
        case PCI_CHIP_VT3314:
            return VIDEO_HQV_INUSE | SW_USE_HQV | VIDEO_3_INUSE;

By :

static unsigned long
ViaInitVideoStatusFlag(VIAPtr pVia)
{
    switch (pVia->ChipId) {
        case PCI_CHIP_VT3205:
        case PCI_CHIP_VT3204:
        case PCI_CHIP_VT3259:
        case PCI_CHIP_VT3314:
            return VIDEO_HQV_INUSE | SW_USE_HQV | VIDEO_1_INUSE;

Now the XV video output is on the LCD screen but the colors are wrong. You will find in attachment a screenshot of the same video with X11 output and with XV output.
Comment 19 Dominique Parisot 2012-09-08 14:44:34 UTC
(In reply to comment #17)

Sorry, but the following modification does not work :
> 
>     /*
>      * Enable video on secondary
>      */
>     if ((pVia->VideoEngine == VIDEO_ENGINE_CME ||
>          pVia->Chipset == VIA_VM800)) {
>         /* V1_ON_SND_DISPLAY */
>         vidCtl |= V1_ON_SND_DISPLAY;
>         /* SECOND_DISPLAY_COLOR_KEY_ENABLE */
>         compose |= SECOND_DISPLAY_COLOR_KEY_ENABLE | 0x1;
>     }

With a VGA screen connected, the XV output goes on the VGA screen and the content of the window of the LCD screen is black.

When the VGA screen is disconnected (and GDM restarted), the content of the window on the LCD screen is black...

For your information, I have tried to remove the if condition to be sure that `vidCtl' and `compose' variables are set and I still have the same bug.
Comment 20 Bartosz Kosiorek 2012-09-08 15:33:40 UTC
Great news.
To fix this issue you have to modify viaSetColorSpace function.
Your chipset ID is PCI_CHIP_VT3259.

Replace following code:
void
viaSetColorSpace(VIAPtr pVia, int hue, int saturation, int brightness,
                 int contrast, Bool reset)
{
    CARD32 col1, col2;

    viaCalculateVideoColor(pVia, hue, saturation, brightness, contrast, reset,
                           &col1, &col2);
    switch (pVia->ChipId) {
        case PCI_CHIP_VT3205:
        case PCI_CHIP_VT3204:
        case PCI_CHIP_VT3259:
        case PCI_CHIP_VT3314:
            VIASETREG(V3_ColorSpaceReg_1, col1);
            VIASETREG(V3_ColorSpaceReg_2, col2);
            DBG_DD(ErrorF("000002C4 %08lx\n", col1));
            DBG_DD(ErrorF("000002C8 %08lx\n", col2));
            break;
        case PCI_CHIP_VT3327:
        case PCI_CHIP_VT3336:
        case PCI_CHIP_VT3324:

with:

void
viaSetColorSpace(VIAPtr pVia, int hue, int saturation, int brightness,
                 int contrast, Bool reset)
{
    CARD32 col1, col2;

    viaCalculateVideoColor(pVia, hue, saturation, brightness, contrast, reset,
                           &col1, &col2);
    switch (pVia->ChipId) {
        case PCI_CHIP_VT3205:
        case PCI_CHIP_VT3204:
        case PCI_CHIP_VT3314:
            VIASETREG(V3_ColorSpaceReg_1, col1);
            VIASETREG(V3_ColorSpaceReg_2, col2);
            DBG_DD(ErrorF("000002C4 %08lx\n", col1));
            DBG_DD(ErrorF("000002C8 %08lx\n", col2));
            break;
        case PCI_CHIP_VT3259:
        case PCI_CHIP_VT3327:
        case PCI_CHIP_VT3336:
        case PCI_CHIP_VT3324:

(In reply to comment #18)
> Created attachment 66846 [details]
> Wrong colors when forcing video output on LCD screen
> 
> SOME RELATIVE GOOD NEWS :
> =========================
> 
> In the ViaInitVideoStatusFlag function (src/via_xv_overlay.c), I have replaced
> :
> 
> static unsigned long
> ViaInitVideoStatusFlag(VIAPtr pVia)
> {
>     switch (pVia->ChipId) {
>         case PCI_CHIP_VT3205:
>         case PCI_CHIP_VT3204:
>         case PCI_CHIP_VT3259:
>         case PCI_CHIP_VT3314:
>             return VIDEO_HQV_INUSE | SW_USE_HQV | VIDEO_3_INUSE;
> 
> By :
> 
> static unsigned long
> ViaInitVideoStatusFlag(VIAPtr pVia)
> {
>     switch (pVia->ChipId) {
>         case PCI_CHIP_VT3205:
>         case PCI_CHIP_VT3204:
>         case PCI_CHIP_VT3259:
>         case PCI_CHIP_VT3314:
>             return VIDEO_HQV_INUSE | SW_USE_HQV | VIDEO_1_INUSE;
> 
> Now the XV video output is on the LCD screen but the colors are wrong. You will
> find in attachment a screenshot of the same video with X11 output and with XV
> output.
Comment 21 Xavier Bachelot 2012-09-08 21:40:04 UTC
Created attachment 66850 [details] [review]
Fix CN400 Xv on IGA2

Your findings plus some cleanup are in the attached patch. I tested it on a VGA only CN400, it works fine. Please confirm the same patch on top of git master works too on your CN400 laptop.
Comment 22 Dominique Parisot 2012-09-10 16:08:02 UTC
(In reply to comment #21)

Bad news...

With your patch, the video is displayed on the LCD screen, but the content of the totem window is very bad : something with yellow and black lines...

Sorry, I can't send you a screenshot because I'm not in front of the computer (which is 60km far from me)...
Comment 23 Xavier Bachelot 2012-09-11 19:33:08 UTC
Created attachment 66993 [details] [review]
Fix CN400 Xv on IGA2 (v2)

Does that patch work better ?
Comment 24 Dominique Parisot 2012-09-12 17:37:17 UTC
(In reply to comment #23)
> Created attachment 66993 [details] [review] [review]
> Fix CN400 Xv on IGA2 (v2)

With the second patch :

- if I play a video with MPlayer with XV output, the result is good :-)

- if I play the same video with totem, the result is bad with differents colors stripes (diagonal)

- with Skype, colors seems to be inverted but the correspondant is visible.

I can't send you screenshots because the computer is 60 km far from me...
Comment 25 Dominique Parisot 2012-09-19 14:52:28 UTC
Created attachment 67392 [details]
Mplayer and Totem outputs

In attachment, you will find the same video output with MPlayer (which is OK) and with Totem (which is wrong).
Comment 26 Xavier Bachelot 2012-12-11 20:10:12 UTC
I've pushed the first iteration of the patch to git master.
I think the color issue with some of the video players is a different bug. I'll try to reproduce on my CN400 but it's currently not available.
Comment 27 Kevin Brace 2017-01-22 19:16:25 UTC
Since the older OpenChrome code is no longer support, I will be closing the bug.
If the bug persists with the latest version, please reopen or refile the bug.
There has been virtually no changes to the Xv code since Version 0.3.3.


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.