Re: [Libva] [Libva-intel-driver][PATCH 1/2] Check whether there is a fully loaded HuC firmware

2017-01-22 Thread Daniel Vetter
On Wed, Sep 28, 2016 at 01:45:54PM -0700, Sean V Kelley wrote:
> On Wed, 2016-09-28 at 08:42 +0800, Xiang, Haihao wrote:
> > > Signed-off-by: Xiang, Haihao 
> 
> lgtm, applied.
> 
> Now we just need the kernel patches merged and we should be good.

Those just landed, you're good to go.

Cheers, Daniel

> 
> Thanks,
> 
> Sean
> 
> 
> > ---
>  src/intel_driver.c | 12 
>  src/intel_driver.h |  1 +
>  2 files changed, 13 insertions(+)
> 
> diff --git a/src/intel_driver.c b/src/intel_driver.c
> index 96c1994..bb19401 100644
> --- a/src/intel_driver.c
> +++ b/src/intel_driver.c
> @@ -44,6 +44,12 @@ uint32_t g_intel_debug_option_flags = 0;
>  #define LOCAL_I915_PARAM_HAS_BSD230
>  #endif
>  
> +#ifdef I915_PARAM_HAS_HUC
> +#define LOCAL_I915_PARAM_HAS_HUC I915_PARAM_HAS_HUC
> +#else
> +#define LOCAL_I915_PARAM_HAS_HUC 42
> +#endif
> +
>  static Bool
>  intel_driver_get_param(struct intel_driver_data *intel, int param, int 
> *value)
>  {
> @@ -130,6 +136,12 @@ intel_driver_init(VADriverContextP ctx)
>  if (intel_driver_get_param(intel, LOCAL_I915_PARAM_HAS_BSD2, _value))
>  intel->has_bsd2 = !!ret_value;
>  
> +intel->has_huc = 0;
> +ret_value = 0;
> +
> +if (intel_driver_get_param(intel, LOCAL_I915_PARAM_HAS_HUC, _value))
> +intel->has_huc = !!ret_value;
> +
>  intel_driver_get_revid(intel, >revision);
>  return true;
>  }
> diff --git a/src/intel_driver.h b/src/intel_driver.h
> index c9a80c8..dcdc03b 100644
> --- a/src/intel_driver.h
> +++ b/src/intel_driver.h
> @@ -181,6 +181,7 @@ struct intel_driver_data
>  unsigned int has_blt: 1; /* Flag: has BLT unit? */
>  unsigned int has_vebox  : 1; /* Flag: has VEBOX unit */
>  unsigned int has_bsd2   : 1; /* Flag: has the second BSD video ring unit 
> */
> +unsigned int has_huc: 1; /* Flag: has a fully loaded HuC firmware? */
>  
>  const struct intel_device_info *device_info;
>  };
> 

> ___
> Libva mailing list
> Libva@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/libva


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Libva mailing list
Libva@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libva


Re: [Libva] [PATCH v2 1/9] ENC: move gpe related function into src/i965_gpe_utils.h/c

2017-01-22 Thread Qu, Pengfei


-Original Message-
From: Zhao, Yakui 
Sent: Monday, January 23, 2017 10:11 AM
To: Qu, Pengfei 
Cc: libva@lists.freedesktop.org
Subject: Re: [Libva] [PATCH v2 1/9] ENC: move gpe related function into 
src/i965_gpe_utils.h/c

