OSDN Git Service

android-x86/hardware-intel-common-vaapi.git
6 years agoAvoid dereferencing a pointer before checking pointer against NULL
Xiang, Haihao [Fri, 26 Jan 2018 07:35:22 +0000 (15:35 +0800)]
Avoid dereferencing a pointer before checking pointer against NULL

It is possible a sequence parameter buffer is not provided by
application.

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
6 years agoNew PCI IDs for CFL
Xiang, Haihao [Thu, 25 Jan 2018 06:41:29 +0000 (14:41 +0800)]
New PCI IDs for CFL

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
6 years agoCQP is supported for jpeg
Xiang, Haihao [Tue, 23 Jan 2018 06:25:15 +0000 (14:25 +0800)]
CQP is supported for jpeg

This fixed regression since 336d891

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
6 years agoVP8 encoding doesn't require packed header
Xiang, Haihao [Tue, 23 Jan 2018 02:56:25 +0000 (10:56 +0800)]
VP8 encoding doesn't require packed header

The corresponding value is set to VA_ENC_PACKED_HEADER_NONE when
querying the supported packed headers. This fixes the regression
caused by cccf2a3 when using FFmpeg/vaapi

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
6 years agoENC:fix min resolution check for encoder
Pengfei Qu [Thu, 18 Jan 2018 09:39:36 +0000 (17:39 +0800)]
ENC:fix min resolution check for encoder

JPEG encoder allow min resolution 1x1
add min resolution check in vaCreateContext to avoid gtest failture
add fix for gtest case
fix the regression in 88249259d4abb2fd701ed3db229941738da2497e

Fixes #330 #333
Signed-off-by: Pengfei Qu <Pengfei.Qu@intel.com>
6 years agotest/avce_context: update RC expectation for Stats entrypoint
U. Artie Eoff [Tue, 23 Jan 2018 04:25:31 +0000 (20:25 -0800)]
test/avce_context: update RC expectation for Stats entrypoint

Rate control attribute is unsupported for AVCE VAEntrypointStats.

This fixes the following test regressions since 336d8913aa30:

AVCEncode/AVCEContextTest.RateControl/3, where GetParam()
  = (VAProfileH264ConstrainedBaseline, VAEntrypointStats)

AVCEncode/AVCEContextTest.RateControl/7, where GetParam()
  = (VAProfileH264Main, VAEntrypointStats)

AVCEncode/AVCEContextTest.RateControl/11, where GetParam()
  = (VAProfileH264High, VAEntrypointStats)

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
6 years agoCheck the flags of the packed headers when creating a config
Xiang, Haihao [Fri, 19 Jan 2018 05:48:56 +0000 (13:48 +0800)]
Check the flags of the packed headers when creating a config

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
6 years agoCheck the requirement on RC mode
Xiang, Haihao [Fri, 19 Jan 2018 05:26:35 +0000 (13:26 +0800)]
Check the requirement on RC mode

This fixes https://github.com/01org/intel-vaapi-driver/issues/337

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
6 years agoCheck decoding mode
Xiang, Haihao [Fri, 19 Jan 2018 03:01:29 +0000 (11:01 +0800)]
Check decoding mode

VA_DEC_SLICE_MODE_NORMAL is supported only for decoding

This fixes https://github.com/01org/intel-vaapi-driver/issues/336

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
6 years agoUpdate .gitignore
Xiang, Haihao [Thu, 13 Jul 2017 01:54:19 +0000 (09:54 +0800)]
Update .gitignore

Filter out generated Gen assembly files

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
6 years agoUse generic register instead of acc0 to calculate the Y/U/V or R/G/B offset
Xiang, Haihao [Thu, 19 Oct 2017 21:09:51 +0000 (05:09 +0800)]
Use generic register instead of acc0 to calculate the Y/U/V or R/G/B offset

The instruction 'mov' cannot assign acc0 with :v anymore on CNL, so all AVS shaders
doesn't work as expected. Replacing acc0 with GRF registers works well on CNL and it
works on GEN8/GEN9 too.

v2: update code style

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
6 years agoENC: add sanity check for invalid input resolution of encoder
Pengfei Qu [Wed, 17 Jan 2018 04:21:51 +0000 (12:21 +0800)]
ENC: add sanity check for invalid input resolution of encoder

Signed-off-by: Pengfei Qu <Pengfei.Qu@intel.com>
6 years agoENC: add mininum resolution query for encoder
Pengfei Qu [Tue, 16 Jan 2018 06:02:45 +0000 (14:02 +0800)]
ENC: add mininum resolution query for encoder

Signed-off-by: Pengfei Qu <Pengfei.Qu@intel.com>
6 years agoFix AVC encoding regression on KBL/GLK/CFL
Xiang, Haihao [Mon, 15 Jan 2018 05:51:35 +0000 (13:51 +0800)]
Fix AVC encoding regression on KBL/GLK/CFL

