Discussion:
[LIBVA_INTEL_DRIVER][PATCH V2 1/3] Move some VPP structures/functions into the common files to support more platforms
(too old to reply)
Zhao Yakui
2016-11-24 01:04:10 UTC
Permalink
This is to define some common structures/functions so that they can
be used on more platforms when adding new VPP functions.

Signed-off-by: Zhao Yakui <***@intel.com>
---
src/Makefile.am | 2 ++
src/gen75_picture_process.c | 1 +
src/gen8_post_processing.h | 8 -----
src/gen9_post_processing.c | 34 ++-------------------
src/intel_common_vpp_internal.h | 67 +++++++++++++++++++++++++++++++++++++++++
src/intel_gen_vppapi.h | 49 ++++++++++++++++++++++++++++++
6 files changed, 121 insertions(+), 40 deletions(-)
create mode 100644 src/intel_common_vpp_internal.h
create mode 100644 src/intel_gen_vppapi.h

diff --git a/src/Makefile.am b/src/Makefile.am
index b6e25d1..c262820 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -153,6 +153,8 @@ source_h = \
gen9_vp9_encapi.h \
gen9_vp9_const_def.h \
gen9_vp9_encoder_kernels.h \
+ intel_gen_vppapi.h \
+ intel_common_vpp_internal.h \
$(NULL)

# convenience library that can be linked by driver and tests
diff --git a/src/gen75_picture_process.c b/src/gen75_picture_process.c
index 46c4ed5..380015d 100644
--- a/src/gen75_picture_process.c
+++ b/src/gen75_picture_process.c
@@ -39,6 +39,7 @@
#include "i965_post_processing.h"
#include "gen75_picture_process.h"
#include "gen8_post_processing.h"
+#include "intel_gen_vppapi.h"

