OSDN Git Service

android-x86/hardware-intel-common-vaapi.git
9 years agoBump version to 1.4.2.pre1
Xiang, Haihao [Fri, 14 Nov 2014 08:35:08 +0000 (16:35 +0800)]
Bump version to 1.4.2.pre1

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
(cherry picked from commit 0428d5285f2c4f3013ad7f1c007cca4122dac124)

Conflicts:
configure.ac

9 years agovpp: fix check for non-linear anamorphic scaling on Sandybridge.
Gwenole Beauchesne [Thu, 30 Oct 2014 14:13:05 +0000 (15:13 +0100)]
vpp: fix check for non-linear anamorphic scaling on Sandybridge.

Fix pp_nv12_avs_initialize() to disable non-linear anamorphic scaling
when not actually requested on Sandybridge. This is now the main entry
point for advanced video scaling there, so the actual scaling mode is
checked for beforehand.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovpp: enable advanced video scaling in VPP pipelines too.
Gwenole Beauchesne [Mon, 13 Oct 2014 16:30:23 +0000 (18:30 +0200)]
vpp: enable advanced video scaling in VPP pipelines too.

Honour advanced video scaling. i.e. propagate vaPutSurface() scaling
flags, but also VPP filter flags. Also enable the sharp 8x8 filter for
high-quality scaling options, while adaptive video scaling is disabled
(bypassed) for now.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovpp: drop internal postprocessing (I965_PP_xxx) flags.
Gwenole Beauchesne [Mon, 13 Oct 2014 15:58:46 +0000 (17:58 +0200)]
vpp: drop internal postprocessing (I965_PP_xxx) flags.

Exclusively use VA-API defined video processing flags, instead of yet
redefining another set with limited use. This means that we can use
scaling, colorspace and picture structure flags as is, without an extra
layer of conversion.

Drop I965_PP_FLAG_MCDI (motion compensated deinterlacing), which was
never set. Dropped the associated dead code, which was never used. And,
anyway, advanced deinterlacing modes shall go through the explcit VPP
interfaces.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovpp: cache calculation of AVS coefficients.
Gwenole Beauchesne [Mon, 13 Oct 2014 15:30:10 +0000 (17:30 +0200)]
vpp: cache calculation of AVS coefficients.

If scaling parameters don't change, i.e. if the same scaling algorithm
and factors are used, there is no point in calculating the filter
coefficients again. So, just cache them into the existing AVS context.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovpp: validate AVS filter coefficients for debugging purposes.
Gwenole Beauchesne [Mon, 13 Oct 2014 14:50:59 +0000 (16:50 +0200)]
vpp: validate AVS filter coefficients for debugging purposes.

Make sure the newly calculated filter coefficients fall into the HW
accepted range of values. This normally should not be an issue with
the current configuration / scaling algorithms though.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovpp: add support for high-quality scaling.
Gwenole Beauchesne [Mon, 13 Oct 2014 14:19:19 +0000 (16:19 +0200)]
vpp: add support for high-quality scaling.

Add support for high-quality scaling during video processing. This is
enabled with the VA_FILTER_SCALING_HQ filter flag. The algorithm used
for that is based on a Lanczos convolution kernel: 3 lobes on either
side for luma samples, and 2 lobes on either side for chroma samples.

v2: fixed rounding precision for normalized coefficients.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovpp: factor out calculation of AVS coefficients.
Gwenole Beauchesne [Mon, 13 Oct 2014 13:56:15 +0000 (15:56 +0200)]
vpp: factor out calculation of AVS coefficients.

Split calculation of AVS coefficients into separate helper functions
in view to supporting alternate algorithms, but we stick to bilinear
interpolation for now.

Actually fix bilinear filtering coefficients if the sharp 8x8 filter
is used. This is still disabled by default though.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovpp: fix AVS coefficients for Broadwell.
Gwenole Beauchesne [Mon, 13 Oct 2014 13:49:08 +0000 (15:49 +0200)]
vpp: fix AVS coefficients for Broadwell.

Fix AVS filter coefficients for Broadwell. At least, we now address
the expected entry in the table but the actual value is still not
viable enough.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovpp: fix adaptive filter for all channels flag (< Haswell).
Gwenole Beauchesne [Mon, 13 Oct 2014 13:17:10 +0000 (15:17 +0200)]
vpp: fix adaptive filter for all channels flag (< Haswell).

The "Adaptive filter for all channels" bit for AVS on Ironlake up to
including Ivybridge/Baytrail is not located in DW137, but rather in
the first table of coefficients for chroma samples.

Thus, split the SAMPLER_STATE_8x8 message DW137 into parts relevant
to Haswell and newer generations ("hsw"), and to the legacy platforms
down to Ironlake ("ilk").

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agoAdd one hook list to disable encoding on some Ivybridge machines
Zhao Yakui [Tue, 11 Nov 2014 04:25:52 +0000 (12:25 +0800)]
Add one hook list to disable encoding on some Ivybridge machines

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Daniel Charles <daniel.charles@intel.com>
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
Signed-off-by: Ram Mohan Satyanarayana <ram.mohanx.satyanarayana@intel.com>
(cherry picked from commit 71a431b04ea04b93ba8f32e95fa545b30726bf59)

9 years agoAdd one hook list to disable encoding on some Sandybridge machines
Zhao Yakui [Tue, 11 Nov 2014 04:25:48 +0000 (12:25 +0800)]
Add one hook list to disable encoding on some Sandybridge machines

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Daniel Charles <daniel.charles@intel.com>
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
Signed-off-by: Ram Mohan Satyanarayana <ram.mohanx.satyanarayana@intel.com>
(cherry picked from commit 080784f57f48c517d7a672b23b6d07278b232660)

9 years agoAdd final header to fix 'make dist'
Emil Velikov [Thu, 18 Sep 2014 16:45:47 +0000 (17:45 +0100)]
Add final header to fix 'make dist'

Add the autogenerated header wayland-drm-client-protocol.h to
noinst_HEADERS thus silence 'make distcheck' about about it being
left out.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoUse python2 to execute gpp.py
Emil Velikov [Thu, 18 Sep 2014 16:45:46 +0000 (17:45 +0100)]
Use python2 to execute gpp.py

Under Archlinux python points to python3, which results in
assertion while generating the gen5-6 files.

make[5]: Entering directory

