intel: Drop DRI1 SwapBuffer implementation
[mesa.git] / src / mesa / drivers / dri / intel / intel_blit.c
index 9f638b0ef985c41a116fa0851db4e7151dbba057..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 __DRIdrawablePrivate * dPriv,
-                const drm_clip_rect_t * rect)
-{
-
-   struct intel_context *intel;
-   const intelScreenPrivate *intelScreen;
-
-   DBG("%s\n", __FUNCTION__);
-
-   assert(dPriv);
-
-   intel = intelScreenContext(dPriv->driScreenPriv->private);
-   if (!intel)
-      return;
-
-   intelScreen = intel->intelScreen;
-
-   /* 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) {
@@ -499,10 +368,11 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
                  switch (irb->Base.Format) {
                  case MESA_FORMAT_ARGB8888:
                  case MESA_FORMAT_XRGB8888:
-                    clearVal = intel->ClearColor8888;
+                    clearVal = PACK_COLOR_8888(clear[3], clear[0],
+                                               clear[1], clear[2]);
                     break;
                  case MESA_FORMAT_RGB565:
-                    clearVal = intel->ClearColor565;
+                    clearVal = PACK_COLOR_565(clear[0], clear[1], clear[2]);
                     break;
                  case MESA_FORMAT_ARGB4444:
                     clearVal = PACK_COLOR_4444(clear[3], clear[0],