extern struct hw_context *
i965_proc_context_init(VADriverContextP ctx,
diff --git a/src/gen8_post_processing.h b/src/gen8_post_processing.h
index bd0601a..18f523e 100644
--- a/src/gen8_post_processing.h
+++ b/src/gen8_post_processing.h
@@ -85,13 +85,5 @@ gen8_post_processing_context_common_init(VADriverContextP ctx,
struct pp_module *pp_modules,
int num_pp_modules,
struct intel_batchbuffer *batch);
-extern VAStatus
-gen9_p010_scaling_post_processing(
- VADriverContextP ctx,
- struct i965_post_processing_context *pp_context,
- struct i965_surface *src_surface,
- VARectangle *src_rect,
- struct i965_surface *dst_surface,
- VARectangle *dst_rect);

#endif
diff --git a/src/gen9_post_processing.c b/src/gen9_post_processing.c
index 1e2d33a..efa8216 100644
--- a/src/gen9_post_processing.c
+++ b/src/gen9_post_processing.c
@@ -38,6 +38,8 @@
#include "intel_media.h"

#include "gen8_post_processing.h"
+#include "intel_gen_vppapi.h"
+#include "intel_common_vpp_internal.h"

static const uint32_t pp_null_gen9[][4] = {
};
@@ -106,38 +108,6 @@ static const uint32_t pp_nv12_blending_gen9[][4] = {
#define MAX_SCALING_SURFACES 16

#define DEFAULT_MOCS 0x02
-#define SRC_MSB 0x0001
-#define DST_MSB 0x0002
-#define SRC_PACKED 0x0004
-#define DST_PACKED 0x0008
-#define PACKED_MASK 0x000C
-
-#define BTI_SCALING_INPUT_Y 0
-#define BTI_SCALING_OUTPUT_Y 8
-
-struct scaling_input_parameter {
- unsigned int input_data[5];
-
- float inv_width;
- float inv_height;
-
- struct {
- unsigned int src_msb : 1;
- unsigned int dst_msb : 1;
- unsigned int src_packed : 1;
- unsigned int dst_packed : 1;
- unsigned int reserved : 28;
- } dw7;
-
- int x_dst;
- int y_dst;
- float x_factor; // src_rect_width / dst_rect_width / Surface_width
- float y_factor; // src_rect_height / dst_rect_height / Surface_height
- float x_orig;
- float y_orig;
- unsigned int bti_input;
- unsigned int bti_output;
-};

static const uint32_t pp_10bit_scaling_gen9[][4] = {
#include "shaders/post_processing/gen9/conv_p010.g9b"
diff --git a/src/intel_common_vpp_internal.h b/src/intel_common_vpp_internal.h
new file mode 100644
index 0000000..5917533
--- /dev/null
+++ b/src/intel_common_vpp_internal.h
@@ -0,0 +1,67 @@
+/*
+ * 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:
+ * Zhao Yakui <***@intel.com>
+ *
+ */
+
+#ifndef _INTEL_COMMON_VPP_INTERNAL_H_
+#define _INTEL_COMMON_VPP_INTERNAL_H_
+
+/* the below is defined for YUV420 format scaling */
+#define SRC_MSB 0x0001
+#define DST_MSB 0x0002
+#define SRC_PACKED 0x0004
+#define DST_PACKED 0x0008
+#define PACKED_MASK 0x000C
+
+#define BTI_SCALING_INPUT_Y 0
+#define BTI_SCALING_OUTPUT_Y 8
+
+struct scaling_input_parameter {
+ unsigned int input_data[5];
+
+ float inv_width;
+ float inv_height;
+
+ struct {
+ unsigned int src_msb : 1;
+ unsigned int dst_msb : 1;
+ unsigned int src_packed : 1;
+ unsigned int dst_packed : 1;
+ unsigned int reserved : 28;
+ } dw7;
+
+ int x_dst;
+ int y_dst;
+ float x_factor; // src_rect_width / dst_rect_width / Surface_width
+ float y_factor; // src_rect_height / dst_rect_height / Surface_height
+ float x_orig;
+ float y_orig;
+ unsigned int bti_input;
+ unsigned int bti_output;
+};
+
+
+#endif // _INTEL_COMMON_VPP_INTERNAL_H_
diff --git a/src/intel_gen_vppapi.h b/src/intel_gen_vppapi.h
new file mode 100644
index 0000000..270219e
--- /dev/null
+++ b/src/intel_gen_vppapi.h
@@ -0,0 +1,49 @@
+/*
+ * 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:
+ * Zhao Yakui <***@intel.com>
+ *
+ */
+
+#ifndef _INTEL_GEN_VPPAPI_H_
+#define _INTEL_GEN_VPPAPI_H_
+
+#include <va/va.h>
+#include <va/va_backend.h>
+
+/*
+struct i965_surface;
+struct i965_post_processing_context;
+*/
+
+extern VAStatus
+gen9_p010_scaling_post_processing(
+ VADriverContextP ctx,
+ struct i965_post_processing_context *pp_context,
+ struct i965_surface *src_surface,
+ VARectangle *src_rect,
+ struct i965_surface *dst_surface,
+ VARectangle *dst_rect);
+
+#endif // _INTE_GEN_VPPAPI_H_
--
2.8.3
Zhao Yakui
2016-11-24 01:04:12 UTC
Permalink
The following conversion is supported:
NV12->NV12
NV12->I420
I420->NV12
I420->I420

Signed-off-by: Zhao Yakui <***@intel.com>
---
src/gen8_post_processing.c | 450 +++++++++++++++++++++++++
src/intel_common_vpp_internal.c | 10 +-
src/intel_common_vpp_internal.h | 9 +
src/shaders/post_processing/gen8/Makefile.am | 3 +-
src/shaders/post_processing/gen8/conv_nv12.g8b | 362 ++++++++++++++++++++
5 files changed, 832 insertions(+), 2 deletions(-)
create mode 100644 src/shaders/post_processing/gen8/conv_nv12.g8b

diff --git a/src/gen8_post_processing.c b/src/gen8_post_processing.c
index a70814c..db15894 100644
--- a/src/gen8_post_processing.c
+++ b/src/gen8_post_processing.c
@@ -43,6 +43,7 @@
#include "intel_media.h"

#include "gen75_picture_process.h"
+#include "intel_common_vpp_internal.h"

#define SURFACE_STATE_PADDED_SIZE SURFACE_STATE_PADDED_SIZE_GEN8

@@ -319,6 +320,14 @@ static struct pp_module pp_modules_gen8[] = {
},
};

+#define MAX_SCALING_SURFACES 16
+
+#define DEFAULT_MOCS 0
+
+static const uint32_t pp_yuv420p8_scaling_gen8[][4] = {
+#include "shaders/post_processing/gen8/conv_nv12.g8b"
+};
+
static int
pp_get_surface_fourcc(VADriverContextP ctx, const struct i965_surface *surface)
{
@@ -1675,8 +1684,449 @@ gen8_post_processing_context_init(VADriverContextP ctx,
void *data,
struct intel_batchbuffer *batch)
{
+ struct i965_driver_data *i965 = i965_driver_data(ctx);
struct i965_post_processing_context *pp_context = data;
+ struct i965_gpe_context *gpe_context;
+ struct i965_kernel scaling_kernel;

gen8_post_processing_context_common_init(ctx, data, pp_modules_gen8, ARRAY_ELEMS(pp_modules_gen8), batch);
avs_init_state(&pp_context->pp_avs_context.state, &gen8_avs_config);
+
+ /* initialize the YUV420 8-Bit scaling context. The below is supported.
+ * NV12 ->NV12
+ * NV12 ->I420
+ * I420 ->I420
+ * I420 ->NV12
+ */
+ gpe_context = &pp_context->scaling_yuv420p8_context;
+ memset(&scaling_kernel, 0, sizeof(scaling_kernel));
+ scaling_kernel.bin = pp_yuv420p8_scaling_gen8;
+ scaling_kernel.size = sizeof(pp_yuv420p8_scaling_gen8);
+ gen8_gpe_load_kernels(ctx, gpe_context, &scaling_kernel, 1);
+ gpe_context->idrt.entry_size = ALIGN(sizeof(struct gen8_interface_descriptor_data), 64);
+ gpe_context->idrt.max_entries = 1;
+ gpe_context->sampler.entry_size = ALIGN(sizeof(struct gen8_sampler_state), 64);
+ gpe_context->sampler.max_entries = 1;
+ gpe_context->curbe.length = ALIGN(sizeof(struct scaling_input_parameter), 32);
+
+ gpe_context->surface_state_binding_table.max_entries = MAX_SCALING_SURFACES;
+ gpe_context->surface_state_binding_table.binding_table_offset = 0;
+ gpe_context->surface_state_binding_table.surface_state_offset = ALIGN(MAX_SCALING_SURFACES * 4, 64);
+ gpe_context->surface_state_binding_table.length = ALIGN(MAX_SCALING_SURFACES * 4, 64) + ALIGN(MAX_SCALING_SURFACES * SURFACE_STATE_PADDED_SIZE_GEN8, 64);
+
+ if (i965->intel.eu_total > 0) {
+ gpe_context->vfe_state.max_num_threads = i965->intel.eu_total * 6;
+ } else {
+ if (i965->intel.has_bsd2)
+ gpe_context->vfe_state.max_num_threads = 300;
+ else
+ gpe_context->vfe_state.max_num_threads = 60;
+ }
+
+ gpe_context->vfe_state.curbe_allocation_size = 37;
+ gpe_context->vfe_state.urb_entry_size = 16;
+ if (i965->intel.has_bsd2)
+ gpe_context->vfe_state.num_urb_entries = 127;
+ else
+ gpe_context->vfe_state.num_urb_entries = 64;
+
+ gpe_context->vfe_state.gpgpu_mode = 0;
+
+ gen8_gpe_context_init(ctx, gpe_context);
+ pp_context->scaling_8bit_initialized = VPPGPE_8BIT_420;
+ return;
+}
+
+static void
+gen8_run_kernel_media_object_walker(VADriverContextP ctx,
+ struct intel_batchbuffer *batch,
+ struct i965_gpe_context *gpe_context,
+ struct gpe_media_object_walker_parameter *param)
+{
+ if (!batch || !gpe_context || !param)
+ return;
+
+ intel_batchbuffer_start_atomic(batch, 0x1000);
+
+ intel_batchbuffer_emit_mi_flush(batch);
+
+ gen8_gpe_pipeline_setup(ctx, gpe_context, batch);
+ gen8_gpe_media_object_walker(ctx, gpe_context, batch, param);
+ gen8_gpe_media_state_flush(ctx, gpe_context, batch);
+
+
+ intel_batchbuffer_end_atomic(batch);
+
+ intel_batchbuffer_flush(batch);
+ return;
+}
+
+static void
+gen8_add_dri_buffer_2d_gpe_surface(VADriverContextP ctx,
+ struct i965_gpe_context *gpe_context,
+ dri_bo *bo,
+ unsigned int bo_offset,
+ unsigned int width,
+ unsigned int height,
+ unsigned int pitch,
+ int is_media_block_rw,
+ unsigned int format,
+ int index,
+ int is_10bit)
+{
+ struct i965_gpe_resource gpe_resource;
+ struct i965_gpe_surface gpe_surface;
+
+ i965_dri_object_to_2d_gpe_resource(&gpe_resource, bo, width, height, pitch);
+ memset(&gpe_surface, 0, sizeof(gpe_surface));
+ gpe_surface.gpe_resource = &gpe_resource;
+ 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;
+ gpe_surface.is_override_offset = 1;
+ gpe_surface.offset = bo_offset;
+ gpe_surface.is_16bpp = is_10bit;
+
+ gen9_gpe_context_add_surface(gpe_context, &gpe_surface, index);
+
+ i965_free_gpe_resource(&gpe_resource);
+}
+
+static void
+gen8_vpp_scaling_sample_state(VADriverContextP ctx,
+ struct i965_gpe_context *gpe_context,
+ VARectangle *src_rect,
+ VARectangle *dst_rect)
+{
+ struct gen8_sampler_state *sampler_state;
+
+ if (gpe_context == NULL || !src_rect || !dst_rect)
+ return;
+ dri_bo_map(gpe_context->sampler.bo, 1);
+
+ if (gpe_context->sampler.bo->virtual == NULL)
+ return;
+
+ assert(gpe_context->sampler.bo->virtual);
+
+ sampler_state = (struct gen8_sampler_state *)
+ (gpe_context->sampler.bo->virtual + gpe_context->sampler.offset);
+
+ memset(sampler_state, 0, sizeof(*sampler_state));
+
+ if ((src_rect->width == dst_rect->width) &&
+ (src_rect->height == dst_rect->height)) {
+ sampler_state->ss0.min_filter = I965_MAPFILTER_NEAREST;
+ sampler_state->ss0.mag_filter = I965_MAPFILTER_NEAREST;
+ } else {
+ sampler_state->ss0.min_filter = I965_MAPFILTER_LINEAR;
+ sampler_state->ss0.mag_filter = I965_MAPFILTER_LINEAR;
+ }
+
+ sampler_state->ss3.r_wrap_mode = I965_TEXCOORDMODE_CLAMP;
+ sampler_state->ss3.s_wrap_mode = I965_TEXCOORDMODE_CLAMP;
+ sampler_state->ss3.t_wrap_mode = I965_TEXCOORDMODE_CLAMP;
+
+ dri_bo_unmap(gpe_context->sampler.bo);
+}
+
+static void
+gen8_gpe_context_yuv420p8_scaling_curbe(VADriverContextP ctx,
+ struct i965_gpe_context *gpe_context,
+ VARectangle *src_rect,
+ struct i965_surface *src_surface,
+ VARectangle *dst_rect,
+ struct i965_surface *dst_surface)
+{
+ struct scaling_input_parameter *scaling_curbe;
+ float src_width, src_height;
+ float coeff;
+ unsigned int fourcc;
+
+ if ((gpe_context == NULL) ||
+ (src_rect == NULL) || (src_surface == NULL) ||
+ (dst_rect == NULL) || (dst_surface == NULL))
+ return;
+
+ scaling_curbe = i965_gpe_context_map_curbe(gpe_context);
+
+ if (!scaling_curbe)
+ return;
+
+ memset(scaling_curbe, 0, sizeof(struct scaling_input_parameter));
+
+ scaling_curbe->bti_input = BTI_SCALING_INPUT_Y;
+ scaling_curbe->bti_output = BTI_SCALING_OUTPUT_Y;
+
+ /* As the src_rect/dst_rect is already checked, it is skipped.*/
+ scaling_curbe->x_dst = dst_rect->x;
+ scaling_curbe->y_dst = dst_rect->y;
+
+ src_width = src_rect->x + src_rect->width;
+ src_height = src_rect->y + src_rect->height;
+
+ scaling_curbe->inv_width = 1 / src_width;
+ scaling_curbe->inv_height = 1 / src_height;
+
+ coeff = (float) (src_rect->width) / dst_rect->width;
+ scaling_curbe->x_factor = coeff / src_width;
+ scaling_curbe->x_orig = (float)(src_rect->x) / src_width;
+
+ coeff = (float) (src_rect->height) / dst_rect->height;
+ scaling_curbe->y_factor = coeff / src_height;
+ scaling_curbe->y_orig = (float)(src_rect->y) / src_height;
+
+ fourcc = pp_get_surface_fourcc(ctx, src_surface);
+ if (fourcc == VA_FOURCC_NV12) {
+ scaling_curbe->dw7.src_packed = 1;
+ }
+
+ fourcc = pp_get_surface_fourcc(ctx, dst_surface);
+
+ if (fourcc == VA_FOURCC_NV12) {
+ scaling_curbe->dw7.dst_packed = 1;
+ }
+
+ i965_gpe_context_unmap_curbe(gpe_context);
+}
+
+static bool
+gen8_pp_context_get_surface_conf(VADriverContextP ctx,
+ struct i965_surface *surface,
+ VARectangle *rect,
+ int *width,
+ int *height,
+ int *pitch,
+ int *bo_offset)
+{
+ unsigned int fourcc;
+ if (!rect || !surface || !width || !height || !pitch || !bo_offset)
+ return false;
+
+ if (surface->base == NULL)
+ return false;
+
+ fourcc = pp_get_surface_fourcc(ctx, surface);
+ if (surface->type == I965_SURFACE_TYPE_SURFACE) {
+ struct object_surface *obj_surface;
+
+ obj_surface = (struct object_surface *)surface->base;
+ width[0] = MIN(rect->x + rect->width, obj_surface->orig_width);
+ height[0] = MIN(rect->y + rect->height, obj_surface->orig_height);
+ pitch[0] = obj_surface->width;
+ bo_offset[0] = 0;
+
+ if (fourcc == VA_FOURCC_P010 || fourcc == VA_FOURCC_NV12) {
+ width[1] = width[0] / 2;
+ height[1] = height[0] / 2;
+ pitch[1] = obj_surface->cb_cr_pitch;
+ bo_offset[1] = obj_surface->width * obj_surface->y_cb_offset;
+ } else {
+ /* I010/I420 format */
+ width[1] = width[0] / 2;
+ height[1] = height[0] / 2;
+ pitch[1] = obj_surface->cb_cr_pitch;
+ bo_offset[1] = obj_surface->width * obj_surface->y_cb_offset;
+ width[2] = width[0] / 2;
+ height[2] = height[0] / 2;
+ pitch[2] = obj_surface->cb_cr_pitch;
+ bo_offset[2] = obj_surface->width * obj_surface->y_cr_offset;
+ }
+
+ } else {
+ struct object_image *obj_image;
+
+ obj_image = (struct object_image *)surface->base;
+
+ width[0] = MIN(rect->x + rect->width, obj_image->image.width);
+ height[0] = MIN(rect->y + rect->height, obj_image->image.height);
+ pitch[0] = obj_image->image.pitches[0];
+ bo_offset[0] = obj_image->image.offsets[0];
+
+ if (fourcc == VA_FOURCC_P010 || fourcc == VA_FOURCC_NV12) {
+ width[1] = width[0] / 2;
+ height[1] = height[0] / 2;
+ pitch[1] = obj_image->image.pitches[1];
+ bo_offset[1] = obj_image->image.offsets[1];
+ } else {
+ /* I010/I420 format */
+ /* YV12 is TBD */
+ width[1] = width[0] / 2;
+ height[1] = height[0] / 2;
+ pitch[1] = obj_image->image.pitches[1];
+ bo_offset[1] = obj_image->image.offsets[1];
+ width[2] = width[0] / 2;
+ height[2] = height[0] / 2;
+ pitch[2] = obj_image->image.pitches[2];
+ bo_offset[2] = obj_image->image.offsets[2];
+ }
+
+ }
+ return true;
+}
+
+static void
+gen8_gpe_context_yuv420p8_scaling_surfaces(VADriverContextP ctx,
+ struct i965_gpe_context *gpe_context,
+ VARectangle *src_rect,
+ struct i965_surface *src_surface,
+ VARectangle *dst_rect,
+ struct i965_surface *dst_surface)
+{
+ unsigned int fourcc;
+ int width[3], height[3], pitch[3], bo_offset[3];
+ dri_bo *bo;
+ struct object_surface *obj_surface;
+ struct object_image *obj_image;
+ int bti;
+
+ if ((gpe_context == NULL) ||
+ (src_rect == NULL) || (src_surface == NULL) ||
+ (dst_rect == NULL) || (dst_surface == NULL))
+ return;
+
+ if (src_surface->base == NULL || dst_surface->base == NULL)
+ return;
+
+ fourcc = pp_get_surface_fourcc(ctx, src_surface);
+
+ if (src_surface->type == I965_SURFACE_TYPE_SURFACE) {
+ obj_surface = (struct object_surface *)src_surface->base;
+ bo = obj_surface->bo;
+ } else {
+ obj_image = (struct object_image *)src_surface->base;
+ bo = obj_image->bo;
+ }
+
+ bti = 0;
+ if (gen8_pp_context_get_surface_conf(ctx, src_surface, src_rect,
+ width, height, pitch,
+ bo_offset)) {
+ bti = BTI_SCALING_INPUT_Y;
+ /* Input surface */
+ gen8_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[0],
+ width[0], height[0],
+ pitch[0], 0,
+ I965_SURFACEFORMAT_R8_UNORM,
+ bti, 0);
+ if (fourcc == VA_FOURCC_NV12) {
+ gen8_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[1],
+ width[1], height[1],
+ pitch[1], 0,
+ I965_SURFACEFORMAT_R8G8_UNORM,
+ bti + 1, 0);
+ } else {
+ gen8_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[1],
+ width[1], height[1],
+ pitch[1], 0,
+ I965_SURFACEFORMAT_R8_UNORM,
+ bti + 1, 0);
+
+ gen8_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[2],
+ width[2], height[2],
+ pitch[2], 0,
+ I965_SURFACEFORMAT_R8_UNORM,
+ bti + 2, 0);
+ }
+ }
+
+ fourcc = pp_get_surface_fourcc(ctx, dst_surface);
+
+ if (dst_surface->type == I965_SURFACE_TYPE_SURFACE) {
+ obj_surface = (struct object_surface *)dst_surface->base;
+ bo = obj_surface->bo;
+ } else {
+ obj_image = (struct object_image *)dst_surface->base;
+ bo = obj_image->bo;
+ }
+
+ if (gen8_pp_context_get_surface_conf(ctx, dst_surface, dst_rect,
+ width, height, pitch,
+ bo_offset)) {
+ bti = BTI_SCALING_OUTPUT_Y;
+ /* Input surface */
+ gen8_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[0],
+ width[0], height[0],
+ pitch[0], 1,
+ I965_SURFACEFORMAT_R8_UINT,
+ bti, 0);
+ if (fourcc == VA_FOURCC_NV12) {
+ gen8_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[1],
+ width[1] * 2, height[1],
+ pitch[1], 1,
+ I965_SURFACEFORMAT_R16_UINT,
+ bti + 1, 0);
+ } else {
+ gen8_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[1],
+ width[1], height[1],
+ pitch[1], 1,
+ I965_SURFACEFORMAT_R8_UINT,
+ bti + 1, 0);
+
+ gen8_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[2],
+ width[2], height[2],
+ pitch[2], 1,
+ I965_SURFACEFORMAT_R8_UINT,
+ bti + 2, 0);
+ }
+ }
+
+ return;
+}
+
+VAStatus
+gen8_yuv420p8_scaling_post_processing(
+ VADriverContextP ctx,
+ struct i965_post_processing_context *pp_context,
+ struct i965_surface *src_surface,
+ VARectangle *src_rect,
+ struct i965_surface *dst_surface,
+ VARectangle *dst_rect)
+{
+ struct i965_gpe_context *gpe_context;
+ struct gpe_media_object_walker_parameter media_object_walker_param;
+ struct intel_vpp_kernel_walker_parameter kernel_walker_param;
+
+ if (!pp_context || !src_surface || !src_rect || !dst_surface || !dst_rect)
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+
+ if (!(pp_context->scaling_8bit_initialized & VPPGPE_8BIT_420))
+ return VA_STATUS_ERROR_UNIMPLEMENTED;
+
+ gpe_context = &pp_context->scaling_yuv420p8_context;
+
+ gen8_gpe_context_init(ctx, gpe_context);
+ gen8_vpp_scaling_sample_state(ctx, gpe_context, src_rect, dst_rect);
+ gen8_gpe_reset_binding_table(ctx, gpe_context);
+ gen8_gpe_context_yuv420p8_scaling_curbe(ctx, gpe_context,
+ src_rect, src_surface,
+ dst_rect, dst_surface);
+
+ gen8_gpe_context_yuv420p8_scaling_surfaces(ctx, gpe_context,
+ src_rect, src_surface,
+ dst_rect, dst_surface);
+
+ gen8_gpe_setup_interface_data(ctx, gpe_context);
+
+ memset(&kernel_walker_param, 0, sizeof(kernel_walker_param));
+ kernel_walker_param.resolution_x = ALIGN(dst_rect->width, 16) >> 4;
+ kernel_walker_param.resolution_y = ALIGN(dst_rect->height, 16) >> 4;
+ kernel_walker_param.no_dependency = 1;
+
+ intel_vpp_init_media_object_walker_parameter(&kernel_walker_param, &media_object_walker_param);
+
+ gen8_run_kernel_media_object_walker(ctx, pp_context->batch,
+ gpe_context,
+ &media_object_walker_param);
+
+ return VA_STATUS_SUCCESS;
}
diff --git a/src/intel_common_vpp_internal.c b/src/intel_common_vpp_internal.c
index 4da056f..d9e2284 100644
--- a/src/intel_common_vpp_internal.c
+++ b/src/intel_common_vpp_internal.c
@@ -62,9 +62,17 @@ intel_yuv420p8_scaling_post_processing(
struct i965_surface *dst_surface,
VARectangle *dst_rect)
{
+ struct i965_driver_data *i965 = i965_driver_data(ctx);
VAStatus va_status;

- va_status = gen9_yuv420p8_scaling_post_processing(ctx, pp_context,
+ if (IS_GEN8(i965->intel.device_info))
+ va_status = gen8_yuv420p8_scaling_post_processing(ctx, pp_context,
+ src_surface,
+ src_rect,
+ dst_surface,
+ dst_rect);
+ else
+ va_status = gen9_yuv420p8_scaling_post_processing(ctx, pp_context,
src_surface,
src_rect,
dst_surface,
diff --git a/src/intel_common_vpp_internal.h b/src/intel_common_vpp_internal.h
index 7575041..88b4b7f 100644
--- a/src/intel_common_vpp_internal.h
+++ b/src/intel_common_vpp_internal.h
@@ -72,4 +72,13 @@ gen9_yuv420p8_scaling_post_processing(
struct i965_surface *dst_surface,
VARectangle *dst_rect);

+VAStatus
+gen8_yuv420p8_scaling_post_processing(
+ VADriverContextP ctx,
+ struct i965_post_processing_context *pp_context,
+ struct i965_surface *src_surface,
+ VARectangle *src_rect,
+ struct i965_surface *dst_surface,
+ VARectangle *dst_rect);
+
#endif // _INTEL_COMMON_VPP_INTERNAL_H_
diff --git a/src/shaders/post_processing/gen8/Makefile.am b/src/shaders/post_processing/gen8/Makefile.am
index 48a077e..052b342 100644
--- a/src/shaders/post_processing/gen8/Makefile.am
+++ b/src/shaders/post_processing/gen8/Makefile.am
@@ -15,7 +15,8 @@ INTEL_PP_G8B = \
INTEL_PP_PRE_G8B = \
sharpening_h_blur.g8b \
sharpening_unmask.g8b \
- sharpening_v_blur.g8b
+ sharpening_v_blur.g8b \
+ conv_nv12.g8b

INTEL_PP_G8A = \
EOT.g8a \
diff --git a/src/shaders/post_processing/gen8/conv_nv12.g8b b/src/shaders/post_processing/gen8/conv_nv12.g8b
new file mode 100644
index 0000000..b62dff3
--- /dev/null
+++ b/src/shaders/post_processing/gen8/conv_nv12.g8b
@@ -0,0 +1,362 @@
+{ 0x00600001, 0x20602648, 0x00000000, 0x76543210 },
+{ 0x00000005, 0x2700124c, 0x16000004, 0x01ff01ff },
+{ 0x00600001, 0x27401208, 0x008d0060, 0x00000000 },
+{ 0x00000005, 0x2720124c, 0x16000006, 0x01ff01ff },
+{ 0x00000041, 0x20a01208, 0x16000700, 0x00100010 },
+{ 0x00600040, 0x27600208, 0x168d0740, 0x00080008 },
+{ 0x00000041, 0x20801228, 0x16000720, 0x00100010 },
+{ 0x00000040, 0x27800228, 0x02000040, 0x000000a0 },
+{ 0x00800040, 0x27400208, 0x028d0740, 0x000000a0 },
+{ 0x00000041, 0x21003ae8, 0x3e000048, 0x3f000000 },
+{ 0x00000041, 0x21603ae8, 0x3e00004c, 0x3f000000 },
+{ 0x00800001, 0x212002e8, 0x00000080, 0x00000000 },
+{ 0x00800001, 0x20c002e8, 0x008d0740, 0x00000000 },
+{ 0x0080015b, 0x401e0000, 0xc020b001, 0x02472004 },
+{ 0x0080015b, 0x3e1e0000, 0x80208001, 0x01872004 },
+{ 0x00800040, 0x28003ae8, 0x3a8d0800, 0x00000054 },
+{ 0x00800040, 0x27c03ae8, 0x3a8d07c0, 0x00000050 },
+{ 0x00000001, 0x28401e28, 0x00000000, 0x00000000 },
+{ 0x00000001, 0x29600208, 0x0000005c, 0x00000000 },
+{ 0x00000040, 0x27a00228, 0x02000044, 0x00000080 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0800, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d07c0, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000058, 0x122c0000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000e000 },
+{ 0x02800031, 0x21803a68, 0x008d0060, 0x00000200 },
+{ 0x00000001, 0x21c01ee8, 0x00000000, 0x00ff00ff },
+{ 0x00800040, 0x28003ae8, 0x3a8d0800, 0x0000004c },
+{ 0x00800001, 0x23600608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x23201ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22a00208, 0x008d07c0, 0x00000000 },
+{ 0x00600001, 0x22800208, 0x008d0060, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000058, 0x122c0000 },
+{ 0x00800001, 0x22e00208, 0x008d0800, 0x00000000 },
+{ 0x00800040, 0x28003ae8, 0x3a8d0800, 0x0000004c },
+{ 0x00800001, 0x24c00608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24801ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24000208, 0x008d07c0, 0x00000000 },
+{ 0x00600001, 0x23e00208, 0x008d0280, 0x00000000 },
+{ 0x00800001, 0x24400208, 0x008d0800, 0x00000000 },
+{ 0x00800040, 0x28003ae8, 0x3a8d0800, 0x0000004c },
+{ 0x00800001, 0x26200608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x25e01ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x25600208, 0x008d07c0, 0x00000000 },
+{ 0x00600001, 0x25400208, 0x008d03e0, 0x00000000 },
+{ 0x00800001, 0x25a00208, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x2200020c, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x28400a28, 0x1e000840, 0x00010001 },
+{ 0x00000001, 0x2204020c, 0x000007a0, 0x00000000 },
+{ 0x00000001, 0x2200020c, 0x00000780, 0x00000000 },
+{ 0x00000001, 0x2208060c, 0x00000000, 0x0003000f },
+{ 0x05000010, 0x20000a23, 0x1e000840, 0x00040004 },
+{ 0x00800040, 0x28003ae8, 0x3a8d0800, 0x0000004c },
+{ 0x00000040, 0x27a00a28, 0x1e0007a0, 0x00040004 },
+{ 0x00800041, 0x21803ae8, 0x3a8d0180, 0x000001c0 },
+{ 0x00600001, 0x22603a28, 0x008d01a0, 0x00000000 },
+{ 0x00600001, 0x21e03a28, 0x008d0180, 0x00000000 },
+{ 0x02800031, 0x21803a68, 0x008d0280, 0x00000200 },
+{ 0x00600001, 0x22282288, 0x00cf0260, 0x00000000 },
+{ 0x00600001, 0x22202288, 0x00cf01e0, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000058, 0x122c0000 },
+{ 0x00800041, 0x21803ae8, 0x3a8d0180, 0x000001c0 },
+{ 0x00600001, 0x23c03a28, 0x008d01a0, 0x00000000 },
+{ 0x00600001, 0x23a03a28, 0x008d0180, 0x00000000 },
+{ 0x02800031, 0x21803a68, 0x008d03e0, 0x00000200 },
+{ 0x00600001, 0x22382288, 0x00cf03c0, 0x00000000 },
+{ 0x00600001, 0x22302288, 0x00cf03a0, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000058, 0x122c0000 },
+{ 0x00800041, 0x21803ae8, 0x3a8d0180, 0x000001c0 },
+{ 0x00600001, 0x25203a28, 0x008d01a0, 0x00000000 },
+{ 0x00600001, 0x25003a28, 0x008d0180, 0x00000000 },
+{ 0x02800031, 0x21803a68, 0x008d0540, 0x00000200 },
+{ 0x00600001, 0x22482288, 0x00cf0520, 0x00000000 },
+{ 0x00600001, 0x22402288, 0x00cf0500, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000960, 0x060a8000 },
+{ 0x00800041, 0x21803ae8, 0x3a8d0180, 0x000001c0 },
+{ 0x00600001, 0x26803a28, 0x008d01a0, 0x00000000 },
+{ 0x00600001, 0x26603a28, 0x008d0180, 0x00000000 },
+{ 0x00600001, 0x22582288, 0x00cf0680, 0x00000000 },
+{ 0x00600001, 0x22502288, 0x00cf0660, 0x00000000 },
+{ 0x0c600031, 0x20003a04, 0x008d0200, 0x00000200 },
+{ 0x00010020, 0x34000007, 0x0e001400, 0xfffffc00 },
+{ 0x00600001, 0x20602668, 0x00000000, 0x76543210 },
+{ 0x00000041, 0x20a01228, 0x16000720, 0x00100010 },
+{ 0x00600009, 0x27601a08, 0x168d0060, 0x00010001 },
+{ 0x00000041, 0x20801208, 0x16000700, 0x00100010 },
+{ 0x00600001, 0x20c00a08, 0x000000a0, 0x00000000 },
+{ 0x00600001, 0x27400208, 0x008d0760, 0x00000000 },
+{ 0x00600040, 0x20e00208, 0x168d00c0, 0x00020002 },
+{ 0x00800040, 0x27400208, 0x028d0740, 0x00000080 },
+{ 0x00800001, 0x216002e8, 0x008d00c0, 0x00000000 },
+{ 0x00800001, 0x212002e8, 0x008d0740, 0x00000000 },
+{ 0x00000005, 0x21a00208, 0x1600003c, 0x000c000c },
+{ 0x0080015b, 0x401e0000, 0xc0202a01, 0x02c72004 },
+{ 0x0080015b, 0x3e1e0000, 0x80202801, 0x02472004 },
+{ 0x00000040, 0x21000228, 0x02000044, 0x000000a0 },
+{ 0x02000010, 0x20000202, 0x160001a0, 0x000c000c },
+{ 0x00800040, 0x28003ae8, 0x3a8d0800, 0x00000038 },
+{ 0x00800040, 0x27c03ae8, 0x3a8d07c0, 0x00000034 },
+{ 0x00000040, 0x28600208, 0x16000058, 0x00010001 },
+{ 0x00000040, 0x28800208, 0x16000058, 0x00020002 },
+{ 0x00000040, 0x28a00208, 0x1600005c, 0x00010001 },
+{ 0x00000040, 0x28c00208, 0x1600005c, 0x00020002 },
+{ 0x0000000c, 0x27a00a28, 0x1e000100, 0x00010001 },
+{ 0x00010020, 0x34000006, 0x0e001400, 0x00000370 },
+{ 0x00000001, 0x28401e28, 0x00000000, 0x00000000 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000860, 0x124c0000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0800, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d07c0, 0x00000000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000c000 },
+{ 0x02800031, 0x28e03a68, 0x008d0060, 0x00000200 },
+{ 0x00000001, 0x22c03ee8, 0x00000000, 0x40800000 },
+{ 0x00000001, 0x21801ee8, 0x00000000, 0x00ff00ff },
+{ 0x0080015b, 0x401e0000, 0xc02401c8, 0x05800404 },
+{ 0x00800001, 0x23c00608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x23801ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x23000208, 0x008d07c0, 0x00000000 },
+{ 0x00600001, 0x22e00208, 0x008d0060, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000860, 0x124c0000 },
+{ 0x00800001, 0x23400208, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x21c0020c, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x28400a28, 0x1e000840, 0x00010001 },
+{ 0x00000001, 0x21c4020c, 0x000007a0, 0x00000000 },
+{ 0x00000001, 0x21c0020c, 0x00000780, 0x00000000 },
+{ 0x00000001, 0x21c8060c, 0x00000000, 0x0003000f },
+{ 0x05000010, 0x20000a21, 0x1e000840, 0x00020002 },
+{ 0x0080015b, 0x401e0000, 0xc02401c8, 0x05800404 },
+{ 0x00000040, 0x27a00a28, 0x1e0007a0, 0x00040004 },
+{ 0x00800041, 0x29203ae8, 0x3a8d0920, 0x00000180 },
+{ 0x00800041, 0x28e03ae8, 0x3a8d08e0, 0x00000180 },
+{ 0x00600001, 0x22803a28, 0x008d0940, 0x00000000 },
+{ 0x00600001, 0x22403a28, 0x008d0920, 0x00000000 },
+{ 0x00600001, 0x22203a28, 0x008d0900, 0x00000000 },
+{ 0x00600001, 0x21a03a28, 0x008d08e0, 0x00000000 },
+{ 0x02800031, 0x28e03a68, 0x008d02e0, 0x00000200 },
+{ 0x00600001, 0x62a00a88, 0x008d0280, 0x00000000 },
+{ 0x00600001, 0x62600a88, 0x008d0240, 0x00000000 },
+{ 0x00600001, 0x41f02288, 0x00cf0220, 0x00000000 },
+{ 0x00600001, 0x41e02288, 0x00cf01a0, 0x00000000 },
+{ 0x00600001, 0x41f12288, 0x006002a0, 0x00000000 },
+{ 0x00600001, 0x41e12288, 0x00600260, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060008a0, 0x060a8000 },
+{ 0x00800041, 0x29203ae8, 0x3a8d0920, 0x00000180 },
+{ 0x00800041, 0x28e03ae8, 0x3a8d08e0, 0x00000180 },
+{ 0x00600001, 0x24803a28, 0x008d0940, 0x00000000 },
+{ 0x00600001, 0x24403a28, 0x008d0920, 0x00000000 },
+{ 0x00600001, 0x24203a28, 0x008d0900, 0x00000000 },
+{ 0x00600001, 0x24003a28, 0x008d08e0, 0x00000000 },
+{ 0x00600001, 0x64a00a88, 0x008d0480, 0x00000000 },
+{ 0x00600001, 0x64600a88, 0x008d0440, 0x00000000 },
+{ 0x00600001, 0x42102288, 0x00cf0420, 0x00000000 },
+{ 0x00600001, 0x42002288, 0x00cf0400, 0x00000000 },
+{ 0x00600001, 0x42112288, 0x006004a0, 0x00000000 },
+{ 0x00600001, 0x42012288, 0x00600460, 0x00000000 },
+{ 0x0c600031, 0x20003a04, 0x008d01c0, 0x00000200 },
+{ 0x00010020, 0x34000005, 0x0e001400, 0xfffffcb0 },
+{ 0x00000020, 0x34000004, 0x0e001400, 0x00000c60 },
+{ 0x00000005, 0x20600208, 0x1600003c, 0x000c000c },
+{ 0x02000010, 0x20000200, 0x16000060, 0x00040004 },
+{ 0x00010020, 0x34000004, 0x0e001400, 0x00000370 },
+{ 0x00000001, 0x28401e28, 0x00000000, 0x00000000 },
+{ 0x0000000c, 0x27800a28, 0x1e000780, 0x00010001 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000860, 0x124c0000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0800, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d07c0, 0x00000000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000c000 },
+{ 0x02800031, 0x28e03a68, 0x008d0060, 0x00000200 },
+{ 0x00000001, 0x22a03ee8, 0x00000000, 0x40800000 },
+{ 0x00000001, 0x21801ee8, 0x00000000, 0x00ff00ff },
+{ 0x0080015b, 0x401e0000, 0xc02401c8, 0x05400404 },
+{ 0x00800001, 0x23a00608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x23601ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22e00208, 0x008d07c0, 0x00000000 },
+{ 0x00600001, 0x22c00208, 0x008d0060, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000860, 0x124c0000 },
+{ 0x00800001, 0x23200208, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x21c0020c, 0x008d0000, 0x00000000 },
+{ 0x00000001, 0x21c4020c, 0x000007a0, 0x00000000 },
+{ 0x00000001, 0x21c0020c, 0x00000780, 0x00000000 },
+{ 0x00000001, 0x21c8060c, 0x00000000, 0x00030007 },
+{ 0x00000040, 0x28400a28, 0x1e000840, 0x00010001 },
+{ 0x00600001, 0x2240020c, 0x008d01c0, 0x00000000 },
+{ 0x05000010, 0x20000a23, 0x1e000840, 0x00020002 },
+{ 0x0080015b, 0x401e0000, 0xc02401c8, 0x05400404 },
+{ 0x00000040, 0x27a00a28, 0x1e0007a0, 0x00040004 },
+{ 0x00800041, 0x29203ae8, 0x3a8d0920, 0x00000180 },
+{ 0x00800041, 0x28e03ae8, 0x3a8d08e0, 0x00000180 },
+{ 0x00600001, 0x22803a28, 0x008d0940, 0x00000000 },
+{ 0x00600001, 0x22203a28, 0x008d0920, 0x00000000 },
+{ 0x00600001, 0x22003a28, 0x008d0900, 0x00000000 },
+{ 0x00600001, 0x21a03a28, 0x008d08e0, 0x00000000 },
+{ 0x02800031, 0x28e03a68, 0x008d02c0, 0x00000200 },
+{ 0x00600001, 0x22682288, 0x00cf0280, 0x00000000 },
+{ 0x00600001, 0x21e82288, 0x00cf0200, 0x00000000 },
+{ 0x00600001, 0x21e02288, 0x00cf01a0, 0x00000000 },
+{ 0x00600001, 0x22602288, 0x00cf0220, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060008a0, 0x040a8000 },
+{ 0x00800041, 0x28e03ae8, 0x3a8d08e0, 0x00000180 },
+{ 0x00600001, 0x24003a28, 0x008d0900, 0x00000000 },
+{ 0x00600001, 0x23e03a28, 0x008d08e0, 0x00000000 },
+{ 0x00600001, 0x21f82288, 0x00cf0400, 0x00000000 },
+{ 0x00600001, 0x21f02288, 0x00cf03e0, 0x00000000 },
+{ 0x0c600031, 0x20003a04, 0x008d01c0, 0x00000200 },
+{ 0x00800041, 0x29203ae8, 0x3a8d0920, 0x00000180 },
+{ 0x00600001, 0x24403a28, 0x008d0940, 0x00000000 },
+{ 0x00600001, 0x24203a28, 0x008d0920, 0x00000000 },
+{ 0x00600001, 0x22782288, 0x00cf0440, 0x00000000 },
+{ 0x00600001, 0x22702288, 0x00cf0420, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060008c0, 0x040a8000 },
+{ 0x0c600031, 0x20003a04, 0x008d0240, 0x00000200 },
+{ 0x00010020, 0x34000007, 0x0e001400, 0xfffffcc0 },
+{ 0x00000020, 0x34000004, 0x0e001400, 0x000008c0 },
+{ 0x00000005, 0x20600208, 0x1600003c, 0x000c000c },
+{ 0x02000010, 0x20000202, 0x16000060, 0x00080008 },
+{ 0x00010020, 0x34000006, 0x0e001400, 0x00000450 },
+{ 0x00000001, 0x28401e28, 0x00000000, 0x00000000 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000860, 0x122c0000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0800, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d07c0, 0x00000000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000e000 },
+{ 0x02800031, 0x28e03a68, 0x008d0060, 0x00000200 },
+{ 0x00800001, 0x22600608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22201ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21e00208, 0x008d0800, 0x00000000 },
+{ 0x00800001, 0x21a00208, 0x008d07c0, 0x00000000 },
+{ 0x00600001, 0x21800208, 0x008d0060, 0x00000000 },
+{ 0x00600001, 0x24000208, 0x008d0180, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000880, 0x122c0000 },
+{ 0x00600001, 0x25200208, 0x008d0400, 0x00000000 },
+{ 0x02800031, 0x29203a68, 0x008d0180, 0x00000200 },
+{ 0x00000001, 0x23e03ee8, 0x00000000, 0x40800000 },
+{ 0x00000001, 0x22a01ee8, 0x00000000, 0x00ff00ff },
+{ 0x0080015b, 0x401e0000, 0xc02401c8, 0x07c00404 },
+{ 0x00800001, 0x24e00608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24a01ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24200208, 0x008d07c0, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000860, 0x122c0000 },
+{ 0x00800001, 0x24600208, 0x008d0800, 0x00000000 },
+{ 0x00800001, 0x26000608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x25c01ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x25400208, 0x008d07c0, 0x00000000 },
+{ 0x00800001, 0x25800208, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x22e0020c, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x28400a28, 0x1e000840, 0x00010001 },
+{ 0x00000001, 0x22e4020c, 0x000007a0, 0x00000000 },
+{ 0x00000001, 0x22e0020c, 0x00000780, 0x00000000 },
+{ 0x00000001, 0x22e8060c, 0x00000000, 0x0003000f },
+{ 0x05000010, 0x20000a21, 0x1e000840, 0x00020002 },
+{ 0x0080015b, 0x401e0000, 0xc02401c8, 0x07c00404 },
+{ 0x00000040, 0x27a00a28, 0x1e0007a0, 0x00040004 },
+{ 0x00800041, 0x28e03ae8, 0x3a8d08e0, 0x000002a0 },
+{ 0x00600001, 0x23403a28, 0x008d0900, 0x00000000 },
+{ 0x00600001, 0x22c03a28, 0x008d08e0, 0x00000000 },
+{ 0x02800031, 0x28e03a68, 0x008d0400, 0x00000200 },
+{ 0x00600001, 0x43102288, 0x00cf0340, 0x00000000 },
+{ 0x00600001, 0x43002288, 0x00cf02c0, 0x00000000 },
+{ 0x00800041, 0x29203ae8, 0x3a8d0920, 0x000002a0 },
+{ 0x00000040, 0x22000204, 0x06000880, 0x122c0000 },
+{ 0x00600001, 0x23a03a28, 0x008d0940, 0x00000000 },
+{ 0x00600001, 0x23603a28, 0x008d0920, 0x00000000 },
+{ 0x02800031, 0x29203a68, 0x008d0520, 0x00000200 },
+{ 0x00600001, 0x63c00a88, 0x008d03a0, 0x00000000 },
+{ 0x00600001, 0x63800a88, 0x008d0360, 0x00000000 },
+{ 0x00600001, 0x43112288, 0x006003c0, 0x00000000 },
+{ 0x00600001, 0x43012288, 0x00600380, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060008a0, 0x060a8000 },
+{ 0x00800041, 0x28e03ae8, 0x3a8d08e0, 0x000002a0 },
+{ 0x00600001, 0x26603a28, 0x008d0900, 0x00000000 },
+{ 0x00600001, 0x26403a28, 0x008d08e0, 0x00000000 },
+{ 0x00600001, 0x43302288, 0x00cf0660, 0x00000000 },
+{ 0x00600001, 0x43202288, 0x00cf0640, 0x00000000 },
+{ 0x00800041, 0x29203ae8, 0x3a8d0920, 0x000002a0 },
+{ 0x00600001, 0x26c03a28, 0x008d0940, 0x00000000 },
+{ 0x00600001, 0x26803a28, 0x008d0920, 0x00000000 },
+{ 0x00600001, 0x66e00a88, 0x008d06c0, 0x00000000 },
+{ 0x00600001, 0x66a00a88, 0x008d0680, 0x00000000 },
+{ 0x00600001, 0x43312288, 0x006006e0, 0x00000000 },
+{ 0x00600001, 0x43212288, 0x006006a0, 0x00000000 },
+{ 0x0c600031, 0x20003a04, 0x008d02e0, 0x00000200 },
+{ 0x00010020, 0x34000005, 0x0e001400, 0xfffffbd0 },
+{ 0x00000020, 0x34000004, 0x0e001400, 0x00000440 },
+{ 0x00000001, 0x28401e28, 0x00000000, 0x00000000 },
+{ 0x0000000c, 0x27800a28, 0x1e000780, 0x00010001 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000860, 0x122c0000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0800, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d07c0, 0x00000000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000e000 },
+{ 0x02800031, 0x28e03a68, 0x008d0060, 0x00000200 },
+{ 0x00800001, 0x22600608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22201ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21e00208, 0x008d0800, 0x00000000 },
+{ 0x00800001, 0x21a00208, 0x008d07c0, 0x00000000 },
+{ 0x00600001, 0x21800208, 0x008d0060, 0x00000000 },
+{ 0x00600001, 0x23e00208, 0x008d0180, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000880, 0x122c0000 },
+{ 0x00600001, 0x25000208, 0x008d03e0, 0x00000000 },
+{ 0x02800031, 0x29203a68, 0x008d0180, 0x00000200 },
+{ 0x00000001, 0x23c03ee8, 0x00000000, 0x40800000 },
+{ 0x00000001, 0x22a01ee8, 0x00000000, 0x00ff00ff },
+{ 0x0080015b, 0x401e0000, 0xc02401c8, 0x07800404 },
+{ 0x00800001, 0x24c00608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24801ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24000208, 0x008d07c0, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000860, 0x122c0000 },
+{ 0x00800001, 0x24400208, 0x008d0800, 0x00000000 },
+{ 0x00800001, 0x25e00608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x25a01ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x25200208, 0x008d07c0, 0x00000000 },
+{ 0x00800001, 0x25600208, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x22e0020c, 0x008d0000, 0x00000000 },
+{ 0x00000001, 0x22e4020c, 0x000007a0, 0x00000000 },
+{ 0x00000001, 0x22e0020c, 0x00000780, 0x00000000 },
+{ 0x00000001, 0x22e8060c, 0x00000000, 0x00030007 },
+{ 0x00000040, 0x28400a28, 0x1e000840, 0x00010001 },
+{ 0x00600001, 0x2360020c, 0x008d02e0, 0x00000000 },
+{ 0x05000010, 0x20000a20, 0x1e000840, 0x00020002 },
+{ 0x0080015b, 0x401e0000, 0xc02401c8, 0x07800404 },
+{ 0x00000040, 0x27a00a28, 0x1e0007a0, 0x00040004 },
+{ 0x00800041, 0x28e03ae8, 0x3a8d08e0, 0x000002a0 },
+{ 0x00600001, 0x23203a28, 0x008d0900, 0x00000000 },
+{ 0x00600001, 0x22c03a28, 0x008d08e0, 0x00000000 },
+{ 0x02800031, 0x28e03a68, 0x008d03e0, 0x00000200 },
+{ 0x00600001, 0x23082288, 0x00cf0320, 0x00000000 },
+{ 0x00600001, 0x23002288, 0x00cf02c0, 0x00000000 },
+{ 0x00800041, 0x29203ae8, 0x3a8d0920, 0x000002a0 },
+{ 0x00000040, 0x22000204, 0x06000880, 0x122c0000 },
+{ 0x00600001, 0x23a03a28, 0x008d0940, 0x00000000 },
+{ 0x00600001, 0x23403a28, 0x008d0920, 0x00000000 },
+{ 0x02800031, 0x29203a68, 0x008d0500, 0x00000200 },
+{ 0x00600001, 0x23882288, 0x00cf03a0, 0x00000000 },
+{ 0x00600001, 0x23802288, 0x00cf0340, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060008a0, 0x040a8000 },
+{ 0x00800041, 0x28e03ae8, 0x3a8d08e0, 0x000002a0 },
+{ 0x00600001, 0x26403a28, 0x008d0900, 0x00000000 },
+{ 0x00600001, 0x26203a28, 0x008d08e0, 0x00000000 },
+{ 0x00600001, 0x23182288, 0x00cf0640, 0x00000000 },
+{ 0x00600001, 0x23102288, 0x00cf0620, 0x00000000 },
+{ 0x0c600031, 0x20003a04, 0x008d02e0, 0x00000200 },
+{ 0x00800041, 0x29203ae8, 0x3a8d0920, 0x000002a0 },
+{ 0x00600001, 0x26803a28, 0x008d0940, 0x00000000 },
+{ 0x00600001, 0x26603a28, 0x008d0920, 0x00000000 },
+{ 0x00600001, 0x23982288, 0x00cf0680, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060008c0, 0x040a8000 },
+{ 0x00600001, 0x23902288, 0x00cf0660, 0x00000000 },
+{ 0x0c600031, 0x20003a04, 0x008d0360, 0x00000200 },
+{ 0x00010020, 0x34000004, 0x0e001400, 0xfffffbe0 },
+{ 0x00600001, 0x2fe0020c, 0x008d0000, 0x00000000 },
+{ 0x07000031, 0x20003a00, 0x06000fe0, 0x82000010 },
--
2.8.3
Zhao Yakui
2016-11-24 01:04:11 UTC
Permalink
V1->V2: Add the support of clearing background color for NV12

The following conversion is supported:
NV12->NV12
NV12->I420
I420->NV12
I420->I420

Signed-off-by: Zhao Yakui <***@intel.com>
---
src/Makefile.am | 1 +
src/gen75_picture_process.c | 140 ++++++++++
src/gen8_post_processing.c | 5 +
src/gen9_post_processing.c | 281 ++++++++++++++++++-
src/i965_post_processing.h | 5 +
src/intel_common_vpp_internal.c | 74 +++++
src/intel_common_vpp_internal.h | 8 +
src/intel_gen_vppapi.h | 12 +
src/shaders/post_processing/gen9/Makefile.am | 5 +-
src/shaders/post_processing/gen9/conv_nv12.g9b | 368 +++++++++++++++++++++++++
10 files changed, 891 insertions(+), 8 deletions(-)
create mode 100644 src/intel_common_vpp_internal.c
create mode 100644 src/shaders/post_processing/gen9/conv_nv12.g9b

diff --git a/src/Makefile.am b/src/Makefile.am
index c262820..424812b 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -101,6 +101,7 @@ source_c = \
gen9_vp9_encoder_kernels.c \
gen9_vp9_const_def.c \
gen9_vp9_encoder.c \
+ intel_common_vpp_internal.c \
$(NULL)

source_h = \
diff --git a/src/gen75_picture_process.c b/src/gen75_picture_process.c
index 380015d..d4106f3 100644
--- a/src/gen75_picture_process.c
+++ b/src/gen75_picture_process.c
@@ -103,6 +103,106 @@ static int intel_gpe_support_10bit_scaling(struct intel_video_process_context *p
return 0;
}

+static void
+rgb_to_yuv(unsigned int argb,
+ unsigned char *y,
+ unsigned char *u,
+ unsigned char *v,
+ unsigned char *a)
+{
+ int r = ((argb >> 16) & 0xff);
+ int g = ((argb >> 8) & 0xff);
+ int b = ((argb >> 0) & 0xff);
+
+ *y = (257 * r + 504 * g + 98 * b) / 1000 + 16;
+ *v = (439 * r - 368 * g - 71 * b) / 1000 + 128;
+ *u = (-148 * r - 291 * g + 439 * b) / 1000 + 128;
+ *a = ((argb >> 24) & 0xff);
+}
+
+static void
+gen8plus_vpp_clear_surface(VADriverContextP ctx,
+ struct i965_post_processing_context *pp_context,
+ struct object_surface *obj_surface,
+ unsigned int color)
+{
+ struct intel_batchbuffer *batch = pp_context->batch;
+ unsigned int blt_cmd, br13;
+ unsigned int tiling = 0, swizzle = 0;
+ int pitch;
+ unsigned char y, u, v, a = 0;
+ int region_width, region_height;
+
+ /* Currently only support NV12 surface */
+ if (!obj_surface || obj_surface->fourcc != VA_FOURCC_NV12)
+ return;
+
+ rgb_to_yuv(color, &y, &u, &v, &a);
+
+ if (a == 0)
+ return;
+
+ dri_bo_get_tiling(obj_surface->bo, &tiling, &swizzle);
+ blt_cmd = GEN8_XY_COLOR_BLT_CMD;
+ pitch = obj_surface->width;
+
+ if (tiling != I915_TILING_NONE) {
+ assert(tiling == I915_TILING_Y);
+ // blt_cmd |= XY_COLOR_BLT_DST_TILED;
+ // pitch >>= 2;
+ }
+
+ br13 = 0xf0 << 16;
+ br13 |= BR13_8;
+ br13 |= pitch;
+
+ intel_batchbuffer_start_atomic_blt(batch, 56);
+ BEGIN_BLT_BATCH(batch, 14);
+
+ region_width = obj_surface->width;
+ region_height = obj_surface->height;
+
+ OUT_BATCH(batch, blt_cmd);
+ OUT_BATCH(batch, br13);
+ OUT_BATCH(batch,
+ 0 << 16 |
+ 0);
+ OUT_BATCH(batch,
+ region_height << 16 |
+ region_width);
+ OUT_RELOC64(batch, obj_surface->bo,
+ I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
+ 0);
+ OUT_BATCH(batch, y);
+
+ br13 = 0xf0 << 16;
+ br13 |= BR13_565;
+ br13 |= pitch;
+
+ region_width = obj_surface->width / 2;
+ region_height = obj_surface->height / 2;
+
+ if (tiling == I915_TILING_Y) {
+ region_height = ALIGN(obj_surface->height / 2, 32);
+ }
+
+ OUT_BATCH(batch, blt_cmd);
+ OUT_BATCH(batch, br13);
+ OUT_BATCH(batch,
+ 0 << 16 |
+ 0);
+ OUT_BATCH(batch,
+ region_height << 16 |
+ region_width);
+ OUT_RELOC64(batch, obj_surface->bo,
+ I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
+ obj_surface->width * obj_surface->y_cb_offset);
+ OUT_BATCH(batch, v << 8 | u);
+
+ ADVANCE_BATCH(batch);
+ intel_batchbuffer_end_atomic(batch);
+}
+
VAStatus
gen75_proc_picture(VADriverContextP ctx,
VAProfile profile,
@@ -208,6 +308,7 @@ gen75_proc_picture(VADriverContextP ctx,
#define SRC_10BIT_420 (5 << 0)
#define SRC_10BIT_422 (6 << 0)
#define SRC_10BIT_444 (7 << 0)
+#define SRC_8BIT_420 (1 << 0)

/* The Bit 6 is used to indicate that it is 10bit or 8bit.
* The Bit 5/4 is used to indicate the 420/422/444 format
@@ -215,6 +316,7 @@ gen75_proc_picture(VADriverContextP ctx,
#define DST_10BIT_420 (5 << 4)
#define DST_10BIT_422 (6 << 4)
#define DST_10BIT_444 (7 << 4)
+#define DST_8BIT_420 (1 << 4)

/* This is mainly for YUY2/RGBA. It is reserved for further */
#define SRC_YUV_PACKED (1 << 3)
@@ -222,6 +324,7 @@ gen75_proc_picture(VADriverContextP ctx,

#define MASK_CSC (0xFF)
#define SCALE_10BIT_420 (SRC_10BIT_420 | DST_10BIT_420)
+#define SCALE_8BIT_420 (SRC_8BIT_420 | DST_8BIT_420)

unsigned int scale_flag;

@@ -234,6 +337,14 @@ gen75_proc_picture(VADriverContextP ctx,
obj_dst_surf->fourcc == VA_FOURCC_I010)
scale_flag |= DST_10BIT_420;

+ if (obj_src_surf->fourcc == VA_FOURCC_NV12 ||
+ obj_src_surf->fourcc == VA_FOURCC_I420)
+ scale_flag |= SRC_8BIT_420;
+
+ if (obj_dst_surf->fourcc == VA_FOURCC_NV12 ||
+ obj_dst_surf->fourcc == VA_FOURCC_I420)
+ scale_flag |= DST_8BIT_420;
+
/* If P010 is converted without resolution change,
* fall back to VEBOX
*/
@@ -267,6 +378,35 @@ gen75_proc_picture(VADriverContextP ctx,
&src_surface, &src_rect,
&dst_surface, &dst_rect);
}
+ if (((scale_flag & MASK_CSC) == SCALE_8BIT_420) &&
+ intel_vpp_support_yuv420p8_scaling(proc_ctx)) {
+ struct i965_proc_context *gpe_proc_ctx;
+ struct i965_surface src_surface, dst_surface;
+ unsigned int tmp_width, tmp_x;
+
+
+ src_surface.base = (struct object_base *)obj_src_surf;
+ src_surface.type = I965_SURFACE_TYPE_SURFACE;
+ dst_surface.base = (struct object_base *)obj_dst_surf;
+ dst_surface.type = I965_SURFACE_TYPE_SURFACE;
+ gpe_proc_ctx = (struct i965_proc_context *)proc_ctx->vpp_fmt_cvt_ctx;
+
+ tmp_x = ALIGN_FLOOR(dst_rect.x, 4);
+ tmp_width = dst_rect.x + dst_rect.width;
+ tmp_width = tmp_width - tmp_x;
+ dst_rect.x = tmp_x;
+ dst_rect.width = tmp_width;
+
+ if (obj_dst_surf->fourcc == VA_FOURCC_NV12 &&
+ pipeline_param->output_background_color)
+ gen8plus_vpp_clear_surface(ctx, &gpe_proc_ctx->pp_context,
+ obj_dst_surf,
+ pipeline_param->output_background_color);
+
+ return intel_yuv420p8_scaling_post_processing(ctx, &gpe_proc_ctx->pp_context,
+ &src_surface, &src_rect,
+ &dst_surface, &dst_rect);
+ }
}

proc_ctx->surface_render_output_object = obj_dst_surf;
diff --git a/src/gen8_post_processing.c b/src/gen8_post_processing.c
index 5ef8cbf..a70814c 100644
--- a/src/gen8_post_processing.c
+++ b/src/gen8_post_processing.c
@@ -1544,6 +1544,11 @@ gen8_post_processing_context_finalize(VADriverContextP ctx,
pp_context->scaling_context_initialized = 0;
}

+ if (pp_context->scaling_8bit_initialized & VPPGPE_8BIT_420) {
+ gen8_gpe_context_destroy(&pp_context->scaling_yuv420p8_context);
+ pp_context->scaling_8bit_initialized &= ~(VPPGPE_8BIT_420);
+ }
+
if(pp_context->vebox_proc_ctx){
gen75_vebox_context_destroy(ctx,pp_context->vebox_proc_ctx);
pp_context->vebox_proc_ctx = NULL;
diff --git a/src/gen9_post_processing.c b/src/gen9_post_processing.c
index efa8216..88d092b 100644
--- a/src/gen9_post_processing.c
+++ b/src/gen9_post_processing.c
@@ -38,6 +38,7 @@
#include "intel_media.h"

#include "gen8_post_processing.h"
+#include "gen75_picture_process.h"
#include "intel_gen_vppapi.h"
#include "intel_common_vpp_internal.h"

@@ -113,6 +114,10 @@ static const uint32_t pp_10bit_scaling_gen9[][4] = {
#include "shaders/post_processing/gen9/conv_p010.g9b"
};

+static const uint32_t pp_yuv420p8_scaling_gen9[][4] = {
+#include "shaders/post_processing/gen9/conv_nv12.g9b"
+};
+
static struct pp_module pp_modules_gen9[] = {
{
{
@@ -449,7 +454,7 @@ gen9_post_processing(VADriverContextP ctx,
}

static void
-gen9_p010_scaling_sample_state(VADriverContextP ctx,
+gen9_vpp_scaling_sample_state(VADriverContextP ctx,
struct i965_gpe_context *gpe_context,
VARectangle *src_rect,
VARectangle *dst_rect)
@@ -533,6 +538,45 @@ gen9_post_processing_context_init(VADriverContextP ctx,

gen8_gpe_context_init(ctx, gpe_context);
pp_context->scaling_context_initialized = 1;
+
+ /* initialize the YUV420 8-Bit scaling context. The below is supported.
+ * NV12 ->NV12
+ * NV12 ->I420
+ * I420 ->I420
+ * I420 ->NV12
+ */
+ gpe_context = &pp_context->scaling_yuv420p8_context;
+ memset(&scaling_kernel, 0, sizeof(scaling_kernel));
+ scaling_kernel.bin = pp_yuv420p8_scaling_gen9;
+ scaling_kernel.size = sizeof(pp_yuv420p8_scaling_gen9);
+ gen8_gpe_load_kernels(ctx, gpe_context, &scaling_kernel, 1);
+ gpe_context->idrt.entry_size = ALIGN(sizeof(struct gen8_interface_descriptor_data), 64);
+ gpe_context->idrt.max_entries = 1;
+ gpe_context->sampler.entry_size = ALIGN(sizeof(struct gen8_sampler_state), 64);
+ gpe_context->sampler.max_entries = 1;
+ gpe_context->curbe.length = ALIGN(sizeof(struct scaling_input_parameter), 32);
+
+ gpe_context->surface_state_binding_table.max_entries = MAX_SCALING_SURFACES;
+ gpe_context->surface_state_binding_table.binding_table_offset = 0;
+ gpe_context->surface_state_binding_table.surface_state_offset = ALIGN(MAX_SCALING_SURFACES * 4, 64);
+ gpe_context->surface_state_binding_table.length = ALIGN(MAX_SCALING_SURFACES * 4, 64) + ALIGN(MAX_SCALING_SURFACES * SURFACE_STATE_PADDED_SIZE_GEN9, 64);
+
+ if (i965->intel.eu_total > 0) {
+ gpe_context->vfe_state.max_num_threads = i965->intel.eu_total * 6;
+ } else {
+ if (i965->intel.has_bsd2)
+ gpe_context->vfe_state.max_num_threads = 300;
+ else
+ gpe_context->vfe_state.max_num_threads = 60;
+ }
+
+ gpe_context->vfe_state.curbe_allocation_size = 37;
+ gpe_context->vfe_state.urb_entry_size = 16;
+ gpe_context->vfe_state.num_urb_entries = 127;
+ gpe_context->vfe_state.gpgpu_mode = 0;
+
+ gen8_gpe_context_init(ctx, gpe_context);
+ pp_context->scaling_8bit_initialized = VPPGPE_8BIT_420;
return;
}

@@ -699,13 +743,13 @@ gen9_pp_context_get_surface_conf(VADriverContextP ctx,
pitch[0] = obj_surface->width;
bo_offset[0] = 0;

- if (fourcc == VA_FOURCC_P010) {
+ if (fourcc == VA_FOURCC_P010 || fourcc == VA_FOURCC_NV12) {
width[1] = width[0] / 2;
height[1] = height[0] / 2;
pitch[1] = obj_surface->cb_cr_pitch;
bo_offset[1] = obj_surface->width * obj_surface->y_cb_offset;
} else {
- /* I010 format */
+ /* I010/I420 format */
width[1] = width[0] / 2;
height[1] = height[0] / 2;
pitch[1] = obj_surface->cb_cr_pitch;
@@ -726,13 +770,13 @@ gen9_pp_context_get_surface_conf(VADriverContextP ctx,
pitch[0] = obj_image->image.pitches[0];
bo_offset[0] = obj_image->image.offsets[0];

- if (fourcc == VA_FOURCC_P010) {
+ if (fourcc == VA_FOURCC_P010 || fourcc == VA_FOURCC_NV12) {
width[1] = width[0] / 2;
height[1] = height[0] / 2;
pitch[1] = obj_image->image.pitches[1];
bo_offset[1] = obj_image->image.offsets[1];
} else {
- /* I010 format */
+ /* I010/I420 format */
width[1] = width[0] / 2;
height[1] = height[0] / 2;
pitch[1] = obj_image->image.pitches[1];
@@ -887,7 +931,7 @@ gen9_p010_scaling_post_processing(
gpe_context = &pp_context->scaling_10bit_context;

gen8_gpe_context_init(ctx, gpe_context);
- gen9_p010_scaling_sample_state(ctx, gpe_context, src_rect, dst_rect);
+ gen9_vpp_scaling_sample_state(ctx, gpe_context, src_rect, dst_rect);
gen9_gpe_reset_binding_table(ctx, gpe_context);
gen9_gpe_context_p010_scaling_curbe(ctx, gpe_context,
src_rect, src_surface,
@@ -912,3 +956,228 @@ gen9_p010_scaling_post_processing(

return VA_STATUS_SUCCESS;
}
+
+static void
+gen9_gpe_context_yuv420p8_scaling_curbe(VADriverContextP ctx,
+ struct i965_gpe_context *gpe_context,
+ VARectangle *src_rect,
+ struct i965_surface *src_surface,
+ VARectangle *dst_rect,
+ struct i965_surface *dst_surface)
+{
+ struct scaling_input_parameter *scaling_curbe;
+ float src_width, src_height;
+ float coeff;
+ unsigned int fourcc;
+
+ if ((gpe_context == NULL) ||
+ (src_rect == NULL) || (src_surface == NULL) ||
+ (dst_rect == NULL) || (dst_surface == NULL))
+ return;
+
+ scaling_curbe = i965_gpe_context_map_curbe(gpe_context);
+
+ if (!scaling_curbe)
+ return;
+
+ memset(scaling_curbe, 0, sizeof(struct scaling_input_parameter));
+
+ scaling_curbe->bti_input = BTI_SCALING_INPUT_Y;
+ scaling_curbe->bti_output = BTI_SCALING_OUTPUT_Y;
+
+ /* As the src_rect/dst_rect is already checked, it is skipped.*/
+ scaling_curbe->x_dst = dst_rect->x;
+ scaling_curbe->y_dst = dst_rect->y;
+
+ src_width = src_rect->x + src_rect->width;
+ src_height = src_rect->y + src_rect->height;
+
+ scaling_curbe->inv_width = 1 / src_width;
+ scaling_curbe->inv_height = 1 / src_height;
+
+ coeff = (float) (src_rect->width) / dst_rect->width;
+ scaling_curbe->x_factor = coeff / src_width;
+ scaling_curbe->x_orig = (float)(src_rect->x) / src_width;
+
+ coeff = (float) (src_rect->height) / dst_rect->height;
+ scaling_curbe->y_factor = coeff / src_height;
+ scaling_curbe->y_orig = (float)(src_rect->y) / src_height;
+
+ fourcc = pp_get_surface_fourcc(ctx, src_surface);
+ if (fourcc == VA_FOURCC_NV12) {
+ scaling_curbe->dw7.src_packed = 1;
+ }
+
+ fourcc = pp_get_surface_fourcc(ctx, dst_surface);
+
+ if (fourcc == VA_FOURCC_NV12) {
+ scaling_curbe->dw7.dst_packed = 1;
+ }
+
+ i965_gpe_context_unmap_curbe(gpe_context);
+}
+
+static void
+gen9_gpe_context_yuv420p8_scaling_surfaces(VADriverContextP ctx,
+ struct i965_gpe_context *gpe_context,
+ VARectangle *src_rect,
+ struct i965_surface *src_surface,
+ VARectangle *dst_rect,
+ struct i965_surface *dst_surface)
+{
+ unsigned int fourcc;
+ int width[3], height[3], pitch[3], bo_offset[3];
+ dri_bo *bo;
+ struct object_surface *obj_surface;
+ struct object_image *obj_image;
+ int bti;
+
+ if ((gpe_context == NULL) ||
+ (src_rect == NULL) || (src_surface == NULL) ||
+ (dst_rect == NULL) || (dst_surface == NULL))
+ return;
+
+ if (src_surface->base == NULL || dst_surface->base == NULL)
+ return;
+
+ fourcc = pp_get_surface_fourcc(ctx, src_surface);
+
+ if (src_surface->type == I965_SURFACE_TYPE_SURFACE) {
+ obj_surface = (struct object_surface *)src_surface->base;
+ bo = obj_surface->bo;
+ } else {
+ obj_image = (struct object_image *)src_surface->base;
+ bo = obj_image->bo;
+ }
+
+ bti = 0;
+ if (gen9_pp_context_get_surface_conf(ctx, src_surface, src_rect,
+ width, height, pitch,
+ bo_offset)) {
+ bti = BTI_SCALING_INPUT_Y;
+ /* Input surface */
+ gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[0],
+ width[0], height[0],
+ pitch[0], 0,
+ I965_SURFACEFORMAT_R8_UNORM,
+ bti, 0);
+ if (fourcc == VA_FOURCC_NV12) {
+ gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[1],
+ width[1], height[1],
+ pitch[1], 0,
+ I965_SURFACEFORMAT_R8G8_UNORM,
+ bti + 1, 0);
+ } else {
+ gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[1],
+ width[1], height[1],
+ pitch[1], 0,
+ I965_SURFACEFORMAT_R8_UNORM,
+ bti + 1, 0);
+
+ gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[2],
+ width[2], height[2],
+ pitch[2], 0,
+ I965_SURFACEFORMAT_R8_UNORM,
+ bti + 2, 0);
+ }
+ }
+
+ fourcc = pp_get_surface_fourcc(ctx, dst_surface);
+
+ if (dst_surface->type == I965_SURFACE_TYPE_SURFACE) {
+ obj_surface = (struct object_surface *)dst_surface->base;
+ bo = obj_surface->bo;
+ } else {
+ obj_image = (struct object_image *)dst_surface->base;
+ bo = obj_image->bo;
+ }
+
+ if (gen9_pp_context_get_surface_conf(ctx, dst_surface, dst_rect,
+ width, height, pitch,
+ bo_offset)) {
+ bti = BTI_SCALING_OUTPUT_Y;
+ /* Input surface */
+ gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[0],
+ width[0], height[0],
+ pitch[0], 1,
+ I965_SURFACEFORMAT_R8_UINT,
+ bti, 0);
+ if (fourcc == VA_FOURCC_NV12) {
+ gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[1],
+ width[1] * 2, height[1],
+ pitch[1], 1,
+ I965_SURFACEFORMAT_R16_UINT,
+ bti + 1, 0);
+ } else {
+ gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[1],
+ width[1], height[1],
+ pitch[1], 1,
+ I965_SURFACEFORMAT_R8_UINT,
+ bti + 1, 0);
+
+ gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[2],
+ width[2], height[2],
+ pitch[2], 1,
+ I965_SURFACEFORMAT_R8_UINT,
+ bti + 2, 0);
+ }
+ }
+
+ return;
+}
+
+VAStatus
+gen9_yuv420p8_scaling_post_processing(
+ VADriverContextP ctx,
+ struct i965_post_processing_context *pp_context,
+ struct i965_surface *src_surface,
+ VARectangle *src_rect,
+ struct i965_surface *dst_surface,
+ VARectangle *dst_rect)
+{
+ struct i965_gpe_context *gpe_context;
+ struct gpe_media_object_walker_parameter media_object_walker_param;
+ struct intel_vpp_kernel_walker_parameter kernel_walker_param;
+
+ if (!pp_context || !src_surface || !src_rect || !dst_surface || !dst_rect)
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+
+ if (!(pp_context->scaling_8bit_initialized & VPPGPE_8BIT_420))
+ return VA_STATUS_ERROR_UNIMPLEMENTED;
+
+ gpe_context = &pp_context->scaling_yuv420p8_context;
+
+ gen8_gpe_context_init(ctx, gpe_context);
+ gen9_vpp_scaling_sample_state(ctx, gpe_context, src_rect, dst_rect);
+ gen9_gpe_reset_binding_table(ctx, gpe_context);
+ gen9_gpe_context_yuv420p8_scaling_curbe(ctx, gpe_context,
+ src_rect, src_surface,
+ dst_rect, dst_surface);
+
+ gen9_gpe_context_yuv420p8_scaling_surfaces(ctx, gpe_context,
+ src_rect, src_surface,
+ dst_rect, dst_surface);
+
+ gen8_gpe_setup_interface_data(ctx, gpe_context);
+
+ memset(&kernel_walker_param, 0, sizeof(kernel_walker_param));
+ kernel_walker_param.resolution_x = ALIGN(dst_rect->width, 16) >> 4;
+ kernel_walker_param.resolution_y = ALIGN(dst_rect->height, 16) >> 4;
+ kernel_walker_param.no_dependency = 1;
+
+ intel_vpp_init_media_object_walker_parameter(&kernel_walker_param, &media_object_walker_param);
+
+ gen9_run_kernel_media_object_walker(ctx, pp_context->batch,
+ gpe_context,
+ &media_object_walker_param);
+
+ return VA_STATUS_SUCCESS;
+}
diff --git a/src/i965_post_processing.h b/src/i965_post_processing.h
index e55bf0b..ef1e676 100755
--- a/src/i965_post_processing.h
+++ b/src/i965_post_processing.h
@@ -600,6 +600,11 @@ struct i965_post_processing_context

struct i965_gpe_context scaling_10bit_context;
int scaling_context_initialized;
+ struct i965_gpe_context scaling_yuv420p8_context;
+#define VPPGPE_8BIT_420 (1 << 0)
+#define VPPGPE_8BIT_422 (1 << 1)
+#define VPPGPE_8BIT_444 (1 << 2)
+ unsigned int scaling_8bit_initialized;
};

struct i965_proc_context
diff --git a/src/intel_common_vpp_internal.c b/src/intel_common_vpp_internal.c
new file mode 100644
index 0000000..4da056f
--- /dev/null
+++ b/src/intel_common_vpp_internal.c
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#include "intel_batchbuffer.h"
+#include "intel_driver.h"
+#include "i965_drv_video.h"
+#include "i965_post_processing.h"
+#include "gen75_picture_process.h"
+
+#include "intel_gen_vppapi.h"
+#include "intel_common_vpp_internal.h"
+
+int
+intel_vpp_support_yuv420p8_scaling(struct intel_video_process_context *proc_ctx)
+{
+ struct i965_proc_context *gpe_proc_ctx;
+
+ if (!proc_ctx || !proc_ctx->vpp_fmt_cvt_ctx)
+ return 0;
+
+ gpe_proc_ctx = (struct i965_proc_context *)proc_ctx->vpp_fmt_cvt_ctx;
+
+ if (gpe_proc_ctx->pp_context.scaling_8bit_initialized & VPPGPE_8BIT_420)
+ return 1;
+ else
+ return 0;
+}
+
+VAStatus
+intel_yuv420p8_scaling_post_processing(
+ VADriverContextP ctx,
+ struct i965_post_processing_context *pp_context,
+ struct i965_surface *src_surface,
+ VARectangle *src_rect,
+ struct i965_surface *dst_surface,
+ VARectangle *dst_rect)
+{
+ VAStatus va_status;
+
+ va_status = gen9_yuv420p8_scaling_post_processing(ctx, pp_context,
+ src_surface,
+ src_rect,
+ dst_surface,
+ dst_rect);
+
+ return va_status;
+}
diff --git a/src/intel_common_vpp_internal.h b/src/intel_common_vpp_internal.h
index 5917533..7575041 100644
--- a/src/intel_common_vpp_internal.h
+++ b/src/intel_common_vpp_internal.h
@@ -63,5 +63,13 @@ struct scaling_input_parameter {
unsigned int bti_output;
};

+VAStatus
+gen9_yuv420p8_scaling_post_processing(
+ VADriverContextP ctx,
+ struct i965_post_processing_context *pp_context,
+ struct i965_surface *src_surface,
+ VARectangle *src_rect,
+ struct i965_surface *dst_surface,
+ VARectangle *dst_rect);

#endif // _INTEL_COMMON_VPP_INTERNAL_H_
diff --git a/src/intel_gen_vppapi.h b/src/intel_gen_vppapi.h
index 270219e..9fe82c9 100644
--- a/src/intel_gen_vppapi.h
+++ b/src/intel_gen_vppapi.h
@@ -46,4 +46,16 @@ gen9_p010_scaling_post_processing(
struct i965_surface *dst_surface,
VARectangle *dst_rect);

+extern int
+intel_vpp_support_yuv420p8_scaling(struct intel_video_process_context *proc_ctx);
+
+extern VAStatus
+intel_yuv420p8_scaling_post_processing(
+ VADriverContextP ctx,
+ struct i965_post_processing_context *pp_context,
+ struct i965_surface *src_surface,
+ VARectangle *src_rect,
+ struct i965_surface *dst_surface,
+ VARectangle *dst_rect);
+
#endif // _INTE_GEN_VPPAPI_H_
diff --git a/src/shaders/post_processing/gen9/Makefile.am b/src/shaders/post_processing/gen9/Makefile.am
index 4155cff..7cbacd9 100644
--- a/src/shaders/post_processing/gen9/Makefile.am
+++ b/src/shaders/post_processing/gen9/Makefile.am
@@ -2,7 +2,8 @@ SRCDIR = $(top_srcdir)/src/shaders/post_processing/gen8
VPATH = $(SRCDIR)

INTEL_PP_PRE_G9B = \
- conv_p010.g9b
+ conv_p010.g9b \
+ conv_nv12.g9b

INTEL_PP_G9B = \
pl2_to_pl2.g9b \
@@ -73,7 +74,7 @@ CLEANFILES = $(INTEL_PP_GEN9_ASM)

EXTRA_DIST = \
$(INTEL_PP_G9B) \
- $(INTEL_PP_PRE_G9B)
+ $(INTEL_PP_PRE_G9B) \
$(NULL)

# Extra clean files so that maintainer-clean removes *everything*
diff --git a/src/shaders/post_processing/gen9/conv_nv12.g9b b/src/shaders/post_processing/gen9/conv_nv12.g9b
new file mode 100644
index 0000000..cf3c68f
--- /dev/null
+++ b/src/shaders/post_processing/gen9/conv_nv12.g9b
@@ -0,0 +1,368 @@
+{ 0x00600001, 0x20602648, 0x00000000, 0x76543210 },
+{ 0x00000005, 0x26c0124c, 0x16000004, 0x07ff07ff },
+{ 0x00600001, 0x26e01208, 0x008d0060, 0x00000000 },
+{ 0x00000005, 0x26c2124c, 0x16000006, 0x07ff07ff },
+{ 0x00000041, 0x20a01208, 0x160006c0, 0x00100010 },
+{ 0x00600040, 0x27000208, 0x168d06e0, 0x00080008 },
+{ 0x00000041, 0x20801228, 0x160006c2, 0x00100010 },
+{ 0x00000040, 0x26c40228, 0x02000040, 0x000000a0 },
+{ 0x00800040, 0x26e00208, 0x028d06e0, 0x000000a0 },
+{ 0x00000041, 0x21003ae8, 0x3e000048, 0x3f000000 },
+{ 0x00000041, 0x21603ae8, 0x3e00004c, 0x3f000000 },
+{ 0x00800001, 0x212002e8, 0x00000080, 0x00000000 },
+{ 0x00800001, 0x20c002e8, 0x008d06e0, 0x00000000 },
+{ 0x0080015b, 0x3b1e0000, 0xc020b001, 0x02472004 },
+{ 0x0080015b, 0x391e0000, 0x80208001, 0x01872004 },
+{ 0x00800040, 0x27603ae8, 0x3a8d0760, 0x00000054 },
+{ 0x00800040, 0x27203ae8, 0x3a8d0720, 0x00000050 },
+{ 0x00000001, 0x26cc1e28, 0x00000000, 0x00000000 },
+{ 0x00000001, 0x28a00208, 0x0000005c, 0x00000000 },
+{ 0x00000040, 0x26c80228, 0x02000044, 0x00000080 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d0720, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000058, 0x122c0000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000e000 },
+{ 0x02800031, 0x21800268, 0x00000060, 0x00000200 },
+{ 0x00000001, 0x21c01ee8, 0x00000000, 0x00ff00ff },
+{ 0x00800040, 0x27603ae8, 0x3a8d0760, 0x0000004c },
+{ 0x00800001, 0x23000608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22c01ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22400208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x22200208, 0x008d0060, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000058, 0x122c0000 },
+{ 0x00800001, 0x22800208, 0x008d0760, 0x00000000 },
+{ 0x00800040, 0x27603ae8, 0x3a8d0760, 0x0000004c },
+{ 0x00800001, 0x24600608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24201ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x23a00208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x23800208, 0x008d0220, 0x00000000 },
+{ 0x00800001, 0x23e00208, 0x008d0760, 0x00000000 },
+{ 0x00800040, 0x27603ae8, 0x3a8d0760, 0x0000004c },
+{ 0x00800001, 0x25c00608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x25801ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x25000208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x24e00208, 0x008d0380, 0x00000000 },
+{ 0x00800001, 0x25400208, 0x008d0760, 0x00000000 },
+{ 0x00600001, 0x2640020c, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x26cc0a28, 0x1e0006cc, 0x00010001 },
+{ 0x00000001, 0x2644020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x2640020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x2648060c, 0x00000000, 0x0003000f },
+{ 0x05000010, 0x20000a23, 0x1e0006cc, 0x00040004 },
+{ 0x00800040, 0x27603ae8, 0x3a8d0760, 0x0000004c },
+{ 0x00000040, 0x26c80a28, 0x1e0006c8, 0x00040004 },
+{ 0x00800041, 0x21803ae8, 0x3a8d0180, 0x000001c0 },
+{ 0x00600001, 0x22003a28, 0x008d01a0, 0x00000000 },
+{ 0x00600001, 0x21e03a28, 0x008d0180, 0x00000000 },
+{ 0x02800031, 0x21800268, 0x00000220, 0x00000200 },
+{ 0x00600001, 0x27a82288, 0x00cf0200, 0x00000000 },
+{ 0x00600001, 0x27a02288, 0x00cf01e0, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000058, 0x122c0000 },
+{ 0x00800041, 0x21803ae8, 0x3a8d0180, 0x000001c0 },
+{ 0x00600001, 0x23603a28, 0x008d01a0, 0x00000000 },
+{ 0x00600001, 0x23403a28, 0x008d0180, 0x00000000 },
+{ 0x02800031, 0x21800268, 0x00000380, 0x00000200 },
+{ 0x00600001, 0x27b82288, 0x00cf0360, 0x00000000 },
+{ 0x00600001, 0x27b02288, 0x00cf0340, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000058, 0x122c0000 },
+{ 0x00800041, 0x21803ae8, 0x3a8d0180, 0x000001c0 },
+{ 0x00600001, 0x24c03a28, 0x008d01a0, 0x00000000 },
+{ 0x00600001, 0x24a03a28, 0x008d0180, 0x00000000 },
+{ 0x02800031, 0x21800268, 0x000004e0, 0x00000200 },
+{ 0x00600001, 0x27c82288, 0x00cf04c0, 0x00000000 },
+{ 0x00600001, 0x27c02288, 0x00cf04a0, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060008a0, 0x020a8000 },
+{ 0x00800041, 0x21803ae8, 0x3a8d0180, 0x000001c0 },
+{ 0x00600001, 0x26203a28, 0x008d01a0, 0x00000000 },
+{ 0x00600001, 0x26003a28, 0x008d0180, 0x00000000 },
+{ 0x00600001, 0x27d82288, 0x00cf0620, 0x00000000 },
+{ 0x00600001, 0x27d02288, 0x00cf0600, 0x00000000 },
+{ 0x0c600033, 0x0003d014, 0x00002642, 0x00000000 },
+{ 0x00010020, 0x34000007, 0x0e001400, 0xfffffc00 },
+{ 0x00600001, 0x20602668, 0x00000000, 0x76543210 },
+{ 0x00000041, 0x20a01228, 0x160006c2, 0x00100010 },
+{ 0x00600009, 0x27001a08, 0x168d0060, 0x00010001 },
+{ 0x00000041, 0x20801208, 0x160006c0, 0x00100010 },
+{ 0x00600001, 0x20c00a08, 0x000000a0, 0x00000000 },
+{ 0x00600001, 0x26e00208, 0x008d0700, 0x00000000 },
+{ 0x00600040, 0x20e00208, 0x168d00c0, 0x00020002 },
+{ 0x00800040, 0x26e00208, 0x028d06e0, 0x00000080 },
+{ 0x00800001, 0x216002e8, 0x008d00c0, 0x00000000 },
+{ 0x00800001, 0x212002e8, 0x008d06e0, 0x00000000 },
+{ 0x00000005, 0x21a00208, 0x1600003c, 0x000c000c },
+{ 0x0080015b, 0x3b1e0000, 0xc0202a01, 0x02c72004 },
+{ 0x0080015b, 0x391e0000, 0x80202801, 0x02472004 },
+{ 0x00000040, 0x21000228, 0x02000044, 0x000000a0 },
+{ 0x02000010, 0x20000202, 0x160001a0, 0x000c000c },
+{ 0x00800040, 0x27603ae8, 0x3a8d0760, 0x00000038 },
+{ 0x00800040, 0x27203ae8, 0x3a8d0720, 0x00000034 },
+{ 0x00000040, 0x26d00208, 0x16000058, 0x00010001 },
+{ 0x00000040, 0x26d40208, 0x16000058, 0x00020002 },
+{ 0x00000040, 0x26d80208, 0x1600005c, 0x00010001 },
+{ 0x00000040, 0x26dc0208, 0x1600005c, 0x00020002 },
+{ 0x0000000c, 0x26c80a28, 0x1e000100, 0x00010001 },
+{ 0x00010020, 0x34000006, 0x0e001400, 0x00000370 },
+{ 0x00000001, 0x26cc1e28, 0x00000000, 0x00000000 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x124c0000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d0720, 0x00000000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000c000 },
+{ 0x02800031, 0x27e00268, 0x00000060, 0x00000200 },
+{ 0x00000001, 0x22603ee8, 0x00000000, 0x40800000 },
+{ 0x00000001, 0x21801ee8, 0x00000000, 0x00ff00ff },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x04c00404 },
+{ 0x00800001, 0x23600608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x23201ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22a00208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x22800208, 0x008d0060, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x124c0000 },
+{ 0x00800001, 0x22e00208, 0x008d0760, 0x00000000 },
+{ 0x00600001, 0x2460020c, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x26cc0a28, 0x1e0006cc, 0x00010001 },
+{ 0x00000001, 0x2464020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x2460020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x2468060c, 0x00000000, 0x0003000f },
+{ 0x05000010, 0x20000a21, 0x1e0006cc, 0x00020002 },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x04c00404 },
+{ 0x00000040, 0x26c80a28, 0x1e0006c8, 0x00040004 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x00000180 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x00000180 },
+{ 0x00600001, 0x22203a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x21e03a28, 0x008d0820, 0x00000000 },
+{ 0x00600001, 0x21c03a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x21a03a28, 0x008d07e0, 0x00000000 },
+{ 0x02800031, 0x27e00268, 0x00000280, 0x00000200 },
+{ 0x00600001, 0x62400a88, 0x008d0220, 0x00000000 },
+{ 0x00600001, 0x62000a88, 0x008d01e0, 0x00000000 },
+{ 0x00600001, 0x47b02288, 0x00cf01c0, 0x00000000 },
+{ 0x00600001, 0x47a02288, 0x00cf01a0, 0x00000000 },
+{ 0x00600001, 0x47b12288, 0x00600240, 0x00000000 },
+{ 0x00600001, 0x47a12288, 0x00600200, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d8, 0x020a8000 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x00000180 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x00000180 },
+{ 0x00600001, 0x24203a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x23e03a28, 0x008d0820, 0x00000000 },
+{ 0x00600001, 0x23c03a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x23a03a28, 0x008d07e0, 0x00000000 },
+{ 0x00600001, 0x64400a88, 0x008d0420, 0x00000000 },
+{ 0x00600001, 0x64000a88, 0x008d03e0, 0x00000000 },
+{ 0x00600001, 0x47d02288, 0x00cf03c0, 0x00000000 },
+{ 0x00600001, 0x47c02288, 0x00cf03a0, 0x00000000 },
+{ 0x00600001, 0x47d12288, 0x00600440, 0x00000000 },
+{ 0x00600001, 0x47c12288, 0x00600400, 0x00000000 },
+{ 0x0c600033, 0x0003d014, 0x00002462, 0x00000000 },
+{ 0x00010020, 0x34000005, 0x0e001400, 0xfffffcb0 },
+{ 0x00000020, 0x34000004, 0x0e001400, 0x00000cc0 },
+{ 0x00000005, 0x20600208, 0x1600003c, 0x000c000c },
+{ 0x02000010, 0x20000200, 0x16000060, 0x00040004 },
+{ 0x00010020, 0x34000004, 0x0e001400, 0x000003a0 },
+{ 0x0000000c, 0x26c40a28, 0x1e0006c4, 0x00010001 },
+{ 0x00000001, 0x26cc1e28, 0x00000000, 0x00000000 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x124c0000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d0720, 0x00000000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000c000 },
+{ 0x02800031, 0x27e00268, 0x00000060, 0x00000200 },
+{ 0x00000001, 0x22203ee8, 0x00000000, 0x40800000 },
+{ 0x00000001, 0x21801ee8, 0x00000000, 0x00ff00ff },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x04400404 },
+{ 0x00800001, 0x23200608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22e01ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22600208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x22400208, 0x008d0060, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x124c0000 },
+{ 0x00800001, 0x22a00208, 0x008d0760, 0x00000000 },
+{ 0x00600001, 0x23e0020c, 0x008d0000, 0x00000000 },
+{ 0x00000001, 0x23e4020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x23e0020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x23e8060c, 0x00000000, 0x00030007 },
+{ 0x00600001, 0x2400020c, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x26cc0a28, 0x1e0006cc, 0x00010001 },
+{ 0x00000001, 0x2404020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x2400020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x2408060c, 0x00000000, 0x00030007 },
+{ 0x05000010, 0x20000a23, 0x1e0006cc, 0x00020002 },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x04400404 },
+{ 0x00000040, 0x26c80a28, 0x1e0006c8, 0x00040004 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x00000180 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x00000180 },
+{ 0x00600001, 0x22003a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x21e03a28, 0x008d0820, 0x00000000 },
+{ 0x00600001, 0x21c03a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x21a03a28, 0x008d07e0, 0x00000000 },
+{ 0x02800031, 0x27e00268, 0x00000240, 0x00000200 },
+{ 0x00600001, 0x28882288, 0x00cf0200, 0x00000000 },
+{ 0x00600001, 0x28682288, 0x00cf01c0, 0x00000000 },
+{ 0x00600001, 0x28602288, 0x00cf01a0, 0x00000000 },
+{ 0x00600001, 0x28802288, 0x00cf01e0, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d8, 0x020a8000 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x00000180 },
+{ 0x00600001, 0x23803a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x23603a28, 0x008d07e0, 0x00000000 },
+{ 0x00600001, 0x28782288, 0x00cf0380, 0x00000000 },
+{ 0x00600001, 0x28702288, 0x00cf0360, 0x00000000 },
+{ 0x0c600033, 0x00043014, 0x000023e1, 0x00000000 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x00000180 },
+{ 0x00600001, 0x23c03a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x23a03a28, 0x008d0820, 0x00000000 },
+{ 0x00600001, 0x28982288, 0x00cf03c0, 0x00000000 },
+{ 0x00600001, 0x28902288, 0x00cf03a0, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006dc, 0x020a8000 },
+{ 0x0c600033, 0x00044014, 0x00002401, 0x00000000 },
+{ 0x00010020, 0x34000007, 0x0e001400, 0xfffffc90 },
+{ 0x00000020, 0x34000004, 0x0e001400, 0x000008f0 },
+{ 0x00000005, 0x20600208, 0x1600003c, 0x000c000c },
+{ 0x02000010, 0x20000202, 0x16000060, 0x00080008 },
+{ 0x00010020, 0x34000006, 0x0e001400, 0x00000450 },
+{ 0x00000001, 0x26cc1e28, 0x00000000, 0x00000000 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x122c0000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d0720, 0x00000000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000e000 },
+{ 0x02800031, 0x27e00268, 0x00000060, 0x00000200 },
+{ 0x00800001, 0x22600608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22201ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21e00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x21a00208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x21800208, 0x008d0060, 0x00000000 },
+{ 0x00600001, 0x23a00208, 0x008d0180, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d4, 0x122c0000 },
+{ 0x00600001, 0x24c00208, 0x008d03a0, 0x00000000 },
+{ 0x02800031, 0x28200268, 0x00000180, 0x00000200 },
+{ 0x00000001, 0x23803ee8, 0x00000000, 0x40800000 },
+{ 0x00000001, 0x22a01ee8, 0x00000000, 0x00ff00ff },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x07000404 },
+{ 0x00800001, 0x24800608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24401ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x23c00208, 0x008d0720, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x122c0000 },
+{ 0x00800001, 0x24000208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x25a00608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x25601ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24e00208, 0x008d0720, 0x00000000 },
+{ 0x00800001, 0x25200208, 0x008d0760, 0x00000000 },
+{ 0x00600001, 0x26a0020c, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x26cc0a28, 0x1e0006cc, 0x00010001 },
+{ 0x00000001, 0x26a4020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x26a0020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x26a8060c, 0x00000000, 0x0003000f },
+{ 0x05000010, 0x20000a21, 0x1e0006cc, 0x00020002 },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x07000404 },
+{ 0x00000040, 0x26c80a28, 0x1e0006c8, 0x00040004 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x000002a0 },
+{ 0x00600001, 0x22e03a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x22c03a28, 0x008d07e0, 0x00000000 },
+{ 0x02800031, 0x27e00268, 0x000003a0, 0x00000200 },
+{ 0x00600001, 0x47b02288, 0x00cf02e0, 0x00000000 },
+{ 0x00600001, 0x47a02288, 0x00cf02c0, 0x00000000 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x000002a0 },
+{ 0x00000040, 0x22000204, 0x060006d4, 0x122c0000 },
+{ 0x00600001, 0x23403a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x23003a28, 0x008d0820, 0x00000000 },
+{ 0x02800031, 0x28200268, 0x000004c0, 0x00000200 },
+{ 0x00600001, 0x63600a88, 0x008d0340, 0x00000000 },
+{ 0x00600001, 0x63200a88, 0x008d0300, 0x00000000 },
+{ 0x00600001, 0x47b12288, 0x00600360, 0x00000000 },
+{ 0x00600001, 0x47a12288, 0x00600320, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d8, 0x020a8000 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x000002a0 },
+{ 0x00600001, 0x26003a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x25e03a28, 0x008d07e0, 0x00000000 },
+{ 0x00600001, 0x47d02288, 0x00cf0600, 0x00000000 },
+{ 0x00600001, 0x47c02288, 0x00cf05e0, 0x00000000 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x000002a0 },
+{ 0x00600001, 0x26603a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x26203a28, 0x008d0820, 0x00000000 },
+{ 0x00600001, 0x66800a88, 0x008d0660, 0x00000000 },
+{ 0x00600001, 0x66400a88, 0x008d0620, 0x00000000 },
+{ 0x00600001, 0x47d12288, 0x00600680, 0x00000000 },
+{ 0x00600001, 0x47c12288, 0x00600640, 0x00000000 },
+{ 0x0c600033, 0x0003d014, 0x000026a2, 0x00000000 },
+{ 0x00010020, 0x34000005, 0x0e001400, 0xfffffbd0 },
+{ 0x00000020, 0x34000004, 0x0e001400, 0x00000470 },
+{ 0x0000000c, 0x26c40a28, 0x1e0006c4, 0x00010001 },
+{ 0x00000001, 0x26cc1e28, 0x00000000, 0x00000000 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x122c0000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d0720, 0x00000000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000e000 },
+{ 0x02800031, 0x27e00268, 0x00000060, 0x00000200 },
+{ 0x00800001, 0x22600608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22201ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21e00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x21a00208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x21800208, 0x008d0060, 0x00000000 },
+{ 0x00600001, 0x23600208, 0x008d0180, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d4, 0x122c0000 },
+{ 0x00600001, 0x24800208, 0x008d0360, 0x00000000 },
+{ 0x02800031, 0x28200268, 0x00000180, 0x00000200 },
+{ 0x00000001, 0x23403ee8, 0x00000000, 0x40800000 },
+{ 0x00000001, 0x22a01ee8, 0x00000000, 0x00ff00ff },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x06800404 },
+{ 0x00800001, 0x24400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x23800208, 0x008d0720, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x122c0000 },
+{ 0x00800001, 0x23c00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x25600608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x25201ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24a00208, 0x008d0720, 0x00000000 },
+{ 0x00800001, 0x24e00208, 0x008d0760, 0x00000000 },
+{ 0x00600001, 0x2620020c, 0x008d0000, 0x00000000 },
+{ 0x00000001, 0x2624020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x2620020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x2628060c, 0x00000000, 0x00030007 },
+{ 0x00600001, 0x2640020c, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x26cc0a28, 0x1e0006cc, 0x00010001 },
+{ 0x00000001, 0x2644020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x2640020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x2648060c, 0x00000000, 0x00030007 },
+{ 0x05000010, 0x20000a20, 0x1e0006cc, 0x00020002 },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x06800404 },
+{ 0x00000040, 0x26c80a28, 0x1e0006c8, 0x00040004 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x000002a0 },
+{ 0x00600001, 0x22e03a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x22c03a28, 0x008d07e0, 0x00000000 },
+{ 0x02800031, 0x27e00268, 0x00000360, 0x00000200 },
+{ 0x00600001, 0x28682288, 0x00cf02e0, 0x00000000 },
+{ 0x00600001, 0x28602288, 0x00cf02c0, 0x00000000 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x000002a0 },
+{ 0x00000040, 0x22000204, 0x060006d4, 0x122c0000 },
+{ 0x00600001, 0x23203a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x23003a28, 0x008d0820, 0x00000000 },
+{ 0x02800031, 0x28200268, 0x00000480, 0x00000200 },
+{ 0x00600001, 0x28882288, 0x00cf0320, 0x00000000 },
+{ 0x00600001, 0x28802288, 0x00cf0300, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d8, 0x020a8000 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x000002a0 },
+{ 0x00600001, 0x25c03a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x25a03a28, 0x008d07e0, 0x00000000 },
+{ 0x00600001, 0x28782288, 0x00cf05c0, 0x00000000 },
+{ 0x00600001, 0x28702288, 0x00cf05a0, 0x00000000 },
+{ 0x0c600033, 0x00043014, 0x00002621, 0x00000000 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x000002a0 },
+{ 0x00600001, 0x26003a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x25e03a28, 0x008d0820, 0x00000000 },
+{ 0x00600001, 0x28982288, 0x00cf0600, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006dc, 0x020a8000 },
+{ 0x00600001, 0x28902288, 0x00cf05e0, 0x00000000 },
+{ 0x0c600033, 0x00044014, 0x00002641, 0x00000000 },
+{ 0x00010020, 0x34000004, 0x0e001400, 0xfffffbb0 },
+{ 0x00600001, 0x2fe0020c, 0x008d0000, 0x00000000 },
+{ 0x07000031, 0x20000200, 0x06000fe0, 0x82000010 },
--
2.8.3
Xiang, Haihao
2016-11-25 08:40:17 UTC
Permalink
Post by Zhao Yakui
V1->V2: Add the support of clearing background color for NV12
Is it possible to clear the background in your new media kernel instead
of BLT?
Post by Zhao Yakui
NV12->NV12
NV12->I420
I420->NV12
I420->I420
---
 src/Makefile.am                                |   1 +
 src/gen75_picture_process.c                    | 140 ++++++++++
 src/gen8_post_processing.c                     |   5 +
 src/gen9_post_processing.c                     | 281
