[Libva] [Libva-intel-driver PATCH 02/27] Add the initial code for HEVC decoding on SKL into the driver
Xiang, Haihao
haihao.xiang at intel.com
Wed Nov 19 07:05:17 PST 2014
The hcp (HEVC codec pipeline) for decoding will be built later
Signed-off-by: Xiang, Haihao <haihao.xiang at intel.com>
---
src/Makefile.am | 2 +
src/gen9_mfd.c | 141 +++++++++++++++++++++++++++++++++++++++++++++++
src/gen9_mfd.h | 45 +++++++++++++++
src/i965_decoder_utils.c | 14 +++++
src/i965_device_info.c | 3 +-
5 files changed, 204 insertions(+), 1 deletion(-)
create mode 100644 src/gen9_mfd.c
create mode 100644 src/gen9_mfd.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 2968dba..566a7ae 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -64,6 +64,7 @@ source_c = \
gen8_vme.c \
gen9_vme.c \
gen9_mfc.c \
+ gen9_mfd.c \
gen75_picture_process.c \
gen75_vme.c \
gen75_vpp_gpe.c \
@@ -104,6 +105,7 @@ source_h = \
gen75_vpp_gpe.h \
gen75_vpp_vebox.h \
gen8_post_processing.h \
+ gen9_mfd.h \
i965_avc_bsd.h \
i965_avc_hw_scoreboard.h\
i965_avc_ildb.h \
diff --git a/src/gen9_mfd.c b/src/gen9_mfd.c
new file mode 100644
index 0000000..cfed038
--- /dev/null
+++ b/src/gen9_mfd.c
@@ -0,0 +1,141 @@
+/*
+ * Copyright © 2014 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:
+ * Xiang Haihao <haihao.xiang at intel.com>
+ *
+ */
+
+#include "sysdeps.h"
+
+#include <va/va.h>
+
+#include "intel_batchbuffer.h"
+#include "intel_driver.h"
+#include "i965_defines.h"
+#include "i965_drv_video.h"
+#include "i965_decoder_utils.h"
+
+#include "gen9_mfd.h"
+
+static VAStatus
+gen9_hcpd_hevc_decode_init(VADriverContextP ctx,
+ struct decode_state *decode_state,
+ struct gen9_hcpd_context *gen9_hcpd_context)
+{
+ /* FIXME: implement it later */
+
+ return VA_STATUS_SUCCESS;
+}
+
+static VAStatus
+gen9_hcpd_hevc_decode_picture(VADriverContextP ctx,
+ struct decode_state *decode_state,
+ struct gen9_hcpd_context *gen9_hcpd_context)
+{
+ VAStatus vaStatus;
+ struct intel_batchbuffer *batch = gen9_hcpd_context->base.batch;
+
+ vaStatus = gen9_hcpd_hevc_decode_init(ctx, decode_state, gen9_hcpd_context);
+
+ if (vaStatus != VA_STATUS_SUCCESS)
+ goto out;
+
+ intel_batchbuffer_start_atomic_bcs(batch, 0x1000);
+ intel_batchbuffer_emit_mi_flush(batch);
+
+ intel_batchbuffer_end_atomic(batch);
+ intel_batchbuffer_flush(batch);
+
+out:
+ return vaStatus;
+}
+
+static VAStatus
+gen9_hcpd_decode_picture(VADriverContextP ctx,
+ VAProfile profile,
+ union codec_state *codec_state,
+ struct hw_context *hw_context)
+{
+ struct gen9_hcpd_context *gen9_hcpd_context = (struct gen9_hcpd_context *)hw_context;
+ struct decode_state *decode_state = &codec_state->decode;
+ VAStatus vaStatus;
+
+ assert(gen9_hcpd_context);
+
+ vaStatus = intel_decoder_sanity_check_input(ctx, profile, decode_state);
+
+ if (vaStatus != VA_STATUS_SUCCESS)
+ goto out;
+
+ switch (profile) {
+ case VAProfileHEVCMain:
+ case VAProfileHEVCMain10:
+ vaStatus = gen9_hcpd_hevc_decode_picture(ctx, decode_state, gen9_hcpd_context);
+ break;
+
+ default:
+ /* should never get here 1!! */
+ assert(0);
+ break;
+ }
+
+out:
+ return vaStatus;
+}
+
+static void
+gen9_hcpd_context_destroy(void *hw_context)
+{
+ struct gen9_hcpd_context *gen9_hcpd_context = (struct gen9_hcpd_context *)hw_context;
+
+ intel_batchbuffer_free(gen9_hcpd_context->base.batch);
+ free(gen9_hcpd_context);
+}
+
+static struct hw_context *
+gen9_hcpd_context_init(VADriverContextP ctx, struct object_config *object_config)
+{
+ struct intel_driver_data *intel = intel_driver_data(ctx);
+ struct gen9_hcpd_context *gen9_hcpd_context = calloc(1, sizeof(struct gen9_hcpd_context));
+
+ if (!gen9_hcpd_context)
+ return NULL;
+
+ gen9_hcpd_context->base.destroy = gen9_hcpd_context_destroy;
+ gen9_hcpd_context->base.run = gen9_hcpd_decode_picture;
+ gen9_hcpd_context->base.batch = intel_batchbuffer_new(intel, I915_EXEC_VEBOX, 0);
+
+ return (struct hw_context *)gen9_hcpd_context;
+}
+
+struct hw_context *
+gen9_dec_hw_context_init(VADriverContextP ctx, struct object_config *obj_config)
+{
+ if (obj_config->profile == VAProfileHEVCMain ||
+ obj_config->profile == VAProfileHEVCMain10) {
+ return gen9_hcpd_context_init(ctx, obj_config);
+ } else {
+ return gen8_dec_hw_context_init(ctx, obj_config);
+ }
+}
diff --git a/src/gen9_mfd.h b/src/gen9_mfd.h
new file mode 100644
index 0000000..1578ea6
--- /dev/null
+++ b/src/gen9_mfd.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright © 2014 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:
+ * Xiang Haihao <haihao.xiang at intel.com>
+ *
+ */
+
+#ifndef GEN9_MFD_H
+#define GEN9_MFD_H
+
+#include <xf86drm.h>
+#include <drm.h>
+#include <i915_drm.h>
+#include <intel_bufmgr.h>
+#include "i965_decoder.h"
+
+struct hw_context;
+
+struct gen9_hcpd_context
+{
+ struct hw_context base;
+};
+
+#endif /* GEN9_MFD_H */
diff --git a/src/i965_decoder_utils.c b/src/i965_decoder_utils.c
index 3ed08b4..e7a4322 100644
--- a/src/i965_decoder_utils.c
+++ b/src/i965_decoder_utils.c
@@ -1069,6 +1069,15 @@ intel_decoder_check_vp8_parameter(VADriverContextP ctx,
return VA_STATUS_SUCCESS;
}
+static VAStatus
+intel_decoder_check_hevc_parameter(VADriverContextP ctx,
+ struct decode_state *decode_state)
+{
+ /* FIXME: implement it later */
+
+ return VA_STATUS_SUCCESS;
+}
+
VAStatus
intel_decoder_sanity_check_input(VADriverContextP ctx,
VAProfile profile,
@@ -1116,6 +1125,11 @@ intel_decoder_sanity_check_input(VADriverContextP ctx,
vaStatus = intel_decoder_check_vp8_parameter(ctx, decode_state);
break;
+ case VAProfileHEVCMain:
+ case VAProfileHEVCMain10:
+ vaStatus = intel_decoder_check_hevc_parameter(ctx, decode_state);
+ break;
+
default:
vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
break;
diff --git a/src/i965_device_info.c b/src/i965_device_info.c
index 4b8f634..9baf56c 100755
--- a/src/i965_device_info.c
+++ b/src/i965_device_info.c
@@ -309,10 +309,11 @@ static struct hw_codec_info chv_hw_codec_info = {
},
};
+extern struct hw_context *gen9_dec_hw_context_init(VADriverContextP, struct object_config *);
extern struct hw_context *gen9_enc_hw_context_init(VADriverContextP, struct object_config *);
extern void gen9_post_processing_context_init(VADriverContextP, void *, struct intel_batchbuffer *);
static struct hw_codec_info skl_hw_codec_info = {
- .dec_hw_context_init = gen8_dec_hw_context_init,
+ .dec_hw_context_init = gen9_dec_hw_context_init,
.enc_hw_context_init = gen9_enc_hw_context_init,
.proc_hw_context_init = gen75_proc_context_init,
.render_init = gen9_render_init,
--
1.9.1
More information about the Libva
mailing list