'/home/emil/development/intel-driver/src/shaders/post_processing/gen5_6'
    GEN      nv12_avs_nv12.g5s
  Traceback (most recent call last):
    File "../../../../src/shaders/gpp.py", line 200, in <module>
      writeblocks(outfile, blocks)
    File "../../../../src/shaders/gpp.py", line 168, in writeblocks
      do_writeblock(block, [])
    File "../../../../src/shaders/gpp.py", line 161, in do_writeblock
      while check_cond(block.param_op, for_curs[0], block.param_limit):
    File "../../../../src/shaders/gpp.py", line 139, in check_cond
      assert type(lim) == int
  AssertionError
    GEN      nv12_avs_nv12.g4b.gen5
  nv12_avs_nv12.g5s: 1: syntax error at ""
  Makefile:617: recipe for target 'nv12_avs_nv12.g4b.gen5' failed

Check at configure time for python2, and fall-back to python.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoDo not overlink i965_drv_video
Emil Velikov [Thu, 18 Sep 2014 16:45:45 +0000 (17:45 +0100)]
Do not overlink i965_drv_video

The va backend does not use any of the libva functions.
As such there is no need to link against it.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agopost-processing: fix out of tree builds
Emil Velikov [Thu, 18 Sep 2014 16:45:44 +0000 (17:45 +0100)]
post-processing: fix out of tree builds

 - add missing prefix for gpp.py
 - include the source directories, rather than the build ones.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoshaders: fix out of tree builds
Emil Velikov [Thu, 18 Sep 2014 16:45:43 +0000 (17:45 +0100)]
shaders: fix out of tree builds

 - correctly set include dir
 - prefix the file 'list' - it's located in the source folder
 - add missing prefix for gpp.py

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodebian: cleanup control & changelog on 'make dist'
Emil Velikov [Thu, 18 Sep 2014 16:45:42 +0000 (17:45 +0100)]
debian: cleanup control & changelog on 'make dist'

Move the files from maintainer~ to dist(cleanfiles)
The former is implicitly included by the latter. 'make dist' is not
fully working yet this brings us a step closer.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoconfigure: use ${libdir} over the hardcoded /usr/lib
Emil Velikov [Thu, 18 Sep 2014 16:45:41 +0000 (17:45 +0100)]
configure: use ${libdir} over the hardcoded /usr/lib

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoconfigure: use top_builddir for wayland_scanner_rules
Emil Velikov [Thu, 18 Sep 2014 16:45:40 +0000 (17:45 +0100)]
configure: use top_builddir for wayland_scanner_rules

Autotools already copies the files appropriately, and using
top_srcdir causes the files to be generated in the source
tree rather than the build one.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoautogen.sh: fix out of tree invocation
Emil Velikov [Thu, 18 Sep 2014 16:45:39 +0000 (17:45 +0100)]
autogen.sh: fix out of tree invocation

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoCall preinit_hw_codec callback after successful initialization to avoid segment fault...
Zhao Yakui [Thu, 30 Oct 2014 00:21:39 +0000 (08:21 +0800)]
Call preinit_hw_codec callback after successful initialization to avoid segment fault issue on unsupported platform

Reported-by: Nicholas Andrade <sdnick484@yahoo.com>
Tested-by: Nicholas Andrade <sdnick484@yahoo.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
(cherry picked from commit 12d1be8fee694f60698e2ce277afff89d029f836)

9 years agovebox: fix denoising when IECP is enabled.
Gwenole Beauchesne [Wed, 20 Aug 2014 14:33:25 +0000 (16:33 +0200)]
vebox: fix denoising when IECP is enabled.

If IECP is enabled, for instance when color conversion is performed
or ProcAmp adjustments are applied, the ultimate denoised output with
additional processing operations applied is the Current Output frame,
not the plain Current Denoised Output frame.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovebox: fix memory leak of VEBOX state tables.
Gwenole Beauchesne [Tue, 26 Aug 2014 15:49:05 +0000 (17:49 +0200)]
vebox: fix memory leak of VEBOX state tables.

This occurs after a while (~10-20 minutes) when video processing is
used, and deinterlacing in particular. At some point, GPU memory is
exhausted and we start error'ing out to upper layers.

https://bugzilla.gnome.org/show_bug.cgi?id=731460#c31

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovebox: use Y-tiling for internal VEBOX surfaces.
Gwenole Beauchesne [Tue, 19 Aug 2014 15:25:17 +0000 (17:25 +0200)]
vebox: use Y-tiling for internal VEBOX surfaces.

Always use Y-tiling in native surface format for performance reasons.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovebox: add support for advanced deinterlacing.
Gwenole Beauchesne [Tue, 12 Aug 2014 13:28:40 +0000 (15:28 +0200)]
vebox: add support for advanced deinterlacing.

Reintegrate Motion Adaptive Deinterlacing (MADI) and Motion Compensated
Deinterlacing (MCDI) support. This is totally reworked so that to allow
for bob-deinterlacing if no previous frame was supplied, improve global
robustness, and ensure that the right surface storage are used, which
is the most important fix.

https://bugs.freedesktop.org/show_bug.cgi?id=79698
https://bugs.freedesktop.org/show_bug.cgi?id=79528

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovebox: factor out deinterlacing code, drop broken MADI/MCDI support.
Gwenole Beauchesne [Mon, 11 Aug 2014 11:55:37 +0000 (13:55 +0200)]
vebox: factor out deinterlacing code, drop broken MADI/MCDI support.

Completely rework the VEBOX code to factor out and improve the various
deinterlacing algorithms in particular. Introduce temporary variables
that are going to be live for the current VPP processing call.

Drop MADI/MCDI support for now, as it never really worked.

Initial focus was to definitively fix first vs. second field detection
code, thus allowing for multiple VEBOX calls with an additional format
conversion away.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovebox: robustify frame store surface storage allocations.
Gwenole Beauchesne [Mon, 11 Aug 2014 12:37:41 +0000 (14:37 +0200)]
vebox: robustify frame store surface storage allocations.

Clean-up frame store surface storage allocation, rename the helper
function to gen75_vebox_ensure_surfaces_storage() and make it more
robust to allocation errors. i.e. propagate them up right away.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovebox: factor out initialization of pipeline parameters.
Gwenole Beauchesne [Mon, 11 Aug 2014 11:52:31 +0000 (13:52 +0200)]
vebox: factor out initialization of pipeline parameters.

Factor out initialization and validation of pipeline parameters.
In particular, introduce a new gen75_vebox_init_pipe_params() helper
function that initializes the filters mask and ensures the supplied
filters are going to be supported.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovebox: clean-up frame store initialization.
Gwenole Beauchesne [Mon, 11 Aug 2014 09:44:12 +0000 (11:44 +0200)]
vebox: clean-up frame store initialization.