adaptive transform decision is disabled by default for KBL/GLK/CFL

This fixes https://github.com/01org/intel-vaapi-driver/issues/323

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
6 years agoenc: Add restriction to vp9 encoder frame rate to avoid hang
jkyu [Thu, 22 Jun 2017 04:12:50 +0000 (00:12 -0400)]
enc: Add restriction to vp9 encoder frame rate to avoid hang

Signed-off-by: jkyu <jiankang.yu@intel.com>
6 years agoENC: fix AVC multi slice
Pengfei Qu [Tue, 26 Dec 2017 09:08:27 +0000 (17:08 +0800)]
ENC: fix AVC multi slice

Fixes #324

Signed-off-by: Pengfei Qu <Pengfei.Qu@intel.com>
6 years agoEnc: fix AVC mbenc curbe paraterer on CNL
Pengfei Qu [Tue, 26 Dec 2017 08:24:49 +0000 (16:24 +0800)]
Enc: fix AVC mbenc curbe paraterer on CNL

Signed-off-by: Pengfei Qu <Pengfei.Qu@intel.com>
6 years agoENC/jpeg: fix regression with Small optimization
Xiang, Haihao [Thu, 11 Jan 2018 05:13:36 +0000 (13:13 +0800)]
ENC/jpeg: fix regression with Small optimization

This fixes 6c1b9b345982babde748518de1834e2af8bcf321:
Small optimization while removing warning

The higher 16 bit of dword_qm[j] (j = 0, 1, ..., 31) is
65535 / (raster_qm[i + 1]) (i = 0, 2, 4, ..., 62)

This fixes https://github.com/01org/intel-vaapi-driver/issues/319

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
6 years agoVDENC: Add the VDENC H264 on CNL
Zhao Yakui [Tue, 18 Apr 2017 03:04:51 +0000 (11:04 +0800)]
VDENC: Add the VDENC H264 on CNL

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Pengfei Qu <pengfei.qu@intel.com>
Signed-off-by: peng.chen <peng.c.chen@intel.com>
6 years agoAdd the HEVC encoder on CNL
peng.chen [Wed, 29 Nov 2017 23:18:31 +0000 (07:18 +0800)]
Add the HEVC encoder on CNL

It was initialed by Yakui

Signed-off-by: peng.chen <peng.c.chen@intel.com>
6 years agoAdd common HCP implementation for CNL
peng.chen [Tue, 19 Dec 2017 09:16:35 +0000 (17:16 +0800)]
Add common HCP implementation for CNL

Signed-off-by: peng.chen <peng.c.chen@intel.com>
6 years agoENC: enable avc encoder on cnl
Qu Pengfei [Fri, 13 Oct 2017 08:21:04 +0000 (16:21 +0800)]
ENC: enable avc encoder on cnl

Signed-off-by: Pengfei Qu <pengfei.qu@intel.com>
Signed-off-by: peng.chen <peng.c.chen@intel.com>
6 years agoENC: add AVC encoder media kernel on CNL
Pengfei Qu [Fri, 13 Oct 2017 08:12:42 +0000 (16:12 +0800)]
ENC: add AVC encoder media kernel on CNL

Signed-off-by: Pengfei Qu <pengfei.qu@intel.com>
Signed-off-by: peng.chen <peng.c.chen@intel.com>
6 years agoAdd support for VP8 encode on CNL
Xiang, Haihao [Fri, 8 Sep 2017 08:42:26 +0000 (16:42 +0800)]
Add support for VP8 encode on CNL

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: peng.chen <peng.c.chen@intel.com>
6 years agoAdd the initial support of CNL
Zhao Yakui [Tue, 28 Jun 2016 09:38:19 +0000 (17:38 +0800)]
Add the initial support of CNL

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Signed-off-by: peng.chen <peng.c.chen@intel.com>
6 years agoFix: AVC encoder use at most 4 fwd ref frames and 1 bwd ref frames
Pengfei Qu [Tue, 28 Nov 2017 07:35:04 +0000 (15:35 +0800)]
Fix: AVC encoder use at most 4 fwd ref frames and 1 bwd ref frames

Fixes #272

Signed-off-by: Pengfei Qu <Pengfei.Qu@intel.com>
6 years agoStats/PreEnc: tests: Add VAEntryPointStats
Sreerenj Balachandran [Fri, 1 Dec 2017 23:02:24 +0000 (15:02 -0800)]
Stats/PreEnc: tests: Add VAEntryPointStats

Add the Stats entrypoint in test case scenarios.

intel-vaapi-driver PR: https://github.com/01org/intel-vaapi-driver/pull/282
libva PR: https://github.com/01org/libva/pull/110

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
6 years agoStats/PreEnc: Add GEN9 AVC PreEnc support
Sreerenj Balachandran [Fri, 1 Dec 2017 22:47:11 +0000 (14:47 -0800)]
Stats/PreEnc: Add GEN9 AVC PreEnc support

