Bug 72220 - [HSW/BYT/BDW sprite planes] Color error while playing video by 'mplayer -vo xv:adapter=1'
Summary: [HSW/BYT/BDW sprite planes] Color error while playing video by 'mplayer -vo x...
Status: CLOSED FIXED
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/Intel (show other bugs)
Version: unspecified
Hardware: Other All
: high major
Assignee: Ville Syrjala
QA Contact: Intel GFX Bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-02 08:39 UTC by Guo Jinxian
Modified: 2017-10-06 14:41 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
abnormal color (1.06 MB, text/plain)
2013-12-02 08:39 UTC, Guo Jinxian
no flags Details
abnormal color (1.06 MB, image/jpeg)
2013-12-02 08:40 UTC, Guo Jinxian
no flags Details
Normal color (1.29 MB, image/jpeg)
2013-12-02 08:41 UTC, Guo Jinxian
no flags Details
dmesg (124.46 KB, text/plain)
2013-12-02 08:42 UTC, Guo Jinxian
no flags Details
xorg log (26.23 KB, text/plain)
2013-12-02 08:42 UTC, Guo Jinxian
no flags Details
vxiinfo (1.17 KB, text/plain)
2013-12-06 03:48 UTC, Guo Jinxian
no flags Details
mplayer dmesg on HSW-M (119.42 KB, text/plain)
2014-04-16 02:01 UTC, Guo Jinxian
no flags Details
adaptor=0 (2.30 MB, image/jpeg)
2014-04-16 08:55 UTC, Guo Jinxian
no flags Details
adaptor=1 (2.51 MB, image/jpeg)
2014-04-16 08:55 UTC, Guo Jinxian
no flags Details
adaptor=1 (2.51 MB, image/jpeg)
2014-04-16 09:03 UTC, Guo Jinxian
no flags Details
snapshot (1.23 MB, image/jpeg)
2014-04-18 01:02 UTC, Guo Jinxian
no flags Details
[PATCH] vo_xv: Check whether the Xv adaptor/port supports scaling (3.01 KB, patch)
2014-05-07 19:01 UTC, Ville Syrjala
no flags Details | Splinter Review

Description Guo Jinxian 2013-12-02 08:39:35 UTC
Created attachment 90086 [details]
abnormal color

Some additional commit info:
Merge: 2922f71 8f79027
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Fri Nov 29 15:52:10 2013 +0100

    Merge remote-tracking branch 'origin/topic/core-stuff' into drm-intel-nightly


Bug detailed description:
-----------------------------
The video color is abnormal while playing video by command 'mplayer -vo xv MPEG-2.mpeg', please check the difference in attachment pictures. 

This is the first time to run igt test on Broadwell.

Steps:
---------------------------
1. xinit &
2. mplayer -vo xv /home/testframework/MPEG-2.mpeg