Rename FRAME_STORE_SUM to FRAME_STORE_COUNT, use existing macros to
determine the number of elements in the frame store array, avoid
duplicate zero initializations.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovebox: fix invalid conversion and scaling params order.
Gwenole Beauchesne [Mon, 11 Aug 2014 14:44:31 +0000 (16:44 +0200)]
vebox: fix invalid conversion and scaling params order.

The arguments to vpp_surface_convert() were mixed up. i.e. both input
and output surfaces were reversed. Changed the vpp_surface_scaling()
arguments order as well to have more consistent helper functions.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovebox: fix order of submitted commands.
Gwenole Beauchesne [Fri, 8 Aug 2014 08:45:53 +0000 (10:45 +0200)]
vebox: fix order of submitted commands.

For each frame, the Intel HD Graphics hardware specification mandates
that the following commands should be submitted, in-order: VEBOX_STATE,
VEBOX_SURFACE_STATE(input), VEBOX_SURFACE_STATE(output), VEB_DI_IECP.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovebox: fix indication of field ordering in sequence.
Gwenole Beauchesne [Fri, 8 Aug 2014 08:35:14 +0000 (10:35 +0200)]
vebox: fix indication of field ordering in sequence.

VEBOX_DNDI_STATE::dndi_top_first indicates whether the top field is
first in sequence (TFF), or if the bottom field comes first. This is
an indication of the temporal sequence for input frames, available
in the "history" buffer. As such, the correct flag to check against,
from a VA-API perspective, is VA_DEINTERLACING_BOTTOM_FIELD_FIRST.

https://bugs.freedesktop.org/show_bug.cgi?id=72518
https://bugs.freedesktop.org/show_bug.cgi?id=72522

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovebox: drop magic numbers in filters mask.
Gwenole Beauchesne [Fri, 8 Aug 2014 13:06:10 +0000 (15:06 +0200)]
vebox: drop magic numbers in filters mask.

Use the existing VPP_{DNDI,IECP}_xxx flags instead of magic numbers.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovebox: silence compilation warning.
Gwenole Beauchesne [Fri, 8 Aug 2014 09:30:25 +0000 (11:30 +0200)]
vebox: silence compilation warning.

Silence the following compilation warning:
  CC     i965_drv_video_la-gen75_vpp_vebox.lo
gen75_vpp_vebox.c: In function 'bdw_veb_dndi_iecp_command':
gen75_vpp_vebox.c:1537:5: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]

Also simplify the calculation of the VEB_DI_IECP::endingX variable
with existing helper macros.

v2: renamed endingX to width64, which represents the width aligned
  on to 64 columns, dropped obsolete startingX [Yakui]

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years ago1.4.1.pre1 for development
Xiang, Haihao [Tue, 30 Sep 2014 04:30:08 +0000 (12:30 +0800)]
1.4.1.pre1 for development

Sync news from V1.4-branch:
c8a8a406cffdccf046a2c92fb8d172b77e7398b3
fe3712b134068c1c25dc42e7dc908f2fa6d8aa0e

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
9 years agoCHV: Add PCIID placeholders for CHV
Sean V Kelley [Wed, 20 Aug 2014 20:03:52 +0000 (13:03 -0700)]
CHV: Add PCIID placeholders for CHV

Pending branding and differentiation by stepping.  CHV is used generically
to match libdrm and mesa identification.

Signed-off-by: Sean V Kelley <sean.v.kelley@intel.com>
(cherry picked from commit 1121cb1f87228005a2b15b5ead95701a7fbe7519)

Conflicts:
src/i965_device_info.c

9 years agoUse the inline CPUID assembly to obtain CPUID string instead of /proc/cpuinfo
Zhao Yakui [Fri, 26 Sep 2014 01:15:36 +0000 (09:15 +0800)]
Use the inline CPUID assembly to obtain CPUID string instead of /proc/cpuinfo

On some systems there is no access to /proc/cpuinfo. So the inline assembly
is used directly to detect the CPUID string.

V2->V3: Follow the suggestion from Google engineer to remove the unused code
of "if 0". And the "unsigned int" data type is updated to "uint32_t".

V1->V2: Based on the Matt Turner's suggestion the __cpuid defined in GCC
cpuid.h is called directly, which is helpful to handle the PIC issue on
32-bit.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
(cherry picked from commit 3e8cce4e7292651af10c9f375a6ad2e9fa494021)

9 years agoCheck the value returned by strstr to avoid NULL pointer
Zhao Yakui [Fri, 26 Sep 2014 01:15:44 +0000 (09:15 +0800)]
Check the value returned by strstr to avoid NULL pointer

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
(cherry picked from commit 021149c50ffd5c55d45acbda6bb950c7206b7255)

9 years agoUse the strncasecmp instead of strcasecmp to make it more robust
Zhao Yakui [Fri, 26 Sep 2014 01:15:41 +0000 (09:15 +0800)]
Use the strncasecmp instead of strcasecmp to make it more robust

At the same time the extra string arrary is removed.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
(cherry picked from commit 05ece0c3698f4f48c4141e8bd0608b9869d8ad0c)

9 years agoEncoding: Add one hook callback function to detect encoding capabilitiy on Haswell
Zhao Yakui [Fri, 12 Sep 2014 02:14:04 +0000 (10:14 +0800)]
Encoding: Add one hook callback function to detect encoding capabilitiy on Haswell

Some Haswell machine doesn't support the encoding. So it should be disabled.
Otherwise the driver can't report the supported capability correctly.

V1->V2: Minor update based on comment from Gwenole Beauchesne. For example:
use the bool tye and remove the hardcoded value

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
(cherry picked from commit 23ae0f76ee5b3c097e6ae34182219cf44b09b82e)

9 years agochange the attribute of hw_codec_info so that it can be updated dynamically
Zhao Yakui [Fri, 12 Sep 2014 02:14:00 +0000 (10:14 +0800)]
change the attribute of hw_codec_info so that it can be updated dynamically

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
(cherry picked from commit 065db8289d3f38a923959f87d1b75767a0633e61)

9 years agoAdd one callback function for hw_codec_info to initialize hw_codec_info
Zhao Yakui [Fri, 12 Sep 2014 02:13:56 +0000 (10:13 +0800)]
Add one callback function for hw_codec_info to initialize hw_codec_info

V1->V2: Refine the call back function name from hw_codec_hook to preinit_hw_codec
And it is called after VADriverContext is fully initialized. This is based on the comment
from Gwenole Beauchesne.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
(cherry picked from commit 33e62fda870dc5c9b482fb6a23260da9ae465806)

9 years agobuild: fix make dist for packaging.
Gwenole Beauchesne [Tue, 9 Sep 2014 13:04:43 +0000 (15:04 +0200)]
build: fix make dist for packaging.

