[Libva] [LIBVA_INTEL_DRIVER][PATCH V2 1/3] Move some VPP structures/functions into the common files to support more platforms

Zhao Yakui yakui.zhao at intel.com
Thu Nov 24 01:04:10 UTC 2016


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 <yakui.zhao at 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 <yakui.zhao at 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 <yakui.zhao at 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



More information about the Libva mailing list