X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fmga%2Fmga_xmesa.c;h=6ec99dbc3ba79ae6039dd3cb00c459e310230af4;hb=1d71bbed3bbeb99d954cc137e4923c5db6e063c8;hp=86da3a2cacffde60b3c95f0146ea0781ddd25ac6;hpb=9136c9b29ed5c14bc89a4c4e3a391e0b097092e1;p=mesa.git diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 86da3a2cacf..6ec99dbc3ba 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -35,7 +35,6 @@ #include "mga_drm.h" #include "mga_xmesa.h" #include "main/context.h" -#include "main/matrix.h" #include "main/simple_list.h" #include "main/imports.h" #include "main/framebuffer.h" @@ -58,31 +57,26 @@ #include "mgatris.h" #include "mgavb.h" #include "mgapixel.h" -#include "mga_xmesa.h" #include "mga_dri.h" #include "utils.h" #include "vblank.h" -#include "main/extensions.h" #include "drirenderbuffer.h" #include "GL/internal/dri_interface.h" -#define need_GL_ARB_multisample -#define need_GL_ARB_texture_compression -#define need_GL_ARB_vertex_buffer_object +#define need_GL_ARB_vertex_array_object #define need_GL_ARB_vertex_program #define need_GL_EXT_fog_coord #define need_GL_EXT_gpu_program_parameters -#define need_GL_EXT_multi_draw_arrays #define need_GL_EXT_secondary_color #if 0 #define need_GL_EXT_paletted_texture #endif #define need_GL_APPLE_vertex_array_object #define need_GL_NV_vertex_program -#include "extension_helper.h" +#include "main/remap_helper.h" /* MGA configuration */ @@ -112,12 +106,12 @@ int MGA_DEBUG = 0; #endif static const __DRIconfig ** -mgaFillInModes( __DRIscreenPrivate *psp, +mgaFillInModes( __DRIscreen *psp, unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer ) { __DRIconfig **configs; - __GLcontextModes * m; + struct gl_config * m; unsigned depth_buffer_factor; unsigned back_buffer_factor; GLenum fb_format; @@ -133,6 +127,7 @@ mgaFillInModes( __DRIscreenPrivate *psp, uint8_t depth_bits_array[3]; uint8_t stencil_bits_array[3]; + uint8_t msaa_samples_array[1]; depth_bits_array[0] = 0; @@ -147,6 +142,8 @@ mgaFillInModes( __DRIscreenPrivate *psp, stencil_bits_array[1] = 0; stencil_bits_array[2] = (stencil_bits == 0) ? 8 : stencil_bits; + msaa_samples_array[0] = 0; + depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1; back_buffer_factor = (have_back_buffer) ? 2 : 1; @@ -162,7 +159,8 @@ mgaFillInModes( __DRIscreenPrivate *psp, configs = driCreateConfigs(fb_format, fb_type, depth_bits_array, stencil_bits_array, depth_buffer_factor, - back_buffer_modes, back_buffer_factor); + back_buffer_modes, back_buffer_factor, + msaa_samples_array, 1, GL_TRUE); if (configs == NULL) { fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__ ); @@ -184,13 +182,12 @@ mgaFillInModes( __DRIscreenPrivate *psp, const __DRIextension *mgaScreenExtensions[] = { &driReadDrawableExtension, &driSwapControlExtension.base, - &driFrameTrackingExtension.base, &driMediaStreamCounterExtension.base, NULL }; static GLboolean -mgaInitDriver(__DRIscreenPrivate *sPriv) +mgaInitDriver(__DRIscreen *sPriv) { mgaScreenPrivate *mgaScreen; MGADRIPtr serverInfo = (MGADRIPtr)sPriv->pDevPriv; @@ -332,7 +329,7 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) static void -mgaDestroyScreen(__DRIscreenPrivate *sPriv) +mgaDestroyScreen(__DRIscreen *sPriv) { mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *) sPriv->private; @@ -385,13 +382,10 @@ static const struct dri_extension g400_extensions[] = static const struct dri_extension card_extensions[] = { - { "GL_ARB_multisample", GL_ARB_multisample_functions }, - { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions }, { "GL_ARB_texture_rectangle", NULL }, - { "GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions }, + { "GL_ARB_vertex_array_object", GL_ARB_vertex_array_object_functions }, { "GL_EXT_blend_logic_op", NULL }, { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions }, - { "GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions }, /* paletted_textures currently doesn't work, but we could fix them later */ #if defined( need_GL_EXT_paletted_texture ) { "GL_EXT_shared_texture_palette", NULL }, @@ -401,7 +395,6 @@ static const struct dri_extension card_extensions[] = { "GL_EXT_stencil_wrap", NULL }, { "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions }, { "GL_MESA_ycbcr_texture", NULL }, - { "GL_SGIS_generate_mipmap", NULL }, { NULL, NULL } }; @@ -429,15 +422,16 @@ static const struct dri_debug_control debug_control[] = static GLboolean -mgaCreateContext( const __GLcontextModes *mesaVis, - __DRIcontextPrivate *driContextPriv, +mgaCreateContext( gl_api api, + const struct gl_config *mesaVis, + __DRIcontext *driContextPriv, void *sharedContextPrivate ) { int i; unsigned maxlevels; - GLcontext *ctx, *shareCtx; + struct gl_context *ctx, *shareCtx; mgaContextPtr mmesa; - __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; + __DRIscreen *sPriv = driContextPriv->driScreenPriv; mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *)sPriv->private; drm_mga_sarea_t *saPriv = (drm_mga_sarea_t *)(((char*)sPriv->pSAREA)+ mgaScreen->sarea_priv_offset); @@ -465,7 +459,7 @@ mgaCreateContext( const __GLcontextModes *mesaVis, shareCtx = ((mgaContextPtr) sharedContextPrivate)->glCtx; else shareCtx = NULL; - mmesa->glCtx = _mesa_create_context(mesaVis, shareCtx, + mmesa->glCtx = _mesa_create_context(API_OPENGL, mesaVis, shareCtx, &functions, (void *) mmesa); if (!mmesa->glCtx) { FREE(mmesa); @@ -539,6 +533,8 @@ mgaCreateContext( const __GLcontextModes *mesaVis, ctx->Const.MaxLineWidthAA = 10.0; ctx->Const.LineWidthGranularity = 1.0; + ctx->Const.MaxDrawBuffers = 1; + mmesa->texture_depth = driQueryOptioni (&mmesa->optionCache, "texture_depth"); if (mmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB) @@ -647,7 +643,7 @@ mgaCreateContext( const __GLcontextModes *mesaVis, } static void -mgaDestroyContext(__DRIcontextPrivate *driContextPriv) +mgaDestroyContext(__DRIcontext *driContextPriv) { mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate; @@ -699,9 +695,9 @@ mgaDestroyContext(__DRIcontextPrivate *driContextPriv) static GLboolean -mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv, - __DRIdrawablePrivate *driDrawPriv, - const __GLcontextModes *mesaVis, +mgaCreateBuffer( __DRIscreen *driScrnPriv, + __DRIdrawable *driDrawPriv, + const struct gl_config *mesaVis, GLboolean isPixmap ) { mgaScreenPrivate *screen = (mgaScreenPrivate *) driScrnPriv->private; @@ -725,7 +721,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv, { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp, screen->frontOffset, screen->frontPitch, @@ -736,7 +732,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp, screen->backOffset, screen->backPitch, @@ -747,7 +743,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, + = driNewRenderbuffer(MESA_FORMAT_Z16, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, @@ -759,7 +755,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv, /* XXX is this right? */ if (mesaVis->stencilBits) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, + = driNewRenderbuffer(MESA_FORMAT_Z24_S8, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, @@ -769,7 +765,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv, } else { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT32, + = driNewRenderbuffer(MESA_FORMAT_Z32, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, @@ -780,7 +776,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv, } else if (mesaVis->depthBits == 32) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT32, + = driNewRenderbuffer(MESA_FORMAT_Z32, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, @@ -791,7 +787,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->stencilBits > 0 && !swStencil) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, + = driNewRenderbuffer(MESA_FORMAT_S8, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, @@ -816,17 +812,17 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv, static void -mgaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) +mgaDestroyBuffer(__DRIdrawable *driDrawPriv) { - _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); + _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL); } static void -mgaSwapBuffers(__DRIdrawablePrivate *dPriv) +mgaSwapBuffers(__DRIdrawable *dPriv) { if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { mgaContextPtr mmesa; - GLcontext *ctx; + struct gl_context *ctx; mmesa = (mgaContextPtr) dPriv->driContextPriv->driverPrivate; ctx = mmesa->glCtx; @@ -841,7 +837,7 @@ mgaSwapBuffers(__DRIdrawablePrivate *dPriv) } static GLboolean -mgaUnbindContext(__DRIcontextPrivate *driContextPriv) +mgaUnbindContext(__DRIcontext *driContextPriv) { mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate; if (mmesa) @@ -857,9 +853,9 @@ mgaUnbindContext(__DRIcontextPrivate *driContextPriv) * But why are we doing context initialization here??? */ static GLboolean -mgaMakeCurrent(__DRIcontextPrivate *driContextPriv, - __DRIdrawablePrivate *driDrawPriv, - __DRIdrawablePrivate *driReadPriv) +mgaMakeCurrent(__DRIcontext *driContextPriv, + __DRIdrawable *driDrawPriv, + __DRIdrawable *driReadPriv) { if (driContextPriv) { mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate; @@ -881,8 +877,8 @@ mgaMakeCurrent(__DRIcontextPrivate *driContextPriv, mmesa->driReadable = driReadPriv; _mesa_make_current(mmesa->glCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate); + (struct gl_framebuffer *) driDrawPriv->driverPrivate, + (struct gl_framebuffer *) driReadPriv->driverPrivate); } else { _mesa_make_current(NULL, NULL, NULL); @@ -894,7 +890,7 @@ mgaMakeCurrent(__DRIcontextPrivate *driContextPriv, void mgaGetLock( mgaContextPtr mmesa, GLuint flags ) { - __DRIdrawablePrivate *dPriv = mmesa->driDrawable; + __DRIdrawable *dPriv = mmesa->driDrawable; drm_mga_sarea_t *sarea = mmesa->sarea; int me = mmesa->hHWContext; int i; @@ -931,7 +927,7 @@ void mgaGetLock( mgaContextPtr mmesa, GLuint flags ) * * \todo maybe fold this into intelInitDriver * - * \return the __GLcontextModes supported by this driver + * \return the struct gl_config supported by this driver */ static const __DRIconfig **mgaInitScreen(__DRIscreen *psp) { @@ -947,22 +943,6 @@ static const __DRIconfig **mgaInitScreen(__DRIscreen *psp) return NULL; - /* Calling driInitExtensions here, with a NULL context pointer, - * does not actually enable the extensions. It just makes sure - * that all the dispatch offsets for all the extensions that - * *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is - * called, but we can't enable the extensions until we have a - * context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - - driInitExtensions( NULL, card_extensions, GL_FALSE ); - driInitExtensions( NULL, g400_extensions, GL_FALSE ); - driInitExtensions(NULL, ARB_vp_extensions, GL_FALSE); - driInitExtensions( NULL, NV_vp_extensions, GL_FALSE ); - if (!mgaInitDriver(psp)) return NULL; @@ -978,7 +958,7 @@ static const __DRIconfig **mgaInitScreen(__DRIscreen *psp) * Get information about previous buffer swaps. */ static int -getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo ) +getSwapInfo( __DRIdrawable *dPriv, __DRIswapInfo * sInfo ) { mgaContextPtr mmesa; @@ -1016,3 +996,10 @@ const struct __DriverAPIRec driDriverAPI = { .WaitForSBC = NULL, .SwapBuffersMSC = NULL }; + +/* This is the table of extensions that the loader will dlsym() for. */ +PUBLIC const __DRIextension *__driDriverExtensions[] = { + &driCoreExtension.base, + &driLegacyExtension.base, + NULL +};