If the intel-gen4asm tool is not available, ship with the pre-built
EU kernels instead of trying to regenerate them. In particular, just
don't expose the build rules if intel-gen4asm is not installed.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agoi965_drv_video: add git commit id to VA driver version string.
Gwenole Beauchesne [Tue, 2 Sep 2014 08:10:21 +0000 (10:10 +0200)]
i965_drv_video: add git commit id to VA driver version string.

v2: renamed i965_drv_version.h to intel_version.h, changed macro
  definition to INTEL_DRIVER_GIT_VERSION, and displayed the git
  version string only in "pre" version modes.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agoi965_drv_video: factor out and robustify vendor string.
Gwenole Beauchesne [Tue, 2 Sep 2014 07:57:20 +0000 (09:57 +0200)]
i965_drv_video: factor out and robustify vendor string.

Move out generation of the vendor string to its specific helper function,
while also making it more robust and aware of possible overflows.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovpp: expose BGRA surface formats on Ivybridge and Haswell.
Gwenole Beauchesne [Mon, 8 Sep 2014 17:06:21 +0000 (19:06 +0200)]
vpp: expose BGRA surface formats on Ivybridge and Haswell.

Allow for vaQuerySurfaceAttributes() to return BGRA and BGRX formats
for VPP on Ivybridge and Haswell. This is supported as both source
and target surface formats.

This fixes VA/EGL interop on Gen7 processors when a BGR[AX] surface
is exported into an EGLImage.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agoReport BUSY surface state accordingly.
Gwenole Beauchesne [Tue, 26 Aug 2014 12:14:54 +0000 (14:14 +0200)]
Report BUSY surface state accordingly.

Return VA_STATUS_ERROR_SURFACE_BUSY for key interfaces.

This covers for va{Get,Put}Image(), as originally mandated by the
VA-API specs; vaBeginPicture() as this is the entry-point to any
decode, encode or video processing operation; but also for plain
vaMapBuffer() operation.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit 62bfb507c8512af6529ee794848155bd7cd97fc6)

9 years agoFactor out va{Get,Put}Image() implementations.
Gwenole Beauchesne [Tue, 26 Aug 2014 11:40:54 +0000 (13:40 +0200)]
Factor out va{Get,Put}Image() implementations.

Use VA internal objects wherever possible for internal functions,
thus leaving VA object ids to the base interface implementation.
Robustify params validation earlier in there too.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit 78ad786967144c2947ac36eac9ee39b0c94778ef)

9 years agoinitial export_refcount for obj_buffer
Zhao, Halley [Tue, 2 Sep 2014 08:28:07 +0000 (02:28 -0600)]
initial export_refcount for obj_buffer
(cherry picked from commit 11d01d01ce7ceedf19c74bdd8a07961b0fd8dd9b)

9 years agoAdd support for new VA buffer export APIs.
Gwenole Beauchesne [Wed, 5 Mar 2014 21:54:10 +0000 (22:54 +0100)]
Add support for new VA buffer export APIs.

Implement va{Acquire,Release}BufferHandle() hooks so that to allow
VA surface or VA image buffer sharing with thirdparty APIs like EGL,
OpenCL, etc.

v2: made sure to sync bo before export, improved VA buffer type check.
v3: tracked internal resources on acquire, disposed them on release.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit 483bb130925182f2096cd9e6fa5dbae6a55e7764)

9 years agoRemove gen7 only limitation for encoding configuration
Zhong Li [Fri, 8 Aug 2014 04:05:43 +0000 (22:05 -0600)]
Remove gen7 only limitation for encoding configuration

Since all generations from gen6 can support avc encoding configuration,
remove gen7 only limitation.
MVC also can be support with little change, but it is low priority,
it will be support when necessary and this function is stable.

Signed-off-by: Zhong Li <zhong.li@intel.com>
(cherry picked from commit f2178e267a67bdecab0a30502804c2ce5bccd0c2)

9 years agoEnabling BDW avc encoding configuration
Zhong Li [Fri, 8 Aug 2014 04:05:42 +0000 (22:05 -0600)]
Enabling BDW avc encoding configuration

Signed-off-by: Zhong Li <zhong.li@intel.com>
(cherry picked from commit 739eb9c0c954eecaf17a24be336ca5054241a338)

9 years agoEnabling HSW avc encoding configuration
Zhong Li [Fri, 8 Aug 2014 04:05:41 +0000 (22:05 -0600)]
Enabling HSW avc encoding configuration

Signed-off-by: Zhong Li <zhong.li@intel.com>
(cherry picked from commit 1239853edc9c344a823d788c6df57da82eda25bf)

9 years agoEnabling SNB avc encoding configuration
Zhong Li [Fri, 8 Aug 2014 04:05:40 +0000 (22:05 -0600)]
Enabling SNB avc encoding configuration

Signed-off-by: Zhong Li <zhong.li@intel.com>
(cherry picked from commit 3e531e7d640ef329151b2205c2e61a67fb80862d)

9 years agoAdd multi quality levels encoding support for GEN7
Zhong Li [Wed, 11 Jun 2014 02:49:21 +0000 (20:49 -0600)]
Add multi quality levels encoding support for GEN7

Two encoding quality levels are support on GEN7.
Default quality level is set to be 1, which has better quality,
but higher gpu usage.
The second quality level is set to be 2, which has worse quality but
it has lower gpu usage.

Other platforms support for multi-quality-level will be added later.

v1->v2: 1. follow haihao's comments to init and check quality_level.
        2. remove CBR limitation for low quality level.

(Zhao Yakui helps to merge several patches on staging so that it can
be cherry-picked to master)

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
9 years agoAdd phantom slice support on IVB+
Zhong Li [Wed, 27 Aug 2014 07:04:49 +0000 (01:04 -0600)]
Add phantom slice support on IVB+

HW requires driver to add a phantom slice when FirstMbX and FirstMbY are
not 0, in order to avc decoding error concealment. Otherwise, GPU may hang.
This patch is a workround for bug: https://bugs.freedesktop.org/show_bug.cgi?id=81447

v1->v2: Follow haihao's suggestion to use common funcion of gen6 phantom slice.
v2->v3: Remove an extraneous newline.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Reviewed-by: Xiang Haihao <haihao.xiang@intel.com>
             Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit 9672c5ab17c32f25ce1bbdb883abda689440b116)

9 years agoMove gen6 phantom slice function as common
Zhong Li [Wed, 27 Aug 2014 07:04:48 +0000 (01:04 -0600)]
Move gen6 phantom slice function as common

Following haihao's suggestion, make gen6 phantom slice funcion can be
re-used by SNB+.