++++++++++++++++++-
 src/i965_post_processing.h                     |   5 +
 src/intel_common_vpp_internal.c                |  74 +++++
 src/intel_common_vpp_internal.h                |   8 +
 src/intel_gen_vppapi.h                         |  12 +
 src/shaders/post_processing/gen9/Makefile.am   |   5 +-
 src/shaders/post_processing/gen9/conv_nv12.g9b | 368
+++++++++++++++++++++++++
 10 files changed, 891 insertions(+), 8 deletions(-)
 create mode 100644 src/intel_common_vpp_internal.c
 create mode 100644 src/shaders/post_processing/gen9/conv_nv12.g9b
diff --git a/src/Makefile.am b/src/Makefile.am
index c262820..424812b 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -101,6 +101,7 @@ source_c = \
  gen9_vp9_encoder_kernels.c      \
  gen9_vp9_const_def.c      \
  gen9_vp9_encoder.c      \
+ intel_common_vpp_internal.c           \
  $(NULL)
 
 source_h = \
diff --git a/src/gen75_picture_process.c
b/src/gen75_picture_process.c
index 380015d..d4106f3 100644
--- a/src/gen75_picture_process.c
+++ b/src/gen75_picture_process.c
@@ -103,6 +103,106 @@ static int
intel_gpe_support_10bit_scaling(struct intel_video_process_context *p
         return 0;
 }
 