The AVC PreEnc includes three stage processing:

1: It does the dowscaling of source and reference pictures.
Also generate the variance and pixel average of current frame,
past and future ref based on user request.

2: Second stage involves the Hierarchical Motion Estimation
Only the 4x hme is supported in PreEnc.

3:Third stage is a PreProc which can generate the Motion Vectors and
Distortion values

libva PR: https://github.com/01org/libva/pull/110

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
6 years agoStat/PreEnc: Add GEN9 AVC PreEnc specific constants
Sreerenj Balachandran [Fri, 1 Dec 2017 22:45:59 +0000 (14:45 -0800)]
Stat/PreEnc: Add GEN9 AVC PreEnc specific constants

* Added preproc curbe init data for I,P and B frames.
* Add preproc ftq lut init constants

libva PR: https://github.com/01org/libva/pull/110

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
6 years agoStats/PreEnc: Add basic infrastructure for PreEnc enablement
Sreerenj Balachandran [Fri, 1 Dec 2017 22:44:58 +0000 (14:44 -0800)]
Stats/PreEnc: Add basic infrastructure for PreEnc enablement

Add necessary changes in common structures and apis
to support Stats Entrypoint.

* add support for the new entrypoint VAEntrypointStats
* added new preproc encode operation enum
* define virtual methods for preproc_set_curbe/send_surface
* add fixes in vaQueryConfigEntrypoints(), vaQueryConfigProfiles,
  vaGetConfigAttributes(), vaQuerySurfaceAttributes(),
  vaCreateContext(), vaCreateBuffer(),vaBeginPicture(),
  vaRenderPicture() and vaEndPicture()
* If PreEnc enabled, only invoke VME.

Note: Enabled the PreEnc Support only for avc encode in Skylake.

libva PR: https://github.com/01org/libva/pull/110

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
6 years agoAdd informational messages for developers on failed H.265 checks
Mark Thompson [Fri, 8 Dec 2017 14:30:08 +0000 (14:30 +0000)]
Add informational messages for developers on failed H.265 checks

Signed-off-by: Mark Thompson <sw@jkqxz.net>
6 years agoAdd informational messages for developers on failed H.264 checks
Mark Thompson [Sat, 2 Dec 2017 16:00:40 +0000 (16:00 +0000)]
Add informational messages for developers on failed H.264 checks

Includes a warning if the level appears to be invalid, but continues anyway
in this case (it could be a correct future value or an unknown extension).

Signed-off-by: Mark Thompson <sw@jkqxz.net>
6 years agoFix coding style error from astyle
Mark Thompson [Sat, 2 Dec 2017 16:00:22 +0000 (16:00 +0000)]
Fix coding style error from astyle

Signed-off-by: Mark Thompson <sw@jkqxz.net>
6 years agoAdd support for H.264 levels 6, 6.1 and 6.2
Mark Thompson [Thu, 30 Nov 2017 21:47:55 +0000 (21:47 +0000)]
Add support for H.264 levels 6, 6.1 and 6.2

Fixes #307.

Signed-off-by: Mark Thompson <sw@jkqxz.net>
6 years agoConvert H.264 level limit lookup functions to use a table
Mark Thompson [Thu, 30 Nov 2017 21:46:33 +0000 (21:46 +0000)]
Convert H.264 level limit lookup functions to use a table

Do not abort on unknown values - instead use the limits for the nearest
valid value of level_idc less than the given one.

Signed-off-by: Mark Thompson <sw@jkqxz.net>
6 years agoRemove unused functions for slice and mv limits
Mark Thompson [Thu, 30 Nov 2017 21:25:03 +0000 (21:25 +0000)]
Remove unused functions for slice and mv limits

Signed-off-by: Mark Thompson <sw@jkqxz.net>
6 years agoInclude missing do in do/while macro
Victor Toso [Tue, 19 Dec 2017 09:05:10 +0000 (10:05 +0100)]
Include missing do in do/while macro

i965_encoder_vp8.c:1895:123: note: put the semicolon on a separate line
                             to silence this warning
i965_encoder_vp8.c:1898:112: warning: while loop has empty body

> ALLOC_VP8_RESOURCE_BUFFER(pak_mpu_tpu_picture_state_buffer,
>                           VP8_PICTURE_STATE_SIZE,
>                           "Picture state buffer");

Signed-off-by: Victor Toso <victortoso@redhat.com>
6 years agoUse enum's type name to fix implicit conversion
Victor Toso [Tue, 19 Dec 2017 07:07:40 +0000 (08:07 +0100)]
Use enum's type name to fix implicit conversion

The implicit conversion happens because there is another enum defined with
the name GEN9_HEVC_ENC_SURFACE_TYPE introduced in the same commit 455351f9