v1->v2: Remove an unnessary comment.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Reviewed-by: Xiang Haihao <haihao.xiang@intel.com>
             Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit 5e30cc3093407ca2b4dbefa1da8a1262ff8ae7e9)

9 years agoH264_Encoding: Fix the incorrect Qp setting under CBR when slice_header is passed
Zhao Yakui [Mon, 1 Sep 2014 07:48:42 +0000 (15:48 +0800)]
H264_Encoding: Fix the incorrect Qp setting under CBR when slice_header is passed

Fix the issue in
https://bugs.freedesktop.org/show_bug.cgi?id=83143

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Tested-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
(cherry picked from commit eca8e0065e3a04156e0817d3a5ac14f4df39d603)

Conflicts:

src/gen6_mfc.c
src/gen8_mfc.c

9 years agodecoder: h264: fix RefPicList0/1 without frame in DPB.
Gwenole Beauchesne [Wed, 18 Jun 2014 11:11:48 +0000 (13:11 +0200)]
decoder: h264: fix RefPicList0/1 without frame in DPB.

Some bitstreams (e.g. truncated, or non conformant), or bugs in codec
layers, would incorrectly make decoders to fill in the RefPicList0/1
lists with surfaces that have not received any content yet.

There is no reason for the driver to crash in such cases.

https://bugs.freedesktop.org/show_bug.cgi?id=82466

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agoAdd more check of H264 slice param to avoid GPU hang caused by the incorrect parameter
Zhao Yakui [Wed, 23 Jul 2014 05:46:17 +0000 (13:46 +0800)]
Add more check of H264 slice param to avoid GPU hang caused by the incorrect parameter

This is to fix the GPU hang in https://bugs.freedesktop.org/show_bug.cgi?id=76363

V1->V2: Use the new check based on Haihao's comment. Discard the current frame with the error
slice_param instead of smart fix. In such case it can prompt that the error slice_param
can be fixed by the upper-middle.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Tested-by: ValdikSS <iam@valdikss.org.ru>
Reviewed-by: Xiang Haihao <haihao.xiang@intel.com>
(cherry picked from commit 04202281135149a13a32dfb8a902debfac1331fe)

9 years agoremove fixed uses of inte-gen4asm tool
Zhao, Yakui [Tue, 1 Jul 2014 01:43:56 +0000 (09:43 +0800)]
remove fixed uses of inte-gen4asm tool

In the gen7 and gen8 post processing Makefiles the GEN4ASM
variable is not honored when calling intel-gen4asm. This causes
build errors when GEN4ASM is set to a different value

This was discovered when using intel-gpu-tools version 1.7 where
the shaders are actually compiled.

Signed-off-by: Daniel Charles <daniel.charles@intel.com>
Reviewed-by: Zhao, Yakui <yakui.zhao@intel.com>
(cherry picked from commit f574f2e8a8da27b96abc3936c5b2372ff2b7eefb)

10 years agoEncoding: Use the different delimeter to pass packed_rawdata and slice_header based...
Zhao, Yakui [Thu, 12 Jun 2014 00:54:41 +0000 (08:54 +0800)]
Encoding: Use the different delimeter to pass packed_rawdata and slice_header based on VAConfigAttribEncPackedHeaders attribute

Currently the packed_slice_header is optional. And it uses the VAEncSliceParameterBuffer
as the delimeter to decide how to insert the packed rawdata/slice_header
for one slice. This is not convenient under some scenario. For example: some
user hope to be more flexible. When the user is responsible for generating the
packed slice_header, it hopes to use the packed slice_header as the delimeter
to determine how to inser the packed rawdata/slice_header for the given slice.
So the VAConfigAttribEncPackedHeaders attriburation of encoding_context is
used to decide which kind of delimeter.
a. When the VAEncPackedSlice is set when calling vaCreateConfig, it will use
the packed slice_header as delimeter. Of course the packed rawdata should be
parsed before the packed slice_header for one given slice. For exmaple:
for the slice 0: the packed rawdata should be parsed before paring the first
packed slice_header. After one packed slice_header is parsed, it will start
to parse the corresponding data for a new slice.

b. When the VAEncPackedSlice is not set when calling vaCreateConfig, it will
use the VAEncSliceParameterBuffer as delimeter.

V1->V2: Return an error instead of only complaining warning message when packed
slice_header is missing for some slice under the VAEncPackedSlice mode. This
is the suggestion from Gwenole and Sreerenj Balachandran.

Signed-off-by: Zhao, Yakui <yakui.zhao@intel.com>
(cherry picked from commit 9d49a6d693aa6c862467a4a879bc86d9cb98dbe5)

10 years agoEncoding: Update the comment for the data structure about the packed rawdata/slice_he...
Zhao, Yakui [Thu, 12 Jun 2014 00:54:38 +0000 (08:54 +0800)]
Encoding: Update the comment for the data structure about the packed rawdata/slice_header data

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
(cherry picked from commit 56715c893fa87e2d3af2938b9202d75cdc79a8fd)

10 years agoFix the segfault while encoding multiple slice per frame.
Sreerenj Balachandran [Wed, 28 May 2014 21:02:41 +0000 (15:02 -0600)]
Fix the segfault while encoding multiple slice per frame.

Zero initialize the packed raw data index array and
packed slice header index array during each preallocation.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Reviewed-by: Zhao, Yakui <yakui.zhao@intel.com>
(cherry picked from commit fbbe401aa28a0b3859d587ef08f0df15a2f7c8f2)

10 years agoFix the segfault while inserting packed slice header
Sreerenj Balachandran [Tue, 27 May 2014 11:18:05 +0000 (05:18 -0600)]
Fix the segfault while inserting packed slice header

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Reviewed-by: Zhao, Yakui <yakui.zhao@intel.com>
(cherry picked from commit 7c2273f1334d7d45e248d128e17200b7e8beffd1)

10 years agoFix the GetConfigAttributes() for H264SteroHighProfile
Sreerenj Balachandran [Thu, 5 Jun 2014 09:00:49 +0000 (12:00 +0300)]
Fix the GetConfigAttributes() for H264SteroHighProfile

(cherry picked from commit 510b271f912afb35edac1d3fb39354ee98b01711)

10 years agoH264_encoding: Don't update the slice qp for CBR mode when finding packed slice_heade...
Zhao, Yakui [Mon, 26 May 2014 00:40:15 +0000 (08:40 +0800)]
H264_encoding: Don't update the slice qp for CBR mode when finding packed slice_header data

Otherwise the slice qp is inconsistent and the encoding is incorrect.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
(cherry picked from commit 897527c30435202927e6cd05cd5189a710d02c91)