The reference picture is snapped by command 'mplayer -vo fbdev2 /home/testframework/MPEG-2.mpeg'
Comment 1 Guo Jinxian 2013-12-02 08:40:47 UTC
Created attachment 90087 [details]
abnormal color
Comment 2 Guo Jinxian 2013-12-02 08:41:37 UTC
Created attachment 90088 [details]
Normal color
Comment 3 Guo Jinxian 2013-12-02 08:42:01 UTC
Created attachment 90089 [details]
dmesg
Comment 4 Guo Jinxian 2013-12-02 08:42:35 UTC
Created attachment 90090 [details]
xorg log
Comment 5 Chris Wilson 2013-12-02 09:02:15 UTC
Looks like an error in the secondary sprite plane handling.
Comment 6 Ville Syrjala 2013-12-02 09:18:55 UTC
(In reply to comment #5)
> Looks like an error in the secondary sprite plane handling.

Wouldn't that require "-vo xv:adaptor=1" on the mplayer cmdline? Or are we lacking gen8 textured video code (no xvinfo output included so I can't tell what's being used here)?
Comment 7 Guo Jinxian 2013-12-06 03:48:56 UTC
Created attachment 90330 [details]
vxiinfo
Comment 8 Guo Jinxian 2013-12-16 05:29:44 UTC
We tried to play h264 video file with the same parameters, the color was error too.
Comment 9 ykzhao 2014-02-24 03:12:46 UTC
(In reply to comment #6)
> (In reply to comment #5)
> Looks like an error in the secondary sprite plane
> handling.

Wouldn't that require "-vo xv:adaptor=1" on the mplayer cmdline?
> Or are we lacking gen8 textured video code (no xvinfo output included so I
> can't tell what's being used here)?

Yes. This is related with that the texutred Xv is not added for gen8.
Comment 10 Chris Wilson 2014-02-24 09:19:51 UTC
Note that currently bdw should support both sprite- and texture-based Xv playback now.
Comment 11 ykzhao 2014-02-25 06:34:19 UTC
(In reply to comment #10)
> Note that currently bdw should support both sprite- and texture-based Xv
> playback now.

Thanks for the clarification. And your efforts are appreciated. 
I check it on BDW. And the textured XV can work as expected.

Hi, JinXian
     Will you please double check it again?

Thanks.
Comment 12 Guo Jinxian 2014-02-25 07:03:08 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > Note that currently bdw should support both sprite- and texture-based Xv
> > playback now.
> 
> Thanks for the clarification. And your efforts are appreciated. 
> I check it on BDW. And the textured XV can work as expected.
> 
> Hi, JinXian
>      Will you please double check it again?
> 
> Thanks.

Yes, it works well now on latest drm-intel-nightly(1be8f2b4dd6d3db00af24d4891c82d2650bd282d), thanks.
Comment 13 Chris Wilson 2014-02-25 07:41:18 UTC
Can you please now test with "mplayer -vo xv:adaptor=1 MPEG-2.mpeg" to see if the original problem with the sprites being miscolored is still true?
Comment 14 Guo Jinxian 2014-02-25 07:46:00 UTC
(In reply to comment #13)
> Can you please now test with "mplayer -vo xv:adaptor=1 MPEG-2.mpeg" to see
> if the original problem with the sprites being miscolored is still true?

Yes, with command "mplayer -vo xv:adaptor=1 MPEG-2.mpeg", the miscolored problem still can be reproduced.
Comment 15 Ville Syrjala 2014-03-03 15:48:11 UTC
I tested this myself and it does look like the hardware is simply doing something wrong. I didn't find any magic bit to fix it. Need to poke at some hardware folks...
Comment 16 Ben Widawsky 2014-03-25 04:13:23 UTC
This should be fixed now. Please confirm.
Comment 17 Chris Wilson 2014-03-25 08:00:36 UTC
Don't think so, Ville found out what was going wrong, but as yet there have been no patches.
Comment 18 Ben Widawsky 2014-03-25 16:29:29 UTC
Isn't it:

commit b934e3839c15da95f9d5fd8fe29fbb04774d15c3
Author: Ville Syrj?l? <ville.syrjala@linux.intel.com>
Date:   Wed Mar 5 13:05:45 2014 +0200

    drm/i915: Don't clobber CHICKEN_PIPESL_1 on BDW
Comment 19 Chris Wilson 2014-03-25 16:33:03 UTC
Yes, apologies I missed it when looking for recent commits from Ville.


commit c7c656226842679bcd9f39dc24441b4ff398a850
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date:   Wed Mar 5 13:05:45 2014 +0200

    drm/i915: Don't clobber CHICKEN_PIPESL_1 on BDW
    
    Misplaced parens cause us to totally clobber the CHICKEN_PIPESL_1
    registers with 0xffffffff. Move the parens to the correct place
    to avoid this.
    
    In particular this caused bit 30 of said registers to be set, which
    caused the sprite CSC to produce incorrect results.
    
    Cc: stable@vger.kernel.org
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72220
    Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Comment 20 Guo Jinxian 2014-03-27 03:12:41 UTC
checked on latest -nightly(07071a9d41aed59f4f2ba66afb82ec35557a80c1), this bug still can be reproduce.
Comment 21 Ville Syrjala 2014-04-14 17:25:12 UTC
(In reply to comment #20)
> checked on latest -nightly(07071a9d41aed59f4f2ba66afb82ec35557a80c1), this
> bug still can be reproduce.

Are you still seeing this?

Also what's the problem with BYT and HSW?
Comment 22 Guo Jinxian 2014-04-16 02:01:38 UTC
Created attachment 97438 [details]
mplayer dmesg on HSW-M

This bug still can be reproduce on latest -nightly(8c7da4ebd7c0aa6f24a558634f6f59204cf65c0b), This bug is able to reproduce on BYT and HSW too.
Comment 23 Ville Syrjala 2014-04-16 08:16:01 UTC
(In reply to comment #22)
> Created attachment 97438 [details]
> mplayer dmesg on HSW-M
> 
> This bug still can be reproduce on latest
> -nightly(8c7da4ebd7c0aa6f24a558634f6f59204cf65c0b), This bug is able to
> reproduce on BYT and HSW too.

Is the exact same color issue, or something else?

Can you take a picture with a camera?
Comment 24 Guo Jinxian 2014-04-16 08:55:22 UTC
Created attachment 97458 [details]
adaptor=0
Comment 25 Guo Jinxian 2014-04-16 08:55:55 UTC
Created attachment 97459 [details]
adaptor=1
Comment 26 Guo Jinxian 2014-04-16 08:58:05 UTC
(In reply to comment #23)
> (In reply to comment #22)
> > Created attachment 97438 [details]
> > mplayer dmesg on HSW-M
> > 
> > This bug still can be reproduce on latest
> > -nightly(8c7da4ebd7c0aa6f24a558634f6f59204cf65c0b), This bug is able to
> > reproduce on BYT and HSW too.
> 
> Is the exact same color issue, or something else?
> 
> Can you take a picture with a camera?

I uploaded two pictures. you can check the difference between adaptor=1 and adaptor=0. thanks.
Comment 27 Guo Jinxian 2014-04-16 09:03:51 UTC
Created attachment 97460 [details]
adaptor=1
Comment 28 Ville Syrjala 2014-04-16 11:37:27 UTC
(In reply to comment #26)
> (In reply to comment #23)
> > (In reply to comment #22)
> > > Created attachment 97438 [details]
> > > mplayer dmesg on HSW-M
> > > 
> > > This bug still can be reproduce on latest
> > > -nightly(8c7da4ebd7c0aa6f24a558634f6f59204cf65c0b), This bug is able to
> > > reproduce on BYT and HSW too.
> > 
> > Is the exact same color issue, or something else?
> > 
> > Can you take a picture with a camera?
> 
> I uploaded two pictures. you can check the difference between adaptor=1 and
> adaptor=0. thanks.

I don't see any significant color difference there. The sprite case looks to have some kind of moire stuff there but I'm not sure if that's due to the camera or display. In any case it looks nothing like the BDW issue this bug is about.

Also I can't see any color problems on my HSW machine here.

I think I'm going to need a better description of the problem before I can proceed.
Comment 29 Guo Jinxian 2014-04-18 01:02:58 UTC
Created attachment 97550 [details]
snapshot
Comment 30 Guo Jinxian 2014-04-18 01:07:44 UTC
(In reply to comment #28)
> (In reply to comment #26)
> > (In reply to comment #23)
> > > (In reply to comment #22)
> > > > Created attachment 97438 [details]
> > > > mplayer dmesg on HSW-M
> > > > 
> > > > This bug still can be reproduce on latest
> > > > -nightly(8c7da4ebd7c0aa6f24a558634f6f59204cf65c0b), This bug is able to
> > > > reproduce on BYT and HSW too.
> > > 
> > > Is the exact same color issue, or something else?
> > > 
> > > Can you take a picture with a camera?
> > 
> > I uploaded two pictures. you can check the difference between adaptor=1 and
> > adaptor=0. thanks.
> 
> I don't see any significant color difference there. The sprite case looks to
> have some kind of moire stuff there but I'm not sure if that's due to the
> camera or display. In any case it looks nothing like the BDW issue this bug
> is about.
> 
> Also I can't see any color problems on my HSW machine here.
> 
> I think I'm going to need a better description of the problem before I can
> proceed.

Sorry, I mean here has blue borders upper and lower of the screen while playing video with parameter "adaptor=1", but the blue borders haven't with "adaptor=0"  .
Please check the snapshot for details. thanks.
Comment 31 Ville Syrjala 2014-05-04 12:43:07 UTC
(In reply to comment #30)
> (In reply to comment #28)
> > (In reply to comment #26)
> > > (In reply to comment #23)
> > > > (In reply to comment #22)
> > > > > Created attachment 97438 [details]
> > > > > mplayer dmesg on HSW-M
> > > > > 
> > > > > This bug still can be reproduce on latest
> > > > > -nightly(8c7da4ebd7c0aa6f24a558634f6f59204cf65c0b), This bug is able to
> > > > > reproduce on BYT and HSW too.
> > > > 
> > > > Is the exact same color issue, or something else?
> > > > 
> > > > Can you take a picture with a camera?
> > > 
> > > I uploaded two pictures. you can check the difference between adaptor=1 and
> > > adaptor=0. thanks.
> > 
> > I don't see any significant color difference there. The sprite case looks to
> > have some kind of moire stuff there but I'm not sure if that's due to the
> > camera or display. In any case it looks nothing like the BDW issue this bug
> > is about.
> > 
> > Also I can't see any color problems on my HSW machine here.
> > 
> > I think I'm going to need a better description of the problem before I can
> > proceed.
> 
> Sorry, I mean here has blue borders upper and lower of the screen while
> playing video with parameter "adaptor=1", but the blue borders haven't with
> "adaptor=0"  .
> Please check the snapshot for details. thanks.

I would guess that's just because HSW/BYT sprites don't support scaling. So the video aspect ratio doesn't match the display aspect ratio and mplayer tries to scale the video to the proper aspect ratio, but the hardware can't actually do that. Currently we have no way to tell userspace that the sprite doesn't support scaling.

Closing this bug as fixed.
Comment 32 Chris Wilson 2014-05-04 15:09:27 UTC
mplayer asks what the best size is for a particular video frame - we obviously report no scaling and so expect mplayer to fill the entire output. Maybe this

static int sna_video_sprite_best_size(ClientPtr client,
                                      XvPortPtr port,
                                      CARD8 motion,
                                      CARD16 vid_w, CARD16 vid_h,
                                      CARD16 drw_w, CARD16 drw_h,
                                      unsigned int *p_w,
                                      unsigned int *p_h)
{
        struct sna_video *video = port->devPriv.ptr;
        struct sna *sna = video->sna;

        if (sna->kgem.gen >= 075) {
                *p_w = vid_w;
                *p_h = vid_h;
        } else {
                *p_w = drw_w;
                *p_h = drw_h;
        }

        return Success;
}

is garbage?
Comment 33 Chris Wilson 2014-05-04 15:10:08 UTC
Hmm, should that really be >= 071 then? Or maybe < 071?
Comment 34 Ville Syrjala 2014-05-07 18:58:44 UTC
(In reply to comment #33)
> Hmm, should that really be >= 071 then? Or maybe < 071?

Yeah >=071 seems like the right choice here. But that won't help mplayer as it doesn't use XvQueryBestSize(). I cooked up a quick and dirty patch to make it do that and it then it falls back to using swscale. But I'm not sure if such a patch would be OK for upstream since the best size query is more of a hint, and if the driver author was more worried about quality than anything else it might reject the scaling request. Based on a quick look at all the open source drivers only tdfx would fall back to swscale for downscaling with my patch, the rest would seem unaffected. And I have no idea what the closed source drivers would do.
Comment 35 Ville Syrjala 2014-05-07 19:01:02 UTC
Created attachment 98639 [details] [review]
[PATCH] vo_xv: Check whether the Xv adaptor/port supports scaling

Here's my mplayer patch for reference. I guess I could post it to mplayer-dev-eng and see what happens...
Comment 36 Guang Yang 2014-05-16 06:52:13 UTC
Chris&Ville, can QA close this bug?
Comment 37 Chris Wilson 2014-05-16 10:59:03 UTC
Yes, the remaining colorkeying looks to be a mplayer issue.
Comment 38 Guo Jinxian 2014-05-19 00:55:10 UTC
(In reply to comment #37)
> Yes, the remaining colorkeying looks to be a mplayer issue.

Verified according the comment.
Comment 39 Elizabeth 2017-10-06 14:41:38 UTC
Closing old verified.


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.