~ubuntu-branches/ubuntu/quantal/mesa/quantal

« back to all changes in this revision

Viewing changes to src/mesa/drivers/dri/i915/intel_context.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-02-21 12:44:07 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: james.westby@ubuntu.com-20070221124407-rgcacs32mycrtadl
ImportĀ upstreamĀ versionĀ 6.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
92
92
 * Mesa's Driver Functions
93
93
 ***************************************/
94
94
 
95
 
#define DRIVER_DATE                     "20050225"
 
95
#define DRIVER_DATE "20061017"
96
96
 
97
97
const GLubyte *intelGetString( GLcontext *ctx, GLenum name )
98
98
{
134
134
   }
135
135
}
136
136
 
137
 
static void intelBufferSize(GLframebuffer *buffer,
138
 
                           GLuint *width, GLuint *height)
139
 
{
140
 
   GET_CURRENT_CONTEXT(ctx);
141
 
   intelContextPtr intel = INTEL_CONTEXT(ctx);
142
 
   /* Need to lock to make sure the driDrawable is uptodate.  This
143
 
    * information is used to resize Mesa's software buffers, so it has
144
 
    * to be correct.
145
 
    */
146
 
   LOCK_HARDWARE(intel);
147
 
   if (intel->driDrawable) {
148
 
      *width = intel->driDrawable->w;
149
 
      *height = intel->driDrawable->h;
150
 
   }
151
 
   else {
152
 
      *width = 0;
153
 
      *height = 0;
154
 
   }
155
 
   UNLOCK_HARDWARE(intel);
156
 
}
157
 
 
158
137
 
159
138
/**
160
139
 * Extension strings exported by the intel driver.
263
242
   functions->Clear = intelClear;
264
243
   functions->Flush = intelglFlush;
265
244
   functions->Finish = intelFinish;
266
 
   functions->GetBufferSize = intelBufferSize;
267
 
   functions->ResizeBuffers = _mesa_resize_framebuffer;
268
245
   functions->GetString = intelGetString;
269
246
   functions->UpdateState = intelInvalidateState;
270
 
   functions->CopyColorTable = _swrast_CopyColorTable;
271
 
   functions->CopyColorSubTable = _swrast_CopyColorSubTable;
272
 
   functions->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
273
 
   functions->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
274
247
 
275
248
   intelInitTextureFuncs( functions );
276
249
   intelInitPixelFuncs( functions );
279
252
 
280
253
static void intel_emit_invarient_state( GLcontext *ctx )
281
254
{
282
 
   intelContextPtr intel = INTEL_CONTEXT(ctx);
283
 
 
284
 
   intel->vtbl.emit_invarient_state( intel );
285
 
   intel->prim.flush = 0;
286
 
 
287
 
   /* Make sure this gets to the hardware, even if we have no cliprects:
288
 
    */
289
 
   LOCK_HARDWARE( intel );
290
 
   intelFlushBatchLocked( intel, GL_TRUE, GL_FALSE, GL_TRUE );
291
 
   UNLOCK_HARDWARE( intel );
292
255
}
293
256
 
294
257
 
398
361
   intel->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS);
399
362
 
400
363
   intel->vblank_flags = (intel->intelScreen->irq_active != 0)
401
 
       ? driGetDefaultVBlankFlags(&intelScreen->optionCache) : VBLANK_FLAG_NO_IRQ;
 
364
       ? driGetDefaultVBlankFlags(&intel->optionCache) : VBLANK_FLAG_NO_IRQ;
402
365
 
403
366
   (*dri_interface->getUST)(&intel->swap_ust);
404
367
   _math_matrix_ctr (&intel->ViewportMatrix);
409
372
     _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
410
373
     _mesa_enable_extension( ctx, "GL_S3_s3tc" );
411
374
   }
