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)
autogen.sh: fix out of tree invocation

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
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>
configure: use ${libdir} over the hardcoded /usr/lib

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
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>
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>
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>
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>
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>
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>
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)
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)
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>
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>
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>
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>
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>
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>
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>
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>