10 years agoH264_Encoding: Add the support of packed slice header to be flexible
Zhao, Yakui [Mon, 26 May 2014 00:40:15 +0000 (08:40 +0800)]
H264_Encoding: Add the support of packed slice header to be flexible

Under some encoding scenario, the user hopes to generate the packed slice
header data by themself and then the driver can insert the passed slice
header packed data into the coded clip.
1.The VA_ENC_PACKED_HEADER_SLICE flag is exported and it is treated as optional.
This is to say: if packed slice header data is passed, it will be
inserted directly. If no packed slice header data is passed, the driver will
help to generate it.
2.Another restriction is that the packed slice header data is inserted after
the packed rawdata for one slice. That is to say: If it needs to insert the
packed rawdata and slice header data, the packed rawdata will be inserted
firstly(This is handled by the driver).

Signed-off-by: Zhao, Yakui <yakui.zhao@intel.com>
(cherry picked from commit 00111e8a8bfa67b971419b72577eaa1b9f47bc34)

Conflicts:
src/gen75_mfc.c
src/gen8_mfc.c

10 years agoH264_encoding: Reset the last_packed_header_type to avoid the unpaired packed header...
Zhao, Yakui [Mon, 26 May 2014 00:40:15 +0000 (08:40 +0800)]
H264_encoding: Reset the last_packed_header_type to avoid the unpaired packed header type/data

After adding the support of inserting the packed rawdata, more group of packed header data
can be passed. In order to insert the packed rawdata correctly, the packed header type/
data should be paired.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
(cherry picked from commit fd78866bd64d7ab57fe8cb0c4b25e8357973b0b1)

10 years agoH264_encoding: Add the support of inserting the packed raw data passed from user
Zhao, Yakui [Mon, 26 May 2014 00:40:15 +0000 (08:40 +0800)]
H264_encoding: Add the support of inserting the packed raw data passed from user

Under some encoding scenario, the user-space application hopes that the driver
can insert the passed packed rawdata into the coded clip. This is to allow the
insertion of packed rawdata passed from user. As the position of packed rawdata
is related with the slice. So the following restrictions are added:
1. the packed rawdata header type/data should be paired.
2. the packed rawdata data is inserted by following the passed order
3. the packed rawdata header type/data is split by using VAEncSliceParameterBuffer.
That is to say: The packed rawdata for slice 0 should be passed before the first
VAEncSliceParameterBuffer. After one VAEncSliceParameterBuffer is parsed,
the subseuquent packed rawdata is for another new slice. The subsequent
packed rawdata after the last VAEncSliceParameterBuffer is ignored.
4. it does not change the rule for the packed data of SPS/PPS/MISC type.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
(cherry picked from commit 974597ef64dc9a283d4787e1484a75d1610414f4)

Conflicts:
src/gen75_mfc.c
src/gen8_mfc.c

10 years agoH264_Encoding: Prepare some data structures for adding packed raw data
Zhao, Yakui [Mon, 26 May 2014 00:40:15 +0000 (08:40 +0800)]
H264_Encoding: Prepare some data structures for adding packed raw data

Under some encoding scenario, the user-space application hopes that the driver
can insert the passed packed rawdata into the coded clip. But the insertion of
packed rawdata is related with the slice. So some data structures are added so
that it can store how the packed rawdata is inserted into the coded clip
per-slice.

Signed-off-by: Zhao, Yakui <yakui.zhao@intel.com>
(cherry picked from commit 65727b1868f01d836659396724b83d2992656242)

10 years agoH264_Encoding: Parse the packed header data from user to fix the hacked code of HW...
Zhao, Yakui [Mon, 26 May 2014 00:40:15 +0000 (08:40 +0800)]
H264_Encoding: Parse the packed header data from user to fix the hacked code of HW skip bytes

When the packed header data from user is inserted into the coded clip, it uses
the hacked code to check the number of HW skip emulation bytes. This is wrong.
So fix it.
Of course if the packed header data is generated by the driver, it is
unnecessary to check it and it can still use the pre-defined number of HW
skip bytes.

V1->V2: Based on Gwenole's comment more nal_unit_type is added.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
(cherry picked from commit cd518563f239cb8523c58010a695098465a4f04e)

10 years agoEncoding: Reinitialize CBR bit rate-control parameter to support switch of bitrate...
Zhao, Yakui [Tue, 10 Jun 2014 06:11:01 +0000 (14:11 +0800)]
Encoding: Reinitialize CBR bit rate-control parameter to support switch of bitrate under CBR

Tested-By: Sean V Kelley <sean.v.kelley@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
(cherry picked from commit 929c1446a28dbefd9655774f2db3e10f7b631dcf)

10 years agodecoder: h264: fix frame store logic for MVC.
Gwenole Beauchesne [Thu, 5 Jun 2014 19:36:33 +0000 (21:36 +0200)]
decoder: h264: fix frame store logic for MVC.

In strict MVC decoding mode, when only the necessary set of inter-view
reference pictures are passed to the ReferenceFrames array for decoding
the current picture, we should not re-use a frame store id that might
be needed for decoding another view component in the same access unit.

One way to solve this problem is to track when the VA surface in a
specified frame store id was last referenced. So, a "ref_age" field
is introduced to the GenFrameStore struct and is updated whenever
the surface is being referenced.

Additionally, the list of retired refs candidates (free_refs) is kept
ordered by increasing ref_age. That way, we can immediately know what
is the oldest frame store id to recycle.

Let deltaAge = CurrAge - RefAge:
If deltaAge > 1, we know for sure that the VA surface is gone ;
If deltaAge = 1, the surface could be re-used for inter prediction ;
If deltaAge = 0, the surface could be re-used for inter-view prediction.

The ref_age in each Frame Store entry is always current, i.e. it is
the same for all reference frames that intervened in the decoding
process of all inter view components of the previous access unit. The
age tracks access units.

v2: used a more correct representation of age, instead of POC [Yakui]
v3: minor optimization for detecting changes of access unit [Haihao]

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit 3b5eb0522fbfe1220dcd0c0bb093a93cfc25e22c)

10 years agodecoder: h264: improve AVC_REF_IDX_STATE for MVC.
Gwenole Beauchesne [Wed, 4 Jun 2014 16:25:33 +0000 (18:25 +0200)]
decoder: h264: improve AVC_REF_IDX_STATE for MVC.

Each Reference List Entry has Bit 6 set to one if the reference
picture is to be used as a long-term reference picture. However,
the H.264 standard, and subsequently the VA-API specs, makes it
possible to mark the picture as "used for short-term reference",
as "used for long-term reference", or even none of those flags.