412
 
   else if (driQueryOptionb (&intelScreen->optionCache, "force_s3tc_enable")) {
 
375
   else if (driQueryOptionb (&intel->optionCache, "force_s3tc_enable")) {
413
376
     _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
414
377
   }
415
378
 
553
516
void intelWindowMoved( intelContextPtr intel )
554
517
{
555
518
   __DRIdrawablePrivate *dPriv = intel->driDrawable;
 
519
   GLframebuffer *drawFb = (GLframebuffer *) dPriv->driverPrivate;
556
520
 
557
521
   if (!intel->ctx.DrawBuffer) {
558
522
      intelSetFrontClipRects( intel );
559
523
   }
560
524
   else {
561
 
      driUpdateFramebufferSize(&intel->ctx, intel->driDrawable);
562
 
    
563
 
      switch (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0]) {
 
525
      driUpdateFramebufferSize(&intel->ctx, dPriv);
 
526
      switch (drawFb->_ColorDrawBufferMask[0]) {
564
527
      case BUFFER_BIT_FRONT_LEFT:
565
528
         intelSetFrontClipRects( intel );
566
529
         break;
573
536
      }
574
537
   }
575
538
 
576
 
   _mesa_resize_framebuffer(&intel->ctx,
577
 
                            (GLframebuffer*)dPriv->driverPrivate,
578
 
                            dPriv->w, dPriv->h);
579
 
   
 
539
   if (drawFb->Width != dPriv->w || drawFb->Height != dPriv->h) {
 
540
      /* update Mesa's notion of framebuffer/window size */
 
541
      _mesa_resize_framebuffer(&intel->ctx, drawFb, dPriv->w, dPriv->h);
 
542
      drawFb->Initialized = GL_TRUE; /* XXX remove someday */
 
543
   }
 
544
 
580
545
   /* Set state we know depends on drawable parameters:
581
546
    */
582
547
   {
583
548
      GLcontext *ctx = &intel->ctx;
584
549
 
 
550
      if (intel->intelScreen->driScrnPriv->ddxMinor >= 7) {
 
551
         drmI830Sarea *sarea = intel->sarea;
 
552
         drm_clip_rect_t drw_rect = { .x1 = dPriv->x, .x2 = dPriv->x + dPriv->w,
 
553
                                      .y1 = dPriv->y, .y2 = dPriv->y + dPriv->h };
 
554
         drm_clip_rect_t pipeA_rect = { .x1 = sarea->pipeA_x,
 
555
                                        .x2 = sarea->pipeA_x + sarea->pipeA_w,
 
556
                                        .y1 = sarea->pipeA_y,
 
557
                                        .y2 = sarea->pipeA_y + sarea->pipeA_h };
 
558
         drm_clip_rect_t pipeB_rect = { .x1 = sarea->pipeB_x,
 
559
                                        .x2 = sarea->pipeB_x + sarea->pipeB_w,
 
560
                                        .y1 = sarea->pipeB_y,
 
561
                                        .y2 = sarea->pipeB_y + sarea->pipeB_h };
 
562
         GLint areaA = driIntersectArea( drw_rect, pipeA_rect );
 
563
         GLint areaB = driIntersectArea( drw_rect, pipeB_rect );
 
564
         GLuint flags = intel->vblank_flags;
 
565
 
 
566
         if (areaB > areaA || (areaA > 0 && areaB > 0)) {
 
567
            flags = intel->vblank_flags | VBLANK_FLAG_SECONDARY;
 
568
         } else {
 
569
            flags = intel->vblank_flags & ~VBLANK_FLAG_SECONDARY;
 
570
         }
 
571
 
 
572
         if (flags != intel->vblank_flags) {
 
573
            intel->vblank_flags = flags;
 
574
            driGetCurrentVBlank(dPriv, intel->vblank_flags, &intel->vbl_seq);
 
575
         }
 
576
      } else {
 
577
         intel->vblank_flags &= ~VBLANK_FLAG_SECONDARY;
 
578
      }
 
579
 
585
580
      ctx->Driver.Scissor( ctx, ctx->Scissor.X, ctx->Scissor.Y,
586
581
                           ctx->Scissor.Width, ctx->Scissor.Height );
587
582
      
606
601
 
607
602
      if ( intel->driDrawable != driDrawPriv ) {
608
603
         /* Shouldn't the readbuffer be stored also? */
609
 
         driDrawableInitVBlank( driDrawPriv, intel->vblank_flags );
 
604
         driDrawableInitVBlank( driDrawPriv, intel->vblank_flags,
 
605
                                &intel->vbl_seq );
610
606
 
611
607
         intel->driDrawable = driDrawPriv;
612
608
         intelWindowMoved( intel );
752
748
      intel = (intelContextPtr) dPriv->driContextPriv->driverPrivate;
753
749
      ctx = &intel->ctx;
754
750
      if (ctx->Visual.doubleBufferMode) {
755
 
         intelScreenPrivate *screen = intel->intelScreen;
756
751
         drm_clip_rect_t rect;
757
752
         rect.x1 = x + dPriv->x;
758
753
         rect.y1 = (dPriv->h - y - h) + dPriv->y;