2 * Copyright © 2009 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 * Xiang Haihao <haihao.xiang@intel.com>
26 * Zou Nan hai <nanhai.zou@intel.com>
30 #ifndef _I965_DRV_VIDEO_H_
31 #define _I965_DRV_VIDEO_H_
34 #include <va/va_backend.h>
36 #include "object_heap.h"
38 #include "intel_driver.h"
40 #include "i965_media.h"
41 #include "i965_render.h"
43 #define I965_MAX_PROFILES 11
44 #define I965_MAX_ENTRYPOINTS 5
45 #define I965_MAX_CONFIG_ATTRIBUTES 10
46 #define I965_MAX_IMAGE_FORMATS 10
47 #define I965_MAX_SUBPIC_FORMATS 2
48 #define I965_MAX_DISPLAY_ATTRIBUTES 4
49 #define I965_STR_VENDOR "i965 Driver 0.1"
53 unsigned char *buffer;
60 struct object_base base;
62 VAEntrypoint entrypoint;
63 VAConfigAttrib attrib_list[I965_MAX_CONFIG_ATTRIBUTES];
69 struct buffer_store *pic_param;
70 struct buffer_store *slice_param;
71 struct buffer_store *iq_matrix;
72 struct buffer_store *bit_plane;
73 struct buffer_store *slice_data;
74 VASurfaceID current_render_target;
80 struct object_base base;
81 VAContextID context_id;
83 VASurfaceID *render_targets;
84 int num_render_targets;
88 struct decode_state decode_state;
93 struct object_base base;
94 VASurfaceStatus status;
95 VASubpictureID subpic;
100 /* FIXME: only for H.264 */
101 dri_bo *direct_mv_wr_top_bo;
102 dri_bo *direct_mv_wr_bottom_bo;
107 struct object_base base;
108 struct buffer_store *buffer_store;
109 int max_num_elements;
117 struct object_base base;
120 unsigned int *palette;
125 struct object_base base;
127 VARectangle src_rect;
128 VARectangle dst_rect;
137 struct i965_driver_data
139 struct intel_driver_data intel;
140 struct object_heap config_heap;
141 struct object_heap context_heap;
142 struct object_heap surface_heap;
143 struct object_heap buffer_heap;
144 struct object_heap image_heap;
145 struct object_heap subpic_heap;
146 struct i965_media_state media_state;
147 struct i965_render_state render_state;
150 #define NEW_CONFIG_ID() object_heap_allocate(&i965->config_heap);
151 #define NEW_CONTEXT_ID() object_heap_allocate(&i965->context_heap);
152 #define NEW_SURFACE_ID() object_heap_allocate(&i965->surface_heap);
153 #define NEW_BUFFER_ID() object_heap_allocate(&i965->buffer_heap);
154 #define NEW_IMAGE_ID() object_heap_allocate(&i965->image_heap);
155 #define NEW_SUBPIC_ID() object_heap_allocate(&i965->subpic_heap);
157 #define CONFIG(id) ((struct object_config *)object_heap_lookup(&i965->config_heap, id))
158 #define CONTEXT(id) ((struct object_context *)object_heap_lookup(&i965->context_heap, id))
159 #define SURFACE(id) ((struct object_surface *)object_heap_lookup(&i965->surface_heap, id))
160 #define BUFFER(id) ((struct object_buffer *)object_heap_lookup(&i965->buffer_heap, id))
161 #define IMAGE(id) ((struct object_image *)object_heap_lookup(&i965->image_heap, id))
162 #define SUBPIC(id) ((struct object_subpic *)object_heap_lookup(&i965->subpic_heap, id))
164 #define FOURCC_IA44 0x34344149
165 #define FOURCC_AI44 0x34344941
167 #define STRIDE(w) (((w) + 0xf) & ~0xf)
168 #define SIZE_YUV420(w, h) (h * (STRIDE(w) + STRIDE(w >> 1)))
170 static INLINE struct i965_driver_data *
171 i965_driver_data(VADriverContextP ctx)
173 return (struct i965_driver_data *)(ctx->pDriverData);
176 #endif /* _I965_DRV_VIDEO_H_ */