This means we have to handle a minimum of 3 states. This doesn't
fit the range of a single bit. Let's examine how this could be
fixed from known practices.

There are cases where the picture is added to RefPicListX[] even
if it is not marked as "used for short-term reference" or "used
for long-term reference": MVC with inter-view reference components
or inter-view only reference components [H.8.4]. Ultimately, this
has an incidence on the value of colZeroFlag (8.4.1.2.2). Since
there is no way to program that, and that it depends on the picture
to be marked as "used for short-term reference" or not, then it
looks reasonable to imply Bit 6 (LongTermPicFlag) as a picture
that is *not* "used for short-term reference", i.e. thus including
genuine long-term reference pictures, and those that are neither
long-term reference nor short-term reference pictures.

In practice, this fixes MVCNV-2.264.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit edbdc0e87919d8b7261d882a32b2d3c271660931)

10 years agosurface: drop SURFACE_DISPLAYED flag.
Gwenole Beauchesne [Fri, 9 May 2014 13:08:05 +0000 (15:08 +0200)]
surface: drop SURFACE_DISPLAYED flag.

The optimization by which the VA surface storage is deallocated after
it is displayed and not used for reference or vaDeriveImage() purposes
cannot be implemented safely. We need to honour explicit lifetimes
defined by the upper codec layer.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit 84926ace7a2c5b88df1ada167a1c273128469aad)

10 years agorender: don't deallocate surface storage of displayed frames.
Gwenole Beauchesne [Fri, 9 May 2014 12:53:30 +0000 (14:53 +0200)]
render: don't deallocate surface storage of displayed frames.

Keep the VA surface storage live until it is explicitly scheduled
for destruction through vaDestroySurfaces() interface. Otherwise,
subsequent vaPutSurface() calls would have no effect.

This fixes various use cases like: display of interlaced frames
that are not marked for reference, multiple rendering to Pixmap
for EXT_texture_from_pixmap and more precisely interlaced streams.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit a840e6403071d397a33e127e8058881a3ef50077)

10 years agodecoder: MVC chroma formats
Gwenole Beauchesne [Fri, 9 May 2014 16:52:00 +0000 (18:52 +0200)]
decoder: MVC chroma formats

This is a part of fa469f74227a7b4e0e6f882c488132eaa9c44417 on staging

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
10 years agodecoder: h264: expose the set of supported MVC profiles.
Gwenole Beauchesne [Tue, 3 Jun 2014 15:30:11 +0000 (17:30 +0200)]
decoder: h264: expose the set of supported MVC profiles.

H.264 MVC decoding support is defined as follows:
- Stereo High profile on Sandybridge and newer ;
- Multiview High profile on Haswell and newer.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit 1f244834dedb7b46863b315a898d8649d01c5f58)

Conflicts:
src/i965_device_info.c
src/i965_drv_video.c
src/va_backend_compat.h

10 years agodecoder: h264: enable Picture ID Remapping on Haswell and newer.
Gwenole Beauchesne [Mon, 2 Jun 2014 11:08:57 +0000 (13:08 +0200)]
decoder: h264: enable Picture ID Remapping on Haswell and newer.

Fill and submit MFX_AVC_PICID_STATE commands to Gen7.5+ hardware.
This optimizes the management of the DPB as the binding array can
now contain entries in any order. This also makes it possible to
support H.264 MultiView High profiles, with any particular number
of views.

v2: added more comments for clarity, removed an assert [Yakui]

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit 8dfdf10612c726b60ecd5b61eee2b7d6a520bb33)

10 years agodecoder: h264: factor out look ups for VA/H264 picture info.
Gwenole Beauchesne [Fri, 16 May 2014 15:04:55 +0000 (17:04 +0200)]
decoder: h264: factor out look ups for VA/H264 picture info.

Add new avc_find_picture() helper function to search for a VAPictureH264
struct based on the supplied VA surface id.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit 3f4f9fc2893af24b7e88f44b6350a5a74d49f0c2)

10 years agodecoder: h264: fix submission of AVC_REF_IDX_STATE command.
Gwenole Beauchesne [Sun, 4 May 2014 22:05:06 +0000 (00:05 +0200)]
decoder: h264: fix submission of AVC_REF_IDX_STATE command.

If the RefPicListX[] entry has no valid picture_id associated to it,
then set the resulting state to 0xff. If that entry has no surface
buffer storage either, then compose a valid state that maps to the
first item in the reference frames list, as mandated by the PRM.

v2: dropped the superfluous "found" variable [Yakui]

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit 151b8851c3a9309e87712651a3697e20a7bdb6c9)

10 years agodecoder: h264: simplify and optimize reference frame store updates.
Gwenole Beauchesne [Tue, 6 May 2014 13:28:29 +0000 (15:28 +0200)]
decoder: h264: simplify and optimize reference frame store updates.

Simplify and optimize the update process of the reference frame store.
Use less iterations to look up existing objects. Use a cache to store
the free'd slots.

Prerequisite: the reference_objects[] array was previously arranged in
a way that the element at index i is exactly the object_surface that
corresponds to the VA surface identified by the VAPictureH264.picture_id
located at index i in the ReferenceFrames[] array.

Theory of operations:

1. Obsolete entries are removed first, i.e. entries in the internal DPB
   that no longer have a match in the supplied ReferenceFrames[] array.
   That obsolete entry index is stored in a local cache: free_slots[].

2. This cache is completed with entries considered as "invalid" or "not
   present", sequentially while traversing the frame store for obsolete
   entries. At the end of this removal process, the free_slots[] array
   represents all possible indices in there that could be re-used for
   new reference frames to track.

3. The list of ReferenceFrames[] objects is traversed for new entries
   that are not already in the frame store. If an entry needs to be
   added, it is placed at the index obtained from the next free_slots[]
   element. There is no need to traverse the frame store array again,
   the next available slot can be known from that free_slots[] cache.

v2: dropped the superfluous "found" variable [Yakui]
v3: renamed "free_slots" array to "free_refs", which now holds
  GenFrameStore entries

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit 70ecad1264255123df99b472891e8ee90399013c)

10 years agodecoder: h264: allocate reference frames earlier, if needed.
Gwenole Beauchesne [Tue, 6 May 2014 12:07:30 +0000 (14:07 +0200)]
decoder: h264: allocate reference frames earlier, if needed.

Sometimes, a dummy frame comes from the codec layer and it is used
as a reference, per the comment in the existing code. Even though
this looks suspicious, keep this criterion but make sure to try
allocating the VA surface, if needed, earlier in the function that
sanity checks the parameters for decoding the current frame.

This makes it possible to fail at a much earlier time, and actually
make it possible to return a sensible error code to the upper layer.

