X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fnouveau%2Fnouveau_context.c;h=a403c24c80985f335e8ed3c79bc8dfcae4d8e91a;hb=c139708087ead063da7ac64126af69f2fe7bcf1e;hp=d7d5a04e6921a1cf41cdfec0bc0a3895866cbc38;hpb=666004148353fa46e818772e496f6d09bd979737;p=mesa.git diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index d7d5a04e692..a403c24c809 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -31,12 +31,14 @@ #include "nouveau_fbo.h" #include "nv_object.xml.h" +#include "main/api_exec.h" #include "main/dd.h" #include "main/framebuffer.h" #include "main/fbobject.h" #include "main/light.h" #include "main/state.h" #include "main/version.h" +#include "main/vtxfmt.h" #include "drivers/common/meta.h" #include "drivers/common/driverfuncs.h" #include "swrast/swrast.h" @@ -59,9 +61,31 @@ nouveau_context_create(gl_api api, struct nouveau_context *nctx; struct gl_context *ctx; + switch (api) { + case API_OPENGL_COMPAT: + /* Do after-the-fact version checking (below). + */ + break; + case API_OPENGLES: + /* NV10 and NV20 can support OpenGL ES 1.0 only. Older chips + * cannot do even that. + */ + if ((screen->device->chipset & 0xf0) == 0x00) { + *error = __DRI_CTX_ERROR_BAD_API; + return GL_FALSE; + } else if (minor_version != 0) { + *error = __DRI_CTX_ERROR_BAD_VERSION; + return GL_FALSE; + } + break; + case API_OPENGLES2: + case API_OPENGL_CORE: + *error = __DRI_CTX_ERROR_BAD_API; + return GL_FALSE; + } + /* API and flag filtering is handled in dri2CreateContextAttribs. */ - (void) api; (void) flags; ctx = screen->driver->context_create(screen, visual, share_ctx); @@ -75,14 +99,16 @@ nouveau_context_create(gl_api api, dri_ctx->driverPrivate = ctx; _mesa_compute_version(ctx); - if (ctx->VersionMajor < major_version - || (ctx->VersionMajor == major_version - && ctx->VersionMinor < minor_version)) { + if (ctx->Version < major_version * 10 + minor_version) { nouveau_context_destroy(dri_ctx); *error = __DRI_CTX_ERROR_BAD_VERSION; return GL_FALSE; } + /* Exec table initialization requires the version to be computed */ + _mesa_initialize_dispatch_tables(ctx); + _mesa_initialize_vbo_vtxfmt(ctx); + if (nouveau_bo_new(context_dev(ctx), NOUVEAU_BO_VRAM, 0, 4096, NULL, &nctx->fence)) { nouveau_context_destroy(dri_ctx); @@ -113,8 +139,8 @@ nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen, nouveau_fbo_functions_init(&functions); /* Initialize the mesa context. */ - _mesa_initialize_context(ctx, API_OPENGL, visual, - share_ctx, &functions, NULL); + _mesa_initialize_context(ctx, API_OPENGL_COMPAT, visual, + share_ctx, &functions); nouveau_state_init(ctx); nouveau_scratch_init(ctx); @@ -174,9 +200,7 @@ nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen, ctx->Extensions.EXT_blend_minmax = true; ctx->Extensions.EXT_fog_coord = true; ctx->Extensions.EXT_framebuffer_blit = true; - ctx->Extensions.EXT_framebuffer_object = true; ctx->Extensions.EXT_packed_depth_stencil = true; - ctx->Extensions.EXT_secondary_color = true; ctx->Extensions.EXT_texture_filter_anisotropic = true; ctx->Extensions.NV_blend_square = true; ctx->Extensions.NV_texture_env_combine4 = true;