From a7a9a91d7b28e5b5faed509d00f0f951e3136b1b Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 27 Apr 2010 11:04:51 -0400 Subject: dri: Add DRI entrypoints to create a context for a given API --- src/mesa/drivers/dri/intel/intel_screen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/mesa/drivers/dri/intel') diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 5e3f40836d..b27e7a34a7 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -364,7 +364,8 @@ extern GLboolean brwCreateContext(const __GLcontextModes * mesaVis, void *sharedContextPrivate); static GLboolean -intelCreateContext(const __GLcontextModes * mesaVis, +intelCreateContext(gl_api api, + const __GLcontextModes * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate) { -- cgit v1.2.3 From 4b69100bdcf26dbb5be4d600b7ca5f5cdf6e8f20 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 27 Apr 2010 11:04:51 -0400 Subject: dri: Add DRI entrypoints to create a context for a given API --- src/mesa/drivers/dri/i915/i830_context.c | 2 +- src/mesa/drivers/dri/i915/i915_context.c | 5 +++-- src/mesa/drivers/dri/i915/i915_context.h | 3 ++- src/mesa/drivers/dri/i965/brw_context.c | 5 +++-- src/mesa/drivers/dri/i965/brw_context.h | 3 ++- src/mesa/drivers/dri/intel/intel_context.c | 5 +++-- src/mesa/drivers/dri/intel/intel_context.h | 1 + src/mesa/drivers/dri/intel/intel_screen.c | 11 +++++++---- 8 files changed, 22 insertions(+), 13 deletions(-) (limited to 'src/mesa/drivers/dri/intel') diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c index ebe8b15ca7..d52ea9812f 100644 --- a/src/mesa/drivers/dri/i915/i830_context.c +++ b/src/mesa/drivers/dri/i915/i830_context.c @@ -63,7 +63,7 @@ i830CreateContext(const __GLcontextModes * mesaVis, i830InitVtbl(i830); i830InitDriverFunctions(&functions); - if (!intelInitContext(intel, mesaVis, driContextPriv, + if (!intelInitContext(intel, __DRI_API_OPENGL, mesaVis, driContextPriv, sharedContextPrivate, &functions)) { FREE(i830); return GL_FALSE; diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 4d86aae87d..b3fe1c05d6 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -94,7 +94,8 @@ i915InitDriverFunctions(struct dd_function_table *functions) extern const struct tnl_pipeline_stage *intel_pipeline[]; GLboolean -i915CreateContext(const __GLcontextModes * mesaVis, +i915CreateContext(int api, + const __GLcontextModes * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate) { @@ -114,7 +115,7 @@ i915CreateContext(const __GLcontextModes * mesaVis, i915InitDriverFunctions(&functions); - if (!intelInitContext(intel, mesaVis, driContextPriv, + if (!intelInitContext(intel, api, mesaVis, driContextPriv, sharedContextPrivate, &functions)) { FREE(i915); return GL_FALSE; diff --git a/src/mesa/drivers/dri/i915/i915_context.h b/src/mesa/drivers/dri/i915/i915_context.h index b5169280f6..a7b9aae6f9 100644 --- a/src/mesa/drivers/dri/i915/i915_context.h +++ b/src/mesa/drivers/dri/i915/i915_context.h @@ -318,7 +318,8 @@ do { \ /*====================================================================== * i915_context.c */ -extern GLboolean i915CreateContext(const __GLcontextModes * mesaVis, +extern GLboolean i915CreateContext(int api, + const __GLcontextModes * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate); diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 360fc12621..523a11aea3 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -68,7 +68,8 @@ static void brwInitDriverFunctions( struct dd_function_table *functions ) functions->Viewport = intel_viewport; } -GLboolean brwCreateContext( const __GLcontextModes *mesaVis, +GLboolean brwCreateContext( int api, + const __GLcontextModes *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate) { @@ -85,7 +86,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis, brwInitVtbl( brw ); brwInitDriverFunctions( &functions ); - if (!intelInitContext( intel, mesaVis, driContextPriv, + if (!intelInitContext( intel, api, mesaVis, driContextPriv, sharedContextPrivate, &functions )) { printf("%s: failed to init intel context\n", __FUNCTION__); FREE(brw); diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 2855c93ea6..1f09651126 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -687,7 +687,8 @@ void brwInitVtbl( struct brw_context *brw ); /*====================================================================== * brw_context.c */ -GLboolean brwCreateContext( const __GLcontextModes *mesaVis, +GLboolean brwCreateContext( int api, + const __GLcontextModes *mesaVis, __DRIcontext *driContextPriv, void *sharedContextPrivate); diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 2ccc12010e..8922d574c1 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -586,6 +586,7 @@ intelInitDriverFunctions(struct dd_function_table *functions) GLboolean intelInitContext(struct intel_context *intel, + int api, const __GLcontextModes * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate, @@ -601,8 +602,8 @@ intelInitContext(struct intel_context *intel, if (intelScreen->bufmgr == NULL) return GL_FALSE; - if (!_mesa_initialize_context(&intel->ctx, mesaVis, shareCtx, - functions, (void *) intel)) { + if (!_mesa_initialize_context_for_api(&intel->ctx, api, mesaVis, shareCtx, + functions, (void *) intel)) { printf("%s: failed to init mesa context\n", __FUNCTION__); return GL_FALSE; } diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 75dabc554c..02bb4d0d64 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -364,6 +364,7 @@ extern int INTEL_DEBUG; */ extern GLboolean intelInitContext(struct intel_context *intel, + int api, const __GLcontextModes * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate, diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index b27e7a34a7..9b7ae73e45 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -356,10 +356,12 @@ extern GLboolean i830CreateContext(const __GLcontextModes * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate); -extern GLboolean i915CreateContext(const __GLcontextModes * mesaVis, +extern GLboolean i915CreateContext(int api, + const __GLcontextModes * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate); -extern GLboolean brwCreateContext(const __GLcontextModes * mesaVis, +extern GLboolean brwCreateContext(int api, + const __GLcontextModes * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate); @@ -375,7 +377,7 @@ intelCreateContext(gl_api api, #ifdef I915 if (IS_9XX(intelScreen->deviceID)) { if (!IS_965(intelScreen->deviceID)) { - return i915CreateContext(mesaVis, driContextPriv, + return i915CreateContext(api, mesaVis, driContextPriv, sharedContextPrivate); } } else { @@ -384,7 +386,8 @@ intelCreateContext(gl_api api, } #else if (IS_965(intelScreen->deviceID)) - return brwCreateContext(mesaVis, driContextPriv, sharedContextPrivate); + return brwCreateContext(api, mesaVis, + driContextPriv, sharedContextPrivate); #endif fprintf(stderr, "Unrecognized deviceID %x\n", intelScreen->deviceID); return GL_FALSE; -- cgit v1.2.3 From 5efee4d4e68067a3fd85b9ff6a2636f502538768 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 27 Apr 2010 21:43:40 -0400 Subject: intel: Advertise GLES1/2 for i915+ when enabled --- src/mesa/drivers/dri/intel/intel_screen.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/mesa/drivers/dri/intel') diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 9b7ae73e45..2b54cda66d 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -434,6 +434,7 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp) struct intel_screen *intelScreen; GLenum fb_format[3]; GLenum fb_type[3]; + unsigned int api_mask; static const GLenum back_buffer_modes[] = { GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML @@ -460,6 +461,17 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp) &intelScreen->deviceID)) return GL_FALSE; + api_mask = (1 << __DRI_API_OPENGL); +#if FEATURE_ES1 + api_mask |= (1 << __DRI_API_GLES); +#endif +#if FEATURE_ES2 + api_mask |= (1 << __DRI_API_GLES2); +#endif + + if (IS_9XX(intelScreen->deviceID) || IS_965(intelScreen->deviceID)) + psp->api_mask = api_mask; + if (!intel_init_bufmgr(intelScreen)) return GL_FALSE; -- cgit v1.2.3 From a5107b0a5cb1ac9f112aa498f57c13580bd56cb3 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 27 Apr 2010 14:57:51 -0400 Subject: intel: Only register ES2 extensions for ES2 contexts --- src/mesa/drivers/dri/i915/Makefile | 1 + src/mesa/drivers/dri/i915/intel_extensions_es2.c | 1 + src/mesa/drivers/dri/i965/Makefile | 1 + src/mesa/drivers/dri/i965/intel_extensions_es2.c | 1 + src/mesa/drivers/dri/intel/intel_context.c | 11 ++- src/mesa/drivers/dri/intel/intel_extensions.h | 2 +- src/mesa/drivers/dri/intel/intel_extensions_es2.c | 93 +++++++++++++++++++++++ 7 files changed, 108 insertions(+), 2 deletions(-) create mode 120000 src/mesa/drivers/dri/i915/intel_extensions_es2.c create mode 120000 src/mesa/drivers/dri/i965/intel_extensions_es2.c create mode 100644 src/mesa/drivers/dri/intel/intel_extensions_es2.c (limited to 'src/mesa/drivers/dri/intel') diff --git a/src/mesa/drivers/dri/i915/Makefile b/src/mesa/drivers/dri/i915/Makefile index 5b49d0c77c..71ee753748 100644 --- a/src/mesa/drivers/dri/i915/Makefile +++ b/src/mesa/drivers/dri/i915/Makefile @@ -16,6 +16,7 @@ DRIVER_SOURCES = \ intel_batchbuffer.c \ intel_clear.c \ intel_extensions.c \ + intel_extensions_es2.c \ intel_mipmap_tree.c \ intel_tex_layout.c \ intel_tex_image.c \ diff --git a/src/mesa/drivers/dri/i915/intel_extensions_es2.c b/src/mesa/drivers/dri/i915/intel_extensions_es2.c new file mode 120000 index 0000000000..0ec1ceee78 --- /dev/null +++ b/src/mesa/drivers/dri/i915/intel_extensions_es2.c @@ -0,0 +1 @@ +../intel/intel_extensions_es2.c \ No newline at end of file diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile index 842d4b7aa1..a0039e800d 100644 --- a/src/mesa/drivers/dri/i965/Makefile +++ b/src/mesa/drivers/dri/i965/Makefile @@ -13,6 +13,7 @@ DRIVER_SOURCES = \ intel_context.c \ intel_decode.c \ intel_extensions.c \ + intel_extensions_es2.c \ intel_fbo.c \ intel_mipmap_tree.c \ intel_regions.c \ diff --git a/src/mesa/drivers/dri/i965/intel_extensions_es2.c b/src/mesa/drivers/dri/i965/intel_extensions_es2.c new file mode 120000 index 0000000000..0ec1ceee78 --- /dev/null +++ b/src/mesa/drivers/dri/i965/intel_extensions_es2.c @@ -0,0 +1 @@ +../intel/intel_extensions_es2.c \ No newline at end of file diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 8922d574c1..8ee9a292a1 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -737,7 +737,16 @@ intelInitContext(struct intel_context *intel, intel->RenderIndex = ~0; - intelInitExtensions(ctx); + switch (ctx->API) { + case API_OPENGL: + intelInitExtensions(ctx); + break; + case API_OPENGLES: + break; + case API_OPENGLES2: + intelInitExtensionsES2(ctx); + break; + } INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control); if (INTEL_DEBUG & DEBUG_BUFMGR) diff --git a/src/mesa/drivers/dri/intel/intel_extensions.h b/src/mesa/drivers/dri/intel/intel_extensions.h index e78e07356e..236442a4d6 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.h +++ b/src/mesa/drivers/dri/intel/intel_extensions.h @@ -33,7 +33,7 @@ extern void intelInitExtensions(GLcontext *ctx); extern void -intelFlushDrawable(__DRIdrawable *drawable); +intelInitExtensionsES2(GLcontext *ctx); #endif diff --git a/src/mesa/drivers/dri/intel/intel_extensions_es2.c b/src/mesa/drivers/dri/intel/intel_extensions_es2.c new file mode 100644 index 0000000000..8a6c15f6d2 --- /dev/null +++ b/src/mesa/drivers/dri/intel/intel_extensions_es2.c @@ -0,0 +1,93 @@ +/************************************************************************** + * + * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include "main/extensions.h" + +#include "intel_extensions.h" +#include "utils.h" + +static const char *es2_extensions[] = { + /* Used by mesa internally (cf all_mesa_extensions in ../common/utils.c) */ + "GL_ARB_draw_buffers", + "GL_ARB_multisample", + "GL_ARB_texture_compression", + "GL_ARB_transpose_matrix", + "GL_ARB_vertex_buffer_object", + "GL_ARB_window_pos", + "GL_EXT_blend_func_separate", + "GL_EXT_compiled_vertex_array", + "GL_EXT_multi_draw_arrays", + "GL_EXT_polygon_offset", + "GL_EXT_texture_object", + "GL_EXT_vertex_array", + "GL_IBM_multimode_draw_arrays", + "GL_MESA_window_pos", + "GL_NV_vertex_program", + + /* Required by GLES2 */ + "GL_ARB_fragment_program", + "GL_ARB_fragment_shader", + "GL_ARB_multitexture", + "GL_ARB_shader_objects", + "GL_ARB_texture_cube_map", + "GL_ARB_texture_mirrored_repeat", + "GL_ARB_texture_non_power_of_two", + "GL_ARB_vertex_shader", + "GL_EXT_blend_color", + "GL_EXT_blend_equation_separate", + "GL_EXT_blend_minmax", + "GL_EXT_blend_subtract", + "GL_EXT_stencil_wrap", + + /* Optional GLES2 */ + "GL_ARB_framebuffer_object", + "GL_EXT_texture_filter_anisotropic", + "GL_ARB_depth_texture", + "GL_EXT_packed_depth_stencil", + +#if FEATURE_OES_EGL_image + "GL_OES_EGL_image", +#endif + + NULL, +}; + +/** + * Initializes potential list of extensions if ctx == NULL, or actually enables + * extensions for a context. + */ +void +intelInitExtensionsES2(GLcontext *ctx) +{ + int i; + + /* Can't use driInitExtensions() since it uses extensions from + * main/remap_helper.h when called the first time. */ + + for (i = 0; es2_extensions[i]; i++) + _mesa_enable_extension(ctx, es2_extensions[i]); +} -- cgit v1.2.3