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 "intel_batchbuffer.h"
35 #include "intel_driver.h"
37 #include "i965_defines.h"
38 #include "i965_drv_video.h"
39 #include "i965_encoder.h"
42 gen6_encoder_end_picture(VADriverContextP ctx,
44 union codec_state *codec_state,
45 struct hw_context *hw_context)
47 struct gen6_encoder_context *gen6_encoder_context = (struct gen6_encoder_context *)hw_context;
48 struct encode_state *encode_state = &codec_state->enc;
51 vaStatus = gen6_vme_pipeline(ctx, profile, encode_state, gen6_encoder_context);
53 if (vaStatus == VA_STATUS_SUCCESS)
54 gen6_mfc_pipeline(ctx, profile, encode_state, gen6_encoder_context);
57 gen6_encoder_context_destroy(void *hw_context)
59 struct gen6_encoder_context *gen6_encoder_context = (struct gen6_encoder_context *)hw_context;
61 gen6_mfc_context_destroy(&gen6_encoder_context->mfc_context);
62 gen6_vme_context_destroy(&gen6_encoder_context->vme_context);
63 intel_batchbuffer_free(gen6_encoder_context->base.batch);
64 free(gen6_encoder_context);
68 gen6_enc_hw_context_init(VADriverContextP ctx, VAProfile profile)
70 struct intel_driver_data *intel = intel_driver_data(ctx);
71 struct gen6_encoder_context *gen6_encoder_context = calloc(1, sizeof(struct gen6_encoder_context));
73 gen6_encoder_context->base.destroy = gen6_encoder_context_destroy;
74 gen6_encoder_context->base.run = gen6_encoder_end_picture;
75 gen6_encoder_context->base.batch = intel_batchbuffer_new(intel, I915_EXEC_RENDER);
77 gen6_vme_context_init(ctx, &gen6_encoder_context->vme_context);
78 gen6_mfc_context_init(ctx, &gen6_encoder_context->mfc_context);
80 return (struct hw_context *)gen6_encoder_context;