Also fix the reference_objects[] array elements to be an exact 1:1
match for ReferenceFrames[] array elements, including possible but
unlikely holes in it. The former array holds object_surface structs
corresponding to the VA surfaces present in the ReferenceFrames[]
array and identified by VAPictureH264.picture_id.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit 5a12ccda3f77d03b6ffa8249d607c03e4dc8161f)

10 years agodecoder: h264: don't deallocate surface storage of older frames.
Gwenole Beauchesne [Tue, 6 May 2014 11:08:28 +0000 (13:08 +0200)]
decoder: h264: don't deallocate surface storage of older frames.

Drop the optimization whereby surfaces that are no longer marked as
reference and that were already displayed are to be destroyed. This
is wrong mainly for two reasons:

1. The surface was displayed... once but it may still be needed for
   subsequent operations like displaying it again, using it for a
   transcode pipeline (encode) for instance, etc.

2. The new set of ReferenceFrames[] correspond to the active set of
   reference frames used for decoding the current slice. In presence
   of Multiview Coding (MVC), that could correspond to the current
   view, in view order index, but the surface may still be needed
   for decoding the next view with the same view_id, while also
   decoding other views with another set of reference frames for them.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
(cherry picked from commit 77af916b44da04e3424490506a7e5bef39c80c7c)

10 years agoencoder: MVC: Add support for MVC profiles
Li Xiaowei [Thu, 19 Dec 2013 09:51:45 +0000 (17:51 +0800)]
encoder: MVC: Add support for MVC profiles

This is a part of bd630edd844b88ea543a027654db296ff7da16cd on staging

Signed-off-by: Li Xiaowei <xiaowei.a.li@intel.com>
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
10 years agoMVC: CODEC_H264_MVC defination and relatived properties check
Li Xiaowei [Tue, 10 Dec 2013 02:35:38 +0000 (10:35 +0800)]
MVC: CODEC_H264_MVC defination and relatived properties check

Signed-off-by: Li Xiaowei <xiaowei.a.li@intel.com>
(cherry picked from commit 7d1ddfd3646f35f306f38bfabef6af9b2ebb19f4)

Conflicts:
src/i965_drv_video.c

10 years agoh264: Add the macros for MVC profiles to keep backward compatibility with libva 1.3.1
Gwenole Beauchesne [Tue, 3 Jun 2014 15:30:11 +0000 (17:30 +0200)]
h264: Add the macros for MVC profiles to keep backward compatibility with libva 1.3.1

It is a part of 1f244834dedb7b46863b315a898d8649d01c5f58 on staging

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
10 years agoDefine i965_CreateSurfaces in header file explicitly to avoid multiple declaration
Zhao Yakui [Tue, 4 Mar 2014 08:23:07 +0000 (16:23 +0800)]
Define i965_CreateSurfaces in header file explicitly to avoid multiple declaration

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
(cherry picked from commit 8b3945aa5df443e93a3f5e6e97dffb1574e2a936)

10 years agoCheck the pointer against NULL
Xiang, Haihao [Thu, 27 Feb 2014 06:10:24 +0000 (14:10 +0800)]
Check the pointer against NULL

The issue is reported by Klockwork

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
(cherry picked from commit 80d1f89388c9cb70218cd759592d2167c8845322)

10 years ago1.3.3.pre1 for development
Xiang, Haihao [Mon, 16 Jun 2014 02:27:12 +0000 (10:27 +0800)]
1.3.3.pre1 for development

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
10 years agoIntel driver 1.3.2
Xiang, Haihao [Mon, 16 Jun 2014 02:21:07 +0000 (10:21 +0800)]
Intel driver 1.3.2

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
10 years agoEncoding: Fix one type error in intra-prediction shader on BDW
Zhao, Yakui [Mon, 9 Jun 2014 04:08:13 +0000 (12:08 +0800)]
Encoding: Fix one type error in intra-prediction shader on BDW

Otherwise it will cause the incorrect intra-prediction for encoding on
Broadwell.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
(cherry picked from commit 20bee4c3cb478702155df1779f24ec483aeab059)

10 years agoUpdate NEWS for 1.3.2 pre1
Xiang, Haihao [Mon, 9 Jun 2014 03:26:54 +0000 (11:26 +0800)]
Update NEWS for 1.3.2 pre1

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
10 years agodebug: add g_intel_debug_option_flags for simple driver debug
Zhao, Halley [Wed, 28 May 2014 08:38:01 +0000 (16:38 +0800)]
debug: add g_intel_debug_option_flags for simple driver debug

VA_INTEL_DEBUG_ASSERT decides assert() is enabled or not
VA_INTEL_DEBUG_BENCH  decides skipping swapbuffer in dri output
(cherry picked from commit 60413182f66c44781456e827b439e98f21cfae4c)

10 years agoFix the scaling issue on IVB/HSW/BDW
Xiang, Haihao [Mon, 26 May 2014 02:14:52 +0000 (10:14 +0800)]
Fix the scaling issue on IVB/HSW/BDW

Scaling is done on each 16x16 block. The shader for scaling
might write pixels out-of-rectangle if the rectangle width/height
isn't aligned to 16.

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
(cherry picked from commit d560387cc819a31791c2a30026473c9bd8786f07)

10 years agoVPP: Simplify surface state setting for csc and scaling on IVB/HSW/BDW
Xiang, Haihao [Mon, 26 May 2014 02:14:51 +0000 (10:14 +0800)]
VPP: Simplify surface state setting for csc and scaling on IVB/HSW/BDW

v2: bpp[] is in unit of bits

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
(cherry picked from commit d415357f25fc01b96592ba29ba95da9d6dc82ff3)

10 years agoNew structure i965_fourcc_info
Xiang, Haihao [Sat, 24 May 2014 06:36:12 +0000 (14:36 +0800)]
New structure i965_fourcc_info

and hold all supported fourcc in an array

v2: bpp[] in bit and fix the vertical factor for 411P (Yakui)

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
(cherry picked from commit 1de3a2cdc8c3f8b2f6191c0f114fa1167f40f2ec)

Conflicts:

src/i965_drv_video.c

10 years agompeg2: calculate the slice data length on IVB
Xiang, Haihao [Mon, 26 May 2014 02:14:53 +0000 (10:14 +0800)]
mpeg2: calculate the slice data length on IVB

Sometimes pending datas are added in slice data buffer, however
HW requires slice data length excludes pending datas, otherwise
the behavior is undefined

https://bugs.freedesktop.org/show_bug.cgi?id=77041

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
(cherry picked from commit a9004e6c5c7f33cd1e33e4dab92a5a0017714bbd)