Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3769 | Serge | 1 | /* |
2 | * Copyright © 2010 Intel Corporation |
||
3 | * |
||
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: |
||
11 | * |
||
12 | * The above copyright notice and this permission notice (including the |
||
13 | * next paragraph) shall be included in all copies or substantial portions |
||
14 | * of the Software. |
||
15 | * |
||
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. |
||
23 | * |
||
24 | * Authors: |
||
25 | * Zhou Chang |
||
26 | * |
||
27 | */ |
||
28 | |||
29 | #include |
||
30 | #include |
||
31 | #include |
||
32 | #include |
||
33 | |||
34 | #include "intel_batchbuffer.h" |
||
35 | #include "intel_driver.h" |
||
36 | |||
37 | #include "i965_defines.h" |
||
38 | #include "i965_drv_video.h" |
||
39 | #include "i965_encoder.h" |
||
40 | #include "gen6_vme.h" |
||
41 | #include "gen6_mfc.h" |
||
42 | |||
43 | static void |
||
44 | gen6_encoder_end_picture(VADriverContextP ctx, |
||
45 | VAProfile profile, |
||
46 | union codec_state *codec_state, |
||
47 | struct hw_context *hw_context) |
||
48 | { |
||
49 | struct gen6_encoder_context *gen6_encoder_context = (struct gen6_encoder_context *)hw_context; |
||
50 | struct encode_state *encode_state = &codec_state->encode; |
||
51 | VAStatus vaStatus; |
||
52 | |||
53 | vaStatus = gen6_vme_pipeline(ctx, profile, encode_state, gen6_encoder_context); |
||
54 | |||
55 | if (vaStatus == VA_STATUS_SUCCESS) |
||
56 | gen6_mfc_pipeline(ctx, profile, encode_state, gen6_encoder_context); |
||
57 | } |
||
58 | static void |
||
59 | gen6_encoder_context_destroy(void *hw_context) |
||
60 | { |
||
61 | struct gen6_encoder_context *gen6_encoder_context = (struct gen6_encoder_context *)hw_context; |
||
62 | |||
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); |
||
67 | } |
||
68 | |||
69 | struct hw_context * |
||
70 | gen6_enc_hw_context_init(VADriverContextP ctx, VAProfile profile) |
||
71 | { |
||
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)); |
||
74 | |||
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, 0); |
||
78 | |||
79 | gen6_vme_context_init(ctx, &gen6_encoder_context->vme_context); |
||
80 | gen6_mfc_context_init(ctx, &gen6_encoder_context->mfc_context); |
||
81 | |||
82 | return (struct hw_context *)gen6_encoder_context; |
||
83 | } |
||
84 | |||
85 | static void |
||
86 | gen75_encoder_end_picture(VADriverContextP ctx, |
||
87 | VAProfile profile, |
||
88 | union codec_state *codec_state, |
||
89 | struct hw_context *hw_context) |
||
90 | { |
||
91 | struct gen6_encoder_context *gen6_encoder_context = (struct gen6_encoder_context *)hw_context; |
||
92 | struct encode_state *encode_state = &codec_state->encode; |
||
93 | VAStatus vaStatus; |
||
94 | |||
95 | vaStatus = gen75_vme_pipeline(ctx, profile, encode_state, gen6_encoder_context); |
||
96 | |||
97 | if (vaStatus == VA_STATUS_SUCCESS) |
||
98 | gen75_mfc_pipeline(ctx, profile, encode_state, gen6_encoder_context); |
||
99 | } |
||
100 | static void |
||
101 | gen75_encoder_context_destroy(void *hw_context) |
||
102 | { |
||
103 | struct gen6_encoder_context *gen6_encoder_context = (struct gen6_encoder_context *)hw_context; |
||
104 | |||
105 | gen75_mfc_context_destroy(&gen6_encoder_context->mfc_context); |
||
106 | gen75_vme_context_destroy(&gen6_encoder_context->vme_context); |
||
107 | intel_batchbuffer_free(gen6_encoder_context->base.batch); |
||
108 | free(gen6_encoder_context); |
||
109 | } |
||
110 | |||
111 | |||
112 | struct hw_context * |
||
113 | gen75_enc_hw_context_init(VADriverContextP ctx, VAProfile profile) |
||
114 | { |
||
115 | struct intel_driver_data *intel = intel_driver_data(ctx); |
||
116 | struct gen6_encoder_context *gen6_encoder_context = calloc(1, sizeof(struct gen6_encoder_context)); |
||
117 | |||
118 | gen6_encoder_context->base.destroy = gen75_encoder_context_destroy; |
||
119 | gen6_encoder_context->base.run = gen75_encoder_end_picture; |
||
120 | gen6_encoder_context->base.batch = intel_batchbuffer_new(intel, I915_EXEC_RENDER, 0); |
||
121 | |||
122 | gen75_vme_context_init(ctx, &gen6_encoder_context->vme_context); |
||
123 | gen75_mfc_context_init(ctx, &gen6_encoder_context->mfc_context); |
||
124 | |||
125 | return (struct hw_context *)gen6_encoder_context; |
||
126 | } |