Bug 73016 - Wrong colors with x264 vaapi playback
Summary: Wrong colors with x264 vaapi playback
Status: RESOLVED FIXED
Alias: None
Product: libva
Classification: Unclassified
Component: intel (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium major
Assignee: haihao
QA Contact: Sean V Kelley
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-24 15:51 UTC by Mark Lee
Modified: 2013-12-30 05:21 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Adjust the default value for contrast/saturation (461 bytes, patch)
2013-12-25 08:16 UTC, haihao
Details | Splinter Review
hardware (2.18 KB, text/plain)
2013-12-27 02:35 UTC, Mark Lee
Details
disable color balance temporarily on Sandybridge (568 bytes, patch)
2013-12-27 04:54 UTC, haihao
Details | Splinter Review
Bypass color balance transformation in another way (1.00 KB, patch)
2013-12-30 02:43 UTC, haihao
Details | Splinter Review

Description Mark Lee 2013-12-24 15:51:13 UTC
What steps will reproduce the problem?
1. Playback a x264 video using gnome-mplayer with vaapi acceleration and  libva-intel-driver-1.2.2-1

What is the expected output? What do you see instead?
I expect the colors to be correct; instead I get mixed up colors.

What version of the product are you using? On what operating system?
Arch Linux-64-bit (3.12.5-1-ARCH)
libva-intel-driver-1.2.2.-1

Please provide any additional information below.
Please see bug report at Arch Linux :
https://bugs.archlinux.org/task/38240

Please see bug report at gnome-mplayer:
http://code.google.com/p/gnome-mplayer/issues/detail?id=707
Comment 1 haihao 2013-12-25 08:16:25 UTC
Created attachment 91183 [details] [review]
Adjust the default value for contrast/saturation

Could you giva a try to the patch ?
Comment 2 Mark Lee 2013-12-25 13:21:17 UTC
I applied the patch and it didn't work. Colors were still incorrect.
Comment 3 haihao 2013-12-27 00:29:57 UTC
Could you attach the output of 'lspci -nn', I want to know what is your HW.
Comment 4 haihao 2013-12-27 00:33:06 UTC
Your are using mplayer-vaapi, right ? Can you get the right color if running the following command:

mplayer -vo vaapi -brightness 0  -contrast 0 -hue 0 -saturation 0 <video file>
Comment 5 Mark Lee 2013-12-27 02:35:12 UTC
Created attachment 91206 [details]
hardware

output of lscpi -nn
Comment 6 Mark Lee 2013-12-27 02:35:34 UTC
I am using mplayer-vaapi; the mplayer command didn't change the color issue.
Comment 7 Mark Lee 2013-12-27 02:35:50 UTC
I can reproduce this error on sandybridge and ironlake hardware (it's all I use).
Comment 8 haihao 2013-12-27 04:50:20 UTC
I can reproduce the issue on Sandybridge, but after applying the patch, the issue disappears.  Could you double-check whether the right driver is used ?
Comment 9 haihao 2013-12-27 04:54:55 UTC
Created attachment 91208 [details] [review]
disable color balance temporarily on Sandybridge

The patch disables color balance totally on Sandybridge, it is only for testing. Can you get the right color after apply this patch ?
Comment 10 Mark Lee 2013-12-27 23:10:32 UTC
I have tested your patch and the color is still messed up.
Comment 11 Mark Lee 2013-12-27 23:20:26 UTC
I have checked the driver and I am sure it's the right one. See below for the output of vainfo :

libva info: VA-API version 0.34.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_34
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.34 (libva 1.2.1)
vainfo: Driver version: Intel i965 driver - 1.2.2
vainfo: Supported profile and entrypoints
      VAProfileNone                   :	VAEntrypointVideoProc
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
Comment 12 haihao 2013-12-30 00:43:47 UTC
Can you reproduce the issue with 1.2.1 ?

http://www.freedesktop.org/software/vaapi/releases/libva-intel-driver/libva-intel-driver-1.2.1.tar.bz2
Comment 13 Lizhong 2013-12-30 00:44:13 UTC
Annual Leave on Dec.30/31, 2013. Please expect delayed email response.
Comment 14 Mark Lee 2013-12-30 01:14:35 UTC
No, mplayer-vaapi 1.2.1 doesn't have the color issue.
Comment 15 haihao 2013-12-30 02:43:01 UTC
Created attachment 91312 [details] [review]
Bypass color balance transformation in another way

The patch bypasses color balance in another way and changes the version information as well.  I am pretty sure the issue is caused by color balance in vaPutSurface().   Could you help to check the following questions after applying the patch ?

1.  Is the driver version shown by vainfo 1.2.3.pre1 ?

2.  Do vainfo and mplayer show the same driver path ?
Comment 16 haihao 2013-12-30 02:46:11 UTC
I have no idea about the issue if the above patch still doesn't work for you :(. Because this is a regression, could you help to do a bisect between 1.2.1 and 1.2.2 to find the bad commit ?
Comment 17 Mark Lee 2013-12-30 03:46:47 UTC
You my good buddy are a treasure! Your patch worked and the color seems fine now! Here's the output of my vainfo:

vainfo: VA-API version: 0.34 (libva 1.2.1)
vainfo: Driver version: Intel i965 driver - 1.2.3.pre1
vainfo: Supported profile and entrypoints
      VAProfileNone                   :	VAEntrypointVideoProc
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSlice
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSlice
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
Comment 18 Mark Lee 2013-12-30 03:52:41 UTC
I just figured out a big issue that's not related to vaapi. The makepkg script in Arch Linux was not reporting that patches were properly applied so the first patch didn't work. I identified this issue and successfully applied the second patch. Now that I've applied the first patch; it works too! I apologize for the inconvenience; thanks for the help!
Comment 19 haihao 2013-12-30 05:21:13 UTC
commit 54cb60f3d973ce6a908ea57f5aa7481803fe653a
Author: Xiang, Haihao <haihao.xiang@intel.com>
Date:   Mon Dec 30 13:15:40 2013 +0800

    Render: Adjust the default value for contrast/saturation
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73016
    Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
    Tested-by: Mark Lee <mark@markelee.com>


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.