1 /**************************************************************************
2  *
3  * Copyright 2003 VMware, Inc.
4  * All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sub license, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * The above copyright notice and this permission notice (including the
15  * next paragraph) shall be included in all copies or substantial portions
16  * of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21  * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25  *
26  **************************************************************************/
27 
28 #ifndef _INTEL_INIT_H_
29 #define _INTEL_INIT_H_
30 
31 #include <stdbool.h>
32 #include <sys/time.h>
33 #include "dri_util.h"
34 #include "intel_bufmgr.h"
35 #include "drm-uapi/i915_drm.h"
36 #include "util/xmlconfig.h"
37 
38 struct intel_screen
39 {
40    int deviceID;
41    int gen;
42 
43    __DRIscreen *driScrnPriv;
44 
45    bool no_hw;
46 
47    bool no_vbo;
48    dri_bufmgr *bufmgr;
49 
50    /**
51    * Configuration cache with default values for all contexts
52    */
53    driOptionCache optionCache;
54 };
55 
56 /* These defines are to ensure that i915_dri's symbols don't conflict with
57  * i965's when linked together.
58  */
59 #define intel_region_alloc                  old_intel_region_alloc
60 #define intel_region_alloc_for_fd           old_intel_region_alloc_for_fd
61 #define intel_region_alloc_for_handle       old_intel_region_alloc_for_handle
62 #define intel_region_flink                  old_intel_region_flink
63 #define intel_region_get_aligned_offset     old_intel_region_get_aligned_offset
64 #define intel_region_get_tile_masks         old_intel_region_get_tile_masks
65 #define intel_region_reference              old_intel_region_reference
66 #define intel_region_release                old_intel_region_release
67 #define intel_bufferobj_buffer              old_intel_bufferobj_buffer
68 #define intel_bufferobj_source              old_intel_bufferobj_source
69 #define intelInitBufferObjectFuncs          old_intelInitBufferObjectFuncs
70 #define intel_upload_data                   old_intel_upload_data
71 #define intel_upload_finish                 old_intel_upload_finish
72 #define intel_batchbuffer_data              old_intel_batchbuffer_data
73 #define intel_batchbuffer_emit_mi_flush     old_intel_batchbuffer_emit_mi_flush
74 #define intel_batchbuffer_emit_reloc        old_intel_batchbuffer_emit_reloc
75 #define intel_batchbuffer_emit_reloc_fenced old_intel_batchbuffer_emit_reloc_fenced
76 #define _intel_batchbuffer_flush            old__intel_batchbuffer_flush
77 #define intel_batchbuffer_free              old_intel_batchbuffer_free
78 #define intel_batchbuffer_init              old_intel_batchbuffer_init
79 #define intelInitClearFuncs                 old_intelInitClearFuncs
80 #define intelInitExtensions                 old_intelInitExtensions
81 #define intel_miptree_copy_teximage         old_intel_miptree_copy_teximage
82 #define intel_miptree_create                old_intel_miptree_create
83 #define intel_miptree_create_for_bo         old_intel_miptree_create_for_bo
84 #define intel_miptree_create_for_dri2_buffer old_intel_miptree_create_for_dri2_buffer
85 #define intel_miptree_create_for_renderbuffer old_intel_miptree_create_for_renderbuffer
86 #define intel_miptree_create_layout         old_intel_miptree_create_layout
87 #define intel_miptree_get_dimensions_for_image old_intel_miptree_get_dimensions_for_image
88 #define intel_miptree_get_image_offset      old_intel_miptree_get_image_offset
89 #define intel_miptree_get_tile_offsets      old_intel_miptree_get_tile_offsets
90 #define intel_miptree_map                   old_intel_miptree_map
91 #define intel_miptree_map_raw               old_intel_miptree_map_raw
92 #define intel_miptree_match_image           old_intel_miptree_match_image
93 #define intel_miptree_reference             old_intel_miptree_reference
94 #define intel_miptree_release               old_intel_miptree_release
95 #define intel_miptree_set_image_offset      old_intel_miptree_set_image_offset
96 #define intel_miptree_set_level_info        old_intel_miptree_set_level_info
97 #define intel_miptree_unmap                 old_intel_miptree_unmap
98 #define intel_miptree_unmap_raw             old_intel_miptree_unmap_raw
99 #define i945_miptree_layout_2d              old_i945_miptree_layout_2d
100 #define intel_get_texture_alignment_unit    old_intel_get_texture_alignment_unit
101 #define intelInitTextureImageFuncs          old_intelInitTextureImageFuncs
102 #define intel_miptree_create_for_teximage   old_intel_miptree_create_for_teximage
103 #define intelSetTexBuffer                   old_intelSetTexBuffer
104 #define intelSetTexBuffer2                  old_intelSetTexBuffer2
105 #define intelInitTextureSubImageFuncs       old_intelInitTextureSubImageFuncs
106 #define intelInitTextureCopyImageFuncs      old_intelInitTextureCopyImageFuncs
107 #define intel_finalize_mipmap_tree          old_intel_finalize_mipmap_tree
108 #define intelInitTextureFuncs               old_intelInitTextureFuncs
109 #define intel_check_blit_fragment_ops       old_intel_check_blit_fragment_ops
110 #define intelInitPixelFuncs                 old_intelInitPixelFuncs
111 #define intelBitmap                         old_intelBitmap
112 #define intelCopyPixels                     old_intelCopyPixels
113 #define intelDrawPixels                     old_intelDrawPixels
114 #define intelReadPixels                     old_intelReadPixels
115 #define intel_check_front_buffer_rendering  old_intel_check_front_buffer_rendering
116 #define intelInitBufferFuncs                old_intelInitBufferFuncs
117 #define intelClearWithBlit                  old_intelClearWithBlit
118 #define intelEmitImmediateColorExpandBlit   old_intelEmitImmediateColorExpandBlit
119 #define intel_emit_linear_blit              old_intel_emit_linear_blit
120 #define intel_miptree_blit                  old_intel_miptree_blit
121 #define i945_miptree_layout                 old_i945_miptree_layout
122 #define intel_init_texture_formats          old_intel_init_texture_formats
123 #define intelCalcViewport                   old_intelCalcViewport
124 #define INTEL_DEBUG                         old_INTEL_DEBUG
125 #define intelDestroyContext                 old_intelDestroyContext
126 #define intelFinish                         old_intelFinish
127 #define _intel_flush                        old__intel_flush
128 #define intel_flush_rendering_to_batch      old_intel_flush_rendering_to_batch
129 #define intelInitContext                    old_intelInitContext
130 #define intelInitDriverFunctions            old_intelInitDriverFunctions
131 #define intelMakeCurrent                    old_intelMakeCurrent
132 #define intel_prepare_render                old_intel_prepare_render
133 #define intelUnbindContext                  old_intelUnbindContext
134 #define intel_update_renderbuffers          old_intel_update_renderbuffers
135 #define aub_dump_bmp                        old_aub_dump_bmp
136 #define get_time                            old_get_time
137 #define intel_translate_blend_factor        old_intel_translate_blend_factor
138 #define intel_translate_compare_func        old_intel_translate_compare_func
139 #define intel_translate_shadow_compare_func old_intel_translate_shadow_compare_func
140 #define intel_translate_stencil_op          old_intel_translate_stencil_op
141 #define intel_init_syncobj_functions        old_intel_init_syncobj_functions
142 #define intelChooseRenderState              old_intelChooseRenderState
143 #define intelFallback                       old_intelFallback
144 #define intel_finish_vb                     old_intel_finish_vb
145 #define intel_flush_prim                    old_intel_flush_prim
146 #define intel_get_prim_space                old_intel_get_prim_space
147 #define intelInitTriFuncs                   old_intelInitTriFuncs
148 #define intel_set_prim                      old_intel_set_prim
149 #define intel_create_private_renderbuffer   old_intel_create_private_renderbuffer
150 #define intel_create_renderbuffer           old_intel_create_renderbuffer
151 #define intel_fbo_init                      old_intel_fbo_init
152 #define intel_get_rb_region                 old_intel_get_rb_region
153 #define intel_renderbuffer_set_draw_offset  old_intel_renderbuffer_set_draw_offset
154 #define intel_miptree_create_for_image_buffer old_intel_miptree_create_for_image_buffer
155 #define intelFenceExtension                 old_intelFenceExtension
156 
157 extern void intelDestroyContext(__DRIcontext * driContextPriv);
158 
159 extern GLboolean intelUnbindContext(__DRIcontext * driContextPriv);
160 
161 const __DRIextension **__driDriverGetExtensions_i915(void);
162 extern const __DRI2fenceExtension intelFenceExtension;
163 
164 extern GLboolean
165 intelMakeCurrent(__DRIcontext * driContextPriv,
166                  __DRIdrawable * driDrawPriv,
167                  __DRIdrawable * driReadPriv);
168 
169 double get_time(void);
170 void aub_dump_bmp(struct gl_context *ctx);
171 
172 #endif
173