2 * Copyright © 2010 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sub license, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 * Zhou Chang <chang.zhou@intel.com>
34 #include <va/va_backend.h>
36 #include "intel_batchbuffer.h"
37 #include "intel_driver.h"
39 #include "i965_defines.h"
40 #include "i965_drv_video.h"
41 #include "i965_encoder.h"
44 gen6_encoder_end_picture(VADriverContextP ctx,
46 union codec_state *codec_state,
47 struct hw_context *hw_context)
49 struct gen6_encoder_context *gen6_encoder_context = (struct gen6_encoder_context *)hw_context;
50 struct encode_state *encode_state = &codec_state->encode;
53 vaStatus = gen6_vme_pipeline(ctx, profile, encode_state, gen6_encoder_context);
55 if (vaStatus == VA_STATUS_SUCCESS)
56 gen6_mfc_pipeline(ctx, profile, encode_state, gen6_encoder_context);
59 gen6_encoder_context_destroy(void *hw_context)
61 struct gen6_encoder_context *gen6_encoder_context = (struct gen6_encoder_context *)hw_context;
63 gen6_mfc_context_destroy(&gen6_encoder_context->mfc_context);
64 gen6_vme_context_destroy(&gen6_encoder_context->vme_context);
65 intel_batchbuffer_free(gen6_encoder_context->base.batch);
66 free(gen6_encoder_context);
70 gen6_enc_hw_context_init(VADriverContextP ctx, VAProfile profile)
72 struct intel_driver_data *intel = intel_driver_data(ctx);
73 struct gen6_encoder_context *gen6_encoder_context = calloc(1, sizeof(struct gen6_encoder_context));
75 gen6_encoder_context->base.destroy = gen6_encoder_context_destroy;
76 gen6_encoder_context->base.run = gen6_encoder_end_picture;
77 gen6_encoder_context->base.batch = intel_batchbuffer_new(intel, I915_EXEC_RENDER);
79 gen6_vme_context_init(ctx, &gen6_encoder_context->vme_context);
80 gen6_mfc_context_init(ctx, &gen6_encoder_context->mfc_context);
82 return (struct hw_context *)gen6_encoder_context;