~ubuntu-branches/ubuntu/precise/mesa/precise-updates

« back to all changes in this revision

Viewing changes to src/mesa/drivers/dri/nouveau/nouveau_context.c

  • Committer: Package Import Robot
  • Author(s): Robert Hooker
  • Date: 2012-02-02 12:05:48 UTC
  • mfrom: (1.7.1) (3.3.27 sid)
  • Revision ID: package-import@ubuntu.com-20120202120548-nvkma85jq0h4coix
Tags: 8.0~rc2-0ubuntu4
Drop drisearchdir handling, it is no longer needed with multiarch
and dri-alternates being removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 *
25
25
 */
26
26
 
 
27
#include <stdbool.h>
27
28
#include "nouveau_driver.h"
28
29
#include "nouveau_context.h"
29
30
#include "nouveau_bufferobj.h"
33
34
#include "main/framebuffer.h"
34
35
#include "main/light.h"
35
36
#include "main/state.h"
 
37
#include "main/version.h"
36
38
#include "drivers/common/meta.h"
37
39
#include "drivers/common/driverfuncs.h"
38
40
#include "swrast/swrast.h"
41
43
#include "tnl/tnl.h"
42
44
#include "tnl/t_context.h"
43
45
 
44
 
#define need_GL_EXT_framebuffer_object
45
 
#define need_GL_EXT_fog_coord
46
 
#define need_GL_EXT_secondary_color
47
 
 
48
 
#include "main/remap_helper.h"
49
 
 
50
 
static const struct dri_extension nouveau_extensions[] = {
51
 
        { "GL_ARB_multitexture",        NULL },
52
 
        { "GL_ARB_texture_env_add",     NULL },
53
 
        { "GL_ARB_texture_mirrored_repeat", NULL },
54
 
        { "GL_EXT_fog_coord",           GL_EXT_fog_coord_functions },
55
 
        { "GL_EXT_framebuffer_blit",    NULL },
56
 
        { "GL_EXT_framebuffer_object",  GL_EXT_framebuffer_object_functions },
57
 
        { "GL_EXT_packed_depth_stencil", NULL},
58
 
        { "GL_EXT_secondary_color",     GL_EXT_secondary_color_functions },
59
 
        { "GL_EXT_stencil_wrap",        NULL },
60
 
        { "GL_EXT_texture_env_combine", NULL },
61
 
        { "GL_EXT_texture_filter_anisotropic", NULL },
62
 
        { "GL_EXT_texture_lod_bias",    NULL },
63
 
        { "GL_NV_blend_square",         NULL },
64
 
        { "GL_NV_texture_env_combine4", NULL },
65
 
        { NULL,                         NULL }
66
 
};
67
 
 
68
46
static void
69
47
nouveau_channel_flush_notify(struct nouveau_channel *chan)
70
48
{
78
56
GLboolean
79
57
nouveau_context_create(gl_api api,
80
58
                       const struct gl_config *visual, __DRIcontext *dri_ctx,
 
59
                       unsigned major_version,
 
60
                       unsigned minor_version,
 
61
                       uint32_t flags,
 
62
                       unsigned *error,
81
63
                       void *share_ctx)
82
64
{
83
65
        __DRIscreen *dri_screen = dri_ctx->driScreenPriv;
84
 
        struct nouveau_screen *screen = dri_screen->private;
 
66
        struct nouveau_screen *screen = dri_screen->driverPrivate;
85
67
        struct nouveau_context *nctx;
86
68
        struct gl_context *ctx;
87
69
 
 
70
        /* API and flag filtering is handled in dri2CreateContextAttribs.
 
71
         */
 
72
        (void) api;
 
73
        (void) flags;
 
74
 
88
75
        ctx = screen->driver->context_create(screen, visual, share_ctx);
89
 
        if (!ctx)
 
76
        if (!ctx) {
 
77
                *error = __DRI_CTX_ERROR_NO_MEMORY;
90
78
                return GL_FALSE;
 
79
        }
91
80
 
92
81
        nctx = to_nouveau_context(ctx);
93
82
        nctx->dri_context = dri_ctx;
94
83
        dri_ctx->driverPrivate = ctx;
95
84
 
 
85
        _mesa_compute_version(ctx);
 
86
        if (ctx->VersionMajor < major_version
 
87
            || (ctx->VersionMajor == major_version
 
88
                && ctx->VersionMinor < minor_version)) {
 
89
           nouveau_context_destroy(dri_ctx);
 
90
           *error = __DRI_CTX_ERROR_BAD_VERSION;
 
91
           return GL_FALSE;
 
92
        }
 
93
 
 
94
        *error = __DRI_CTX_ERROR_SUCCESS;
96
95
        return GL_TRUE;
97
96
}
98
97
 
140
139
        nctx->hw.chan->user_private = nctx;
141
140
 
142
141
        /* Enable any supported extensions. */
143
 
        driInitExtensions(ctx, nouveau_extensions, GL_TRUE);
 
142
        ctx->Extensions.EXT_blend_color = true;
 
143
        ctx->Extensions.EXT_blend_minmax = true;
 
144
        ctx->Extensions.EXT_fog_coord = true;
 
145
        ctx->Extensions.EXT_framebuffer_blit = true;
 
146
        ctx->Extensions.EXT_framebuffer_object = true;
 
147
        ctx->Extensions.EXT_packed_depth_stencil = true;
 
148
        ctx->Extensions.EXT_secondary_color = true;
 
149
        ctx->Extensions.EXT_texture_filter_anisotropic = true;
 
150
        ctx->Extensions.NV_blend_square = true;
 
151
        ctx->Extensions.NV_texture_env_combine4 = true;
144
152
 
145
153
        return GL_TRUE;
146
154
}
191
199
        __DRIbuffer *buffers = NULL;
192
200
        int i = 0, count, ret;
193
201
 
194
 
        if (draw->lastStamp == *draw->pStamp)
 
202
        if (draw->lastStamp == draw->dri2.stamp)
195
203
                return;
196
 
        draw->lastStamp = *draw->pStamp;
 
204
        draw->lastStamp = draw->dri2.stamp;
197
205
 
198
206
        if (nfb->need_front)
199
207
                attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
271
279
        struct gl_context *ctx = dri_ctx->driverPrivate;
272
280
        struct gl_framebuffer *fb = draw->driverPrivate;
273
281
 
274
 
        *stamp = *draw->pStamp;
 
282
        *stamp = draw->dri2.stamp;
275
283
 
276
284
        nouveau_update_renderbuffers(dri_ctx, draw);
277
285
        _mesa_resize_framebuffer(ctx, fb, draw->w, draw->h);
351
359
                dri2InvalidateDrawable(draw);
352
360
        }
353
361
 
354
 
        if (*draw->pStamp != *stamp)
 
362
        if (draw->dri2.stamp != *stamp)
355
363
                update_framebuffer(dri_ctx, draw, stamp);
356
364
}
357
365