intel: Drop DRI1 SwapBuffer implementation
authorKristian Høgsberg <krh@bitplanet.net>
Fri, 1 Jan 2010 23:31:48 +0000 (18:31 -0500)
committerKristian Høgsberg <krh@bitplanet.net>
Mon, 4 Jan 2010 16:48:01 +0000 (11:48 -0500)
src/mesa/drivers/dri/intel/intel_blit.c
src/mesa/drivers/dri/intel/intel_screen.c
src/mesa/drivers/dri/intel/intel_swapbuffers.c

index 4b83e1d22da6a507c261aecdf0ca15d9f98792f2..3f2f8eb7cda760f0c2ad7ec9f87a2e83f50a0834 100644 (file)
 
 #define FILE_DEBUG_FLAG DEBUG_BLIT
 
-/**
- * Copy the back color buffer to the front color buffer. 
- * Used for SwapBuffers().
- */
-void
-intelCopyBuffer(const __DRIdrawable * dPriv,
-                const drm_clip_rect_t * rect)
-{
-
-   struct intel_context *intel;
-
-   DBG("%s\n", __FUNCTION__);
-
-   assert(dPriv);
-
-   intel = intelScreenContext(dPriv->driScreenPriv->private);
-   if (!intel)
-      return;
-
-   /* The LOCK_HARDWARE is required for the cliprects.  Buffer offsets
-    * should work regardless.
-    */
-   LOCK_HARDWARE(intel);
-
-   if (dPriv && dPriv->numClipRects) {
-      struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
-      struct intel_region *src, *dst;
-      int nbox = dPriv->numClipRects;
-      drm_clip_rect_t *pbox = dPriv->pClipRects;
-      int cpp;
-      int src_pitch, dst_pitch;
-      unsigned short src_x, src_y;
-      int BR13, CMD;
-      int i;
-      dri_bo *aper_array[3];
-
-      src = intel_get_rb_region(&intel_fb->Base, BUFFER_BACK_LEFT);
-      dst = intel_get_rb_region(&intel_fb->Base, BUFFER_FRONT_LEFT);
-
-      src_pitch = src->pitch * src->cpp;
-      dst_pitch = dst->pitch * dst->cpp;
-
-      cpp = src->cpp;
-
-      ASSERT(intel_fb);
-      ASSERT(intel_fb->Base.Name == 0);    /* Not a user-created FBO */
-      ASSERT(src);
-      ASSERT(dst);
-      ASSERT(src->cpp == dst->cpp);
-
-      if (cpp == 2) {
-        BR13 = (0xCC << 16) | BR13_565;
-        CMD = XY_SRC_COPY_BLT_CMD;
-      }
-      else {
-        BR13 = (0xCC << 16) | BR13_8888;
-        CMD = XY_SRC_COPY_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB;
-      }
-
-      assert(src->tiling != I915_TILING_Y);
-      assert(dst->tiling != I915_TILING_Y);
-#ifndef I915
-      if (src->tiling != I915_TILING_NONE) {
-        CMD |= XY_SRC_TILED;
-        src_pitch /= 4;
-      }
-      if (dst->tiling != I915_TILING_NONE) {
-        CMD |= XY_DST_TILED;
-        dst_pitch /= 4;
-      }
-#endif
-      /* do space/cliprects check before going any further */
-      intel_batchbuffer_require_space(intel->batch, 8 * 4,
-                                     REFERENCES_CLIPRECTS);
-   again:
-      aper_array[0] = intel->batch->buf;
-      aper_array[1] = dst->buffer;
-      aper_array[2] = src->buffer;
-
-      if (dri_bufmgr_check_aperture_space(aper_array, 3) != 0) {
-       intel_batchbuffer_flush(intel->batch);
-       goto again;
-      }
-
-      for (i = 0; i < nbox; i++, pbox++) {
-        drm_clip_rect_t box = *pbox;
-
-        if (rect) {
-           if (!intel_intersect_cliprects(&box, &box, rect))
-              continue;
-        }
-
-        if (box.x1 >= box.x2 ||
-            box.y1 >= box.y2)
-           continue;
-
-        assert(box.x1 < box.x2);
-        assert(box.y1 < box.y2);
-        src_x = box.x1 - dPriv->x + dPriv->backX;
-        src_y = box.y1 - dPriv->y + dPriv->backY;
-
-        BEGIN_BATCH(8, REFERENCES_CLIPRECTS);
-        OUT_BATCH(CMD);
-        OUT_BATCH(BR13 | dst_pitch);
-        OUT_BATCH((box.y1 << 16) | box.x1);
-        OUT_BATCH((box.y2 << 16) | box.x2);
-
-        OUT_RELOC(dst->buffer,
-                  I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
-                  0);
-        OUT_BATCH((src_y << 16) | src_x);
-        OUT_BATCH(src_pitch);
-        OUT_RELOC(src->buffer,
-                  I915_GEM_DOMAIN_RENDER, 0,
-                  0);
-        ADVANCE_BATCH();
-      }
-
-      /* Flush the rendering and the batch so that the results all land on the
-       * screen in a timely fashion.
-       */
-      intel_batchbuffer_emit_mi_flush(intel->batch);
-      intel_batchbuffer_flush(intel->batch);
-   }
-
-   UNLOCK_HARDWARE(intel);
-}
-
 static GLuint translate_raster_op(GLenum logicop)
 {
    switch(logicop) {
index 0a1afdfb874d1afe55167c24897d774e69bf7638..807c373b74f5d871ab2847cf19e2085efa605749 100644 (file)
@@ -688,7 +688,6 @@ const struct __DriverAPIRec driDriverAPI = {
    .DestroyContext      = intelDestroyContext,
    .CreateBuffer        = intelCreateBuffer,
    .DestroyBuffer       = intelDestroyBuffer,
-   .SwapBuffers                 = intelSwapBuffers,
    .MakeCurrent                 = intelMakeCurrent,
    .UnbindContext       = intelUnbindContext,
    .GetSwapInfo                 = intelGetSwapInfo,
index 8e3aa9534c4d126d264b4d6d882f70a4eac5975c..9f563e7c1dc0581153153810e3149aa45227f9b7 100644 (file)
@@ -80,66 +80,6 @@ intelFixupVblank(struct intel_context *intel, __DRIdrawable *dPriv)
    }
 }
 
-
-/**
- * Called from driSwapBuffers()
- */
-void
-intelSwapBuffers(__DRIdrawable * dPriv)
-{
-   __DRIscreen *psp = dPriv->driScreenPriv;
-
-   if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
-      GET_CURRENT_CONTEXT(ctx);
-      struct intel_context *intel;
-
-      if (ctx == NULL)
-        return;
-
-      intel = intel_context(ctx);
-
-      if (ctx->Visual.doubleBufferMode) {
-        GLboolean missed_target;
-        struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
-        int64_t ust;
-         
-        _mesa_notifySwapBuffers(ctx);  /* flush pending rendering comands */
-
-       /*
-        * The old swapping ioctl was incredibly racy, just wait for vblank
-        * and do the swap ourselves.
-        */
-        driWaitForVBlank(dPriv, &missed_target);
-
-        /*
-         * Update each buffer's vbl_pending so we don't get too out of
-         * sync
-         */
-        intel_get_renderbuffer(&intel_fb->Base,
-                               BUFFER_BACK_LEFT)->vbl_pending = dPriv->vblSeq;
-         intel_get_renderbuffer(&intel_fb->Base,
-                               BUFFER_FRONT_LEFT)->vbl_pending = dPriv->vblSeq;
-
-        intelCopyBuffer(dPriv, NULL);
-
-        intel_fb->swap_count++;
-        (*psp->systemTime->getUST) (&ust);
-        if (missed_target) {
-           intel_fb->swap_missed_count++;
-           intel_fb->swap_missed_ust = ust - intel_fb->swap_ust;
-        }
-
-        intel_fb->swap_ust = ust;
-      }
-      drmCommandNone(intel->driFd, DRM_I915_GEM_THROTTLE);
-   }
-   else {
-      /* XXX this shouldn't be an error but we can't handle it for now */
-      fprintf(stderr, "%s: drawable has no context!\n", __FUNCTION__);
-   }
-}
-
-
 /**
  * This will be called whenever the currently bound window is moved/resized.
  * XXX: actually, it seems to NOT be called when the window is only moved (BP).