6 #include "egl_tracker.h"
11 #include "pipe/p_context.h"
12 #include "pipe/p_screen.h"
14 #include "state_tracker/st_public.h"
15 #include "state_tracker/drm_api.h"
17 #include "GL/internal/glcore.h"
19 #define need_GL_ARB_multisample
20 #define need_GL_ARB_point_parameters
21 #define need_GL_ARB_texture_compression
22 #define need_GL_ARB_vertex_buffer_object
23 #define need_GL_ARB_vertex_program
24 #define need_GL_ARB_window_pos
25 #define need_GL_EXT_blend_color
26 #define need_GL_EXT_blend_equation_separate
27 #define need_GL_EXT_blend_func_separate
28 #define need_GL_EXT_blend_minmax
29 #define need_GL_EXT_cull_vertex
30 #define need_GL_EXT_fog_coord
31 #define need_GL_EXT_framebuffer_object
32 #define need_GL_EXT_multi_draw_arrays
33 #define need_GL_EXT_secondary_color
34 #define need_GL_NV_vertex_program
35 #include "extension_helper.h"
39 * Copied for intel extentions.
41 const struct dri_extension card_extensions
[] = {
42 {"GL_ARB_multisample", GL_ARB_multisample_functions
},
43 {"GL_ARB_multitexture", NULL
},
44 {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions
},
45 {"GL_ARB_texture_border_clamp", NULL
},
46 {"GL_ARB_texture_compression", GL_ARB_texture_compression_functions
},
47 {"GL_ARB_texture_cube_map", NULL
},
48 {"GL_ARB_texture_env_add", NULL
},
49 {"GL_ARB_texture_env_combine", NULL
},
50 {"GL_ARB_texture_env_dot3", NULL
},
51 {"GL_ARB_texture_mirrored_repeat", NULL
},
52 {"GL_ARB_texture_rectangle", NULL
},
53 {"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions
},
54 {"GL_ARB_pixel_buffer_object", NULL
},
55 {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions
},
56 {"GL_ARB_window_pos", GL_ARB_window_pos_functions
},
57 {"GL_EXT_blend_color", GL_EXT_blend_color_functions
},
58 {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions
},
59 {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions
},
60 {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions
},
61 {"GL_EXT_blend_subtract", NULL
},
62 {"GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions
},
63 {"GL_EXT_fog_coord", GL_EXT_fog_coord_functions
},
64 {"GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions
},
65 {"GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions
},
66 {"GL_EXT_packed_depth_stencil", NULL
},
67 {"GL_EXT_pixel_buffer_object", NULL
},
68 {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions
},
69 {"GL_EXT_stencil_wrap", NULL
},
70 {"GL_EXT_texture_edge_clamp", NULL
},
71 {"GL_EXT_texture_env_combine", NULL
},
72 {"GL_EXT_texture_env_dot3", NULL
},
73 {"GL_EXT_texture_filter_anisotropic", NULL
},
74 {"GL_EXT_texture_lod_bias", NULL
},
75 {"GL_3DFX_texture_compression_FXT1", NULL
},
76 {"GL_APPLE_client_storage", NULL
},
77 {"GL_MESA_pack_invert", NULL
},
78 {"GL_MESA_ycbcr_texture", NULL
},
79 {"GL_NV_blend_square", NULL
},
80 {"GL_NV_vertex_program", GL_NV_vertex_program_functions
},
81 {"GL_NV_vertex_program1_1", NULL
},
82 {"GL_SGIS_generate_mipmap", NULL
},
87 drm_create_context(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLConfig
*conf
, _EGLContext
*share_list
, const EGLint
*attrib_list
)
89 struct drm_device
*dev
= lookup_drm_device(dpy
);
90 struct drm_context
*ctx
;
91 struct drm_context
*share
= NULL
;
92 struct st_context
*st_share
= NULL
;
94 __GLcontextModes
*visual
;
96 for (i
= 0; attrib_list
&& attrib_list
[i
] != EGL_NONE
; i
++) {
97 switch (attrib_list
[i
]) {
98 /* no attribs defined for now */
100 _eglError(EGL_BAD_ATTRIBUTE
, "eglCreateContext");
101 return EGL_NO_CONTEXT
;
105 ctx
= (struct drm_context
*) calloc(1, sizeof(struct drm_context
));
109 _eglInitContext(drv
, &ctx
->base
, conf
, attrib_list
);
111 ctx
->pipe
= dev
->api
->create_context(dev
->api
, dev
->screen
);
116 st_share
= share
->st
;
118 visual
= drm_visual_from_config(conf
);
119 ctx
->st
= st_create_context(ctx
->pipe
, visual
, st_share
);
120 drm_visual_modes_destroy(visual
);
128 ctx
->pipe
->destroy(ctx
->pipe
);
136 drm_destroy_context(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLContext
*context
)
138 struct drm_context
*c
= lookup_drm_context(context
);
139 if (!_eglIsContextBound(&c
->base
)) {
140 st_destroy_context(c
->st
);
147 drm_make_current(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLSurface
*draw
, _EGLSurface
*read
, _EGLContext
*context
)
149 struct drm_surface
*readSurf
= lookup_drm_surface(read
);
150 struct drm_surface
*drawSurf
= lookup_drm_surface(draw
);
151 struct drm_context
*ctx
= lookup_drm_context(context
);
154 b
= _eglMakeCurrent(drv
, dpy
, draw
, read
, context
);
159 if (!drawSurf
|| !readSurf
)
162 st_make_current(ctx
->st
, drawSurf
->stfb
, readSurf
->stfb
);
164 /* st_resize_framebuffer needs a bound context to work */
165 st_resize_framebuffer(drawSurf
->stfb
, drawSurf
->w
, drawSurf
->h
);
166 st_resize_framebuffer(readSurf
->stfb
, readSurf
->w
, readSurf
->h
);
168 st_make_current(NULL
, NULL
, NULL
);