To avoid the several warnings below (by clang), let's use the enum's
defined type name.

gen9_hevc_encoder.c:5754:34: warning: implicit conversion from
enumeration type 'enum _GEN9_HEVC_ENC_SURFACE_TYPE' to different
enumeration type 'enum GEN9_HEVC_ENC_SURFACE_TYPE' [-Wenum-conversion]
     HEVC_ENC_SURFACE_Y_2X, bti_idx,
     ^~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Victor Toso <victortoso@redhat.com>
6 years agoFix coding style
Victor Toso [Tue, 19 Dec 2017 07:15:41 +0000 (08:15 +0100)]
Fix coding style

Fix requested by the pre-commit hook introduced in 2f0a8449f37b
> astyle --style=linux -cnpUH -s4 -M120 \
> src/gen9_hevc_encoder.c src/i965_encoder_vp8.c

This is necessary to avoid unrelated changes in the next two commits.

Signed-off-by: Victor Toso <victortoso@redhat.com>
6 years agoFix possible implicit conversion
Victor Toso [Tue, 19 Dec 2017 08:52:41 +0000 (09:52 +0100)]
Fix possible implicit conversion

Change variables and function's return type to unsigned int to be able to
hold 4010803200 (level_idc is 186) which is bigger then INT_MAX.

> gen9_hevc_enc_utils.c:72:19: warning: implicit conversion from 'long' to
> 'int' changes value from 4010803200 to -284164096 [-Wconstant-conversion]
>         max_bps = 4010803200;
>                 ~ ^~~~~~~~~~

Signed-off-by: Victor Toso <victortoso@redhat.com>
6 years agoFix check return value without assignment
Victor Toso [Tue, 19 Dec 2017 08:17:33 +0000 (09:17 +0100)]
Fix check return value without assignment

gen9_hevc_encoder.c:1248:19: warning: using the result of an assignment
as a condition without parentheses [-Wparentheses]
    if (va_status |= VA_STATUS_SUCCESS)
        ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~

Signed-off-by: Victor Toso <victortoso@redhat.com>
6 years agoi965: Remove negative check on unsigned variable
Victor Toso [Mon, 18 Dec 2017 15:28:32 +0000 (16:28 +0100)]
i965: Remove negative check on unsigned variable

Since its intoduction at 58a4a6afe80835829e95d

