Bug 93499

Summary: daf8f6c762874 introduced display corruption on i3 330M
Product: libva Reporter: benisty.e
Component: intelAssignee: PengChen <peng.c.chen>
Status: RESOLVED FIXED QA Contact: Sean V Kelley <seanvk>
Severity: major    
Priority: medium CC: tlinux
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: lspci -nn
a patch for testing

Description benisty.e 2015-12-25 09:07:19 UTC
The following commit introduced some display corruption on my machine (core i3-330M):

commit daf8f6c76287452f2bc37af83d9078831ba0a8b0
Author: Peng Chen <peng.c.chen@intel.com>
Date:   Mon Jun 15 22:28:22 2015 +0800

    support HEVC 10bits decoding

    v2: code cleanup

    v3: store shift in an int to make it more readable (Emil)

A screenshot of the issue is available here (green squares on the
right hand of the image): http://imgur.com/sxcfusK

libva: HEAD of v1.6-branch
intel-driver: HEAD of v1.6-branch
xorg-server: 1.18.0
xorg-xf86-video-intel: HEAD of git master
ffmpeg: 2.8.4
mpv: HEAD of git master

Steps to reproduce the issue:
Play any file using vaapi hw acceleration (mpv -vo=vaapi -hwdec=vaapi file)
Comment 1 haihao 2015-12-28 01:30:16 UTC
Could you attach the output of 'lspci -nn'
Comment 2 benisty.e 2015-12-28 17:06:53 UTC
Created attachment 120716 [details]
lspci -nn
Comment 3 Tomasz C. 2015-12-28 22:23:04 UTC
The same problem on Intel Core i5-450M

After upgrade:
libva (1.6.1-1 -> 1.6.2-1)
libva-intel-driver (1.6.1-1 -> 1.6.2-1)
Comment 4 PengChen 2016-01-04 05:53:37 UTC
@@ -3825,17 +3829,17 @@ i965_check_alloc_surface_bo(VADriverContextP ctx,

     int bpp_1stplane = bpp_1stplane_by_fourcc(fourcc);

-    if (obj_surface->user_h_stride_set) {
-        ASSERT_RET(IS_ALIGNED(obj_surface->width, 128), VA_STATUS_ERROR_INVALID
-    } else
-        obj_surface->width = ALIGN(obj_surface->orig_width * bpp_1stplane, 128)
+    if ((tiled && !obj_surface->user_disable_tiling)) {
+      if (obj_surface->user_h_stride_set) {
+          ASSERT_RET(IS_ALIGNED(obj_surface->width, 128), VA_STATUS_ERROR_INVAL
+      } else
+          obj_surface->width = ALIGN(obj_surface->orig_width * bpp_1stplane, 12

-    if (obj_surface->user_v_stride_set) {
-        ASSERT_RET(IS_ALIGNED(obj_surface->height, 32), VA_STATUS_ERROR_INVALID
-    } else
-        obj_surface->height = ALIGN(obj_surface->orig_height, 32);
+      if (obj_surface->user_v_stride_set) {
+          ASSERT_RET(IS_ALIGNED(obj_surface->height, 32), VA_STATUS_ERROR_INVAL
+      } else
+          obj_surface->height = ALIGN(obj_surface->orig_height, 32);

-    if ((tiled && !obj_surface->user_disable_tiling)) {
         ASSERT_RET(fourcc != VA_FOURCC_I420 &&
                fourcc != VA_FOURCC_IYUV &&
                fourcc != VA_FOURCC_YV12,

hi benisty, could you help me to try above patch for i965_drv_video.c?
Comment 5 benisty.e 2016-01-04 10:12:09 UTC
I'd be pleased to try your patch but could you please attach it ? the copy/paste patch is horribly broken, thanks.
Comment 6 PengChen 2016-01-05 00:55:31 UTC
Created attachment 120803 [details]
a patch for testing
Comment 7 benisty.e 2016-01-05 07:01:25 UTC
(In reply to PengChen from comment #6)
> Created attachment 120803 [details]
> a patch for testing

That patch fixed the issue, thank you very much.
Comment 8 Tomasz C. 2016-01-05 09:19:08 UTC
On Intel Core i5-450M this patch also fixes a bug.

Thank you!
Comment 9 haihao 2016-01-11 08:37:23 UTC
commit 10c4cdd103f730a9e07ffcf0f940e8f63ee5738d
Author: peng.chen <peng.c.chen@intel.com>
Date:   Thu Jan 7 08:54:34 2016 +0800

    only re-caculate surface width&height for tiled surface

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.