On 01/22/2017 03:36 PM, Pengfei Qu wrote:
> v1:
> add align version for obj surface conversion to gpe surface remove 
> comments and enum value
>
> Signed-off-by: Pengfei Qu
> Reviewed-by: Sean V Kelley
> ---
>   src/gen9_vp9_encoder.c | 154 ++---
>   src/gen9_vp9_encoder.h |  10 --
>   src/i965_defines.h |   3 +
>   src/i965_gpe_utils.c   | 256 
> +
>   src/i965_gpe_utils.h   |  75 +++
>   5 files changed, 340 insertions(+), 158 deletions(-)
>   mode change 100755 =>  100644 src/i965_defines.h
>
> diff --git a/src/gen9_vp9_encoder.c b/src/gen9_vp9_encoder.c index 
> 05d86da..32ed729 100644
> --- a/src/gen9_vp9_encoder.c
> +++ b/src/gen9_vp9_encoder.c
> @@ -58,7 +58,6 @@
>   #define BRC_KERNEL_AVBR 0x0040
>   #define BRC_KERNEL_CQL  0x0080
>
> -#define DEFAULT_MOCS  0x02
>   #define VP9_PIC_STATE_BUFFER_SIZE 192
>
>   typedef struct _intel_kernel_header_ @@ -842,7 +841,7 @@ 
> gen9_vp9_free_resources(struct gen9_encoder_context_vp9 *vme_context)
>
>   static void
>   gen9_init_media_object_walker_parameter(struct intel_encoder_context 
> *encoder_context,
> -struct 
> vp9_encoder_kernel_walker_parameter *kernel_walker_param,
> +struct 
> + gpe_encoder_kernel_walker_parameter *kernel_walker_param,
>   struct 
> gpe_media_object_walker_parameter *walker_param)
>   {
>   memset(walker_param, 0, sizeof(*walker_param)); @@ -924,147 
> +923,6 @@ gen9_init_media_object_walker_parameter(struct 
> intel_encoder_context *encoder_co
>   }
>
>   static void
> -gen9_add_2d_gpe_surface(VADriverContextP ctx,
> -struct i965_gpe_context *gpe_context,
> -struct object_surface *obj_surface,
> -int is_uv_surface,
> -int is_media_block_rw,
> -unsigned int format,
> -int index)
> -{
> -struct i965_gpe_resource gpe_resource;
> -struct i965_gpe_surface gpe_surface;
> -
> -memset(_surface, 0, sizeof(gpe_surface));
> -
> -i965_object_surface_to_2d_gpe_resource(_resource, obj_surface);
> -gpe_surface.gpe_resource =_resource;
> -gpe_surface.is_2d_surface = 1;
> -gpe_surface.is_uv_surface = !!is_uv_surface;
> -gpe_surface.is_media_block_rw = !!is_media_block_rw;
> -
> -gpe_surface.cacheability_control = DEFAULT_MOCS;
> -gpe_surface.format = format;
> -
> -gen9_gpe_context_add_surface(gpe_context,_surface, index);
> -i965_free_gpe_resource(_resource);
> -}
> -
> -static void
> -gen9_add_adv_gpe_surface(VADriverContextP ctx,
> - struct i965_gpe_context *gpe_context,
> - struct object_surface *obj_surface,
> - int index)
> -{
> -struct i965_gpe_resource gpe_resource;
> -struct i965_gpe_surface gpe_surface;
> -
> -memset(_surface, 0, sizeof(gpe_surface));
> -
> -i965_object_surface_to_2d_gpe_resource(_resource, obj_surface);
> -gpe_surface.gpe_resource =_resource;
> -gpe_surface.is_adv_surface = 1;
> -gpe_surface.cacheability_control = DEFAULT_MOCS;
> -gpe_surface.v_direction = 2;
> -
> -gen9_gpe_context_add_surface(gpe_context,_surface, index);
> -i965_free_gpe_resource(_resource);
> -}
> -
> -static void
> -gen9_add_buffer_gpe_surface(VADriverContextP ctx,
> -struct i965_gpe_context *gpe_context,
> -struct i965_gpe_resource *gpe_buffer,
> -int is_raw_buffer,
> -unsigned int size,
> -unsigned int offset,
> -int index)
> -{
> -struct i965_gpe_surface gpe_surface;
> -
> -memset(_surface, 0, sizeof(gpe_surface));
> -
> -gpe_surface.gpe_resource = gpe_buffer;
> -gpe_surface.is_buffer = 1;
> -gpe_surface.is_raw_buffer = !!is_raw_buffer;
> -gpe_surface.cacheability_control = DEFAULT_MOCS;
> -gpe_surface.size = size;
> -gpe_surface.offset = offset;
> -
> -gen9_gpe_context_add_surface(gpe_context,_surface, index);
> -}
> -
> -static void
> -gen9_add_buffer_2d_gpe_surface(VADriverContextP ctx,
> -   struct i965_gpe_context *gpe_context,
> -   struct i965_gpe_resource *gpe_buffer,
> -   int is_media_block_rw,
> -   unsigned int format,
> -   int index)
> -{
> -  

Re: [Libva] [PATCH v2 2/9] ENC: add common structure for AVC/HEVC encoder

2017-01-22 Thread Qu, Pengfei


-Original Message-
From: Zhao, Yakui 
Sent: Monday, January 23, 2017 10:25 AM
To: Qu, Pengfei 
Cc: libva@lists.freedesktop.org
Subject: Re: [Libva] [PATCH v2 2/9] ENC: add common structure for AVC/HEVC 
encoder

On 01/22/2017 03:36 PM, Pengfei Qu wrote:
> v1:
> add context init function for AVC encoder
>
> v2:
> add file in the Makefile.am
>
> Signed-off-by: Pengfei Qu
> Reviewed-by: Sean V Kelley
> ---
>   src/Makefile.am   |   3 +
>   src/i965_encoder_api.h|  47 
>   src/i965_encoder_common.c | 124 +++
>   src/i965_encoder_common.h | 530 
> ++
>   4 files changed, 704 insertions(+)
>   mode change 100755 =>  100644 src/Makefile.am
>   create mode 100644 src/i965_encoder_api.h
>   create mode 100644 src/i965_encoder_common.c
>   create mode 100644 src/i965_encoder_common.h
>
> diff --git a/src/Makefile.am b/src/Makefile.am old mode 100755 new 
> mode 100644 index 424812b..a7508e5
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -102,6 +102,7 @@ source_c = \
>   gen9_vp9_const_def.c  \
>   gen9_vp9_encoder.c  \
>   intel_common_vpp_internal.c   \
> +i965_encoder_common.c\
>   $(NULL)
>
>   source_h = \
> @@ -156,6 +157,8 @@ source_h = \
>   gen9_vp9_encoder_kernels.h   \
>   intel_gen_vppapi.h   \
>   intel_common_vpp_internal.h   \
> +i965_encoder_common.h\
> +i965_encoder_api.h\
>   $(NULL)
>
>   # convenience library that can be linked by driver and tests diff 
> --git a/src/i965_encoder_api.h b/src/i965_encoder_api.h new file mode 
> 100644 index 000..ebb0edc
> --- /dev/null
> +++ b/src/i965_encoder_api.h
> @@ -0,0 +1,47 @@
> +/*
> + * Copyright © 2016 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person 
> +obtaining a
> + * copy of this software and associated documentation files (the
> + * "Software"), to deal in the Software without restriction, 
> +including
> + * without limitation the rights to use, copy, modify, merge, 
> +publish,
> + * distribute, sub license, and/or sell copies of the Software, and 
> +to
> + * permit persons to whom the Software is furnished to do so, subject 
> +to
> + * the following conditions:
> + *
> + * The above copyright notice and this permission notice (including 
> +the
> + * next paragraph) shall be included in all copies or substantial 
> +portions
> + * of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
> +EXPRESS
> + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
> + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE 
> +FOR
> + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 
> +CONTRACT,
> + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> + *
> + * Authors:
> + * Pengfei Qu
> + *
> + */
> +
> +#ifndef _I965_ENCODER_API_H_
> +#define _I965_ENCODER_API_H_
> +
> +#include
> +
> +struct intel_encoder_context;
> +struct hw_context;
> +
> +/* H264/AVC */
> +extern Bool
> +gen9_avc_vme_context_init(VADriverContextP ctx, struct 
> +intel_encoder_context *encoder_context);
> +
> +extern Bool
> +gen9_avc_pak_context_init(VADriverContextP ctx, struct 
> +intel_encoder_context *encoder_context);
> +
> +extern VAStatus
> +gen9_avc_coded_status(VADriverContextP ctx, char *buffer, struct 
> +hw_context *hw_context);
> +
> +#endif  // _I965_ENCODER_API_H_
> diff --git a/src/i965_encoder_common.c b/src/i965_encoder_common.c new 
> file mode 100644 index 000..a045701
> --- /dev/null
> +++ b/src/i965_encoder_common.c
> @@ -0,0 +1,124 @@
> +/*
> + * Copyright @ 2016 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person 
> +obtaining a
> + * copy of this software and associated documentation files (the
> + * "Software"), to deal in the Software without restriction, 
> +including
> + * without limitation the rights to use, copy, modify, merge, 
> +publish,
> + * distribute, sub license, and/or sell copies of the Software, and 
> +to
> + * permit persons to whom the Software is furnished to do so, subject 
> +to
> + * the following conditions:
> + *
> + * The above copyright notice and this permission notice (including 
> +the
> + * next paragraph) shall be included in all copies or substantial 
> +portions
> + * of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
> +EXPRESS
> + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
> + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE 
> +FOR
> + * ANY CLAIM, DAMAGES OR OTHER 

Re: [Libva] [PATCH v2 0/9] Encoder Architecture Changes (Primarily AVC)

2017-01-22 Thread Xiang, Haihao


> On 01/22/2017 03:36 PM, Pengfei Qu wrote:
> > Encoder architecture restructuring for H.264 (with some impact to HEVC now)
> > on HSW+
> 
> Sorry that patch 04 is missing.

It was blocked by the mail server, I just approved it in the mailing list
moderation, you should receive it now.


> 
> > * Improvements to the shaders
> > * Improvements to the B frame efficiency
> > * Improvements to the low bit rate mode
> > * Improved features in two stage VME/PAK pipeline
> > 
> > v1:
> > Reduce the patch number and re org for VME and MFX related patches.
> > Patch re org for VME pipeline
> > Patch re org for MFX pipeline
> > keep assert for internal logic and replace assert for input validation
> > function.
> > Remove unnecessary comments and enum value.
> > Use the 64bit version OUT_BCS_RELOC64.
> > Move kernel binary into header file.
> > use misc parameter from encoder_context structure.
> > 
> > v2:
> > add APL support
> > For each patch, new file is added in the Makefile.am
> > Fix zero divide issue under cqp
> > Correct the license header for the new file.
> > Fix the Batch buffer logic when conditional end enabled.
> > Remove the execution bit for the files.
> > misc changes.
> > 
> > Pengfei Qu (9):
> >    ENC: move gpe related function into src/i965_gpe_utils.h/c
> >    ENC: add common structure for AVC/HEVC encoder
> >    ENC: add const data/table for AVC encoder
> >    ENC: add AVC kernel binary on SKL
> >    ENC: add AVC common structure and functions
> >    ENC: add kernel related structure and define for AVC
> >    ENC: add VME pipeline for AVC encoder
> >    ENC: add MFX pipeline for AVC encoder
> >    ENC:support more quality level and switch to new AVC encoder solution
> >  on SKL/APL
> > 
> >   src/Makefile.am|10 +
> >   src/gen9_avc_const_def.c   |  1090 
> >   src/gen9_avc_const_def.h   |   115 +
> >   src/gen9_avc_encoder.c |  7631 +
> >   src/gen9_avc_encoder.h |  2339 
> >   src/gen9_avc_encoder_kernels.h | 12078
> > +++
> >   src/gen9_vp9_encoder.c |   154 +-
> >   src/gen9_vp9_encoder.h |10 -
> >   src/i965_avc_encoder_common.c  |   319 ++
> >   src/i965_avc_encoder_common.h  |   305 +
> >   src/i965_defines.h | 3 +
> >   src/i965_drv_video.c   | 8 +-
> >   src/i965_drv_video.h   | 2 +
> >   src/i965_encoder.c |55 +-
> >   src/i965_encoder_api.h |47 +
> >   src/i965_encoder_common.c  |   124 +
> >   src/i965_encoder_common.h  |   539 ++
> >   src/i965_gpe_utils.c   |   256 +
> >   src/i965_gpe_utils.h   |75 +
> >   19 files changed, 24992 insertions(+), 168 deletions(-)
> >   mode change 100755 =>  100644 src/Makefile.am
> >   create mode 100644 src/gen9_avc_const_def.c
> >   create mode 100644 src/gen9_avc_const_def.h
> >   create mode 100644 src/gen9_avc_encoder.c
> >   create mode 100644 src/gen9_avc_encoder.h
> >   create mode 100644 src/gen9_avc_encoder_kernels.h
> >   create mode 100644 src/i965_avc_encoder_common.c
> >   create mode 100644 src/i965_avc_encoder_common.h
> >   mode change 100755 =>  100644 src/i965_defines.h
> >   create mode 100644 src/i965_encoder_api.h
> >   create mode 100644 src/i965_encoder_common.c
> >   create mode 100644 src/i965_encoder_common.h
> > 
> 
> ___
> Libva mailing list
> Libva@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/libva
___
Libva mailing list
Libva@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libva


Re: [Libva] [PATCH v2 2/9] ENC: add common structure for AVC/HEVC encoder

2017-01-22 Thread Zhao Yakui

On 01/22/2017 03:36 PM, Pengfei Qu wrote:

v1:
add context init function for AVC encoder

v2:
add file in the Makefile.am

Signed-off-by: Pengfei Qu
Reviewed-by: Sean V Kelley
---
  src/Makefile.am   |   3 +
  src/i965_encoder_api.h|  47 
  src/i965_encoder_common.c | 124 +++
  src/i965_encoder_common.h | 530 ++
  4 files changed, 704 insertions(+)
  mode change 100755 =>  100644 src/Makefile.am
  create mode 100644 src/i965_encoder_api.h
  create mode 100644 src/i965_encoder_common.c
  create mode 100644 src/i965_encoder_common.h

diff --git a/src/Makefile.am b/src/Makefile.am
old mode 100755
new mode 100644
index 424812b..a7508e5
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -102,6 +102,7 @@ source_c = \
gen9_vp9_const_def.c  \
gen9_vp9_encoder.c  \
intel_common_vpp_internal.c   \
+i965_encoder_common.c\
$(NULL)

  source_h = \
@@ -156,6 +157,8 @@ source_h = \
gen9_vp9_encoder_kernels.h   \
intel_gen_vppapi.h   \
intel_common_vpp_internal.h   \
+i965_encoder_common.h\
+i965_encoder_api.h\
$(NULL)

  # convenience library that can be linked by driver and tests
diff --git a/src/i965_encoder_api.h b/src/i965_encoder_api.h
new file mode 100644
index 000..ebb0edc
--- /dev/null
+++ b/src/i965_encoder_api.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright © 2016 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Pengfei Qu
+ *
+ */
+
+#ifndef _I965_ENCODER_API_H_
+#define _I965_ENCODER_API_H_
+
+#include
+
+struct intel_encoder_context;
+struct hw_context;
+
+/* H264/AVC */
+extern Bool
+gen9_avc_vme_context_init(VADriverContextP ctx, struct intel_encoder_context 
*encoder_context);
+
+extern Bool
+gen9_avc_pak_context_init(VADriverContextP ctx, struct intel_encoder_context 
*encoder_context);
+
+extern VAStatus
+gen9_avc_coded_status(VADriverContextP ctx, char *buffer, struct hw_context 
*hw_context);
+
+#endif  // _I965_ENCODER_API_H_
diff --git a/src/i965_encoder_common.c b/src/i965_encoder_common.c
new file mode 100644
index 000..a045701
--- /dev/null
+++ b/src/i965_encoder_common.c
@@ -0,0 +1,124 @@
+/*
+ * Copyright @ 2016 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWAR OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Pengfei Qu
+ *
+ */
+#include
+#include
+#include "intel_batchbuffer.h"
+#include "intel_driver.h"
+#include "i965_encoder_common.h"
+#include "i965_gpe_utils.h"
+
+
+const unsigned int table_enc_search_path[2][8][16] =
+{
+// I-Frame&  P-Frame
+{
+// MEMethod: 0
+{
+0x120FF10F, 0x1E22E20D, 

Re: [Libva] [PATCH v2 0/9] Encoder Architecture Changes (Primarily AVC)

2017-01-22 Thread Zhao Yakui

On 01/22/2017 03:36 PM, Pengfei Qu wrote:

Encoder architecture restructuring for H.264 (with some impact to HEVC now) on 
HSW+


Sorry that patch 04 is missing.


* Improvements to the shaders
* Improvements to the B frame efficiency
* Improvements to the low bit rate mode
* Improved features in two stage VME/PAK pipeline

v1:
Reduce the patch number and re org for VME and MFX related patches.
Patch re org for VME pipeline
Patch re org for MFX pipeline
keep assert for internal logic and replace assert for input validation function.
Remove unnecessary comments and enum value.
Use the 64bit version OUT_BCS_RELOC64.
Move kernel binary into header file.
use misc parameter from encoder_context structure.

v2:
add APL support
For each patch, new file is added in the Makefile.am
Fix zero divide issue under cqp
Correct the license header for the new file.
Fix the Batch buffer logic when conditional end enabled.
Remove the execution bit for the files.
misc changes.

Pengfei Qu (9):
   ENC: move gpe related function into src/i965_gpe_utils.h/c
   ENC: add common structure for AVC/HEVC encoder
   ENC: add const data/table for AVC encoder
   ENC: add AVC kernel binary on SKL
   ENC: add AVC common structure and functions
   ENC: add kernel related structure and define for AVC
   ENC: add VME pipeline for AVC encoder
   ENC: add MFX pipeline for AVC encoder
   ENC:support more quality level and switch to new AVC encoder solution
 on SKL/APL

  src/Makefile.am|10 +
  src/gen9_avc_const_def.c   |  1090 
  src/gen9_avc_const_def.h   |   115 +
  src/gen9_avc_encoder.c |  7631 +
  src/gen9_avc_encoder.h |  2339 
  src/gen9_avc_encoder_kernels.h | 12078 +++
  src/gen9_vp9_encoder.c |   154 +-
  src/gen9_vp9_encoder.h |10 -
  src/i965_avc_encoder_common.c  |   319 ++
  src/i965_avc_encoder_common.h  |   305 +
  src/i965_defines.h | 3 +
  src/i965_drv_video.c   | 8 +-
  src/i965_drv_video.h   | 2 +
  src/i965_encoder.c |55 +-
  src/i965_encoder_api.h |47 +
  src/i965_encoder_common.c  |   124 +
  src/i965_encoder_common.h  |   539 ++
  src/i965_gpe_utils.c   |   256 +
  src/i965_gpe_utils.h   |75 +
  19 files changed, 24992 insertions(+), 168 deletions(-)
  mode change 100755 =>  100644 src/Makefile.am
  create mode 100644 src/gen9_avc_const_def.c
  create mode 100644 src/gen9_avc_const_def.h
  create mode 100644 src/gen9_avc_encoder.c
  create mode 100644 src/gen9_avc_encoder.h
  create mode 100644 src/gen9_avc_encoder_kernels.h
  create mode 100644 src/i965_avc_encoder_common.c
  create mode 100644 src/i965_avc_encoder_common.h
  mode change 100755 =>  100644 src/i965_defines.h
  create mode 100644 src/i965_encoder_api.h
  create mode 100644 src/i965_encoder_common.c
  create mode 100644 src/i965_encoder_common.h



___
Libva mailing list
Libva@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libva


Re: [Libva] [PATCH v2 1/9] ENC: move gpe related function into src/i965_gpe_utils.h/c

2017-01-22 Thread Zhao Yakui

On 01/22/2017 03:36 PM, Pengfei Qu wrote:

v1:
add align version for obj surface conversion to gpe surface
remove comments and enum value

Signed-off-by: Pengfei Qu
Reviewed-by: Sean V Kelley
---
  src/gen9_vp9_encoder.c | 154 ++---
  src/gen9_vp9_encoder.h |  10 --
  src/i965_defines.h |   3 +
  src/i965_gpe_utils.c   | 256 +
  src/i965_gpe_utils.h   |  75 +++
  5 files changed, 340 insertions(+), 158 deletions(-)
  mode change 100755 =>  100644 src/i965_defines.h

diff --git a/src/gen9_vp9_encoder.c b/src/gen9_vp9_encoder.c
index 05d86da..32ed729 100644
--- a/src/gen9_vp9_encoder.c
+++ b/src/gen9_vp9_encoder.c
@@ -58,7 +58,6 @@
  #define BRC_KERNEL_AVBR 0x0040
  #define BRC_KERNEL_CQL  0x0080

-#define DEFAULT_MOCS  0x02
  #define VP9_PIC_STATE_BUFFER_SIZE 192

  typedef struct _intel_kernel_header_
@@ -842,7 +841,7 @@ gen9_vp9_free_resources(struct gen9_encoder_context_vp9 
*vme_context)

  static void
  gen9_init_media_object_walker_parameter(struct intel_encoder_context 
*encoder_context,
-struct 
vp9_encoder_kernel_walker_parameter *kernel_walker_param,
+struct 
gpe_encoder_kernel_walker_parameter *kernel_walker_param,
  struct 
gpe_media_object_walker_parameter *walker_param)
  {
  memset(walker_param, 0, sizeof(*walker_param));
@@ -924,147 +923,6 @@ gen9_init_media_object_walker_parameter(struct 
intel_encoder_context *encoder_co
  }

  static void
-gen9_add_2d_gpe_surface(VADriverContextP ctx,
-struct i965_gpe_context *gpe_context,
-struct object_surface *obj_surface,
-int is_uv_surface,
-int is_media_block_rw,
-unsigned int format,
-int index)
-{
-struct i965_gpe_resource gpe_resource;
-struct i965_gpe_surface gpe_surface;
-
-memset(_surface, 0, sizeof(gpe_surface));
-
-i965_object_surface_to_2d_gpe_resource(_resource, obj_surface);
-gpe_surface.gpe_resource =_resource;
-gpe_surface.is_2d_surface = 1;
-gpe_surface.is_uv_surface = !!is_uv_surface;
-gpe_surface.is_media_block_rw = !!is_media_block_rw;
-
-gpe_surface.cacheability_control = DEFAULT_MOCS;
-gpe_surface.format = format;
-
-gen9_gpe_context_add_surface(gpe_context,_surface, index);
-i965_free_gpe_resource(_resource);
-}
-
-static void
-gen9_add_adv_gpe_surface(VADriverContextP ctx,
- struct i965_gpe_context *gpe_context,
- struct object_surface *obj_surface,
- int index)
-{
-struct i965_gpe_resource gpe_resource;
-struct i965_gpe_surface gpe_surface;
-
-memset(_surface, 0, sizeof(gpe_surface));
-
-i965_object_surface_to_2d_gpe_resource(_resource, obj_surface);
-gpe_surface.gpe_resource =_resource;
-gpe_surface.is_adv_surface = 1;
-gpe_surface.cacheability_control = DEFAULT_MOCS;
-gpe_surface.v_direction = 2;
-
-gen9_gpe_context_add_surface(gpe_context,_surface, index);
-i965_free_gpe_resource(_resource);
-}
-
-static void
-gen9_add_buffer_gpe_surface(VADriverContextP ctx,
-struct i965_gpe_context *gpe_context,
-struct i965_gpe_resource *gpe_buffer,
-int is_raw_buffer,
-unsigned int size,
-unsigned int offset,
-int index)
-{
-struct i965_gpe_surface gpe_surface;
-
-memset(_surface, 0, sizeof(gpe_surface));
-
-gpe_surface.gpe_resource = gpe_buffer;
-gpe_surface.is_buffer = 1;
-gpe_surface.is_raw_buffer = !!is_raw_buffer;
-gpe_surface.cacheability_control = DEFAULT_MOCS;
-gpe_surface.size = size;
-gpe_surface.offset = offset;
-
-gen9_gpe_context_add_surface(gpe_context,_surface, index);
-}
-
-static void
-gen9_add_buffer_2d_gpe_surface(VADriverContextP ctx,
-   struct i965_gpe_context *gpe_context,
-   struct i965_gpe_resource *gpe_buffer,
-   int is_media_block_rw,
-   unsigned int format,
-   int index)
-{
-struct i965_gpe_surface gpe_surface;
-
-memset(_surface, 0, sizeof(gpe_surface));
-
-gpe_surface.gpe_resource = gpe_buffer;
-gpe_surface.is_2d_surface = 1;
-gpe_surface.is_media_block_rw = !!is_media_block_rw;
-gpe_surface.cacheability_control = DEFAULT_MOCS;
-gpe_surface.format = format;
-
-gen9_gpe_context_add_surface(gpe_context,_surface, index);
-}
-
-static void
-gen9_add_dri_buffer_gpe_surface(VADriverContextP ctx,
-struct 

Re: [Libva] [PATCH 2/4] Set the pipeline to use the new VP8 encoding shaders on BSW

2017-01-22 Thread Xiang, Haihao

Thanks, Mark. I am looking the issue now.


> On 13/01/17 00:02, Xiang, Haihao wrote:
> > 
> > Thanks for the detailed info, I will look into the issue. BTW can you try
> > other vaapi based tools, such as yamitranscode?
> 
> Yes, I can now reproduce this with yamitranscode as well.
> 
> Given the video below, extract the H.264 stream and then:
> 
> ./yamitranscode -i in.h264 -f 60 --rcmode CBR --ow 1920 --oh 1080 -c VP8 -b
> 500 -N 1000 -o out.ivf
> 
> consistently gives both a broken output stream (though partially playable) and
> a GPU hang somewhere in the middle on Skylake.
> 
> Example GPU error dump:  rd0_error_yami>.
> 
> Thanks,
> 
> - Mark
> 
> 
> > > -Original Message-
> > > From: Mark Thompson [mailto:s...@jkqxz.net]
> > > Sent: Friday, January 13, 2017 6:11 AM
> > > To: libva@lists.freedesktop.org; Xiang, Haihao 
> > > Subject: Re: [Libva] [PATCH 2/4] Set the pipeline to use the new VP8
> > > encoding
> > > shaders on BSW
> > > 
> > > On 12/01/17 07:30, Xiang, Haihao wrote:
> > > > 
> > > > Hi Mark,
> > > > 
> > > > Can you reproduce the issue you mentioned below? If yes, I would like
> > > > to fix it in the new version of the patch series.
> > > 
> > > Hi,
> > > 
> > > Yes, I can reproduce it consistently on both Skylake and Kaby Lake.  Some
> > > detailed instructions follow...
> > > 
> > > 
> > > Get standard test input:
> > >  > > 80p_60fps_normal.mp4>.  (The input file does matter somewhat: I tried some
> > > others and found it harder to reproduce.  Maybe the highly variable
> > > complexity here helps to show the problem.)
> > > 
> > > Get current libav from git: .
> > > 
> > > Apply patches adding framerate configuration and VP8 encode support to
> > > libav:  > > framerate-parameters-to-driver.patch>,
> > >  > > support.patch>.
> > > 
> > > Configure libav with --enable-vaapi and build.
> > > 
> > > 
> > > Now run a transcode from the H.264 of the input file to VP8.  What happens
> > > varies with the bitrate selected (this is now on Skylake GT2, 6300):
> > > 
> > > 
> > > ./avconv -y -threads 1 -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -
> > > hwaccel_output_format vaapi -i bbb_sunflower_1080p_60fps_normal.mp4 -
> > > an -c:v vp8_vaapi -r 60 -b:v 5M out.webm
> > > 
> > > (CBR at 5Mbps)  Everything works and the output looks good: yay!  (This is
> > > an
> > > immense improvement over the current driver - if you run the same
> > > command there, the output is working but terrible quality.)
> > > 
> > > 
> > > ./avconv -y -threads 1 -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -
> > > hwaccel_output_format vaapi -i bbb_sunflower_1080p_60fps_normal.mp4 -
> > > an -c:v vp8_vaapi -r 60 -b:v 5M out.webm
> > > 
> > > (CBR at 2Mbps)  Mostly works, but the output is broken at times and the
> > > bitrate target is often missed by a long way.
> > > 
> > > 
> > > ./avconv -y -threads 1 -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -
> > > hwaccel_output_format vaapi -i bbb_sunflower_1080p_60fps_normal.mp4 -
> > > an -c:v vp8_vaapi -r 60 -b:v 1M out.webm
> > > 
> > > (CBR at 1Mbps)  Consistently hangs at around frame 570.
> > > 
> > > 
> > > [1321697.079583] drm/i915: Resetting chip after gpu hang [1321697.081571]
> > > [drm] GuC firmware load skipped [1321699.063831] [drm] RC6 on
> > > 
> > > /sys/class/drm/card0/error for one case:
> > > .
> > > 
> > > Backtrace of userspace at the hang point:
> > > 
> > > #0  0x76351cc7 in ioctl () at ../sysdeps/unix/syscall-
> > > template.S:84
> > > #1  0x75821708 in drmIoctl () from /usr/lib/x86_64-linux-
> > > gnu/libdrm.so.2
> > > #2  0x748e3e00 in ?? () from /usr/lib/x86_64-linux-
> > > gnu/libdrm_intel.so.1
> > > #3  0x748e4036 in ?? () from /usr/lib/x86_64-linux-
> > > gnu/libdrm_intel.so.1
> > > #4  0x74bded57 in intel_batchbuffer_flush (batch=0x56c03240)
> > > at ../../src/intel_batchbuffer.c:147
> > > #5  0x74b9c821 in i965_run_kernel_media_object
> > > (ctx=0x56ad15b0, encoder_context=0x56bfff10,
> > > gpe_context=0x56b6da38, media_function=11, param=0x7fffd5f0)
> > > at ../../src/i965_encoder_vp8.c:2174
> > > #6  0x74baa044 in i965_encoder_vp8_pak_tpu (ctx=0x56ad15b0,
> > > encode_state=0x56ae5cd0, encoder_context=0x56bfff10)
> > > at ../../src/i965_encoder_vp8.c:6503
> > > #7  0x74baa5a7 in i965_encoder_vp8_pak_pipeline
> > > (ctx=0x56ad15b0, profile=VAProfileVP8Version0_3,
> > > encode_state=0x56ae5cd0, encoder_context=0x56bfff10)
> > > at ../../src/i965_encoder_vp8.c:6620
> > > #8  0x74b988b3 in intel_encoder_end_picture (ctx=0x56ad15b0,
> > > 

Re: [Libva] [PATCH 2/4] Set the pipeline to use the new VP8 encoding shaders on BSW

2017-01-22 Thread Mark Thompson
On 13/01/17 00:02, Xiang, Haihao wrote:
> 
> Thanks for the detailed info, I will look into the issue. BTW can you try 
> other vaapi based tools, such as yamitranscode?

Yes, I can now reproduce this with yamitranscode as well.

Given the video below, extract the H.264 stream and then:

./yamitranscode -i in.h264 -f 60 --rcmode CBR --ow 1920 --oh 1080 -c VP8 -b 500 
-N 1000 -o out.ivf

consistently gives both a broken output stream (though partially playable) and 
a GPU hang somewhere in the middle on Skylake.

Example GPU error dump: 
.

Thanks,

- Mark


>> -Original Message-
>> From: Mark Thompson [mailto:s...@jkqxz.net]
>> Sent: Friday, January 13, 2017 6:11 AM
>> To: libva@lists.freedesktop.org; Xiang, Haihao 
>> Subject: Re: [Libva] [PATCH 2/4] Set the pipeline to use the new VP8 encoding
>> shaders on BSW
>>
>> On 12/01/17 07:30, Xiang, Haihao wrote:
>>>
>>> Hi Mark,
>>>
>>> Can you reproduce the issue you mentioned below? If yes, I would like
>>> to fix it in the new version of the patch series.
>>
>> Hi,
>>
>> Yes, I can reproduce it consistently on both Skylake and Kaby Lake.  Some
>> detailed instructions follow...
>>
>>
>> Get standard test input:
>> > 80p_60fps_normal.mp4>.  (The input file does matter somewhat: I tried some
>> others and found it harder to reproduce.  Maybe the highly variable
>> complexity here helps to show the problem.)
>>
>> Get current libav from git: .
>>
>> Apply patches adding framerate configuration and VP8 encode support to
>> libav: > framerate-parameters-to-driver.patch>,
>> > support.patch>.
>>
>> Configure libav with --enable-vaapi and build.
>>
>>
>> Now run a transcode from the H.264 of the input file to VP8.  What happens
>> varies with the bitrate selected (this is now on Skylake GT2, 6300):
>>
>>
>> ./avconv -y -threads 1 -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -
>> hwaccel_output_format vaapi -i bbb_sunflower_1080p_60fps_normal.mp4 -
>> an -c:v vp8_vaapi -r 60 -b:v 5M out.webm
>>
>> (CBR at 5Mbps)  Everything works and the output looks good: yay!  (This is an
>> immense improvement over the current driver - if you run the same
>> command there, the output is working but terrible quality.)
>>
>>
>> ./avconv -y -threads 1 -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -
>> hwaccel_output_format vaapi -i bbb_sunflower_1080p_60fps_normal.mp4 -
>> an -c:v vp8_vaapi -r 60 -b:v 5M out.webm
>>
>> (CBR at 2Mbps)  Mostly works, but the output is broken at times and the
>> bitrate target is often missed by a long way.
>>
>>
>> ./avconv -y -threads 1 -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -
>> hwaccel_output_format vaapi -i bbb_sunflower_1080p_60fps_normal.mp4 -
>> an -c:v vp8_vaapi -r 60 -b:v 1M out.webm
>>
>> (CBR at 1Mbps)  Consistently hangs at around frame 570.
>>
>>
>> [1321697.079583] drm/i915: Resetting chip after gpu hang [1321697.081571]
>> [drm] GuC firmware load skipped [1321699.063831] [drm] RC6 on
>>
>> /sys/class/drm/card0/error for one case:
>> .
>>
>> Backtrace of userspace at the hang point:
>>
>> #0  0x76351cc7 in ioctl () at ../sysdeps/unix/syscall-template.S:84
>> #1  0x75821708 in drmIoctl () from /usr/lib/x86_64-linux-
>> gnu/libdrm.so.2
>> #2  0x748e3e00 in ?? () from /usr/lib/x86_64-linux-
>> gnu/libdrm_intel.so.1
>> #3  0x748e4036 in ?? () from /usr/lib/x86_64-linux-
>> gnu/libdrm_intel.so.1
>> #4  0x74bded57 in intel_batchbuffer_flush (batch=0x56c03240)
>> at ../../src/intel_batchbuffer.c:147
>> #5  0x74b9c821 in i965_run_kernel_media_object
>> (ctx=0x56ad15b0, encoder_context=0x56bfff10,
>> gpe_context=0x56b6da38, media_function=11, param=0x7fffd5f0)
>> at ../../src/i965_encoder_vp8.c:2174
>> #6  0x74baa044 in i965_encoder_vp8_pak_tpu (ctx=0x56ad15b0,
>> encode_state=0x56ae5cd0, encoder_context=0x56bfff10)
>> at ../../src/i965_encoder_vp8.c:6503
>> #7  0x74baa5a7 in i965_encoder_vp8_pak_pipeline
>> (ctx=0x56ad15b0, profile=VAProfileVP8Version0_3,
>> encode_state=0x56ae5cd0, encoder_context=0x56bfff10)
>> at ../../src/i965_encoder_vp8.c:6620
>> #8  0x74b988b3 in intel_encoder_end_picture (ctx=0x56ad15b0,
>> profile=VAProfileVP8Version0_3, codec_state=0x56ae5cd0,
>> hw_context=0x56bfff10) at ../../src/i965_encoder.c:1313
>> #9  0x74b8aa23 in i965_EndPicture (ctx=0x56ad15b0,
>> context=33554433) at ../../src/i965_drv_video.c:3588
>> #10 0x776744ca in vaEndPicture (dpy=0x56ad1540,
>> context=33554433) at ../../git/va/va.c:1285
>> #11 0x55df76d8 in vaapi_encode_issue (avctx=0x56b5f100,
>>