> i965_drv_video.c:2860:23: warning: comparison of unsigned
> expression < 0 is always false [-Wtautological-compare]
>    if ((num_elements < 0) ||
>         ~~~~~~~~~~~~ ^ ~

Signed-off-by: Victor Toso <victortoso@redhat.com>
6 years agoSmall optimization while removing warning
Victor Toso [Mon, 18 Dec 2017 15:01:24 +0000 (16:01 +0100)]
Small optimization while removing warning

Removed the helper array and its initialization loop as we can achieve the
same with two variables in one loop.

This patch also removes the warning below:

> gen8_mfc.c:2735:9: warning: variable 'i' is incremented both in the loop
> header and in the loop body [-Wfor-loop-analysis]
>         i++;
>         ^
> gen8_mfc.c:2732:25: note: incremented here
>     for (i = 0; i < 64; i++) {
>                         ^

Signed-off-by: Victor Toso <victortoso@redhat.com>
6 years agoVC1: Fix for frame coding mode
Xiang, Haihao [Mon, 8 Jan 2018 12:34:11 +0000 (20:34 +0800)]
VC1: Fix for frame coding mode

Some VC1 clips might be marked interlaced but have fcm < 2, and the
wrong fcm will lead to undefined behavior, such as GPU hang.

This fixes https://github.com/01org/intel-vaapi-driver/issues/316

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
6 years agogenX_mfd: add comment on dmv buffer scaling
carpalis [Wed, 6 Dec 2017 11:02:32 +0000 (12:02 +0100)]
genX_mfd: add comment on dmv buffer scaling

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: optimize comparison out of loop
carpalis [Sun, 12 Nov 2017 14:56:57 +0000 (15:56 +0100)]
genX_mfd: optimize comparison out of loop

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: fix code indenting
carpalis [Wed, 1 Nov 2017 19:08:49 +0000 (20:08 +0100)]
genX_mfd: fix code indenting

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogen8_mfd: program hardware for range reduction scaling
carpalis [Wed, 1 Nov 2017 19:04:13 +0000 (20:04 +0100)]
gen8_mfd: program hardware for range reduction scaling

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: clean up the use of profile bitstream element
carpalis [Wed, 1 Nov 2017 18:45:42 +0000 (19:45 +0100)]
genX_mfd: clean up the use of profile bitstream element

Only gen6 needs mapping from input range to the hardware range for
the profile bitstream element. For gen7 and up there is no need for a
mapping as the hardware uses only one bit indicating simple/main profile
or advanced profile. Therefore, we can remove the mapping for gen7 and
clean up the code a bit.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: fix range reduction scaling
carpalis [Wed, 1 Nov 2017 15:11:59 +0000 (16:11 +0100)]
genX_mfd: fix range reduction scaling

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: fix dmv buffer size calculation
carpalis [Tue, 31 Oct 2017 14:22:14 +0000 (15:22 +0100)]
genX_mfd: fix dmv buffer size calculation

The picture size may vary within a VC-1 stream. We should calculate
the dmv buffer size from the size of the surface instead of the
size of the first picture that uses the surface. Subsequent pictures
may be larger, which could overflow the dmv buffer.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: fix intensity compensation for frame-interlaced content
carpalis [Sat, 28 Oct 2017 13:21:39 +0000 (15:21 +0200)]
genX_mfd: fix intensity compensation for frame-interlaced content

When frame-interlaced pictures are signalled to be intensity
compensated, we need to set the hardware to compensating both the top and
the bottom field.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogen7_mfd: remove obsolete gen7_vc1_surface fields
carpalis [Sat, 28 Oct 2017 09:07:13 +0000 (11:07 +0200)]
gen7_mfd: remove obsolete gen7_vc1_surface fields

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agoi965_decoder_utils: enable decoding of VC-1 interlaced pictures
carpalis [Fri, 27 Oct 2017 12:58:53 +0000 (14:58 +0200)]
i965_decoder_utils: enable decoding of VC-1 interlaced pictures

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogen8_mfd: add support for VC-1 interlaced intensity compensation
carpalis [Fri, 27 Oct 2017 12:57:00 +0000 (14:57 +0200)]
gen8_mfd: add support for VC-1 interlaced intensity compensation

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogen8_mfd: add support for VC-1 interlaced reference frames
carpalis [Fri, 27 Oct 2017 12:56:26 +0000 (14:56 +0200)]
gen8_mfd: add support for VC-1 interlaced reference frames

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogen8_mfd: add support for VC-1 interlaced pictures
carpalis [Fri, 27 Oct 2017 12:55:56 +0000 (14:55 +0200)]
gen8_mfd: add support for VC-1 interlaced pictures

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogen7_mfd: add support for VC-1 interlaced intensity compensation
carpalis [Fri, 27 Oct 2017 12:54:57 +0000 (14:54 +0200)]
gen7_mfd: add support for VC-1 interlaced intensity compensation

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogen7_mfd: add support for VC-1 interlaced reference frames
carpalis [Fri, 27 Oct 2017 12:53:59 +0000 (14:53 +0200)]
gen7_mfd: add support for VC-1 interlaced reference frames

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogen7_mfd: add support for VC-1 interlaced pictures
carpalis [Fri, 27 Oct 2017 12:53:21 +0000 (14:53 +0200)]
gen7_mfd: add support for VC-1 interlaced pictures

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogen75_mfd: add support for VC-1 interlaced intensity compensation
carpalis [Fri, 27 Oct 2017 12:26:18 +0000 (14:26 +0200)]
gen75_mfd: add support for VC-1 interlaced intensity compensation

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogen75_mfd: add support for VC-1 interlaced reference frames
carpalis [Fri, 27 Oct 2017 12:24:24 +0000 (14:24 +0200)]
gen75_mfd: add support for VC-1 interlaced reference frames

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogen75_mfd: add support for VC-1 interlaced pictures
carpalis [Fri, 27 Oct 2017 12:23:07 +0000 (14:23 +0200)]
gen75_mfd: add support for VC-1 interlaced pictures

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agoi965_decoder_utils: add support for VC-1 interlaced pictures
carpalis [Fri, 27 Oct 2017 12:19:10 +0000 (14:19 +0200)]
i965_decoder_utils: add support for VC-1 interlaced pictures

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: fix calculation of motion vector mode
carpalis [Fri, 27 Oct 2017 11:04:33 +0000 (13:04 +0200)]
genX_mfd: fix calculation of motion vector mode

As stated in the PRM, the FastUVMCFlag field should be equal to the LSB
of the Motion Vector Mode field. This also conforms to VC-1 spec, as
FASTUVMC controls whether color difference motion vectors are
reconstructed with quarter of half pixel resolution.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: no raw coded bitplanes for skipped pictures
carpalis [Wed, 25 Oct 2017 11:26:01 +0000 (13:26 +0200)]
genX_mfd: no raw coded bitplanes for skipped pictures

Skipped pictures should not signal raw coded bitplanes as there are no
MBs encoded. Failure to do so results in decoding errors.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: fix BitplanePresentFlag for skipped pictures
carpalis [Tue, 24 Oct 2017 18:30:16 +0000 (20:30 +0200)]
genX_mfd: fix BitplanePresentFlag for skipped pictures

Skipped pictures do not pass a bitplane buffer. We do, however,
locally encode a bitplane buffer with only the SKIPMB bit set. The
presence of this buffer must be passed through the BitplanePresentFlag
hardware field.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: align dmv buffer use with VC-1 spec and PRM
carpalis [Mon, 23 Oct 2017 10:05:35 +0000 (12:05 +0200)]
genX_mfd: align dmv buffer use with VC-1 spec and PRM

As stated in VC-1 spec, the direct MV buffer will be written when
decoding a P frame. Subsequently, the direct MV buffer is read when
decoding a B frame that backward references this P frame.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: no need for loop filtering for skipped pictures
carpalis [Mon, 23 Oct 2017 09:02:35 +0000 (11:02 +0200)]
genX_mfd: no need for loop filtering for skipped pictures

Skipped pictures are equal to their reference frame and, therefore,
should not pass the loop filter. Although the loop filter was already
a null operation as all transform coefficients are zero for skipped
pictures, this may save some cyles in the decoder hardware.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: remove mapping of I frame to BI frame
carpalis [Mon, 23 Oct 2017 08:23:35 +0000 (10:23 +0200)]
genX_mfd: remove mapping of I frame to BI frame

This mapping does not make sense. Unless the mapping is some workaround
for a hardware quirk, we should be able to safely remove it. If this
breaks things, we can always put it back accompanied with an explanation
in the code.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: change order within if-else
carpalis [Mon, 23 Oct 2017 08:13:59 +0000 (10:13 +0200)]
genX_mfd: change order within if-else

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: use input range instead of mapped range in comparison
carpalis [Sun, 22 Oct 2017 18:40:31 +0000 (20:40 +0200)]
genX_mfd: use input range instead of mapped range in comparison

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: remove one-to-one mapping for picture_type
carpalis [Sun, 22 Oct 2017 17:53:11 +0000 (19:53 +0200)]
genX_mfd: remove one-to-one mapping for picture_type

In genX_mfd_vc1_pic_state, the logic of picture_type is not very clear
as it is mapped from the input range to the hardware range. The mapping,
however, is an identity mapping that, effectively, only maps a skipped
picture to a P picture. By putting the skipped picture logic explicitly
in the ocde, we can remove the unnecessary mapping and make the logic
much more clear.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: fix unnecessary variable reuse
carpalis [Sun, 22 Oct 2017 16:09:21 +0000 (18:09 +0200)]
genX_mfd: fix unnecessary variable reuse
Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: do not scale dmv buffer with height
carpalis [Sun, 22 Oct 2017 14:30:47 +0000 (16:30 +0200)]
genX_mfd: do not scale dmv buffer with height

PRM states that for VC-1 the direct motion vector buffer may be scaled
with frame height but should not be scaled with frame width. Hardware
assumes frame width is fixed at 128 MBs.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: align hardware programming of Y Offset for V(Cr) with comment
carpalis [Sun, 22 Oct 2017 13:54:58 +0000 (15:54 +0200)]
genX_mfd: align hardware programming of Y Offset for V(Cr) with comment

Although the PRM does not state that this field must be zero for
non-JPEG, we might as well set it to zero as indicated in the comment
and to make its use more clear.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: fix hardware programming for bitplanes coded in raw mode
carpalis [Sun, 22 Oct 2017 13:13:54 +0000 (15:13 +0200)]
genX_mfd: fix hardware programming for bitplanes coded in raw mode

Bitplanes that are coded in raw mode are signalled through the
raw_coding flags in the VAPictureParameterBufferVC1 structure. The
absence of a bitplane does not necessarily imply that this bit is
encoded in raw mode. A progressive P picture in advanced profile, for
example, does not encode the SKIPMB bitplane nor does it encode this
bit in raw mode.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: mask unused bits in bitplane_present.value
carpalis [Sun, 22 Oct 2017 11:29:19 +0000 (13:29 +0200)]
genX_mfd: mask unused bits in bitplane_present.value

Due to the union construct, unused bits in bitplane_present.value might
be uninitialized even when the used bits are all set to a value.
Masking the unused bits prevents spurious true values when all used
bits are unset, e.g. skipped pictures.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: fix bitplane encoding for skipped pictures
carpalis [Sat, 21 Oct 2017 14:53:16 +0000 (16:53 +0200)]
genX_mfd: fix bitplane encoding for skipped pictures

VC-1 skipped pictures do not encode a slice or MB layer, nor do they
encode any bitplanes. For a skipped picture, we should unconditionally
encode the bitplane buffer with only the SKIPMB bit set. Furthermore,
we optimize the static picture_type comparison out of the double loop.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogen75_mfd: Check ptr before dereferencing
carpalis [Sat, 21 Oct 2017 13:07:39 +0000 (15:07 +0200)]
gen75_mfd: Check ptr before dereferencing

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agogenX_mfd: remove emulation byte on MB layer boundary
carpalis [Sat, 21 Oct 2017 10:22:19 +0000 (12:22 +0200)]
genX_mfd: remove emulation byte on MB layer boundary

As stated in the PRM, VC-1 decoder hardware cannot handle the case
where the second 0x00 byte in the emulation prevention pattern
0x00 0x00 0x03 (0x00-0x03) coincides with the start of the
MB layer. Fixed by overwriting the 0x03 byte with the previous 0x00
byte and adjusting the MB layer byte offset accordingly.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 years agoDo CSC/scaling from 8bit 420 YUV to RGB32 in the common path
Xiang, Haihao [Thu, 19 Oct 2017 23:14:49 +0000 (07:14 +0800)]
Do CSC/scaling from 8bit 420 YUV to RGB32 in the common path

A new vpp shader is added

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
6 years agoDo CSC/scaling for YV12/IMC1/IMC3 surface in the common path
Xiang, Haihao [Fri, 20 Oct 2017 00:07:25 +0000 (08:07 +0800)]
Do CSC/scaling for YV12/IMC1/IMC3 surface in the common path

The existing vpp shader is re-used

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
6 years agoAllow loading mulitple kernels for a single GPE for the common path on GEN8
Xiang, Haihao [Sun, 22 Oct 2017 00:47:42 +0000 (08:47 +0800)]
Allow loading mulitple kernels for a single GPE for the common path on GEN8

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
6 years agoMove reserved bytes to the end of the structure
Xiang, Haihao [Sat, 21 Oct 2017 20:09:03 +0000 (04:09 +0800)]
Move reserved bytes to the end of the structure

This structure defines the input parameters from driver to common
csc/scaling shader, so the corresponding vpp shaders are updated as
well. In addition, more reserved bytes are added for future use

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
6 years agoAdd info messages for failure cases of vaExportSurfaceHandle()
Mark Thompson [Thu, 30 Nov 2017 22:31:34 +0000 (22:31 +0000)]
Add info messages for failure cases of vaExportSurfaceHandle()

Signed-off-by: Mark Thompson <sw@jkqxz.net>
6 years agoAdd new functions for logging
Mark Thompson [Thu, 30 Nov 2017 22:19:31 +0000 (22:19 +0000)]
Add new functions for logging

These use the error and info callbacks added recently to libva.

Signed-off-by: Mark Thompson <sw@jkqxz.net>
6 years agoAVC encoder: fix ROI CQP array indexing
U. Artie Eoff [Fri, 1 Dec 2017 21:16:12 +0000 (13:16 -0800)]
AVC encoder: fix ROI CQP array indexing

Use correct variable for ROI indexing.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
6 years agoAVC encoder: fix ROI config for CQP
U. Artie Eoff [Fri, 1 Dec 2017 20:59:40 +0000 (12:59 -0800)]
AVC encoder: fix ROI config for CQP

Introduced in:

commit 972e6f2b36499389bc7cb7bb34414423b5525143
Author: Xiang, Haihao <haihao.xiang@intel.com>
Date:   Wed Jan 4 09:40:47 2017 +0800

    AVC encoder: use generic ROI parameters

num_roi setting was lost and thus always 0, which essentially
disabled the "for (j = num_roi; j ; j--)" loop in the
VA_RC_CQP case.

Fix this by ensuring num_roi is set to the correct value stored
in the common structure.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
6 years agoImplement vaExportSurfaceHandle()
Mark Thompson [Sun, 17 Sep 2017 17:10:38 +0000 (18:10 +0100)]
Implement vaExportSurfaceHandle()

This is a new interface in libva to support wider use-cases of passing
surfaces to external APIs.  In particular, this does not require creation
of derived images before export, and offers richer metadata such as DRM
format information.

Signed-off-by: Mark Thompson <sw@jkqxz.net>
6 years agotest: add null check assertions to object_heap tests
U. Artie Eoff [Wed, 29 Nov 2017 19:26:59 +0000 (11:26 -0800)]
test: add null check assertions to object_heap tests

Ensure objects are not NULL before dereferencing.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
6 years agovme_context->private_enc_ctx: check null before dereference
U. Artie Eoff [Wed, 29 Nov 2017 19:06:13 +0000 (11:06 -0800)]
vme_context->private_enc_ctx: check null before dereference

Ensure priv_ctx is not null before dereferencing it.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
6 years agofix possible null dereference after null check
U. Artie Eoff [Wed, 29 Nov 2017 18:45:10 +0000 (10:45 -0800)]
fix possible null dereference after null check

obj_surf_input and obj_surf_output are dereferenced unconditionally
and required for successful control flow.  Thus, verify they
are not null, else return error.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
6 years agofix inadvertent logic error in conditional
U. Artie Eoff [Wed, 29 Nov 2017 18:17:11 +0000 (10:17 -0800)]
fix inadvertent logic error in conditional

The condition:

  slice_param->slice_type != SLICE_TYPE_I ||
    slice_param->slice_type != SLICE_TYPE_SI

...is always true.  This appears to be an inadvertent
logic error by original author.  The assumption is that
&& was the intention and makes more sense, thus change it
to us && instead of ||.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
6 years agotest: fix use of uninitialized variable
U. Artie Eoff [Thu, 16 Nov 2017 23:25:21 +0000 (15:25 -0800)]
test: fix use of uninitialized variable

Initialize VAImage variable at the point of declaration.

Since i965_DeriveImage is declared as extern in the tests,
a static scanner appears to be unable to detect that VAImage is
actually initialized by the i965_DeriveImage implementation
in the driver.  This causes it to flag it as "use of an
uninitialized variable" along the success path.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
6 years agogtest: Fix 5 failed cases on legacy platforms
Xiang, Haihao [Sat, 21 Oct 2017 06:30:24 +0000 (14:30 +0800)]
gtest: Fix 5 failed cases on legacy platforms

Some legacy platforms only support VAProfileH264StereoHigh decoding

[----------] Global test environment tear-down
[==========] 599 tests from 16 test cases ran. (335 ms total)
[  PASSED  ] 594 tests.
[  FAILED  ] 5 tests, listed below:
[  FAILED  ] AVCDecode/I965ConfigTest.Create/3, where GetParam() = VAProfileH264MultiviewHigh : VAEntrypointVLD
[  FAILED  ] AVCEncode/I965ConfigTest.Create/12, where GetParam() = VAProfileH264MultiviewHigh : VAEntrypointEncSlice
[  FAILED  ] AVCEncode/I965ConfigTest.Create/13, where GetParam() = VAProfileH264MultiviewHigh : VAEntrypointEncSliceLP
[  FAILED  ] AVCEncode/I965ConfigTest.Create/14, where GetParam() = VAProfileH264MultiviewHigh : VAEntrypointEncPicture
[  FAILED  ] AVCEncode/I965ConfigTest.Create/15, where GetParam() = VAProfileH264MultiviewHigh : VAEntrypointFEI

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
6 years agoAdd upper bound check in HCP_IND_OBJ_BASE_ADDR_STATE
Xiang, Haihao [Mon, 30 Oct 2017 21:58:24 +0000 (05:58 +0800)]
Add upper bound check in HCP_IND_OBJ_BASE_ADDR_STATE

The commit 29e375a fixed some VP9 decoding artifacts reported in
https://github.com/01org/intel-vaapi-driver/issues/262, but we still
see artifacts when decoding some VP9 clips. More investigations show
that the artifacts are caused by graphics address 0

The graphics address for a GEM BO may be 0 since the commit
below was merged into i915 KMD

commit 2889caa9232109afc8881f29a2205abeb5709d0c
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jun 16 15:05:19 2017 +0100

    drm/i915: Eliminate lots of iterations over the execobjects array

So we never saw this issue before commit 2889caa

Setting upper bound to 0 causes that HW ignores upper bound check, which
works for non-zero base graphics address in HCP pipeline, however the
upper bound check is required for graphics address 0, so we add the bound
check no matter what is the graphics address

This fixes https://github.com/01org/intel-vaapi-driver/issues/297

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
6 years agovp9enc: limit min_qp of brc to be non-zero
Zhong Li [Thu, 16 Nov 2017 09:05:14 +0000 (17:05 +0800)]
vp9enc: limit min_qp of brc to be non-zero

If base_qindex (luma_ac_qindex) is equal to zero, the enode mode will be
lossless mode when
luma_dc_qindex_delta/chroma_ac_qindex_delta/chroma_dc_qindex_delta are
also zero. In this case, the tx_mode should be set to ONLY_4X4, but current
driver only support TX_MODE_SELECT. This will cause the lossless mode
encoding failure.
Limitting the min_qp to be non-zero can force the encoding mode to be normal
mode.
It is to fix issue #284

Signed-off-by: Zhong Li <zhong.li@intel.com>
6 years agofix memset size for fixed array
U. Artie Eoff [Tue, 21 Nov 2017 20:05:39 +0000 (12:05 -0800)]
fix memset size for fixed array

Use sizeof on fixed array instead of hard-coded value.

The hard-coded value did not account for the size of the
data type (uint32_t) and therefore did not zero out the
entire array, rather it only zero'd out number of elements
bytes.

This prevents compiler memset-elt-size error when using
-Wall -Werror compiler flags.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
6 years agogen5_6: fix null shader generation
Sebastian Ramacher [Thu, 5 Oct 2017 22:23:54 +0000 (00:23 +0200)]
gen5_6: fix null shader generation

Also null.g4b is not required here.

Signed-off-by: Sebastian Ramacher <sramacher@debian.org>