diff options
Diffstat (limited to 'src/mesa/drivers')
| -rw-r--r-- | src/mesa/drivers/dri/intel_winsys/intel_context.c | 45 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/intel_winsys/intel_context.h | 12 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c | 17 | 
3 files changed, 49 insertions, 25 deletions
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_context.c b/src/mesa/drivers/dri/intel_winsys/intel_context.c index f8fe74ff1e..dc6a02999e 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_context.c +++ b/src/mesa/drivers/dri/intel_winsys/intel_context.c @@ -177,24 +177,27 @@ intelCreateContext(const __GLcontextModes * mesaVis,                     __DRIcontextPrivate * driContextPriv,                     void *sharedContextPrivate)  { -   struct dd_function_table functions; -        struct intel_context *intel = CALLOC_STRUCT(intel_context); +#if 0 +   struct dd_function_table functions;     GLcontext *ctx = &intel->ctx; -     GLcontext *shareCtx = (GLcontext *) sharedContextPrivate; +#endif +     __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;     intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private;     drmI830Sarea *saPriv = intelScreen->sarea;     int fthrottle_mode;     GLboolean havePools; +#if 0     intelInitDriverFunctions(&functions);     if (!_mesa_initialize_context(&intel->ctx,                                   mesaVis, shareCtx,                                   &functions, (void *) intel))        return GL_FALSE; +#endif     driContextPriv->driverPrivate = intel;     intel->intelScreen = intelScreen; @@ -231,10 +234,13 @@ intelCreateContext(const __GLcontextModes * mesaVis,     /* Disable imaging extension until convolution is working in      * teximage paths:      */ +#if 0     driInitExtensions(ctx, card_extensions,  /* 		      GL_TRUE, */                       GL_FALSE); +#endif +#if 0     if (intel->ctx.Mesa_DXTn) {        _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");        _mesa_enable_extension(ctx, "GL_S3_s3tc"); @@ -242,6 +248,7 @@ intelCreateContext(const __GLcontextModes * mesaVis,     else if (driQueryOptionb(&intel->optionCache, "force_s3tc_enable")) {        _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");     } +#endif  #ifdef DEBUG     __intel_debug = driParseDebugString(getenv("INTEL_DEBUG"), debug_control); @@ -275,7 +282,12 @@ intelCreateContext(const __GLcontextModes * mesaVis,        }     } +#if 0     st_create_context( &intel->ctx, intel->pipe );  +#else +   intel->st = st_create_context2(intel->pipe,  mesaVis, NULL); +   intel->st->ctx->DriverCtx = intel; +#endif     return GL_TRUE;  } @@ -285,6 +297,7 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)  {     struct intel_context *intel =        (struct intel_context *) driContextPriv->driverPrivate; +   GLcontext *ctx = intel->st->ctx;     assert(intel);               /* should never be null */     if (intel) { @@ -294,7 +307,7 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)        //intel->vtbl.destroy(intel); -      release_texture_heaps = (intel->ctx.Shared->RefCount == 1); +      release_texture_heaps = (ctx->Shared->RefCount == 1);        intel_batchbuffer_free(intel->batch); @@ -316,10 +329,14 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)            */        } +#if 0        /* free the Mesa context data */ -      _mesa_free_context_data(&intel->ctx); +      _mesa_free_context_data(ctx);        st_destroy_context(intel->ctx.st); +#else +      st_destroy_context2(intel->st); +#endif     }  } @@ -329,8 +346,9 @@ intelUnbindContext(__DRIcontextPrivate * driContextPriv)     struct intel_context *intel = (struct intel_context *) driContextPriv->driverPrivate;     /* XXX UnbindContext is called AFTER the new context is made current.        Hopefully shouldn't be a problem ? */ -   FLUSH_VERTICES((&intel->ctx), 0); -   intelFlush(&intel->ctx); +   GLcontext *ctx = intel->st->ctx; +   FLUSH_VERTICES(ctx, 0); +   intelFlush(ctx);     return GL_TRUE;  } @@ -338,8 +356,8 @@ intelUnbindContext(__DRIcontextPrivate * driContextPriv)  /**   * Copied/modified from drirenderbuffer.c   */ -static void -updateFramebufferSize(GLcontext *ctx, const __DRIdrawablePrivate *dPriv) +void +intelUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawablePrivate *dPriv)  {     struct gl_framebuffer *fb = (struct gl_framebuffer *) dPriv->driverPrivate;     if (fb && (dPriv->w != fb->Width || dPriv->h != fb->Height)) { @@ -371,23 +389,24 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,        struct intel_framebuffer *intel_fb =  	 (struct intel_framebuffer *) driDrawPriv->driverPrivate;        GLframebuffer *readFb = (GLframebuffer *) driReadPriv->driverPrivate; +      GLcontext *ctx = intel->st->ctx;        /* this is a hack so we have a valid context when the region allocation           is done. Need a per-screen context? */        intel->intelScreen->dummyctxptr = intel;        /* update GLframebuffer size to match window if needed */ -      updateFramebufferSize(&intel->ctx, driDrawPriv); +      intelUpdateFramebufferSize(ctx, driDrawPriv);        if (driReadPriv != driDrawPriv) { -         updateFramebufferSize(&intel->ctx, driReadPriv); +         intelUpdateFramebufferSize(ctx, driReadPriv);        } -      _mesa_make_current(&intel->ctx, &intel_fb->Base, readFb); +      _mesa_make_current(ctx, &intel_fb->Base, readFb);        /* The drawbuffer won't always be updated by _mesa_make_current:          */ -      if (intel->ctx.DrawBuffer == &intel_fb->Base) { +      if (ctx->DrawBuffer == &intel_fb->Base) {  	 if (intel->driDrawable != driDrawPriv) {  	    if (driDrawPriv->pdraw->swap_interval == (unsigned)-1) { diff --git a/src/mesa/drivers/dri/intel_winsys/intel_context.h b/src/mesa/drivers/dri/intel_winsys/intel_context.h index 76c900157a..281d68cc7e 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_context.h +++ b/src/mesa/drivers/dri/intel_winsys/intel_context.h @@ -44,16 +44,16 @@ struct pipe_context;  struct pipe_region;  struct intel_context;  struct _DriBufferObject; - +struct st_context;  #define INTEL_MAX_FIXUP 64  struct intel_context  { -   GLcontext ctx;               /* the parent class */ -    -   struct pipe_context *pipe; +   struct st_context *st; + +   struct pipe_context *pipe;  /**< a softpipe or i915simple context */     GLint refcount; @@ -158,7 +158,7 @@ extern void intelFlush(GLcontext * ctx);  static INLINE struct intel_context *  intel_context(GLcontext * ctx)  { -   return (struct intel_context *) ctx; +   return (struct intel_context *) ctx->DriverCtx;  }  extern struct intel_renderbuffer *intel_renderbuffer(struct gl_renderbuffer @@ -166,5 +166,7 @@ extern struct intel_renderbuffer *intel_renderbuffer(struct gl_renderbuffer  extern void intel_init_region_functions(struct pipe_context *pipe); +extern void +intelUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawablePrivate *dPriv);  #endif diff --git a/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c b/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c index a6d0d43e4d..2ffc757469 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c +++ b/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c @@ -30,12 +30,14 @@  #include "intel_swapbuffers.h"  #include "intel_batchbuffer.h"  #include "intel_reg.h" +#include "intel_winsys.h"  #include "context.h"  #include "utils.h"  #include "drirenderbuffer.h"  #include "vblank.h"  #include "pipe/p_context.h" +#include "state_tracker/st_context.h"  #include "state_tracker/st_cb_fbo.h" @@ -95,8 +97,8 @@ intelCopyBuffer(__DRIdrawablePrivate * dPriv,     /* if this drawable isn't currently bound the LOCK_HARDWARE done on the        current context (which is what intelScreenContext should return) might        not get a contended lock and thus cliprects not updated (tests/manywin) */ -      if ((struct intel_context *)dPriv->driContextPriv->driverPrivate != intel) -         DRI_VALIDATE_DRAWABLE_INFO(intel->driScreen, dPriv); +   if ((struct intel_context *)dPriv->driContextPriv->driverPrivate != intel) +      DRI_VALIDATE_DRAWABLE_INFO(intel->driScreen, dPriv);     if (dPriv && dPriv->numClipRects) { @@ -210,7 +212,8 @@ intelCopyBuffer(__DRIdrawablePrivate * dPriv,  		   DRM_BO_MASK_MEM | DRM_BO_FLAG_WRITE, 0);  	 OUT_BATCH((sbox.y1 << 16) | sbox.x1);  	 OUT_BATCH((srcpitch * cpp) & 0xffff); -	 OUT_RELOC(backRegion->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ, +	 OUT_RELOC(dri_bo(backRegion->buffer), +                   DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ,  		   DRM_BO_MASK_MEM | DRM_BO_FLAG_READ, 0);  	 ADVANCE_BATCH(); @@ -245,18 +248,18 @@ intelCopyBuffer(__DRIdrawablePrivate * dPriv,  void  intelWindowMoved(struct intel_context *intel)  { -   GLcontext *ctx = &intel->ctx; +   GLcontext *ctx = intel->st->ctx;     __DRIdrawablePrivate *dPriv = intel->driDrawable;     struct intel_framebuffer *intel_fb = dPriv->driverPrivate; -   if (!intel->ctx.DrawBuffer) { +   if (!intel->st->ctx->DrawBuffer) {        /* when would this happen? -BP */        assert(0);        intel->numClipRects = 0;     }     /* Update Mesa's notion of window size */ -   driUpdateFramebufferSize(ctx, dPriv); +   intelUpdateFramebufferSize(ctx, dPriv);     intel_fb->Base.Initialized = GL_TRUE; /* XXX remove someday */     { @@ -615,7 +618,7 @@ intelCopySubBuffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)     if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {        struct intel_context *intel =           (struct intel_context *) dPriv->driContextPriv->driverPrivate; -      GLcontext *ctx = &intel->ctx; +      GLcontext *ctx = intel->st->ctx;        if (ctx->Visual.doubleBufferMode) {           drm_clip_rect_t rect;  | 