+static void
+rgb_to_yuv(unsigned int argb,
+           unsigned char *y,
+           unsigned char *u,
+           unsigned char *v,
+           unsigned char *a)
+{
+    int r = ((argb >> 16) & 0xff);
+    int g = ((argb >> 8) & 0xff);
+    int b = ((argb >> 0) & 0xff);
+
+    *y = (257 * r + 504 * g + 98 * b) / 1000 + 16;
+    *v = (439 * r - 368 * g - 71 * b) / 1000 + 128;
+    *u = (-148 * r - 291 * g + 439 * b) / 1000 + 128;
+    *a = ((argb >> 24) & 0xff);
+}
+
+static void
+gen8plus_vpp_clear_surface(VADriverContextP ctx,
+                       struct i965_post_processing_context
*pp_context,
+                       struct object_surface *obj_surface,
+                       unsigned int color)
+{
+    struct intel_batchbuffer *batch = pp_context->batch;
+    unsigned int blt_cmd, br13;
+    unsigned int tiling = 0, swizzle = 0;
+    int pitch;
+    unsigned char y, u, v, a = 0;
+    int region_width, region_height;
+
+    /* Currently only support NV12 surface */
+    if (!obj_surface || obj_surface->fourcc != VA_FOURCC_NV12)
+        return;
+
+    rgb_to_yuv(color, &y, &u, &v, &a);
+
+    if (a == 0)
+        return;
+
+    dri_bo_get_tiling(obj_surface->bo, &tiling, &swizzle);
+    blt_cmd = GEN8_XY_COLOR_BLT_CMD;
+    pitch = obj_surface->width;
+
+    if (tiling != I915_TILING_NONE) {
+        assert(tiling == I915_TILING_Y);
+        // blt_cmd |= XY_COLOR_BLT_DST_TILED;
+        // pitch >>= 2;
+    }
+
+    br13 = 0xf0 << 16;
+    br13 |= BR13_8;
+    br13 |= pitch;
+
+    intel_batchbuffer_start_atomic_blt(batch, 56);
+    BEGIN_BLT_BATCH(batch, 14);
+
+    region_width = obj_surface->width;
+    region_height = obj_surface->height;
+
+    OUT_BATCH(batch, blt_cmd);
+    OUT_BATCH(batch, br13);
+    OUT_BATCH(batch,
+              0 << 16 |
+              0);
+    OUT_BATCH(batch,
+              region_height << 16 |
+              region_width);
+    OUT_RELOC64(batch, obj_surface->bo,
+              I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
+              0);
+    OUT_BATCH(batch, y);
+
+    br13 = 0xf0 << 16;
+    br13 |= BR13_565;
+    br13 |= pitch;
+
+    region_width = obj_surface->width / 2;
+    region_height = obj_surface->height / 2;
+
+    if (tiling == I915_TILING_Y) {
+        region_height = ALIGN(obj_surface->height / 2, 32);
+    }
+
+    OUT_BATCH(batch, blt_cmd);
+    OUT_BATCH(batch, br13);
+    OUT_BATCH(batch,
+              0 << 16 |
+              0);
+    OUT_BATCH(batch,
+              region_height << 16 |
+              region_width);
+    OUT_RELOC64(batch, obj_surface->bo,
+              I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
+              obj_surface->width * obj_surface->y_cb_offset);
+    OUT_BATCH(batch, v << 8 | u);
+
+    ADVANCE_BATCH(batch);
+    intel_batchbuffer_end_atomic(batch);
+}
+
 VAStatus
 gen75_proc_picture(VADriverContextP ctx,
                    VAProfile profile,
@@ -208,6 +308,7 @@ gen75_proc_picture(VADriverContextP ctx,
 #define SRC_10BIT_420    (5 << 0)
 #define SRC_10BIT_422    (6 << 0)
 #define SRC_10BIT_444    (7 << 0)
+#define SRC_8BIT_420     (1 << 0)
 
 /* The Bit 6 is used to indicate that it is 10bit or 8bit.
  * The Bit 5/4 is used to indicate the 420/422/444 format
@@ -215,6 +316,7 @@ gen75_proc_picture(VADriverContextP ctx,
 #define DST_10BIT_420    (5 << 4)
 #define DST_10BIT_422    (6 << 4)
 #define DST_10BIT_444    (7 << 4)
+#define DST_8BIT_420     (1 << 4)
 
 /* This is mainly for YUY2/RGBA. It is reserved for further */
 #define SRC_YUV_PACKED   (1 << 3)
@@ -222,6 +324,7 @@ gen75_proc_picture(VADriverContextP ctx,
 
 #define MASK_CSC         (0xFF)
 #define SCALE_10BIT_420  (SRC_10BIT_420 | DST_10BIT_420)
+#define SCALE_8BIT_420  (SRC_8BIT_420 | DST_8BIT_420)
 
         unsigned int scale_flag;
 
@@ -234,6 +337,14 @@ gen75_proc_picture(VADriverContextP ctx,
             obj_dst_surf->fourcc == VA_FOURCC_I010)
             scale_flag |= DST_10BIT_420;
 
+        if (obj_src_surf->fourcc == VA_FOURCC_NV12 ||
+            obj_src_surf->fourcc == VA_FOURCC_I420)
+            scale_flag |= SRC_8BIT_420;
+
+        if (obj_dst_surf->fourcc == VA_FOURCC_NV12 ||
+            obj_dst_surf->fourcc == VA_FOURCC_I420)
+            scale_flag |= DST_8BIT_420;
+
         /* If P010 is converted without resolution change,
          * fall back to VEBOX
          */
@@ -267,6 +378,35 @@ gen75_proc_picture(VADriverContextP ctx,
                                                      &src_surface,
&src_rect,
                                                      &dst_surface,
&dst_rect);
         }
+        if (((scale_flag & MASK_CSC) == SCALE_8BIT_420) &&
+             intel_vpp_support_yuv420p8_scaling(proc_ctx)) {
+            struct i965_proc_context *gpe_proc_ctx;
+            struct i965_surface src_surface, dst_surface;
+            unsigned int tmp_width, tmp_x;
+
+
+            src_surface.base = (struct object_base *)obj_src_surf;
+            src_surface.type = I965_SURFACE_TYPE_SURFACE;
+            dst_surface.base = (struct object_base *)obj_dst_surf;
+            dst_surface.type = I965_SURFACE_TYPE_SURFACE;
+            gpe_proc_ctx = (struct i965_proc_context *)proc_ctx-
Post by Zhao Yakui
vpp_fmt_cvt_ctx;
+
+            tmp_x = ALIGN_FLOOR(dst_rect.x, 4);
+            tmp_width = dst_rect.x + dst_rect.width;
+            tmp_width = tmp_width - tmp_x;
+            dst_rect.x = tmp_x;
+            dst_rect.width = tmp_width;
+
+            if (obj_dst_surf->fourcc == VA_FOURCC_NV12 &&
+                pipeline_param->output_background_color)
+                gen8plus_vpp_clear_surface(ctx, &gpe_proc_ctx-
Post by Zhao Yakui
pp_context,
+                                           obj_dst_surf,
+                                           pipeline_param-
Post by Zhao Yakui
output_background_color);
+
+            return intel_yuv420p8_scaling_post_processing(ctx,
&gpe_proc_ctx->pp_context,
+                                                     &src_surface,
&src_rect,
+                                                     &dst_surface,
&dst_rect);
+        }
     }
 
     proc_ctx->surface_render_output_object = obj_dst_surf;
diff --git a/src/gen8_post_processing.c b/src/gen8_post_processing.c
index 5ef8cbf..a70814c 100644
--- a/src/gen8_post_processing.c
+++ b/src/gen8_post_processing.c
@@ -1544,6 +1544,11 @@
gen8_post_processing_context_finalize(VADriverContextP ctx,
         pp_context->scaling_context_initialized = 0;
     }
 
+    if (pp_context->scaling_8bit_initialized & VPPGPE_8BIT_420) {
+        gen8_gpe_context_destroy(&pp_context-
Post by Zhao Yakui
scaling_yuv420p8_context);
+        pp_context->scaling_8bit_initialized &= ~(VPPGPE_8BIT_420);
+    }
+
     if(pp_context->vebox_proc_ctx){
        gen75_vebox_context_destroy(ctx,pp_context->vebox_proc_ctx);
        pp_context->vebox_proc_ctx = NULL;
diff --git a/src/gen9_post_processing.c b/src/gen9_post_processing.c
index efa8216..88d092b 100644
--- a/src/gen9_post_processing.c
+++ b/src/gen9_post_processing.c
@@ -38,6 +38,7 @@
 #include "intel_media.h"
 
 #include "gen8_post_processing.h"
+#include "gen75_picture_process.h"
 #include "intel_gen_vppapi.h"
 #include "intel_common_vpp_internal.h"
 
@@ -113,6 +114,10 @@ static const uint32_t pp_10bit_scaling_gen9[][4] = {
 #include "shaders/post_processing/gen9/conv_p010.g9b"
 };
 
+static const uint32_t pp_yuv420p8_scaling_gen9[][4] = {
+#include "shaders/post_processing/gen9/conv_nv12.g9b"
+};
+
 static struct pp_module pp_modules_gen9[] = {
     {
         {
@@ -449,7 +454,7 @@ gen9_post_processing(VADriverContextP ctx,
 }
 
 static void
-gen9_p010_scaling_sample_state(VADriverContextP ctx,
+gen9_vpp_scaling_sample_state(VADriverContextP ctx,
                                struct i965_gpe_context *gpe_context,
                                VARectangle *src_rect,
                                VARectangle *dst_rect)
@@ -533,6 +538,45 @@
gen9_post_processing_context_init(VADriverContextP ctx,
 
     gen8_gpe_context_init(ctx, gpe_context);
     pp_context->scaling_context_initialized = 1;
+
+    /* initialize the YUV420 8-Bit scaling context. The below is
supported.
+     * NV12 ->NV12
+     * NV12 ->I420
+     * I420 ->I420
+     * I420 ->NV12
+     */
+    gpe_context = &pp_context->scaling_yuv420p8_context;
+    memset(&scaling_kernel, 0, sizeof(scaling_kernel));
+    scaling_kernel.bin = pp_yuv420p8_scaling_gen9;
+    scaling_kernel.size = sizeof(pp_yuv420p8_scaling_gen9);
+    gen8_gpe_load_kernels(ctx, gpe_context, &scaling_kernel, 1);
+    gpe_context->idrt.entry_size = ALIGN(sizeof(struct
gen8_interface_descriptor_data), 64);
+    gpe_context->idrt.max_entries = 1;
+    gpe_context->sampler.entry_size = ALIGN(sizeof(struct
gen8_sampler_state), 64);
+    gpe_context->sampler.max_entries = 1;
+    gpe_context->curbe.length = ALIGN(sizeof(struct
scaling_input_parameter), 32);
+
+    gpe_context->surface_state_binding_table.max_entries =
MAX_SCALING_SURFACES;
+    gpe_context->surface_state_binding_table.binding_table_offset =
0;
+    gpe_context->surface_state_binding_table.surface_state_offset =
ALIGN(MAX_SCALING_SURFACES * 4, 64);
+    gpe_context->surface_state_binding_table.length =
ALIGN(MAX_SCALING_SURFACES * 4, 64) + ALIGN(MAX_SCALING_SURFACES *
SURFACE_STATE_PADDED_SIZE_GEN9, 64);
+
+    if (i965->intel.eu_total > 0) {
+        gpe_context->vfe_state.max_num_threads = i965-
Post by Zhao Yakui
intel.eu_total * 6;
+    } else {
+        if (i965->intel.has_bsd2)
+            gpe_context->vfe_state.max_num_threads = 300;
+        else
+            gpe_context->vfe_state.max_num_threads = 60;
+    }
+
+    gpe_context->vfe_state.curbe_allocation_size = 37;
+    gpe_context->vfe_state.urb_entry_size = 16;
+    gpe_context->vfe_state.num_urb_entries = 127;
+    gpe_context->vfe_state.gpgpu_mode = 0;
+
+    gen8_gpe_context_init(ctx, gpe_context);
+    pp_context->scaling_8bit_initialized = VPPGPE_8BIT_420;
     return;
 }
 
@@ -699,13 +743,13 @@
gen9_pp_context_get_surface_conf(VADriverContextP ctx,
         pitch[0] = obj_surface->width;
         bo_offset[0] = 0;
 
-        if (fourcc == VA_FOURCC_P010) {
+        if (fourcc == VA_FOURCC_P010 || fourcc == VA_FOURCC_NV12) {
             width[1] = width[0] / 2;
             height[1] = height[0] / 2;
             pitch[1] = obj_surface->cb_cr_pitch;
             bo_offset[1] = obj_surface->width * obj_surface-
Post by Zhao Yakui
y_cb_offset;
         } else {
-            /* I010 format */
+            /* I010/I420 format */
             width[1] = width[0] / 2;
             height[1] = height[0] / 2;
             pitch[1] = obj_surface->cb_cr_pitch;
@@ -726,13 +770,13 @@
gen9_pp_context_get_surface_conf(VADriverContextP ctx,
         pitch[0] = obj_image->image.pitches[0];
         bo_offset[0] = obj_image->image.offsets[0];
 
-        if (fourcc == VA_FOURCC_P010) {
+        if (fourcc == VA_FOURCC_P010 || fourcc == VA_FOURCC_NV12) {
             width[1] = width[0] / 2;
             height[1] = height[0] / 2;
             pitch[1] = obj_image->image.pitches[1];
             bo_offset[1] = obj_image->image.offsets[1];
         } else {
-            /* I010 format */
+            /* I010/I420 format */
             width[1] = width[0] / 2;
             height[1] = height[0] / 2;
             pitch[1] = obj_image->image.pitches[1];
@@ -887,7 +931,7 @@ gen9_p010_scaling_post_processing(
     gpe_context = &pp_context->scaling_10bit_context;
 
     gen8_gpe_context_init(ctx, gpe_context);
-    gen9_p010_scaling_sample_state(ctx, gpe_context, src_rect,
dst_rect);
+    gen9_vpp_scaling_sample_state(ctx, gpe_context, src_rect,
dst_rect);
     gen9_gpe_reset_binding_table(ctx, gpe_context);
     gen9_gpe_context_p010_scaling_curbe(ctx, gpe_context,
                                         src_rect, src_surface,
@@ -912,3 +956,228 @@ gen9_p010_scaling_post_processing(
 
     return VA_STATUS_SUCCESS;
 }
+
+static void
+gen9_gpe_context_yuv420p8_scaling_curbe(VADriverContextP ctx,
+                               struct i965_gpe_context *gpe_context,
+                               VARectangle *src_rect,
+                               struct i965_surface *src_surface,
+                               VARectangle *dst_rect,
+                               struct i965_surface *dst_surface)
+{
+    struct scaling_input_parameter *scaling_curbe;
+    float src_width, src_height;
+    float coeff;
+    unsigned int fourcc;
+
+    if ((gpe_context == NULL) ||
+        (src_rect == NULL) || (src_surface == NULL) ||
+        (dst_rect == NULL) || (dst_surface == NULL))
+        return;
+
+    scaling_curbe = i965_gpe_context_map_curbe(gpe_context);
+
+    if (!scaling_curbe)
+        return;
+
+    memset(scaling_curbe, 0, sizeof(struct
scaling_input_parameter));
+
+    scaling_curbe->bti_input = BTI_SCALING_INPUT_Y;
+    scaling_curbe->bti_output = BTI_SCALING_OUTPUT_Y;
+
+    /* As the src_rect/dst_rect is already checked, it is skipped.*/
+    scaling_curbe->x_dst     = dst_rect->x;
+    scaling_curbe->y_dst     = dst_rect->y;
+
+    src_width = src_rect->x + src_rect->width;
+    src_height = src_rect->y + src_rect->height;
+
+    scaling_curbe->inv_width = 1 / src_width;
+    scaling_curbe->inv_height = 1 / src_height;
+
+    coeff = (float) (src_rect->width) / dst_rect->width;
+    scaling_curbe->x_factor = coeff / src_width;
+    scaling_curbe->x_orig = (float)(src_rect->x) / src_width;
+
+    coeff = (float) (src_rect->height) / dst_rect->height;
+    scaling_curbe->y_factor = coeff / src_height;
+    scaling_curbe->y_orig = (float)(src_rect->y) / src_height;
+
+    fourcc = pp_get_surface_fourcc(ctx, src_surface);
+    if (fourcc == VA_FOURCC_NV12) {
+        scaling_curbe->dw7.src_packed = 1;
+    }
+
+    fourcc = pp_get_surface_fourcc(ctx, dst_surface);
+
+    if (fourcc == VA_FOURCC_NV12) {
+        scaling_curbe->dw7.dst_packed = 1;
+    }
+
+    i965_gpe_context_unmap_curbe(gpe_context);
+}
+
+static void
+gen9_gpe_context_yuv420p8_scaling_surfaces(VADriverContextP ctx,
+                               struct i965_gpe_context *gpe_context,
+                               VARectangle *src_rect,
+                               struct i965_surface *src_surface,
+                               VARectangle *dst_rect,
+                               struct i965_surface *dst_surface)
+{
+    unsigned int fourcc;
+    int width[3], height[3], pitch[3], bo_offset[3];
+    dri_bo *bo;
+    struct object_surface *obj_surface;
+    struct object_image *obj_image;
+    int bti;
+
+    if ((gpe_context == NULL) ||
+        (src_rect == NULL) || (src_surface == NULL) ||
+        (dst_rect == NULL) || (dst_surface == NULL))
+        return;
+
+    if (src_surface->base == NULL || dst_surface->base == NULL)
+        return;
+
+    fourcc = pp_get_surface_fourcc(ctx, src_surface);
+
+    if (src_surface->type == I965_SURFACE_TYPE_SURFACE) {
+        obj_surface = (struct object_surface *)src_surface->base;
+        bo = obj_surface->bo;
+    } else {
+        obj_image = (struct object_image *)src_surface->base;
+        bo = obj_image->bo;
+    }
+
+    bti = 0;
+    if (gen9_pp_context_get_surface_conf(ctx, src_surface, src_rect,
+                                         width, height, pitch,
+                                         bo_offset)) {
+        bti = BTI_SCALING_INPUT_Y;
+        /* Input surface */
+        gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+                                           bo_offset[0],
+                                           width[0], height[0],
+                                           pitch[0], 0,
+                                           I965_SURFACEFORMAT_R8_UNO
RM,
+                                           bti, 0);
+        if (fourcc == VA_FOURCC_NV12) {
+            gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+                                           bo_offset[1],
+                                           width[1], height[1],
+                                           pitch[1], 0,
+                                           I965_SURFACEFORMAT_R8G8_U
NORM,
+                                           bti + 1, 0);
+        } else {
+            gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+                                           bo_offset[1],
+                                           width[1], height[1],
+                                           pitch[1], 0,
+                                           I965_SURFACEFORMAT_R8_UNO
RM,
+                                           bti + 1, 0);
+
+            gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+                                           bo_offset[2],
+                                           width[2], height[2],
+                                           pitch[2], 0,
+                                           I965_SURFACEFORMAT_R8_UNO
RM,
+                                           bti + 2, 0);
+        }
+    }
+
+    fourcc = pp_get_surface_fourcc(ctx, dst_surface);
+
+    if (dst_surface->type == I965_SURFACE_TYPE_SURFACE) {
+        obj_surface = (struct object_surface *)dst_surface->base;
+        bo = obj_surface->bo;
+    } else {
+        obj_image = (struct object_image *)dst_surface->base;
+        bo = obj_image->bo;
+    }
+
+    if (gen9_pp_context_get_surface_conf(ctx, dst_surface, dst_rect,
+                                         width, height, pitch,
+                                         bo_offset)) {
+        bti = BTI_SCALING_OUTPUT_Y;
+        /* Input surface */
+        gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+                                           bo_offset[0],
+                                           width[0], height[0],
+                                           pitch[0], 1,
+                                           I965_SURFACEFORMAT_R8_UIN
T,
+                                           bti, 0);
+        if (fourcc == VA_FOURCC_NV12) {
+            gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+                                           bo_offset[1],
+                                           width[1] * 2, height[1],
+                                           pitch[1], 1,
+                                           I965_SURFACEFORMAT_R16_UI
NT,
+                                           bti + 1, 0);
+        } else {
+            gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+                                           bo_offset[1],
+                                           width[1], height[1],
+                                           pitch[1], 1,
+                                           I965_SURFACEFORMAT_R8_UIN
T,
+                                           bti + 1, 0);
+
+            gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+                                           bo_offset[2],
+                                           width[2], height[2],
+                                           pitch[2], 1,
+                                           I965_SURFACEFORMAT_R8_UIN
T,
+                                           bti + 2, 0);
+        }
+    }
+
+    return;
+}
+
+VAStatus
+gen9_yuv420p8_scaling_post_processing(
+    VADriverContextP   ctx,
+    struct i965_post_processing_context *pp_context,
+    struct i965_surface *src_surface,
+    VARectangle *src_rect,
+    struct i965_surface *dst_surface,
+    VARectangle *dst_rect)
+{
+    struct i965_gpe_context *gpe_context;
+    struct gpe_media_object_walker_parameter
media_object_walker_param;
+    struct intel_vpp_kernel_walker_parameter kernel_walker_param;
+
+    if (!pp_context || !src_surface || !src_rect || !dst_surface ||
!dst_rect)
+        return VA_STATUS_ERROR_INVALID_PARAMETER;
+
+    if (!(pp_context->scaling_8bit_initialized & VPPGPE_8BIT_420))
+        return VA_STATUS_ERROR_UNIMPLEMENTED;
+
+    gpe_context = &pp_context->scaling_yuv420p8_context;
+
+    gen8_gpe_context_init(ctx, gpe_context);
+    gen9_vpp_scaling_sample_state(ctx, gpe_context, src_rect,
dst_rect);
+    gen9_gpe_reset_binding_table(ctx, gpe_context);
+    gen9_gpe_context_yuv420p8_scaling_curbe(ctx, gpe_context,
+                                        src_rect, src_surface,
+                                        dst_rect, dst_surface);
+
+    gen9_gpe_context_yuv420p8_scaling_surfaces(ctx, gpe_context,
+                                        src_rect, src_surface,
+                                        dst_rect, dst_surface);
+
+    gen8_gpe_setup_interface_data(ctx, gpe_context);
+
+    memset(&kernel_walker_param, 0, sizeof(kernel_walker_param));
+    kernel_walker_param.resolution_x = ALIGN(dst_rect->width, 16) >>
4;
+    kernel_walker_param.resolution_y = ALIGN(dst_rect->height, 16)
Post by Zhao Yakui
4;
+    kernel_walker_param.no_dependency = 1;
+
+    intel_vpp_init_media_object_walker_parameter(&kernel_walker_para
m, &media_object_walker_param);
+
+    gen9_run_kernel_media_object_walker(ctx, pp_context->batch,
+                                        gpe_context,
+                                        &media_object_walker_param);
+
+    return VA_STATUS_SUCCESS;
+}
diff --git a/src/i965_post_processing.h b/src/i965_post_processing.h
index e55bf0b..ef1e676 100755
--- a/src/i965_post_processing.h
+++ b/src/i965_post_processing.h
@@ -600,6 +600,11 @@ struct i965_post_processing_context
 
     struct i965_gpe_context scaling_10bit_context;
     int scaling_context_initialized;
+    struct i965_gpe_context scaling_yuv420p8_context;
+#define VPPGPE_8BIT_420    (1 << 0)
+#define VPPGPE_8BIT_422    (1 << 1)
+#define VPPGPE_8BIT_444    (1 << 2)
+    unsigned int scaling_8bit_initialized;
 };
 
 struct i965_proc_context
diff --git a/src/intel_common_vpp_internal.c
b/src/intel_common_vpp_internal.c
new file mode 100644
index 0000000..4da056f
--- /dev/null
+++ b/src/intel_common_vpp_internal.c
@@ -0,0 +1,74 @@
+/*
+ * 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 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#include "intel_batchbuffer.h"
+#include "intel_driver.h"
+#include "i965_drv_video.h"
+#include "i965_post_processing.h"
+#include "gen75_picture_process.h"
+
+#include "intel_gen_vppapi.h"
+#include "intel_common_vpp_internal.h"
+
+int
+intel_vpp_support_yuv420p8_scaling(struct
intel_video_process_context *proc_ctx)
+{
+    struct i965_proc_context *gpe_proc_ctx;
+
+    if (!proc_ctx || !proc_ctx->vpp_fmt_cvt_ctx)
+        return 0;
+
+    gpe_proc_ctx = (struct i965_proc_context *)proc_ctx-
Post by Zhao Yakui
vpp_fmt_cvt_ctx;
+
+    if (gpe_proc_ctx->pp_context.scaling_8bit_initialized &
VPPGPE_8BIT_420)
+        return 1;
+    else
+        return 0;
+}
+
+VAStatus
+intel_yuv420p8_scaling_post_processing(
+    VADriverContextP   ctx,
+    struct i965_post_processing_context *pp_context,
+    struct i965_surface *src_surface,
+    VARectangle *src_rect,
+    struct i965_surface *dst_surface,
+    VARectangle *dst_rect)
+{
+    VAStatus va_status;
+
+    va_status = gen9_yuv420p8_scaling_post_processing(ctx,
pp_context,
+                                                      src_surface,
+                                                      src_rect,
+                                                      dst_surface,
+                                                      dst_rect);
+
+    return va_status;
+}
diff --git a/src/intel_common_vpp_internal.h
b/src/intel_common_vpp_internal.h
index 5917533..7575041 100644
--- a/src/intel_common_vpp_internal.h
+++ b/src/intel_common_vpp_internal.h
@@ -63,5 +63,13 @@ struct scaling_input_parameter {
     unsigned int bti_output;
 };
 
+VAStatus
+gen9_yuv420p8_scaling_post_processing(
+    VADriverContextP   ctx,
+    struct i965_post_processing_context *pp_context,
+    struct i965_surface *src_surface,
+    VARectangle *src_rect,
+    struct i965_surface *dst_surface,
+    VARectangle *dst_rect);
 
 #endif  // _INTEL_COMMON_VPP_INTERNAL_H_
diff --git a/src/intel_gen_vppapi.h b/src/intel_gen_vppapi.h
index 270219e..9fe82c9 100644
--- a/src/intel_gen_vppapi.h
+++ b/src/intel_gen_vppapi.h
@@ -46,4 +46,16 @@ gen9_p010_scaling_post_processing(
     struct i965_surface *dst_surface,
     VARectangle *dst_rect);
 
+extern int
+intel_vpp_support_yuv420p8_scaling(struct
intel_video_process_context *proc_ctx);
+
+extern VAStatus
+intel_yuv420p8_scaling_post_processing(
+    VADriverContextP   ctx,
+    struct i965_post_processing_context *pp_context,
+    struct i965_surface *src_surface,
+    VARectangle *src_rect,
+    struct i965_surface *dst_surface,
+    VARectangle *dst_rect);
+
 #endif  // _INTE_GEN_VPPAPI_H_
diff --git a/src/shaders/post_processing/gen9/Makefile.am
b/src/shaders/post_processing/gen9/Makefile.am
index 4155cff..7cbacd9 100644
--- a/src/shaders/post_processing/gen9/Makefile.am
+++ b/src/shaders/post_processing/gen9/Makefile.am
@@ -2,7 +2,8 @@ SRCDIR =
$(top_srcdir)/src/shaders/post_processing/gen8
 VPATH = $(SRCDIR)
 
 INTEL_PP_PRE_G9B = \
- conv_p010.g9b
+ conv_p010.g9b           \
+        conv_nv12.g9b
 
 INTEL_PP_G9B = \
  pl2_to_pl2.g9b \
@@ -73,7 +74,7 @@ CLEANFILES = $(INTEL_PP_GEN9_ASM)
 
 EXTRA_DIST = \
  $(INTEL_PP_G9B) \
- $(INTEL_PP_PRE_G9B)
+ $(INTEL_PP_PRE_G9B) \
  $(NULL)
 
 # Extra clean files so that maintainer-clean removes *everything*
diff --git a/src/shaders/post_processing/gen9/conv_nv12.g9b
b/src/shaders/post_processing/gen9/conv_nv12.g9b
new file mode 100644
index 0000000..cf3c68f
--- /dev/null
+++ b/src/shaders/post_processing/gen9/conv_nv12.g9b
@@ -0,0 +1,368 @@
+{ 0x00600001, 0x20602648, 0x00000000, 0x76543210 },
+{ 0x00000005, 0x26c0124c, 0x16000004, 0x07ff07ff },
+{ 0x00600001, 0x26e01208, 0x008d0060, 0x00000000 },
+{ 0x00000005, 0x26c2124c, 0x16000006, 0x07ff07ff },
+{ 0x00000041, 0x20a01208, 0x160006c0, 0x00100010 },
+{ 0x00600040, 0x27000208, 0x168d06e0, 0x00080008 },
+{ 0x00000041, 0x20801228, 0x160006c2, 0x00100010 },
+{ 0x00000040, 0x26c40228, 0x02000040, 0x000000a0 },
+{ 0x00800040, 0x26e00208, 0x028d06e0, 0x000000a0 },
+{ 0x00000041, 0x21003ae8, 0x3e000048, 0x3f000000 },
+{ 0x00000041, 0x21603ae8, 0x3e00004c, 0x3f000000 },
+{ 0x00800001, 0x212002e8, 0x00000080, 0x00000000 },
+{ 0x00800001, 0x20c002e8, 0x008d06e0, 0x00000000 },
+{ 0x0080015b, 0x3b1e0000, 0xc020b001, 0x02472004 },
+{ 0x0080015b, 0x391e0000, 0x80208001, 0x01872004 },
+{ 0x00800040, 0x27603ae8, 0x3a8d0760, 0x00000054 },
+{ 0x00800040, 0x27203ae8, 0x3a8d0720, 0x00000050 },
+{ 0x00000001, 0x26cc1e28, 0x00000000, 0x00000000 },
+{ 0x00000001, 0x28a00208, 0x0000005c, 0x00000000 },
+{ 0x00000040, 0x26c80228, 0x02000044, 0x00000080 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d0720, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000058, 0x122c0000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000e000 },
+{ 0x02800031, 0x21800268, 0x00000060, 0x00000200 },
+{ 0x00000001, 0x21c01ee8, 0x00000000, 0x00ff00ff },
+{ 0x00800040, 0x27603ae8, 0x3a8d0760, 0x0000004c },
+{ 0x00800001, 0x23000608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22c01ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22400208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x22200208, 0x008d0060, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000058, 0x122c0000 },
+{ 0x00800001, 0x22800208, 0x008d0760, 0x00000000 },
+{ 0x00800040, 0x27603ae8, 0x3a8d0760, 0x0000004c },
+{ 0x00800001, 0x24600608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24201ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x23a00208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x23800208, 0x008d0220, 0x00000000 },
+{ 0x00800001, 0x23e00208, 0x008d0760, 0x00000000 },
+{ 0x00800040, 0x27603ae8, 0x3a8d0760, 0x0000004c },
+{ 0x00800001, 0x25c00608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x25801ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x25000208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x24e00208, 0x008d0380, 0x00000000 },
+{ 0x00800001, 0x25400208, 0x008d0760, 0x00000000 },
+{ 0x00600001, 0x2640020c, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x26cc0a28, 0x1e0006cc, 0x00010001 },
+{ 0x00000001, 0x2644020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x2640020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x2648060c, 0x00000000, 0x0003000f },
+{ 0x05000010, 0x20000a23, 0x1e0006cc, 0x00040004 },
+{ 0x00800040, 0x27603ae8, 0x3a8d0760, 0x0000004c },
+{ 0x00000040, 0x26c80a28, 0x1e0006c8, 0x00040004 },
+{ 0x00800041, 0x21803ae8, 0x3a8d0180, 0x000001c0 },
+{ 0x00600001, 0x22003a28, 0x008d01a0, 0x00000000 },
+{ 0x00600001, 0x21e03a28, 0x008d0180, 0x00000000 },
+{ 0x02800031, 0x21800268, 0x00000220, 0x00000200 },
+{ 0x00600001, 0x27a82288, 0x00cf0200, 0x00000000 },
+{ 0x00600001, 0x27a02288, 0x00cf01e0, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000058, 0x122c0000 },
+{ 0x00800041, 0x21803ae8, 0x3a8d0180, 0x000001c0 },
+{ 0x00600001, 0x23603a28, 0x008d01a0, 0x00000000 },
+{ 0x00600001, 0x23403a28, 0x008d0180, 0x00000000 },
+{ 0x02800031, 0x21800268, 0x00000380, 0x00000200 },
+{ 0x00600001, 0x27b82288, 0x00cf0360, 0x00000000 },
+{ 0x00600001, 0x27b02288, 0x00cf0340, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000058, 0x122c0000 },
+{ 0x00800041, 0x21803ae8, 0x3a8d0180, 0x000001c0 },
+{ 0x00600001, 0x24c03a28, 0x008d01a0, 0x00000000 },
+{ 0x00600001, 0x24a03a28, 0x008d0180, 0x00000000 },
+{ 0x02800031, 0x21800268, 0x000004e0, 0x00000200 },
+{ 0x00600001, 0x27c82288, 0x00cf04c0, 0x00000000 },
+{ 0x00600001, 0x27c02288, 0x00cf04a0, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060008a0, 0x020a8000 },
+{ 0x00800041, 0x21803ae8, 0x3a8d0180, 0x000001c0 },
+{ 0x00600001, 0x26203a28, 0x008d01a0, 0x00000000 },
+{ 0x00600001, 0x26003a28, 0x008d0180, 0x00000000 },
+{ 0x00600001, 0x27d82288, 0x00cf0620, 0x00000000 },
+{ 0x00600001, 0x27d02288, 0x00cf0600, 0x00000000 },
+{ 0x0c600033, 0x0003d014, 0x00002642, 0x00000000 },
+{ 0x00010020, 0x34000007, 0x0e001400, 0xfffffc00 },
+{ 0x00600001, 0x20602668, 0x00000000, 0x76543210 },
+{ 0x00000041, 0x20a01228, 0x160006c2, 0x00100010 },
+{ 0x00600009, 0x27001a08, 0x168d0060, 0x00010001 },
+{ 0x00000041, 0x20801208, 0x160006c0, 0x00100010 },
+{ 0x00600001, 0x20c00a08, 0x000000a0, 0x00000000 },
+{ 0x00600001, 0x26e00208, 0x008d0700, 0x00000000 },
+{ 0x00600040, 0x20e00208, 0x168d00c0, 0x00020002 },
+{ 0x00800040, 0x26e00208, 0x028d06e0, 0x00000080 },
+{ 0x00800001, 0x216002e8, 0x008d00c0, 0x00000000 },
+{ 0x00800001, 0x212002e8, 0x008d06e0, 0x00000000 },
+{ 0x00000005, 0x21a00208, 0x1600003c, 0x000c000c },
+{ 0x0080015b, 0x3b1e0000, 0xc0202a01, 0x02c72004 },
+{ 0x0080015b, 0x391e0000, 0x80202801, 0x02472004 },
+{ 0x00000040, 0x21000228, 0x02000044, 0x000000a0 },
+{ 0x02000010, 0x20000202, 0x160001a0, 0x000c000c },
+{ 0x00800040, 0x27603ae8, 0x3a8d0760, 0x00000038 },
+{ 0x00800040, 0x27203ae8, 0x3a8d0720, 0x00000034 },
+{ 0x00000040, 0x26d00208, 0x16000058, 0x00010001 },
+{ 0x00000040, 0x26d40208, 0x16000058, 0x00020002 },
+{ 0x00000040, 0x26d80208, 0x1600005c, 0x00010001 },
+{ 0x00000040, 0x26dc0208, 0x1600005c, 0x00020002 },
+{ 0x0000000c, 0x26c80a28, 0x1e000100, 0x00010001 },
+{ 0x00010020, 0x34000006, 0x0e001400, 0x00000370 },
+{ 0x00000001, 0x26cc1e28, 0x00000000, 0x00000000 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x124c0000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d0720, 0x00000000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000c000 },
+{ 0x02800031, 0x27e00268, 0x00000060, 0x00000200 },
+{ 0x00000001, 0x22603ee8, 0x00000000, 0x40800000 },
+{ 0x00000001, 0x21801ee8, 0x00000000, 0x00ff00ff },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x04c00404 },
+{ 0x00800001, 0x23600608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x23201ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22a00208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x22800208, 0x008d0060, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x124c0000 },
+{ 0x00800001, 0x22e00208, 0x008d0760, 0x00000000 },
+{ 0x00600001, 0x2460020c, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x26cc0a28, 0x1e0006cc, 0x00010001 },
+{ 0x00000001, 0x2464020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x2460020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x2468060c, 0x00000000, 0x0003000f },
+{ 0x05000010, 0x20000a21, 0x1e0006cc, 0x00020002 },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x04c00404 },
+{ 0x00000040, 0x26c80a28, 0x1e0006c8, 0x00040004 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x00000180 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x00000180 },
+{ 0x00600001, 0x22203a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x21e03a28, 0x008d0820, 0x00000000 },
+{ 0x00600001, 0x21c03a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x21a03a28, 0x008d07e0, 0x00000000 },
+{ 0x02800031, 0x27e00268, 0x00000280, 0x00000200 },
+{ 0x00600001, 0x62400a88, 0x008d0220, 0x00000000 },
+{ 0x00600001, 0x62000a88, 0x008d01e0, 0x00000000 },
+{ 0x00600001, 0x47b02288, 0x00cf01c0, 0x00000000 },
+{ 0x00600001, 0x47a02288, 0x00cf01a0, 0x00000000 },
+{ 0x00600001, 0x47b12288, 0x00600240, 0x00000000 },
+{ 0x00600001, 0x47a12288, 0x00600200, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d8, 0x020a8000 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x00000180 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x00000180 },
+{ 0x00600001, 0x24203a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x23e03a28, 0x008d0820, 0x00000000 },
+{ 0x00600001, 0x23c03a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x23a03a28, 0x008d07e0, 0x00000000 },
+{ 0x00600001, 0x64400a88, 0x008d0420, 0x00000000 },
+{ 0x00600001, 0x64000a88, 0x008d03e0, 0x00000000 },
+{ 0x00600001, 0x47d02288, 0x00cf03c0, 0x00000000 },
+{ 0x00600001, 0x47c02288, 0x00cf03a0, 0x00000000 },
+{ 0x00600001, 0x47d12288, 0x00600440, 0x00000000 },
+{ 0x00600001, 0x47c12288, 0x00600400, 0x00000000 },
+{ 0x0c600033, 0x0003d014, 0x00002462, 0x00000000 },
+{ 0x00010020, 0x34000005, 0x0e001400, 0xfffffcb0 },
+{ 0x00000020, 0x34000004, 0x0e001400, 0x00000cc0 },
+{ 0x00000005, 0x20600208, 0x1600003c, 0x000c000c },
+{ 0x02000010, 0x20000200, 0x16000060, 0x00040004 },
+{ 0x00010020, 0x34000004, 0x0e001400, 0x000003a0 },
+{ 0x0000000c, 0x26c40a28, 0x1e0006c4, 0x00010001 },
+{ 0x00000001, 0x26cc1e28, 0x00000000, 0x00000000 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x124c0000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d0720, 0x00000000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000c000 },
+{ 0x02800031, 0x27e00268, 0x00000060, 0x00000200 },
+{ 0x00000001, 0x22203ee8, 0x00000000, 0x40800000 },
+{ 0x00000001, 0x21801ee8, 0x00000000, 0x00ff00ff },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x04400404 },
+{ 0x00800001, 0x23200608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22e01ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22600208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x22400208, 0x008d0060, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x124c0000 },
+{ 0x00800001, 0x22a00208, 0x008d0760, 0x00000000 },
+{ 0x00600001, 0x23e0020c, 0x008d0000, 0x00000000 },
+{ 0x00000001, 0x23e4020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x23e0020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x23e8060c, 0x00000000, 0x00030007 },
+{ 0x00600001, 0x2400020c, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x26cc0a28, 0x1e0006cc, 0x00010001 },
+{ 0x00000001, 0x2404020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x2400020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x2408060c, 0x00000000, 0x00030007 },
+{ 0x05000010, 0x20000a23, 0x1e0006cc, 0x00020002 },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x04400404 },
+{ 0x00000040, 0x26c80a28, 0x1e0006c8, 0x00040004 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x00000180 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x00000180 },
+{ 0x00600001, 0x22003a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x21e03a28, 0x008d0820, 0x00000000 },
+{ 0x00600001, 0x21c03a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x21a03a28, 0x008d07e0, 0x00000000 },
+{ 0x02800031, 0x27e00268, 0x00000240, 0x00000200 },
+{ 0x00600001, 0x28882288, 0x00cf0200, 0x00000000 },
+{ 0x00600001, 0x28682288, 0x00cf01c0, 0x00000000 },
+{ 0x00600001, 0x28602288, 0x00cf01a0, 0x00000000 },
+{ 0x00600001, 0x28802288, 0x00cf01e0, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d8, 0x020a8000 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x00000180 },
+{ 0x00600001, 0x23803a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x23603a28, 0x008d07e0, 0x00000000 },
+{ 0x00600001, 0x28782288, 0x00cf0380, 0x00000000 },
+{ 0x00600001, 0x28702288, 0x00cf0360, 0x00000000 },
+{ 0x0c600033, 0x00043014, 0x000023e1, 0x00000000 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x00000180 },
+{ 0x00600001, 0x23c03a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x23a03a28, 0x008d0820, 0x00000000 },
+{ 0x00600001, 0x28982288, 0x00cf03c0, 0x00000000 },
+{ 0x00600001, 0x28902288, 0x00cf03a0, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006dc, 0x020a8000 },
+{ 0x0c600033, 0x00044014, 0x00002401, 0x00000000 },
+{ 0x00010020, 0x34000007, 0x0e001400, 0xfffffc90 },
+{ 0x00000020, 0x34000004, 0x0e001400, 0x000008f0 },
+{ 0x00000005, 0x20600208, 0x1600003c, 0x000c000c },
+{ 0x02000010, 0x20000202, 0x16000060, 0x00080008 },
+{ 0x00010020, 0x34000006, 0x0e001400, 0x00000450 },
+{ 0x00000001, 0x26cc1e28, 0x00000000, 0x00000000 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x122c0000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d0720, 0x00000000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000e000 },
+{ 0x02800031, 0x27e00268, 0x00000060, 0x00000200 },
+{ 0x00800001, 0x22600608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22201ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21e00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x21a00208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x21800208, 0x008d0060, 0x00000000 },
+{ 0x00600001, 0x23a00208, 0x008d0180, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d4, 0x122c0000 },
+{ 0x00600001, 0x24c00208, 0x008d03a0, 0x00000000 },
+{ 0x02800031, 0x28200268, 0x00000180, 0x00000200 },
+{ 0x00000001, 0x23803ee8, 0x00000000, 0x40800000 },
+{ 0x00000001, 0x22a01ee8, 0x00000000, 0x00ff00ff },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x07000404 },
+{ 0x00800001, 0x24800608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24401ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x23c00208, 0x008d0720, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x122c0000 },
+{ 0x00800001, 0x24000208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x25a00608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x25601ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24e00208, 0x008d0720, 0x00000000 },
+{ 0x00800001, 0x25200208, 0x008d0760, 0x00000000 },
+{ 0x00600001, 0x26a0020c, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x26cc0a28, 0x1e0006cc, 0x00010001 },
+{ 0x00000001, 0x26a4020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x26a0020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x26a8060c, 0x00000000, 0x0003000f },
+{ 0x05000010, 0x20000a21, 0x1e0006cc, 0x00020002 },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x07000404 },
+{ 0x00000040, 0x26c80a28, 0x1e0006c8, 0x00040004 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x000002a0 },
+{ 0x00600001, 0x22e03a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x22c03a28, 0x008d07e0, 0x00000000 },
+{ 0x02800031, 0x27e00268, 0x000003a0, 0x00000200 },
+{ 0x00600001, 0x47b02288, 0x00cf02e0, 0x00000000 },
+{ 0x00600001, 0x47a02288, 0x00cf02c0, 0x00000000 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x000002a0 },
+{ 0x00000040, 0x22000204, 0x060006d4, 0x122c0000 },
+{ 0x00600001, 0x23403a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x23003a28, 0x008d0820, 0x00000000 },
+{ 0x02800031, 0x28200268, 0x000004c0, 0x00000200 },
+{ 0x00600001, 0x63600a88, 0x008d0340, 0x00000000 },
+{ 0x00600001, 0x63200a88, 0x008d0300, 0x00000000 },
+{ 0x00600001, 0x47b12288, 0x00600360, 0x00000000 },
+{ 0x00600001, 0x47a12288, 0x00600320, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d8, 0x020a8000 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x000002a0 },
+{ 0x00600001, 0x26003a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x25e03a28, 0x008d07e0, 0x00000000 },
+{ 0x00600001, 0x47d02288, 0x00cf0600, 0x00000000 },
+{ 0x00600001, 0x47c02288, 0x00cf05e0, 0x00000000 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x000002a0 },
+{ 0x00600001, 0x26603a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x26203a28, 0x008d0820, 0x00000000 },
+{ 0x00600001, 0x66800a88, 0x008d0660, 0x00000000 },
+{ 0x00600001, 0x66400a88, 0x008d0620, 0x00000000 },
+{ 0x00600001, 0x47d12288, 0x00600680, 0x00000000 },
+{ 0x00600001, 0x47c12288, 0x00600640, 0x00000000 },
+{ 0x0c600033, 0x0003d014, 0x000026a2, 0x00000000 },
+{ 0x00010020, 0x34000005, 0x0e001400, 0xfffffbd0 },
+{ 0x00000020, 0x34000004, 0x0e001400, 0x00000470 },
+{ 0x0000000c, 0x26c40a28, 0x1e0006c4, 0x00010001 },
+{ 0x00000001, 0x26cc1e28, 0x00000000, 0x00000000 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x122c0000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d0720, 0x00000000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000e000 },
+{ 0x02800031, 0x27e00268, 0x00000060, 0x00000200 },
+{ 0x00800001, 0x22600608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22201ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21e00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x21a00208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x21800208, 0x008d0060, 0x00000000 },
+{ 0x00600001, 0x23600208, 0x008d0180, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d4, 0x122c0000 },
+{ 0x00600001, 0x24800208, 0x008d0360, 0x00000000 },
+{ 0x02800031, 0x28200268, 0x00000180, 0x00000200 },
+{ 0x00000001, 0x23403ee8, 0x00000000, 0x40800000 },
+{ 0x00000001, 0x22a01ee8, 0x00000000, 0x00ff00ff },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x06800404 },
+{ 0x00800001, 0x24400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x23800208, 0x008d0720, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x122c0000 },
+{ 0x00800001, 0x23c00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x25600608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x25201ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24a00208, 0x008d0720, 0x00000000 },
+{ 0x00800001, 0x24e00208, 0x008d0760, 0x00000000 },
+{ 0x00600001, 0x2620020c, 0x008d0000, 0x00000000 },
+{ 0x00000001, 0x2624020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x2620020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x2628060c, 0x00000000, 0x00030007 },
+{ 0x00600001, 0x2640020c, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x26cc0a28, 0x1e0006cc, 0x00010001 },
+{ 0x00000001, 0x2644020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x2640020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x2648060c, 0x00000000, 0x00030007 },
+{ 0x05000010, 0x20000a20, 0x1e0006cc, 0x00020002 },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x06800404 },
+{ 0x00000040, 0x26c80a28, 0x1e0006c8, 0x00040004 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x000002a0 },
+{ 0x00600001, 0x22e03a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x22c03a28, 0x008d07e0, 0x00000000 },
+{ 0x02800031, 0x27e00268, 0x00000360, 0x00000200 },
+{ 0x00600001, 0x28682288, 0x00cf02e0, 0x00000000 },
+{ 0x00600001, 0x28602288, 0x00cf02c0, 0x00000000 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x000002a0 },
+{ 0x00000040, 0x22000204, 0x060006d4, 0x122c0000 },
+{ 0x00600001, 0x23203a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x23003a28, 0x008d0820, 0x00000000 },
+{ 0x02800031, 0x28200268, 0x00000480, 0x00000200 },
+{ 0x00600001, 0x28882288, 0x00cf0320, 0x00000000 },
+{ 0x00600001, 0x28802288, 0x00cf0300, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d8, 0x020a8000 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x000002a0 },
+{ 0x00600001, 0x25c03a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x25a03a28, 0x008d07e0, 0x00000000 },
+{ 0x00600001, 0x28782288, 0x00cf05c0, 0x00000000 },
+{ 0x00600001, 0x28702288, 0x00cf05a0, 0x00000000 },
+{ 0x0c600033, 0x00043014, 0x00002621, 0x00000000 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x000002a0 },
+{ 0x00600001, 0x26003a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x25e03a28, 0x008d0820, 0x00000000 },
+{ 0x00600001, 0x28982288, 0x00cf0600, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006dc, 0x020a8000 },
+{ 0x00600001, 0x28902288, 0x00cf05e0, 0x00000000 },
+{ 0x0c600033, 0x00044014, 0x00002641, 0x00000000 },
+{ 0x00010020, 0x34000004, 0x0e001400, 0xfffffbb0 },
+{ 0x00600001, 0x2fe0020c, 0x008d0000, 0x00000000 },
+{ 0x07000031, 0x20000200, 0x06000fe0, 0x82000010 },
Zhao Yakui
2016-11-25 08:58:07 UTC
Permalink
Post by Xiang, Haihao
Post by Zhao Yakui
V1->V2: Add the support of clearing background color for NV12
Is it possible to clear the background in your new media kernel instead
of BLT?
Background color is cleared on the total surface width/height.
But the csc/scaling conversion is executed on part region of one surface.
They are for the different purpose. So it is not appropriate that the
CSC and clearing backgroud color are combined together.

Thanks
Yakui
Post by Xiang, Haihao
Post by Zhao Yakui
NV12->NV12
NV12->I420
I420->NV12
I420->I420
---
src/Makefile.am | 1 +
src/gen75_picture_process.c | 140 ++++++++++
src/gen8_post_processing.c | 5 +
src/gen9_post_processing.c | 281
++++++++++++++++++-
src/i965_post_processing.h | 5 +
src/intel_common_vpp_internal.c | 74 +++++
src/intel_common_vpp_internal.h | 8 +
src/intel_gen_vppapi.h | 12 +
src/shaders/post_processing/gen9/Makefile.am | 5 +-
src/shaders/post_processing/gen9/conv_nv12.g9b | 368
+++++++++++++++++++++++++
10 files changed, 891 insertions(+), 8 deletions(-)
create mode 100644 src/intel_common_vpp_internal.c
create mode 100644 src/shaders/post_processing/gen9/conv_nv12.g9b
diff --git a/src/Makefile.am b/src/Makefile.am
index c262820..424812b 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -101,6 +101,7 @@ source_c = \
gen9_vp9_encoder_kernels.c \
gen9_vp9_const_def.c \
gen9_vp9_encoder.c \
+ intel_common_vpp_internal.c \
$(NULL)
source_h = \
diff --git a/src/gen75_picture_process.c
b/src/gen75_picture_process.c
index 380015d..d4106f3 100644
--- a/src/gen75_picture_process.c
+++ b/src/gen75_picture_process.c
@@ -103,6 +103,106 @@ static int
intel_gpe_support_10bit_scaling(struct intel_video_process_context *p
return 0;
}
+static void
+rgb_to_yuv(unsigned int argb,
+ unsigned char *y,
+ unsigned char *u,
+ unsigned char *v,
+ unsigned char *a)
+{
+ int r = ((argb>> 16)& 0xff);
+ int g = ((argb>> 8)& 0xff);
+ int b = ((argb>> 0)& 0xff);
+
+ *y = (257 * r + 504 * g + 98 * b) / 1000 + 16;
+ *v = (439 * r - 368 * g - 71 * b) / 1000 + 128;
+ *u = (-148 * r - 291 * g + 439 * b) / 1000 + 128;
+ *a = ((argb>> 24)& 0xff);
+}
+
+static void
+gen8plus_vpp_clear_surface(VADriverContextP ctx,
+ struct i965_post_processing_context
*pp_context,
+ struct object_surface *obj_surface,
+ unsigned int color)
+{
+ struct intel_batchbuffer *batch = pp_context->batch;
+ unsigned int blt_cmd, br13;
+ unsigned int tiling = 0, swizzle = 0;
+ int pitch;
+ unsigned char y, u, v, a = 0;
+ int region_width, region_height;
+
+ /* Currently only support NV12 surface */
+ if (!obj_surface || obj_surface->fourcc != VA_FOURCC_NV12)
+ return;
+
+ rgb_to_yuv(color,&y,&u,&v,&a);
+
+ if (a == 0)
+ return;
+
+ dri_bo_get_tiling(obj_surface->bo,&tiling,&swizzle);
+ blt_cmd = GEN8_XY_COLOR_BLT_CMD;
+ pitch = obj_surface->width;
+
+ if (tiling != I915_TILING_NONE) {
+ assert(tiling == I915_TILING_Y);
+ // blt_cmd |= XY_COLOR_BLT_DST_TILED;
+ // pitch>>= 2;
+ }
+
+ br13 = 0xf0<< 16;
+ br13 |= BR13_8;
+ br13 |= pitch;
+
+ intel_batchbuffer_start_atomic_blt(batch, 56);
+ BEGIN_BLT_BATCH(batch, 14);
+
+ region_width = obj_surface->width;
+ region_height = obj_surface->height;
+
+ OUT_BATCH(batch, blt_cmd);
+ OUT_BATCH(batch, br13);
+ OUT_BATCH(batch,
+ 0<< 16 |
+ 0);
+ OUT_BATCH(batch,
+ region_height<< 16 |
+ region_width);
+ OUT_RELOC64(batch, obj_surface->bo,
+ I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
+ 0);
+ OUT_BATCH(batch, y);
+
+ br13 = 0xf0<< 16;
+ br13 |= BR13_565;
+ br13 |= pitch;
+
+ region_width = obj_surface->width / 2;
+ region_height = obj_surface->height / 2;
+
+ if (tiling == I915_TILING_Y) {
+ region_height = ALIGN(obj_surface->height / 2, 32);
+ }
+
+ OUT_BATCH(batch, blt_cmd);
+ OUT_BATCH(batch, br13);
+ OUT_BATCH(batch,
+ 0<< 16 |
+ 0);
+ OUT_BATCH(batch,
+ region_height<< 16 |
+ region_width);
+ OUT_RELOC64(batch, obj_surface->bo,
+ I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
+ obj_surface->width * obj_surface->y_cb_offset);
+ OUT_BATCH(batch, v<< 8 | u);
+
+ ADVANCE_BATCH(batch);
+ intel_batchbuffer_end_atomic(batch);
+}
+
VAStatus
gen75_proc_picture(VADriverContextP ctx,
VAProfile profile,
@@ -208,6 +308,7 @@ gen75_proc_picture(VADriverContextP ctx,
#define SRC_10BIT_420 (5<< 0)
#define SRC_10BIT_422 (6<< 0)
#define SRC_10BIT_444 (7<< 0)
+#define SRC_8BIT_420 (1<< 0)
/* The Bit 6 is used to indicate that it is 10bit or 8bit.
* The Bit 5/4 is used to indicate the 420/422/444 format
@@ -215,6 +316,7 @@ gen75_proc_picture(VADriverContextP ctx,
#define DST_10BIT_420 (5<< 4)
#define DST_10BIT_422 (6<< 4)
#define DST_10BIT_444 (7<< 4)
+#define DST_8BIT_420 (1<< 4)
/* This is mainly for YUY2/RGBA. It is reserved for further */
#define SRC_YUV_PACKED (1<< 3)
@@ -222,6 +324,7 @@ gen75_proc_picture(VADriverContextP ctx,
#define MASK_CSC (0xFF)
#define SCALE_10BIT_420 (SRC_10BIT_420 | DST_10BIT_420)
+#define SCALE_8BIT_420 (SRC_8BIT_420 | DST_8BIT_420)
unsigned int scale_flag;
@@ -234,6 +337,14 @@ gen75_proc_picture(VADriverContextP ctx,
obj_dst_surf->fourcc == VA_FOURCC_I010)
scale_flag |= DST_10BIT_420;
+ if (obj_src_surf->fourcc == VA_FOURCC_NV12 ||
+ obj_src_surf->fourcc == VA_FOURCC_I420)
+ scale_flag |= SRC_8BIT_420;
+
+ if (obj_dst_surf->fourcc == VA_FOURCC_NV12 ||
+ obj_dst_surf->fourcc == VA_FOURCC_I420)
+ scale_flag |= DST_8BIT_420;
+
/* If P010 is converted without resolution change,
* fall back to VEBOX
*/
@@ -267,6 +378,35 @@ gen75_proc_picture(VADriverContextP ctx,
&src_surface, &src_rect,
&dst_surface, &dst_rect);
}
+ if (((scale_flag& MASK_CSC) == SCALE_8BIT_420)&&
+ intel_vpp_support_yuv420p8_scaling(proc_ctx)) {
+ struct i965_proc_context *gpe_proc_ctx;
+ struct i965_surface src_surface, dst_surface;
+ unsigned int tmp_width, tmp_x;
+
+
+ src_surface.base = (struct object_base *)obj_src_surf;
+ src_surface.type = I965_SURFACE_TYPE_SURFACE;
+ dst_surface.base = (struct object_base *)obj_dst_surf;
+ dst_surface.type = I965_SURFACE_TYPE_SURFACE;
+ gpe_proc_ctx = (struct i965_proc_context *)proc_ctx-
Post by Zhao Yakui
vpp_fmt_cvt_ctx;
+
+ tmp_x = ALIGN_FLOOR(dst_rect.x, 4);
+ tmp_width = dst_rect.x + dst_rect.width;
+ tmp_width = tmp_width - tmp_x;
+ dst_rect.x = tmp_x;
+ dst_rect.width = tmp_width;
+
+ if (obj_dst_surf->fourcc == VA_FOURCC_NV12&&
+ pipeline_param->output_background_color)
+ gen8plus_vpp_clear_surface(ctx,&gpe_proc_ctx-
Post by Zhao Yakui
pp_context,
+ obj_dst_surf,
+ pipeline_param-
Post by Zhao Yakui
output_background_color);
+
+ return intel_yuv420p8_scaling_post_processing(ctx,
&gpe_proc_ctx->pp_context,
+&src_surface,
&src_rect,
+&dst_surface,
&dst_rect);
+ }
}
proc_ctx->surface_render_output_object = obj_dst_surf;
diff --git a/src/gen8_post_processing.c b/src/gen8_post_processing.c
index 5ef8cbf..a70814c 100644
--- a/src/gen8_post_processing.c
+++ b/src/gen8_post_processing.c
@@ -1544,6 +1544,11 @@
gen8_post_processing_context_finalize(VADriverContextP ctx,
pp_context->scaling_context_initialized = 0;
}
+ if (pp_context->scaling_8bit_initialized& VPPGPE_8BIT_420) {
+ gen8_gpe_context_destroy(&pp_context-
Post by Zhao Yakui
scaling_yuv420p8_context);
+ pp_context->scaling_8bit_initialized&= ~(VPPGPE_8BIT_420);
+ }
+
if(pp_context->vebox_proc_ctx){
gen75_vebox_context_destroy(ctx,pp_context->vebox_proc_ctx);
pp_context->vebox_proc_ctx = NULL;
diff --git a/src/gen9_post_processing.c b/src/gen9_post_processing.c
index efa8216..88d092b 100644
--- a/src/gen9_post_processing.c
+++ b/src/gen9_post_processing.c
@@ -38,6 +38,7 @@
#include "intel_media.h"
#include "gen8_post_processing.h"
+#include "gen75_picture_process.h"
#include "intel_gen_vppapi.h"
#include "intel_common_vpp_internal.h"
@@ -113,6 +114,10 @@ static const uint32_t pp_10bit_scaling_gen9[][4] = {
#include "shaders/post_processing/gen9/conv_p010.g9b"
};
+static const uint32_t pp_yuv420p8_scaling_gen9[][4] = {
+#include "shaders/post_processing/gen9/conv_nv12.g9b"
+};
+
static struct pp_module pp_modules_gen9[] = {
{
{
@@ -449,7 +454,7 @@ gen9_post_processing(VADriverContextP ctx,
}
static void
-gen9_p010_scaling_sample_state(VADriverContextP ctx,
+gen9_vpp_scaling_sample_state(VADriverContextP ctx,
struct i965_gpe_context *gpe_context,
VARectangle *src_rect,
VARectangle *dst_rect)
@@ -533,6 +538,45 @@
gen9_post_processing_context_init(VADriverContextP ctx,
gen8_gpe_context_init(ctx, gpe_context);
pp_context->scaling_context_initialized = 1;
+
+ /* initialize the YUV420 8-Bit scaling context. The below is supported.
+ * NV12 ->NV12
+ * NV12 ->I420
+ * I420 ->I420
+ * I420 ->NV12
+ */
+ gpe_context =&pp_context->scaling_yuv420p8_context;
+ memset(&scaling_kernel, 0, sizeof(scaling_kernel));
+ scaling_kernel.bin = pp_yuv420p8_scaling_gen9;
+ scaling_kernel.size = sizeof(pp_yuv420p8_scaling_gen9);
+ gen8_gpe_load_kernels(ctx, gpe_context,&scaling_kernel, 1);
+ gpe_context->idrt.entry_size = ALIGN(sizeof(struct
gen8_interface_descriptor_data), 64);
+ gpe_context->idrt.max_entries = 1;
+ gpe_context->sampler.entry_size = ALIGN(sizeof(struct
gen8_sampler_state), 64);
+ gpe_context->sampler.max_entries = 1;
+ gpe_context->curbe.length = ALIGN(sizeof(struct
scaling_input_parameter), 32);
+
+ gpe_context->surface_state_binding_table.max_entries =
MAX_SCALING_SURFACES;
+ gpe_context->surface_state_binding_table.binding_table_offset = 0;
+ gpe_context->surface_state_binding_table.surface_state_offset =
ALIGN(MAX_SCALING_SURFACES * 4, 64);
+ gpe_context->surface_state_binding_table.length =
ALIGN(MAX_SCALING_SURFACES * 4, 64) + ALIGN(MAX_SCALING_SURFACES *
SURFACE_STATE_PADDED_SIZE_GEN9, 64);
+
+ if (i965->intel.eu_total> 0) {
+ gpe_context->vfe_state.max_num_threads = i965-
Post by Zhao Yakui
intel.eu_total * 6;
+ } else {
+ if (i965->intel.has_bsd2)
+ gpe_context->vfe_state.max_num_threads = 300;
+ else
+ gpe_context->vfe_state.max_num_threads = 60;
+ }
+
+ gpe_context->vfe_state.curbe_allocation_size = 37;
+ gpe_context->vfe_state.urb_entry_size = 16;
+ gpe_context->vfe_state.num_urb_entries = 127;
+ gpe_context->vfe_state.gpgpu_mode = 0;
+
+ gen8_gpe_context_init(ctx, gpe_context);
+ pp_context->scaling_8bit_initialized = VPPGPE_8BIT_420;
return;
}
@@ -699,13 +743,13 @@
gen9_pp_context_get_surface_conf(VADriverContextP ctx,
pitch[0] = obj_surface->width;
bo_offset[0] = 0;
- if (fourcc == VA_FOURCC_P010) {
+ if (fourcc == VA_FOURCC_P010 || fourcc == VA_FOURCC_NV12) {
width[1] = width[0] / 2;
height[1] = height[0] / 2;
pitch[1] = obj_surface->cb_cr_pitch;
bo_offset[1] = obj_surface->width * obj_surface-
Post by Zhao Yakui
y_cb_offset;
} else {
- /* I010 format */
+ /* I010/I420 format */
width[1] = width[0] / 2;
height[1] = height[0] / 2;
pitch[1] = obj_surface->cb_cr_pitch;
@@ -726,13 +770,13 @@
gen9_pp_context_get_surface_conf(VADriverContextP ctx,
pitch[0] = obj_image->image.pitches[0];
bo_offset[0] = obj_image->image.offsets[0];
- if (fourcc == VA_FOURCC_P010) {
+ if (fourcc == VA_FOURCC_P010 || fourcc == VA_FOURCC_NV12) {
width[1] = width[0] / 2;
height[1] = height[0] / 2;
pitch[1] = obj_image->image.pitches[1];
bo_offset[1] = obj_image->image.offsets[1];
} else {
- /* I010 format */
+ /* I010/I420 format */
width[1] = width[0] / 2;
height[1] = height[0] / 2;
pitch[1] = obj_image->image.pitches[1];
@@ -887,7 +931,7 @@ gen9_p010_scaling_post_processing(
gpe_context =&pp_context->scaling_10bit_context;
gen8_gpe_context_init(ctx, gpe_context);
- gen9_p010_scaling_sample_state(ctx, gpe_context, src_rect, dst_rect);
+ gen9_vpp_scaling_sample_state(ctx, gpe_context, src_rect, dst_rect);
gen9_gpe_reset_binding_table(ctx, gpe_context);
gen9_gpe_context_p010_scaling_curbe(ctx, gpe_context,
src_rect, src_surface,
@@ -912,3 +956,228 @@ gen9_p010_scaling_post_processing(
return VA_STATUS_SUCCESS;
}
+
+static void
+gen9_gpe_context_yuv420p8_scaling_curbe(VADriverContextP ctx,
+ struct i965_gpe_context *gpe_context,
+ VARectangle *src_rect,
+ struct i965_surface *src_surface,
+ VARectangle *dst_rect,
+ struct i965_surface *dst_surface)
+{
+ struct scaling_input_parameter *scaling_curbe;
+ float src_width, src_height;
+ float coeff;
+ unsigned int fourcc;
+
+ if ((gpe_context == NULL) ||
+ (src_rect == NULL) || (src_surface == NULL) ||
+ (dst_rect == NULL) || (dst_surface == NULL))
+ return;
+
+ scaling_curbe = i965_gpe_context_map_curbe(gpe_context);
+
+ if (!scaling_curbe)
+ return;
+
+ memset(scaling_curbe, 0, sizeof(struct
scaling_input_parameter));
+
+ scaling_curbe->bti_input = BTI_SCALING_INPUT_Y;
+ scaling_curbe->bti_output = BTI_SCALING_OUTPUT_Y;
+
+ /* As the src_rect/dst_rect is already checked, it is skipped.*/
+ scaling_curbe->x_dst = dst_rect->x;
+ scaling_curbe->y_dst = dst_rect->y;
+
+ src_width = src_rect->x + src_rect->width;
+ src_height = src_rect->y + src_rect->height;
+
+ scaling_curbe->inv_width = 1 / src_width;
+ scaling_curbe->inv_height = 1 / src_height;
+
+ coeff = (float) (src_rect->width) / dst_rect->width;
+ scaling_curbe->x_factor = coeff / src_width;
+ scaling_curbe->x_orig = (float)(src_rect->x) / src_width;
+
+ coeff = (float) (src_rect->height) / dst_rect->height;
+ scaling_curbe->y_factor = coeff / src_height;
+ scaling_curbe->y_orig = (float)(src_rect->y) / src_height;
+
+ fourcc = pp_get_surface_fourcc(ctx, src_surface);
+ if (fourcc == VA_FOURCC_NV12) {
+ scaling_curbe->dw7.src_packed = 1;
+ }
+
+ fourcc = pp_get_surface_fourcc(ctx, dst_surface);
+
+ if (fourcc == VA_FOURCC_NV12) {
+ scaling_curbe->dw7.dst_packed = 1;
+ }
+
+ i965_gpe_context_unmap_curbe(gpe_context);
+}
+
+static void
+gen9_gpe_context_yuv420p8_scaling_surfaces(VADriverContextP ctx,
+ struct i965_gpe_context *gpe_context,
+ VARectangle *src_rect,
+ struct i965_surface *src_surface,
+ VARectangle *dst_rect,
+ struct i965_surface *dst_surface)
+{
+ unsigned int fourcc;
+ int width[3], height[3], pitch[3], bo_offset[3];
+ dri_bo *bo;
+ struct object_surface *obj_surface;
+ struct object_image *obj_image;
+ int bti;
+
+ if ((gpe_context == NULL) ||
+ (src_rect == NULL) || (src_surface == NULL) ||
+ (dst_rect == NULL) || (dst_surface == NULL))
+ return;
+
+ if (src_surface->base == NULL || dst_surface->base == NULL)
+ return;
+
+ fourcc = pp_get_surface_fourcc(ctx, src_surface);
+
+ if (src_surface->type == I965_SURFACE_TYPE_SURFACE) {
+ obj_surface = (struct object_surface *)src_surface->base;
+ bo = obj_surface->bo;
+ } else {
+ obj_image = (struct object_image *)src_surface->base;
+ bo = obj_image->bo;
+ }
+
+ bti = 0;
+ if (gen9_pp_context_get_surface_conf(ctx, src_surface, src_rect,
+ width, height, pitch,
+ bo_offset)) {
+ bti = BTI_SCALING_INPUT_Y;
+ /* Input surface */
+ gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[0],
+ width[0], height[0],
+ pitch[0], 0,
+ I965_SURFACEFORMAT_R8_UNO
RM,
+ bti, 0);
+ if (fourcc == VA_FOURCC_NV12) {
+ gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[1],
+ width[1], height[1],
+ pitch[1], 0,
+ I965_SURFACEFORMAT_R8G8_U
NORM,
+ bti + 1, 0);
+ } else {
+ gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[1],
+ width[1], height[1],
+ pitch[1], 0,
+ I965_SURFACEFORMAT_R8_UNO
RM,
+ bti + 1, 0);
+
+ gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[2],
+ width[2], height[2],
+ pitch[2], 0,
+ I965_SURFACEFORMAT_R8_UNO
RM,
+ bti + 2, 0);
+ }
+ }
+
+ fourcc = pp_get_surface_fourcc(ctx, dst_surface);
+
+ if (dst_surface->type == I965_SURFACE_TYPE_SURFACE) {
+ obj_surface = (struct object_surface *)dst_surface->base;
+ bo = obj_surface->bo;
+ } else {
+ obj_image = (struct object_image *)dst_surface->base;
+ bo = obj_image->bo;
+ }
+
+ if (gen9_pp_context_get_surface_conf(ctx, dst_surface, dst_rect,
+ width, height, pitch,
+ bo_offset)) {
+ bti = BTI_SCALING_OUTPUT_Y;
+ /* Input surface */
+ gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[0],
+ width[0], height[0],
+ pitch[0], 1,
+ I965_SURFACEFORMAT_R8_UIN
T,
+ bti, 0);
+ if (fourcc == VA_FOURCC_NV12) {
+ gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[1],
+ width[1] * 2, height[1],
+ pitch[1], 1,
+ I965_SURFACEFORMAT_R16_UI
NT,
+ bti + 1, 0);
+ } else {
+ gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[1],
+ width[1], height[1],
+ pitch[1], 1,
+ I965_SURFACEFORMAT_R8_UIN
T,
+ bti + 1, 0);
+
+ gen9_add_dri_buffer_2d_gpe_surface(ctx, gpe_context, bo,
+ bo_offset[2],
+ width[2], height[2],
+ pitch[2], 1,
+ I965_SURFACEFORMAT_R8_UIN
T,
+ bti + 2, 0);
+ }
+ }
+
+ return;
+}
+
+VAStatus
+gen9_yuv420p8_scaling_post_processing(
+ VADriverContextP ctx,
+ struct i965_post_processing_context *pp_context,
+ struct i965_surface *src_surface,
+ VARectangle *src_rect,
+ struct i965_surface *dst_surface,
+ VARectangle *dst_rect)
+{
+ struct i965_gpe_context *gpe_context;
+ struct gpe_media_object_walker_parameter
media_object_walker_param;
+ struct intel_vpp_kernel_walker_parameter kernel_walker_param;
+
+ if (!pp_context || !src_surface || !src_rect || !dst_surface || !dst_rect)
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+
+ if (!(pp_context->scaling_8bit_initialized& VPPGPE_8BIT_420))
+ return VA_STATUS_ERROR_UNIMPLEMENTED;
+
+ gpe_context =&pp_context->scaling_yuv420p8_context;
+
+ gen8_gpe_context_init(ctx, gpe_context);
+ gen9_vpp_scaling_sample_state(ctx, gpe_context, src_rect, dst_rect);
+ gen9_gpe_reset_binding_table(ctx, gpe_context);
+ gen9_gpe_context_yuv420p8_scaling_curbe(ctx, gpe_context,
+ src_rect, src_surface,
+ dst_rect, dst_surface);
+
+ gen9_gpe_context_yuv420p8_scaling_surfaces(ctx, gpe_context,
+ src_rect, src_surface,
+ dst_rect, dst_surface);
+
+ gen8_gpe_setup_interface_data(ctx, gpe_context);
+
+ memset(&kernel_walker_param, 0, sizeof(kernel_walker_param));
+ kernel_walker_param.resolution_x = ALIGN(dst_rect->width, 16)>>
4;
+ kernel_walker_param.resolution_y = ALIGN(dst_rect->height, 16)
Post by Zhao Yakui
4;
+ kernel_walker_param.no_dependency = 1;
+
+ intel_vpp_init_media_object_walker_parameter(&kernel_walker_para
m,&media_object_walker_param);
+
+ gen9_run_kernel_media_object_walker(ctx, pp_context->batch,
+ gpe_context,
+&media_object_walker_param);
+
+ return VA_STATUS_SUCCESS;
+}
diff --git a/src/i965_post_processing.h b/src/i965_post_processing.h
index e55bf0b..ef1e676 100755
--- a/src/i965_post_processing.h
+++ b/src/i965_post_processing.h
@@ -600,6 +600,11 @@ struct i965_post_processing_context
struct i965_gpe_context scaling_10bit_context;
int scaling_context_initialized;
+ struct i965_gpe_context scaling_yuv420p8_context;
+#define VPPGPE_8BIT_420 (1<< 0)
+#define VPPGPE_8BIT_422 (1<< 1)
+#define VPPGPE_8BIT_444 (1<< 2)
+ unsigned int scaling_8bit_initialized;
};
struct i965_proc_context
diff --git a/src/intel_common_vpp_internal.c
b/src/intel_common_vpp_internal.c
new file mode 100644
index 0000000..4da056f
--- /dev/null
+++ b/src/intel_common_vpp_internal.c
@@ -0,0 +1,74 @@
+/*
+ * 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 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.
+ *
+ */
+
+#include<stdio.h>
+#include<stdlib.h>
+#include<string.h>
+#include<assert.h>
+
+#include "intel_batchbuffer.h"
+#include "intel_driver.h"
+#include "i965_drv_video.h"
+#include "i965_post_processing.h"
+#include "gen75_picture_process.h"
+
+#include "intel_gen_vppapi.h"
+#include "intel_common_vpp_internal.h"
+
+int
+intel_vpp_support_yuv420p8_scaling(struct
intel_video_process_context *proc_ctx)
+{
+ struct i965_proc_context *gpe_proc_ctx;
+
+ if (!proc_ctx || !proc_ctx->vpp_fmt_cvt_ctx)
+ return 0;
+
+ gpe_proc_ctx = (struct i965_proc_context *)proc_ctx-
Post by Zhao Yakui
vpp_fmt_cvt_ctx;
+
+ if (gpe_proc_ctx->pp_context.scaling_8bit_initialized&
VPPGPE_8BIT_420)
+ return 1;
+ else
+ return 0;
+}
+
+VAStatus
+intel_yuv420p8_scaling_post_processing(
+ VADriverContextP ctx,
+ struct i965_post_processing_context *pp_context,
+ struct i965_surface *src_surface,
+ VARectangle *src_rect,
+ struct i965_surface *dst_surface,
+ VARectangle *dst_rect)
+{
+ VAStatus va_status;
+
+ va_status = gen9_yuv420p8_scaling_post_processing(ctx,
pp_context,
+ src_surface,
+ src_rect,
+ dst_surface,
+ dst_rect);
+
+ return va_status;
+}
diff --git a/src/intel_common_vpp_internal.h
b/src/intel_common_vpp_internal.h
index 5917533..7575041 100644
--- a/src/intel_common_vpp_internal.h
+++ b/src/intel_common_vpp_internal.h
@@ -63,5 +63,13 @@ struct scaling_input_parameter {
unsigned int bti_output;
};
+VAStatus
+gen9_yuv420p8_scaling_post_processing(
+ VADriverContextP ctx,
+ struct i965_post_processing_context *pp_context,
+ struct i965_surface *src_surface,
+ VARectangle *src_rect,
+ struct i965_surface *dst_surface,
+ VARectangle *dst_rect);
#endif // _INTEL_COMMON_VPP_INTERNAL_H_
diff --git a/src/intel_gen_vppapi.h b/src/intel_gen_vppapi.h
index 270219e..9fe82c9 100644
--- a/src/intel_gen_vppapi.h
+++ b/src/intel_gen_vppapi.h
@@ -46,4 +46,16 @@ gen9_p010_scaling_post_processing(
struct i965_surface *dst_surface,
VARectangle *dst_rect);
+extern int
+intel_vpp_support_yuv420p8_scaling(struct
intel_video_process_context *proc_ctx);
+
+extern VAStatus
+intel_yuv420p8_scaling_post_processing(
+ VADriverContextP ctx,
+ struct i965_post_processing_context *pp_context,
+ struct i965_surface *src_surface,
+ VARectangle *src_rect,
+ struct i965_surface *dst_surface,
+ VARectangle *dst_rect);
+
#endif // _INTE_GEN_VPPAPI_H_
diff --git a/src/shaders/post_processing/gen9/Makefile.am
b/src/shaders/post_processing/gen9/Makefile.am
index 4155cff..7cbacd9 100644
--- a/src/shaders/post_processing/gen9/Makefile.am
+++ b/src/shaders/post_processing/gen9/Makefile.am
@@ -2,7 +2,8 @@ SRCDIR =
$(top_srcdir)/src/shaders/post_processing/gen8
VPATH = $(SRCDIR)
INTEL_PP_PRE_G9B = \
- conv_p010.g9b
+ conv_p010.g9b \
+ conv_nv12.g9b
INTEL_PP_G9B = \
pl2_to_pl2.g9b \
@@ -73,7 +74,7 @@ CLEANFILES = $(INTEL_PP_GEN9_ASM)
EXTRA_DIST = \
$(INTEL_PP_G9B) \
- $(INTEL_PP_PRE_G9B)
+ $(INTEL_PP_PRE_G9B) \
$(NULL)
# Extra clean files so that maintainer-clean removes *everything*
diff --git a/src/shaders/post_processing/gen9/conv_nv12.g9b
b/src/shaders/post_processing/gen9/conv_nv12.g9b
new file mode 100644
index 0000000..cf3c68f
--- /dev/null
+++ b/src/shaders/post_processing/gen9/conv_nv12.g9b
@@ -0,0 +1,368 @@
+{ 0x00600001, 0x20602648, 0x00000000, 0x76543210 },
+{ 0x00000005, 0x26c0124c, 0x16000004, 0x07ff07ff },
+{ 0x00600001, 0x26e01208, 0x008d0060, 0x00000000 },
+{ 0x00000005, 0x26c2124c, 0x16000006, 0x07ff07ff },
+{ 0x00000041, 0x20a01208, 0x160006c0, 0x00100010 },
+{ 0x00600040, 0x27000208, 0x168d06e0, 0x00080008 },
+{ 0x00000041, 0x20801228, 0x160006c2, 0x00100010 },
+{ 0x00000040, 0x26c40228, 0x02000040, 0x000000a0 },
+{ 0x00800040, 0x26e00208, 0x028d06e0, 0x000000a0 },
+{ 0x00000041, 0x21003ae8, 0x3e000048, 0x3f000000 },
+{ 0x00000041, 0x21603ae8, 0x3e00004c, 0x3f000000 },
+{ 0x00800001, 0x212002e8, 0x00000080, 0x00000000 },
+{ 0x00800001, 0x20c002e8, 0x008d06e0, 0x00000000 },
+{ 0x0080015b, 0x3b1e0000, 0xc020b001, 0x02472004 },
+{ 0x0080015b, 0x391e0000, 0x80208001, 0x01872004 },
+{ 0x00800040, 0x27603ae8, 0x3a8d0760, 0x00000054 },
+{ 0x00800040, 0x27203ae8, 0x3a8d0720, 0x00000050 },
+{ 0x00000001, 0x26cc1e28, 0x00000000, 0x00000000 },
+{ 0x00000001, 0x28a00208, 0x0000005c, 0x00000000 },
+{ 0x00000040, 0x26c80228, 0x02000044, 0x00000080 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d0720, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000058, 0x122c0000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000e000 },
+{ 0x02800031, 0x21800268, 0x00000060, 0x00000200 },
+{ 0x00000001, 0x21c01ee8, 0x00000000, 0x00ff00ff },
+{ 0x00800040, 0x27603ae8, 0x3a8d0760, 0x0000004c },
+{ 0x00800001, 0x23000608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22c01ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22400208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x22200208, 0x008d0060, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000058, 0x122c0000 },
+{ 0x00800001, 0x22800208, 0x008d0760, 0x00000000 },
+{ 0x00800040, 0x27603ae8, 0x3a8d0760, 0x0000004c },
+{ 0x00800001, 0x24600608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24201ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x23a00208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x23800208, 0x008d0220, 0x00000000 },
+{ 0x00800001, 0x23e00208, 0x008d0760, 0x00000000 },
+{ 0x00800040, 0x27603ae8, 0x3a8d0760, 0x0000004c },
+{ 0x00800001, 0x25c00608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x25801ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x25000208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x24e00208, 0x008d0380, 0x00000000 },
+{ 0x00800001, 0x25400208, 0x008d0760, 0x00000000 },
+{ 0x00600001, 0x2640020c, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x26cc0a28, 0x1e0006cc, 0x00010001 },
+{ 0x00000001, 0x2644020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x2640020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x2648060c, 0x00000000, 0x0003000f },
+{ 0x05000010, 0x20000a23, 0x1e0006cc, 0x00040004 },
+{ 0x00800040, 0x27603ae8, 0x3a8d0760, 0x0000004c },
+{ 0x00000040, 0x26c80a28, 0x1e0006c8, 0x00040004 },
+{ 0x00800041, 0x21803ae8, 0x3a8d0180, 0x000001c0 },
+{ 0x00600001, 0x22003a28, 0x008d01a0, 0x00000000 },
+{ 0x00600001, 0x21e03a28, 0x008d0180, 0x00000000 },
+{ 0x02800031, 0x21800268, 0x00000220, 0x00000200 },
+{ 0x00600001, 0x27a82288, 0x00cf0200, 0x00000000 },
+{ 0x00600001, 0x27a02288, 0x00cf01e0, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000058, 0x122c0000 },
+{ 0x00800041, 0x21803ae8, 0x3a8d0180, 0x000001c0 },
+{ 0x00600001, 0x23603a28, 0x008d01a0, 0x00000000 },
+{ 0x00600001, 0x23403a28, 0x008d0180, 0x00000000 },
+{ 0x02800031, 0x21800268, 0x00000380, 0x00000200 },
+{ 0x00600001, 0x27b82288, 0x00cf0360, 0x00000000 },
+{ 0x00600001, 0x27b02288, 0x00cf0340, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x06000058, 0x122c0000 },
+{ 0x00800041, 0x21803ae8, 0x3a8d0180, 0x000001c0 },
+{ 0x00600001, 0x24c03a28, 0x008d01a0, 0x00000000 },
+{ 0x00600001, 0x24a03a28, 0x008d0180, 0x00000000 },
+{ 0x02800031, 0x21800268, 0x000004e0, 0x00000200 },
+{ 0x00600001, 0x27c82288, 0x00cf04c0, 0x00000000 },
+{ 0x00600001, 0x27c02288, 0x00cf04a0, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060008a0, 0x020a8000 },
+{ 0x00800041, 0x21803ae8, 0x3a8d0180, 0x000001c0 },
+{ 0x00600001, 0x26203a28, 0x008d01a0, 0x00000000 },
+{ 0x00600001, 0x26003a28, 0x008d0180, 0x00000000 },
+{ 0x00600001, 0x27d82288, 0x00cf0620, 0x00000000 },
+{ 0x00600001, 0x27d02288, 0x00cf0600, 0x00000000 },
+{ 0x0c600033, 0x0003d014, 0x00002642, 0x00000000 },
+{ 0x00010020, 0x34000007, 0x0e001400, 0xfffffc00 },
+{ 0x00600001, 0x20602668, 0x00000000, 0x76543210 },
+{ 0x00000041, 0x20a01228, 0x160006c2, 0x00100010 },
+{ 0x00600009, 0x27001a08, 0x168d0060, 0x00010001 },
+{ 0x00000041, 0x20801208, 0x160006c0, 0x00100010 },
+{ 0x00600001, 0x20c00a08, 0x000000a0, 0x00000000 },
+{ 0x00600001, 0x26e00208, 0x008d0700, 0x00000000 },
+{ 0x00600040, 0x20e00208, 0x168d00c0, 0x00020002 },
+{ 0x00800040, 0x26e00208, 0x028d06e0, 0x00000080 },
+{ 0x00800001, 0x216002e8, 0x008d00c0, 0x00000000 },
+{ 0x00800001, 0x212002e8, 0x008d06e0, 0x00000000 },
+{ 0x00000005, 0x21a00208, 0x1600003c, 0x000c000c },
+{ 0x0080015b, 0x3b1e0000, 0xc0202a01, 0x02c72004 },
+{ 0x0080015b, 0x391e0000, 0x80202801, 0x02472004 },
+{ 0x00000040, 0x21000228, 0x02000044, 0x000000a0 },
+{ 0x02000010, 0x20000202, 0x160001a0, 0x000c000c },
+{ 0x00800040, 0x27603ae8, 0x3a8d0760, 0x00000038 },
+{ 0x00800040, 0x27203ae8, 0x3a8d0720, 0x00000034 },
+{ 0x00000040, 0x26d00208, 0x16000058, 0x00010001 },
+{ 0x00000040, 0x26d40208, 0x16000058, 0x00020002 },
+{ 0x00000040, 0x26d80208, 0x1600005c, 0x00010001 },
+{ 0x00000040, 0x26dc0208, 0x1600005c, 0x00020002 },
+{ 0x0000000c, 0x26c80a28, 0x1e000100, 0x00010001 },
+{ 0x00010020, 0x34000006, 0x0e001400, 0x00000370 },
+{ 0x00000001, 0x26cc1e28, 0x00000000, 0x00000000 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x124c0000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d0720, 0x00000000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000c000 },
+{ 0x02800031, 0x27e00268, 0x00000060, 0x00000200 },
+{ 0x00000001, 0x22603ee8, 0x00000000, 0x40800000 },
+{ 0x00000001, 0x21801ee8, 0x00000000, 0x00ff00ff },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x04c00404 },
+{ 0x00800001, 0x23600608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x23201ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22a00208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x22800208, 0x008d0060, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x124c0000 },
+{ 0x00800001, 0x22e00208, 0x008d0760, 0x00000000 },
+{ 0x00600001, 0x2460020c, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x26cc0a28, 0x1e0006cc, 0x00010001 },
+{ 0x00000001, 0x2464020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x2460020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x2468060c, 0x00000000, 0x0003000f },
+{ 0x05000010, 0x20000a21, 0x1e0006cc, 0x00020002 },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x04c00404 },
+{ 0x00000040, 0x26c80a28, 0x1e0006c8, 0x00040004 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x00000180 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x00000180 },
+{ 0x00600001, 0x22203a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x21e03a28, 0x008d0820, 0x00000000 },
+{ 0x00600001, 0x21c03a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x21a03a28, 0x008d07e0, 0x00000000 },
+{ 0x02800031, 0x27e00268, 0x00000280, 0x00000200 },
+{ 0x00600001, 0x62400a88, 0x008d0220, 0x00000000 },
+{ 0x00600001, 0x62000a88, 0x008d01e0, 0x00000000 },
+{ 0x00600001, 0x47b02288, 0x00cf01c0, 0x00000000 },
+{ 0x00600001, 0x47a02288, 0x00cf01a0, 0x00000000 },
+{ 0x00600001, 0x47b12288, 0x00600240, 0x00000000 },
+{ 0x00600001, 0x47a12288, 0x00600200, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d8, 0x020a8000 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x00000180 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x00000180 },
+{ 0x00600001, 0x24203a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x23e03a28, 0x008d0820, 0x00000000 },
+{ 0x00600001, 0x23c03a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x23a03a28, 0x008d07e0, 0x00000000 },
+{ 0x00600001, 0x64400a88, 0x008d0420, 0x00000000 },
+{ 0x00600001, 0x64000a88, 0x008d03e0, 0x00000000 },
+{ 0x00600001, 0x47d02288, 0x00cf03c0, 0x00000000 },
+{ 0x00600001, 0x47c02288, 0x00cf03a0, 0x00000000 },
+{ 0x00600001, 0x47d12288, 0x00600440, 0x00000000 },
+{ 0x00600001, 0x47c12288, 0x00600400, 0x00000000 },
+{ 0x0c600033, 0x0003d014, 0x00002462, 0x00000000 },
+{ 0x00010020, 0x34000005, 0x0e001400, 0xfffffcb0 },
+{ 0x00000020, 0x34000004, 0x0e001400, 0x00000cc0 },
+{ 0x00000005, 0x20600208, 0x1600003c, 0x000c000c },
+{ 0x02000010, 0x20000200, 0x16000060, 0x00040004 },
+{ 0x00010020, 0x34000004, 0x0e001400, 0x000003a0 },
+{ 0x0000000c, 0x26c40a28, 0x1e0006c4, 0x00010001 },
+{ 0x00000001, 0x26cc1e28, 0x00000000, 0x00000000 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x124c0000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d0720, 0x00000000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000c000 },
+{ 0x02800031, 0x27e00268, 0x00000060, 0x00000200 },
+{ 0x00000001, 0x22203ee8, 0x00000000, 0x40800000 },
+{ 0x00000001, 0x21801ee8, 0x00000000, 0x00ff00ff },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x04400404 },
+{ 0x00800001, 0x23200608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22e01ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22600208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x22400208, 0x008d0060, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x124c0000 },
+{ 0x00800001, 0x22a00208, 0x008d0760, 0x00000000 },
+{ 0x00600001, 0x23e0020c, 0x008d0000, 0x00000000 },
+{ 0x00000001, 0x23e4020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x23e0020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x23e8060c, 0x00000000, 0x00030007 },
+{ 0x00600001, 0x2400020c, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x26cc0a28, 0x1e0006cc, 0x00010001 },
+{ 0x00000001, 0x2404020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x2400020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x2408060c, 0x00000000, 0x00030007 },
+{ 0x05000010, 0x20000a23, 0x1e0006cc, 0x00020002 },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x04400404 },
+{ 0x00000040, 0x26c80a28, 0x1e0006c8, 0x00040004 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x00000180 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x00000180 },
+{ 0x00600001, 0x22003a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x21e03a28, 0x008d0820, 0x00000000 },
+{ 0x00600001, 0x21c03a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x21a03a28, 0x008d07e0, 0x00000000 },
+{ 0x02800031, 0x27e00268, 0x00000240, 0x00000200 },
+{ 0x00600001, 0x28882288, 0x00cf0200, 0x00000000 },
+{ 0x00600001, 0x28682288, 0x00cf01c0, 0x00000000 },
+{ 0x00600001, 0x28602288, 0x00cf01a0, 0x00000000 },
+{ 0x00600001, 0x28802288, 0x00cf01e0, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d8, 0x020a8000 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x00000180 },
+{ 0x00600001, 0x23803a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x23603a28, 0x008d07e0, 0x00000000 },
+{ 0x00600001, 0x28782288, 0x00cf0380, 0x00000000 },
+{ 0x00600001, 0x28702288, 0x00cf0360, 0x00000000 },
+{ 0x0c600033, 0x00043014, 0x000023e1, 0x00000000 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x00000180 },
+{ 0x00600001, 0x23c03a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x23a03a28, 0x008d0820, 0x00000000 },
+{ 0x00600001, 0x28982288, 0x00cf03c0, 0x00000000 },
+{ 0x00600001, 0x28902288, 0x00cf03a0, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006dc, 0x020a8000 },
+{ 0x0c600033, 0x00044014, 0x00002401, 0x00000000 },
+{ 0x00010020, 0x34000007, 0x0e001400, 0xfffffc90 },
+{ 0x00000020, 0x34000004, 0x0e001400, 0x000008f0 },
+{ 0x00000005, 0x20600208, 0x1600003c, 0x000c000c },
+{ 0x02000010, 0x20000202, 0x16000060, 0x00080008 },
+{ 0x00010020, 0x34000006, 0x0e001400, 0x00000450 },
+{ 0x00000001, 0x26cc1e28, 0x00000000, 0x00000000 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x122c0000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d0720, 0x00000000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000e000 },
+{ 0x02800031, 0x27e00268, 0x00000060, 0x00000200 },
+{ 0x00800001, 0x22600608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22201ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21e00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x21a00208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x21800208, 0x008d0060, 0x00000000 },
+{ 0x00600001, 0x23a00208, 0x008d0180, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d4, 0x122c0000 },
+{ 0x00600001, 0x24c00208, 0x008d03a0, 0x00000000 },
+{ 0x02800031, 0x28200268, 0x00000180, 0x00000200 },
+{ 0x00000001, 0x23803ee8, 0x00000000, 0x40800000 },
+{ 0x00000001, 0x22a01ee8, 0x00000000, 0x00ff00ff },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x07000404 },
+{ 0x00800001, 0x24800608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24401ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x23c00208, 0x008d0720, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x122c0000 },
+{ 0x00800001, 0x24000208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x25a00608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x25601ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24e00208, 0x008d0720, 0x00000000 },
+{ 0x00800001, 0x25200208, 0x008d0760, 0x00000000 },
+{ 0x00600001, 0x26a0020c, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x26cc0a28, 0x1e0006cc, 0x00010001 },
+{ 0x00000001, 0x26a4020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x26a0020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x26a8060c, 0x00000000, 0x0003000f },
+{ 0x05000010, 0x20000a21, 0x1e0006cc, 0x00020002 },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x07000404 },
+{ 0x00000040, 0x26c80a28, 0x1e0006c8, 0x00040004 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x000002a0 },
+{ 0x00600001, 0x22e03a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x22c03a28, 0x008d07e0, 0x00000000 },
+{ 0x02800031, 0x27e00268, 0x000003a0, 0x00000200 },
+{ 0x00600001, 0x47b02288, 0x00cf02e0, 0x00000000 },
+{ 0x00600001, 0x47a02288, 0x00cf02c0, 0x00000000 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x000002a0 },
+{ 0x00000040, 0x22000204, 0x060006d4, 0x122c0000 },
+{ 0x00600001, 0x23403a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x23003a28, 0x008d0820, 0x00000000 },
+{ 0x02800031, 0x28200268, 0x000004c0, 0x00000200 },
+{ 0x00600001, 0x63600a88, 0x008d0340, 0x00000000 },
+{ 0x00600001, 0x63200a88, 0x008d0300, 0x00000000 },
+{ 0x00600001, 0x47b12288, 0x00600360, 0x00000000 },
+{ 0x00600001, 0x47a12288, 0x00600320, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d8, 0x020a8000 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x000002a0 },
+{ 0x00600001, 0x26003a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x25e03a28, 0x008d07e0, 0x00000000 },
+{ 0x00600001, 0x47d02288, 0x00cf0600, 0x00000000 },
+{ 0x00600001, 0x47c02288, 0x00cf05e0, 0x00000000 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x000002a0 },
+{ 0x00600001, 0x26603a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x26203a28, 0x008d0820, 0x00000000 },
+{ 0x00600001, 0x66800a88, 0x008d0660, 0x00000000 },
+{ 0x00600001, 0x66400a88, 0x008d0620, 0x00000000 },
+{ 0x00600001, 0x47d12288, 0x00600680, 0x00000000 },
+{ 0x00600001, 0x47c12288, 0x00600640, 0x00000000 },
+{ 0x0c600033, 0x0003d014, 0x000026a2, 0x00000000 },
+{ 0x00010020, 0x34000005, 0x0e001400, 0xfffffbd0 },
+{ 0x00000020, 0x34000004, 0x0e001400, 0x00000470 },
+{ 0x0000000c, 0x26c40a28, 0x1e0006c4, 0x00010001 },
+{ 0x00000001, 0x26cc1e28, 0x00000000, 0x00000000 },
+{ 0x00600001, 0x20600208, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x122c0000 },
+{ 0x00800001, 0x21400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x20c00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x20800208, 0x008d0720, 0x00000000 },
+{ 0x00000001, 0x20680608, 0x00000000, 0x0000e000 },
+{ 0x02800031, 0x27e00268, 0x00000060, 0x00000200 },
+{ 0x00800001, 0x22600608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x22201ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x21e00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x21a00208, 0x008d0720, 0x00000000 },
+{ 0x00600001, 0x21800208, 0x008d0060, 0x00000000 },
+{ 0x00600001, 0x23600208, 0x008d0180, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d4, 0x122c0000 },
+{ 0x00600001, 0x24800208, 0x008d0360, 0x00000000 },
+{ 0x02800031, 0x28200268, 0x00000180, 0x00000200 },
+{ 0x00000001, 0x23403ee8, 0x00000000, 0x40800000 },
+{ 0x00000001, 0x22a01ee8, 0x00000000, 0x00ff00ff },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x06800404 },
+{ 0x00800001, 0x24400608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24001ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x23800208, 0x008d0720, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d0, 0x122c0000 },
+{ 0x00800001, 0x23c00208, 0x008d0760, 0x00000000 },
+{ 0x00800001, 0x25600608, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x25201ee8, 0x00000000, 0x00000000 },
+{ 0x00800001, 0x24a00208, 0x008d0720, 0x00000000 },
+{ 0x00800001, 0x24e00208, 0x008d0760, 0x00000000 },
+{ 0x00600001, 0x2620020c, 0x008d0000, 0x00000000 },
+{ 0x00000001, 0x2624020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x2620020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x2628060c, 0x00000000, 0x00030007 },
+{ 0x00600001, 0x2640020c, 0x008d0000, 0x00000000 },
+{ 0x00000040, 0x26cc0a28, 0x1e0006cc, 0x00010001 },
+{ 0x00000001, 0x2644020c, 0x000006c8, 0x00000000 },
+{ 0x00000001, 0x2640020c, 0x000006c4, 0x00000000 },
+{ 0x00000001, 0x2648060c, 0x00000000, 0x00030007 },
+{ 0x05000010, 0x20000a20, 0x1e0006cc, 0x00020002 },
+{ 0x0080015b, 0x3b1e0000, 0xc023b1c8, 0x06800404 },
+{ 0x00000040, 0x26c80a28, 0x1e0006c8, 0x00040004 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x000002a0 },
+{ 0x00600001, 0x22e03a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x22c03a28, 0x008d07e0, 0x00000000 },
+{ 0x02800031, 0x27e00268, 0x00000360, 0x00000200 },
+{ 0x00600001, 0x28682288, 0x00cf02e0, 0x00000000 },
+{ 0x00600001, 0x28602288, 0x00cf02c0, 0x00000000 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x000002a0 },
+{ 0x00000040, 0x22000204, 0x060006d4, 0x122c0000 },
+{ 0x00600001, 0x23203a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x23003a28, 0x008d0820, 0x00000000 },
+{ 0x02800031, 0x28200268, 0x00000480, 0x00000200 },
+{ 0x00600001, 0x28882288, 0x00cf0320, 0x00000000 },
+{ 0x00600001, 0x28802288, 0x00cf0300, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006d8, 0x020a8000 },
+{ 0x00800041, 0x27e03ae8, 0x3a8d07e0, 0x000002a0 },
+{ 0x00600001, 0x25c03a28, 0x008d0800, 0x00000000 },
+{ 0x00600001, 0x25a03a28, 0x008d07e0, 0x00000000 },
+{ 0x00600001, 0x28782288, 0x00cf05c0, 0x00000000 },
+{ 0x00600001, 0x28702288, 0x00cf05a0, 0x00000000 },
+{ 0x0c600033, 0x00043014, 0x00002621, 0x00000000 },
+{ 0x00800041, 0x28203ae8, 0x3a8d0820, 0x000002a0 },
+{ 0x00600001, 0x26003a28, 0x008d0840, 0x00000000 },
+{ 0x00600001, 0x25e03a28, 0x008d0820, 0x00000000 },
+{ 0x00600001, 0x28982288, 0x00cf0600, 0x00000000 },
+{ 0x00000040, 0x22000204, 0x060006dc, 0x020a8000 },
+{ 0x00600001, 0x28902288, 0x00cf05e0, 0x00000000 },
+{ 0x0c600033, 0x00044014, 0x00002641, 0x00000000 },
+{ 0x00010020, 0x34000004, 0x0e001400, 0xfffffbb0 },
+{ 0x00600001, 0x2fe0020c, 0x008d0000, 0x00000000 },
+{ 0x07000031, 0x20000200, 0x06000fe0, 0x82000010 },
Xiang, Haihao
2016-11-25 08:36:47 UTC
Permalink
Post by Zhao Yakui
This is to define some common structures/functions so that they can
be used on more platforms when adding new VPP functions.
Here new VPP functions just means CSC and scaling, right?
Post by Zhao Yakui
---
 src/Makefile.am                 |  2 ++
 src/gen75_picture_process.c     |  1 +
 src/gen8_post_processing.h      |  8 -----
 src/gen9_post_processing.c      | 34 ++-------------------
 src/intel_common_vpp_internal.h | 67
+++++++++++++++++++++++++++++++++++++++++
 src/intel_gen_vppapi.h          | 49 ++++++++++++++++++++++++++++++
 6 files changed, 121 insertions(+), 40 deletions(-)
 create mode 100644 src/intel_common_vpp_internal.h
 create mode 100644 src/intel_gen_vppapi.h
diff --git a/src/Makefile.am b/src/Makefile.am
index b6e25d1..c262820 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -153,6 +153,8 @@ source_h = \
  gen9_vp9_encapi.h           \
  gen9_vp9_const_def.h      \
  gen9_vp9_encoder_kernels.h           \
+ intel_gen_vppapi.h           \
+ intel_common_vpp_internal.h           \
  $(NULL)
 
 # convenience library that can be linked by driver and tests
diff --git a/src/gen75_picture_process.c
b/src/gen75_picture_process.c
index 46c4ed5..380015d 100644
--- a/src/gen75_picture_process.c
+++ b/src/gen75_picture_process.c
@@ -39,6 +39,7 @@
 #include "i965_post_processing.h"
 #include "gen75_picture_process.h"
 #include "gen8_post_processing.h"
+#include "intel_gen_vppapi.h"
 
 extern struct hw_context *
 i965_proc_context_init(VADriverContextP ctx,
diff --git a/src/gen8_post_processing.h b/src/gen8_post_processing.h
index bd0601a..18f523e 100644
--- a/src/gen8_post_processing.h
+++ b/src/gen8_post_processing.h
@@ -85,13 +85,5 @@
gen8_post_processing_context_common_init(VADriverContextP ctx,
                                          struct pp_module
*pp_modules,
                                          int num_pp_modules,
                                          struct intel_batchbuffer
*batch);
-extern VAStatus
-gen9_p010_scaling_post_processing(
-    VADriverContextP   ctx,
-    struct i965_post_processing_context *pp_context,
-    struct i965_surface *src_surface,
-    VARectangle *src_rect,
-    struct i965_surface *dst_surface,
-    VARectangle *dst_rect);
 
 #endif
diff --git a/src/gen9_post_processing.c b/src/gen9_post_processing.c
index 1e2d33a..efa8216 100644
--- a/src/gen9_post_processing.c
+++ b/src/gen9_post_processing.c
@@ -38,6 +38,8 @@
 #include "intel_media.h"
 
 #include "gen8_post_processing.h"
+#include "intel_gen_vppapi.h"
+#include "intel_common_vpp_internal.h"
 
 static const uint32_t pp_null_gen9[][4] = {
 };
@@ -106,38 +108,6 @@ static const uint32_t pp_nv12_blending_gen9[][4] = {
 #define MAX_SCALING_SURFACES    16
 
 #define DEFAULT_MOCS    0x02
-#define SRC_MSB         0x0001
-#define DST_MSB         0x0002
-#define SRC_PACKED      0x0004
-#define DST_PACKED      0x0008
-#define PACKED_MASK     0x000C
-
-#define BTI_SCALING_INPUT_Y     0
-#define BTI_SCALING_OUTPUT_Y    8
-
-struct scaling_input_parameter {
-    unsigned int input_data[5];
-
-    float inv_width;
-    float inv_height;
-
-    struct {
-        unsigned int src_msb : 1;
-        unsigned int dst_msb : 1;
-        unsigned int src_packed : 1;
-        unsigned int dst_packed : 1;
-        unsigned int reserved : 28;
-    } dw7;
-
-    int x_dst;
-    int y_dst;
-    float    x_factor; // src_rect_width / dst_rect_width /
Surface_width
-    float    y_factor; // src_rect_height / dst_rect_height /
Surface_height
-    float    x_orig;
-    float    y_orig;
-    unsigned int bti_input;
-    unsigned int bti_output;
-};
 
 static const uint32_t pp_10bit_scaling_gen9[][4] = {
 #include "shaders/post_processing/gen9/conv_p010.g9b"
diff --git a/src/intel_common_vpp_internal.h
b/src/intel_common_vpp_internal.h
new file mode 100644
index 0000000..5917533
--- /dev/null
+++ b/src/intel_common_vpp_internal.h
@@ -0,0 +1,67 @@
+/*
+ * 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 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.
+ *
+ *
+ */
+
+#ifndef _INTEL_COMMON_VPP_INTERNAL_H_
+#define _INTEL_COMMON_VPP_INTERNAL_H_
+
+/* the below is defined for YUV420 format scaling */
+#define SRC_MSB         0x0001
+#define DST_MSB         0x0002
+#define SRC_PACKED      0x0004
+#define DST_PACKED      0x0008
+#define PACKED_MASK     0x000C
+
+#define BTI_SCALING_INPUT_Y     0
+#define BTI_SCALING_OUTPUT_Y    8
+
+struct scaling_input_parameter {
+    unsigned int input_data[5];
+
+    float inv_width;
+    float inv_height;
+
+    struct {
+        unsigned int src_msb : 1;
+        unsigned int dst_msb : 1;
+        unsigned int src_packed : 1;
+        unsigned int dst_packed : 1;
+        unsigned int reserved : 28;
+    } dw7;
+
+    int x_dst;
+    int y_dst;
+    float    x_factor; // src_rect_width / dst_rect_width /
Surface_width
+    float    y_factor; // src_rect_height / dst_rect_height /
Surface_height
+    float    x_orig;
+    float    y_orig;
+    unsigned int bti_input;
+    unsigned int bti_output;
+};
+
+
+#endif  // _INTEL_COMMON_VPP_INTERNAL_H_
diff --git a/src/intel_gen_vppapi.h b/src/intel_gen_vppapi.h
new file mode 100644
index 0000000..270219e
--- /dev/null
+++ b/src/intel_gen_vppapi.h
@@ -0,0 +1,49 @@
+/*
+ * 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 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.
+ *
+ *
+ */
+
+#ifndef _INTEL_GEN_VPPAPI_H_
+#define _INTEL_GEN_VPPAPI_H_
+
+#include <va/va.h>
+#include <va/va_backend.h>
+
+/*
+struct i965_surface;
+struct i965_post_processing_context;
+*/
+
+extern VAStatus
+gen9_p010_scaling_post_processing(
+    VADriverContextP   ctx,
+    struct i965_post_processing_context *pp_context,
+    struct i965_surface *src_surface,
+    VARectangle *src_rect,
+    struct i965_surface *dst_surface,
+    VARectangle *dst_rect);
+
+#endif  // _INTE_GEN_VPPAPI_H_
Zhao Yakui
2016-11-25 08:59:11 UTC
Permalink
Post by Xiang, Haihao
Post by Zhao Yakui
This is to define some common structures/functions so that they can
be used on more platforms when adding new VPP functions.
Here new VPP functions just means CSC and scaling, right?
Yes.

Thanks
Yakui
Post by Xiang, Haihao
Post by Zhao Yakui
---
src/Makefile.am | 2 ++
src/gen75_picture_process.c | 1 +
src/gen8_post_processing.h | 8 -----
src/gen9_post_processing.c | 34 ++-------------------
src/intel_common_vpp_internal.h | 67
+++++++++++++++++++++++++++++++++++++++++
src/intel_gen_vppapi.h | 49 ++++++++++++++++++++++++++++++
6 files changed, 121 insertions(+), 40 deletions(-)
create mode 100644 src/intel_common_vpp_internal.h
create mode 100644 src/intel_gen_vppapi.h
diff --git a/src/Makefile.am b/src/Makefile.am
index b6e25d1..c262820 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -153,6 +153,8 @@ source_h = \
gen9_vp9_encapi.h \
gen9_vp9_const_def.h \
gen9_vp9_encoder_kernels.h \
+ intel_gen_vppapi.h \
+ intel_common_vpp_internal.h \
$(NULL)
# convenience library that can be linked by driver and tests
diff --git a/src/gen75_picture_process.c
b/src/gen75_picture_process.c
index 46c4ed5..380015d 100644
--- a/src/gen75_picture_process.c
+++ b/src/gen75_picture_process.c
@@ -39,6 +39,7 @@
#include "i965_post_processing.h"
#include "gen75_picture_process.h"
#include "gen8_post_processing.h"
+#include "intel_gen_vppapi.h"
extern struct hw_context *
i965_proc_context_init(VADriverContextP ctx,
diff --git a/src/gen8_post_processing.h b/src/gen8_post_processing.h
index bd0601a..18f523e 100644
--- a/src/gen8_post_processing.h
+++ b/src/gen8_post_processing.h
@@ -85,13 +85,5 @@
gen8_post_processing_context_common_init(VADriverContextP ctx,
struct pp_module
*pp_modules,
int num_pp_modules,
struct intel_batchbuffer *batch);
-extern VAStatus
-gen9_p010_scaling_post_processing(
- VADriverContextP ctx,
- struct i965_post_processing_context *pp_context,
- struct i965_surface *src_surface,
- VARectangle *src_rect,
- struct i965_surface *dst_surface,
- VARectangle *dst_rect);
#endif
diff --git a/src/gen9_post_processing.c b/src/gen9_post_processing.c
index 1e2d33a..efa8216 100644
--- a/src/gen9_post_processing.c
+++ b/src/gen9_post_processing.c
@@ -38,6 +38,8 @@
#include "intel_media.h"
#include "gen8_post_processing.h"
+#include "intel_gen_vppapi.h"
+#include "intel_common_vpp_internal.h"
static const uint32_t pp_null_gen9[][4] = {
};
@@ -106,38 +108,6 @@ static const uint32_t pp_nv12_blending_gen9[][4] = {
#define MAX_SCALING_SURFACES 16
#define DEFAULT_MOCS 0x02
-#define SRC_MSB 0x0001
-#define DST_MSB 0x0002
-#define SRC_PACKED 0x0004
-#define DST_PACKED 0x0008
-#define PACKED_MASK 0x000C
-
-#define BTI_SCALING_INPUT_Y 0
-#define BTI_SCALING_OUTPUT_Y 8
-
-struct scaling_input_parameter {
- unsigned int input_data[5];
-
- float inv_width;
- float inv_height;
-
- struct {
- unsigned int src_msb : 1;
- unsigned int dst_msb : 1;
- unsigned int src_packed : 1;
- unsigned int dst_packed : 1;
- unsigned int reserved : 28;
- } dw7;
-
- int x_dst;
- int y_dst;
- float x_factor; // src_rect_width / dst_rect_width /
Surface_width
- float y_factor; // src_rect_height / dst_rect_height / Surface_height
- float x_orig;
- float y_orig;
- unsigned int bti_input;
- unsigned int bti_output;
-};
static const uint32_t pp_10bit_scaling_gen9[][4] = {
#include "shaders/post_processing/gen9/conv_p010.g9b"
diff --git a/src/intel_common_vpp_internal.h
b/src/intel_common_vpp_internal.h
new file mode 100644
index 0000000..5917533
--- /dev/null
+++ b/src/intel_common_vpp_internal.h
@@ -0,0 +1,67 @@
+/*
+ * 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 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.
+ *
+ *
+ */
+
+#ifndef _INTEL_COMMON_VPP_INTERNAL_H_
+#define _INTEL_COMMON_VPP_INTERNAL_H_
+
+/* the below is defined for YUV420 format scaling */
+#define SRC_MSB 0x0001
+#define DST_MSB 0x0002
+#define SRC_PACKED 0x0004
+#define DST_PACKED 0x0008
+#define PACKED_MASK 0x000C
+
+#define BTI_SCALING_INPUT_Y 0
+#define BTI_SCALING_OUTPUT_Y 8
+
+struct scaling_input_parameter {
+ unsigned int input_data[5];
+
+ float inv_width;
+ float inv_height;
+
+ struct {
+ unsigned int src_msb : 1;
+ unsigned int dst_msb : 1;
+ unsigned int src_packed : 1;
+ unsigned int dst_packed : 1;
+ unsigned int reserved : 28;
+ } dw7;
+
+ int x_dst;
+ int y_dst;
+ float x_factor; // src_rect_width / dst_rect_width /
Surface_width
+ float y_factor; // src_rect_height / dst_rect_height / Surface_height
+ float x_orig;
+ float y_orig;
+ unsigned int bti_input;
+ unsigned int bti_output;
+};
+
+
+#endif // _INTEL_COMMON_VPP_INTERNAL_H_
diff --git a/src/intel_gen_vppapi.h b/src/intel_gen_vppapi.h
new file mode 100644
index 0000000..270219e
--- /dev/null
+++ b/src/intel_gen_vppapi.h
@@ -0,0 +1,49 @@
+/*
+ * 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 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.
+ *
+ *
+ */
+
+#ifndef _INTEL_GEN_VPPAPI_H_
+#define _INTEL_GEN_VPPAPI_H_
+
+#include<va/va.h>
+#include<va/va_backend.h>
+
+/*
+struct i965_surface;
+struct i965_post_processing_context;
+*/
+
+extern VAStatus
+gen9_p010_scaling_post_processing(
+ VADriverContextP ctx,
+ struct i965_post_processing_context *pp_context,
+ struct i965_surface *src_surface,
+ VARectangle *src_rect,
+ struct i965_surface *dst_surface,
+ VARectangle *dst_rect);
+
+#endif // _INTE_GEN_VPPAPI_H_
Xiang, Haihao
2016-11-29 01:21:22 UTC
Permalink
Applied, thanks.
Post by Zhao Yakui
This is to define some common structures/functions so that they can
be used on more platforms when adding new VPP functions.
---
 src/Makefile.am                 |  2 ++
 src/gen75_picture_process.c     |  1 +
 src/gen8_post_processing.h      |  8 -----
 src/gen9_post_processing.c      | 34 ++-------------------
 src/intel_common_vpp_internal.h | 67
+++++++++++++++++++++++++++++++++++++++++
 src/intel_gen_vppapi.h          | 49 ++++++++++++++++++++++++++++++
 6 files changed, 121 insertions(+), 40 deletions(-)
 create mode 100644 src/intel_common_vpp_internal.h
 create mode 100644 src/intel_gen_vppapi.h
diff --git a/src/Makefile.am b/src/Makefile.am
index b6e25d1..c262820 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -153,6 +153,8 @@ source_h = \
  gen9_vp9_encapi.h           \
  gen9_vp9_const_def.h      \
  gen9_vp9_encoder_kernels.h           \
+ intel_gen_vppapi.h           \
+ intel_common_vpp_internal.h           \
  $(NULL)
 
 # convenience library that can be linked by driver and tests
diff --git a/src/gen75_picture_process.c
b/src/gen75_picture_process.c
index 46c4ed5..380015d 100644
--- a/src/gen75_picture_process.c
+++ b/src/gen75_picture_process.c
@@ -39,6 +39,7 @@
 #include "i965_post_processing.h"
 #include "gen75_picture_process.h"
 #include "gen8_post_processing.h"
+#include "intel_gen_vppapi.h"
 
 extern struct hw_context *
 i965_proc_context_init(VADriverContextP ctx,
diff --git a/src/gen8_post_processing.h b/src/gen8_post_processing.h
index bd0601a..18f523e 100644
--- a/src/gen8_post_processing.h
+++ b/src/gen8_post_processing.h
@@ -85,13 +85,5 @@
gen8_post_processing_context_common_init(VADriverContextP ctx,
                                          struct pp_module
*pp_modules,
                                          int num_pp_modules,
                                          struct intel_batchbuffer
*batch);
-extern VAStatus
-gen9_p010_scaling_post_processing(
-    VADriverContextP   ctx,
-    struct i965_post_processing_context *pp_context,
-    struct i965_surface *src_surface,
-    VARectangle *src_rect,
-    struct i965_surface *dst_surface,
-    VARectangle *dst_rect);
 
 #endif
diff --git a/src/gen9_post_processing.c b/src/gen9_post_processing.c
index 1e2d33a..efa8216 100644
--- a/src/gen9_post_processing.c
+++ b/src/gen9_post_processing.c
@@ -38,6 +38,8 @@
 #include "intel_media.h"
 
 #include "gen8_post_processing.h"
+#include "intel_gen_vppapi.h"
+#include "intel_common_vpp_internal.h"
 
 static const uint32_t pp_null_gen9[][4] = {
 };
@@ -106,38 +108,6 @@ static const uint32_t pp_nv12_blending_gen9[][4] = {
 #define MAX_SCALING_SURFACES    16
 
 #define DEFAULT_MOCS    0x02
-#define SRC_MSB         0x0001
-#define DST_MSB         0x0002
-#define SRC_PACKED      0x0004
-#define DST_PACKED      0x0008
-#define PACKED_MASK     0x000C
-
-#define BTI_SCALING_INPUT_Y     0
-#define BTI_SCALING_OUTPUT_Y    8
-
-struct scaling_input_parameter {
-    unsigned int input_data[5];
-
-    float inv_width;
-    float inv_height;
-
-    struct {
-        unsigned int src_msb : 1;
-        unsigned int dst_msb : 1;
-        unsigned int src_packed : 1;
-        unsigned int dst_packed : 1;
-        unsigned int reserved : 28;
-    } dw7;
-
-    int x_dst;
-    int y_dst;
-    float    x_factor; // src_rect_width / dst_rect_width /
Surface_width
-    float    y_factor; // src_rect_height / dst_rect_height /
Surface_height
-    float    x_orig;
-    float    y_orig;
-    unsigned int bti_input;
-    unsigned int bti_output;
-};
 
 static const uint32_t pp_10bit_scaling_gen9[][4] = {
 #include "shaders/post_processing/gen9/conv_p010.g9b"
diff --git a/src/intel_common_vpp_internal.h
b/src/intel_common_vpp_internal.h
new file mode 100644
index 0000000..5917533
--- /dev/null
+++ b/src/intel_common_vpp_internal.h
@@ -0,0 +1,67 @@
+/*
+ * 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 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.
+ *
+ *
+ */
+
+#ifndef _INTEL_COMMON_VPP_INTERNAL_H_
+#define _INTEL_COMMON_VPP_INTERNAL_H_
+
+/* the below is defined for YUV420 format scaling */
+#define SRC_MSB         0x0001
+#define DST_MSB         0x0002
+#define SRC_PACKED      0x0004
+#define DST_PACKED      0x0008
+#define PACKED_MASK     0x000C
+
+#define BTI_SCALING_INPUT_Y     0
+#define BTI_SCALING_OUTPUT_Y    8
+
+struct scaling_input_parameter {
+    unsigned int input_data[5];
+
+    float inv_width;
+    float inv_height;
+
+    struct {
+        unsigned int src_msb : 1;
+        unsigned int dst_msb : 1;
+        unsigned int src_packed : 1;
+        unsigned int dst_packed : 1;
+        unsigned int reserved : 28;
+    } dw7;
+
+    int x_dst;
+    int y_dst;
+    float    x_factor; // src_rect_width / dst_rect_width /
Surface_width
+    float    y_factor; // src_rect_height / dst_rect_height /
Surface_height
+    float    x_orig;
+    float    y_orig;
+    unsigned int bti_input;
+    unsigned int bti_output;
+};
+
+
+#endif  // _INTEL_COMMON_VPP_INTERNAL_H_
diff --git a/src/intel_gen_vppapi.h b/src/intel_gen_vppapi.h
new file mode 100644
index 0000000..270219e
--- /dev/null
+++ b/src/intel_gen_vppapi.h
@@ -0,0 +1,49 @@
+/*
+ * 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 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.
+ *
+ *
+ */
+
+#ifndef _INTEL_GEN_VPPAPI_H_
+#define _INTEL_GEN_VPPAPI_H_
+
+#include <va/va.h>
+#include <va/va_backend.h>
+
+/*
+struct i965_surface;
+struct i965_post_processing_context;
+*/
+
+extern VAStatus
+gen9_p010_scaling_post_processing(
+    VADriverContextP   ctx,
+    struct i965_post_processing_context *pp_context,
+    struct i965_surface *src_surface,
+    VARectangle *src_rect,
+    struct i965_surface *dst_surface,
+    VARectangle *dst_rect);
+
+#endif  // _INTE_GEN_VPPAPI_H_
Loading...