Remove remnants of i915 texture-from-pbo code.
authorKeith Whitwell <keith@tungstengraphics.com>
Thu, 2 Aug 2007 13:50:08 +0000 (14:50 +0100)
committerKeith Whitwell <keith@tungstengraphics.com>
Thu, 2 Aug 2007 13:50:08 +0000 (14:50 +0100)
src/mesa/drivers/dri/i915pipe/intel_buffer_objects.c
src/mesa/drivers/dri/i915pipe/intel_buffer_objects.h
src/mesa/drivers/dri/i915pipe/intel_regions.c
src/mesa/drivers/dri/i915pipe/intel_screen.c
src/mesa/drivers/dri/i915pipe/intel_state.c
src/mesa/drivers/dri/i915pipe/intel_tex_image.c
src/mesa/pipe/p_context.h
src/mesa/pipe/p_state.h

index eee5fa9bf47329c4a3a4715ccb44ca8a28966007..fdcfdca9bbaf370efde0eb2a986e1448c2264321 100644 (file)
@@ -62,39 +62,6 @@ intel_bufferobj_alloc(GLcontext * ctx, GLuint name, GLenum target)
 }
 
 
-/* Break the COW tie to the region.  The region gets to keep the data.
- */
-void
-intel_bufferobj_release_region(struct intel_context *intel,
-                               struct intel_buffer_object *intel_obj)
-{
-   assert(intel_obj->region->buffer == intel_obj->buffer);
-   intel_obj->region->pbo = NULL;
-   intel_obj->region = NULL;
-   driBOUnReference(intel_obj->buffer);
-   intel_obj->buffer = NULL;
-
-   /* This leads to a large number of buffer deletion/creation events.
-    * Currently the drm doesn't like that:
-    */
-   driGenBuffers(intel->intelScreen->regionPool,
-                 "buffer object", 1, &intel_obj->buffer, 64, 0, 0);
-   LOCK_HARDWARE(intel);
-   driBOData(intel_obj->buffer, intel_obj->Base.Size, NULL, 0);
-   UNLOCK_HARDWARE(intel);
-}
-
-/* Break the COW tie to the region.  Both the pbo and the region end
- * up with a copy of the data.
- */
-void
-intel_bufferobj_cow(struct intel_context *intel,
-                    struct intel_buffer_object *intel_obj)
-{
-   assert(intel_obj->region);
-   intel->pipe->region_cow(intel->pipe, intel_obj->region);
-}
-
 
 /**
  * Deallocate/free a vertex/pixel buffer object.
@@ -103,15 +70,11 @@ intel_bufferobj_cow(struct intel_context *intel,
 static void
 intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj)
 {
-   struct intel_context *intel = intel_context(ctx);
    struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
 
    assert(intel_obj);
 
-   if (intel_obj->region) {
-      intel_bufferobj_release_region(intel, intel_obj);
-   }
-   else if (intel_obj->buffer) {
+   if (intel_obj->buffer) {
       driDeleteBuffers(1, &intel_obj->buffer);
    }
 
@@ -139,9 +102,6 @@ intel_bufferobj_data(GLcontext * ctx,
    intel_obj->Base.Size = size;
    intel_obj->Base.Usage = usage;
 
-   if (intel_obj->region)
-      intel_bufferobj_release_region(intel, intel_obj);
-
    LOCK_HARDWARE(intel);
    driBOData(intel_obj->buffer, size, data, 0);
    UNLOCK_HARDWARE(intel);
@@ -161,14 +121,10 @@ intel_bufferobj_subdata(GLcontext * ctx,
                         GLsizeiptrARB size,
                         const GLvoid * data, struct gl_buffer_object *obj)
 {
-   struct intel_context *intel = intel_context(ctx);
    struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
 
    assert(intel_obj);
 
-   if (intel_obj->region)
-      intel_bufferobj_cow(intel, intel_obj);
-
    driBOSubData(intel_obj->buffer, offset, size, data);
 }
 
@@ -199,16 +155,12 @@ intel_bufferobj_map(GLcontext * ctx,
                     GLenum target,
                     GLenum access, struct gl_buffer_object *obj)
 {
-   struct intel_context *intel = intel_context(ctx);
    struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
 
    /* XXX: Translate access to flags arg below:
     */
    assert(intel_obj);
 
-   if (intel_obj->region)
-      intel_bufferobj_cow(intel, intel_obj);
-
    obj->Pointer = driBOMap(intel_obj->buffer,
                            DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 0);
    return obj->Pointer;
@@ -235,13 +187,6 @@ struct _DriBufferObject *
 intel_bufferobj_buffer(struct intel_context *intel,
                        struct intel_buffer_object *intel_obj, GLuint flag)
 {
-   if (intel_obj->region) {
-      if (flag == INTEL_WRITE_PART)
-         intel_bufferobj_cow(intel, intel_obj);
-      else if (flag == INTEL_WRITE_FULL)
-         intel_bufferobj_release_region(intel, intel_obj);
-   }
-
    return intel_obj->buffer;
 }
 
index a1f63c147b80df3723229a5551fb9f7296d77dcd..0f648104ee9c7ba59b5ebed587db6fad5631c188 100644 (file)
@@ -42,10 +42,6 @@ struct intel_buffer_object
 {
    struct gl_buffer_object Base;
    struct _DriBufferObject *buffer;     /* the low-level buffer manager's buffer handle */
-
-   struct pipe_region *region; /* Is there a zero-copy texture
-                                   associated with this (pixel)
-                                   buffer object? */
 };
 
 
index bdbc59e7ac2f84fbd4246d5b5fd37cc526c83df3..f2280ceb515004c7f72e2f023ef55a1f9802c843 100644 (file)
@@ -75,10 +75,6 @@ intel_region_map(struct pipe_context *pipe, struct pipe_region *region)
 {
    DBG("%s\n", __FUNCTION__);
    if (!region->map_refcount++) {
-      if (region->pbo) {
-         pipe->region_cow(pipe, region);
-      }
-
       region->map = driBOMap(region->buffer,
                              DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 0);
    }
@@ -96,8 +92,6 @@ intel_region_unmap(struct pipe_context *pipe, struct pipe_region *region)
    }
 }
 
-#undef TEST_CACHED_TEXTURES
-
 static struct pipe_region *
 intel_region_alloc(struct pipe_context *pipe,
                    GLuint cpp, GLuint pitch, GLuint height)
@@ -115,13 +109,9 @@ intel_region_alloc(struct pipe_context *pipe,
 
    driGenBuffers(intelScreen->regionPool,
                  "region", 1, &region->buffer, 64,
-#ifdef TEST_CACHED_TEXTURES             
-                DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_BIND_CACHED |
-                DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 
-#else
                 0,
-#endif
                 0);
+
    LOCK_HARDWARE(intel);
    driBOData(region->buffer, pitch * cpp * height, NULL, 0);
    UNLOCK_HARDWARE(intel);
@@ -142,9 +132,6 @@ intel_region_release(struct pipe_context *pipe, struct pipe_region **region)
    if ((*region)->refcount == 0) {
       assert((*region)->map_refcount == 0);
 
-      if ((*region)->pbo)
-        (*region)->pbo->region = NULL;
-      (*region)->pbo = NULL;
       driBOUnReference((*region)->buffer);
       free(*region);
    }
@@ -275,15 +262,6 @@ intel_region_data(struct pipe_context *pipe,
    if (intel == NULL)
       return;
 
-   if (dst->pbo) {
-      if (dstx == 0 &&
-          dsty == 0 && width == dst->pitch && height == dst->height)
-         pipe->region_release_pbo(pipe, dst);
-      else
-         pipe->region_cow(pipe, dst);
-   }
-
-
    LOCK_HARDWARE(intel);
 
    _mesa_copy_rect(pipe->region_map(pipe, dst) + dst_offset,
@@ -317,14 +295,6 @@ intel_region_copy(struct pipe_context *pipe,
    if (intel == NULL)
       return;
 
-   if (dst->pbo) {
-      if (dstx == 0 &&
-          dsty == 0 && width == dst->pitch && height == dst->height)
-         pipe->region_release_pbo(pipe, dst);
-      else
-         pipe->region_cow(pipe, dst);
-   }
-
    assert(src->cpp == dst->cpp);
 
    intelEmitCopyBlit(intel,
@@ -354,141 +324,18 @@ intel_region_fill(struct pipe_context *pipe,
    if (intel == NULL)
       return;   
 
-   if (dst->pbo) {
-      if (dstx == 0 &&
-          dsty == 0 && width == dst->pitch && height == dst->height)
-         pipe->region_release_pbo(pipe, dst);
-      else
-         pipe->region_cow(pipe, dst);
-   }
-
    intelEmitFillBlit(intel,
                      dst->cpp,
                      dst->pitch, dst->buffer, dst_offset,
                      dstx, dsty, width, height, value, mask);
 }
 
-/* Attach to a pbo, discarding our data.  Effectively zero-copy upload
- * the pbo's data.
- */
-static void
-intel_region_attach_pbo(struct pipe_context *pipe,
-                        struct pipe_region *region,
-                        struct intel_buffer_object *pbo)
-{
-   if (region->pbo == pbo)
-      return;
-
-   /* If there is already a pbo attached, break the cow tie now.
-    * Don't call pipe_region_release_pbo() as that would
-    * unnecessarily allocate a new buffer we would have to immediately
-    * discard.
-    */
-   if (region->pbo) {
-      region->pbo->region = NULL;
-      region->pbo = NULL;
-   }
-
-   if (region->buffer) {
-      driDeleteBuffers(1, &region->buffer);
-      region->buffer = NULL;
-   }
-
-   region->pbo = pbo;
-   region->pbo->region = region;
-   region->buffer = driBOReference(pbo->buffer);
-}
-
 
-/* Break the COW tie to the pbo.  The pbo gets to keep the data.
- */
-static void
-intel_region_release_pbo(struct pipe_context *pipe,
-                         struct pipe_region *region)
-{
-   intelScreenPrivate *intelScreen = pipe_screen(pipe);
-   struct intel_context *intel = intelScreenContext(intelScreen);
-
-   assert(region->buffer == region->pbo->buffer);
-   region->pbo->region = NULL;
-   region->pbo = NULL;
-   driBOUnReference(region->buffer);
-   region->buffer = NULL;
-
-   driGenBuffers(intelScreen->regionPool,
-                 "region", 1, &region->buffer, 64, 0, 0);
-   
-   LOCK_HARDWARE(intel);
-   driBOData(region->buffer,
-             region->cpp * region->pitch * region->height, NULL, 0);
-   UNLOCK_HARDWARE(intel);
-}
-
-/* Break the COW tie to the pbo.  Both the pbo and the region end up
- * with a copy of the data.
- */
-static void
-intel_region_cow(struct pipe_context *pipe, struct pipe_region *region)
-{
-   intelScreenPrivate *intelScreen = pipe_screen(pipe);
-   struct intel_context *intel = intelScreenContext(intelScreen);
-   struct intel_buffer_object *pbo = region->pbo;
-
-   if (intel == NULL)
-      return;
-
-   pipe->region_release_pbo(pipe, region);
-
-   assert(region->cpp * region->pitch * region->height == pbo->Base.Size);
-
-   DBG("%s (%d bytes)\n", __FUNCTION__, pbo->Base.Size);
-
-   /* Now blit from the texture buffer to the new buffer: 
-    */
-
-   intel_batchbuffer_flush(intel->batch);
-
-   if (!intel->locked) {
-      LOCK_HARDWARE(intel);
-      intelEmitCopyBlit(intel,
-                       region->cpp,
-                       region->pitch,
-                       region->buffer, 0,
-                       region->pitch,
-                       pbo->buffer, 0,
-                       0, 0, 0, 0, 
-                       region->pitch, region->height,
-                       GL_COPY);
-      
-      intel_batchbuffer_flush(intel->batch);
-      UNLOCK_HARDWARE(intel);
-   }
-   else {
-      intelEmitCopyBlit(intel,
-                       region->cpp,
-                       region->pitch,
-                       region->buffer, 0,
-                       region->pitch,
-                       pbo->buffer, 0,
-                       0, 0, 0, 0, 
-                       region->pitch, region->height,
-                       GL_COPY);
-      
-      intel_batchbuffer_flush(intel->batch);
-   }
-}
 
 static struct _DriBufferObject *
 intel_region_buffer(struct pipe_context *pipe,
                     struct pipe_region *region, GLuint flag)
 {
-   if (region->pbo) {
-      if (flag == INTEL_WRITE_PART)
-         pipe->region_cow(pipe, region);
-      else if (flag == INTEL_WRITE_FULL)
-         pipe->region_release_pbo(pipe, region);
-   }
-
    return region->buffer;
 }
 
@@ -507,9 +354,6 @@ intel_init_region_functions(struct pipe_context *pipe)
    pipe->region_data = intel_region_data;
    pipe->region_copy = intel_region_copy;
    pipe->region_fill = intel_region_fill;
-   pipe->region_cow = intel_region_cow;
-   pipe->region_attach_pbo = intel_region_attach_pbo;
-   pipe->region_release_pbo = intel_region_release_pbo;
    pipe->region_buffer = intel_region_buffer;
 }
 
index fad3a2c29b72218b3050665dcc4febea64acaa7f..565bfc52430346a96f32f191cb210ca769cf453b 100644 (file)
@@ -101,7 +101,6 @@ intel_recreate_static(struct pipe_context *pipe,
                      void *virtual,
                      GLuint cpp, GLuint pitch, GLuint height)
 {
-   struct intel_context *intel = 0;
   if (region) {
      pipe->region_update_static(pipe, region, mem_type, offset,
                                 virtual, cpp, pitch, height);
index fc98b6a12bafa5255c0045ac3caf68a7c10023dc..2455f177dad398604d8b68620a50cbaebd881a41 100644 (file)
@@ -245,8 +245,6 @@ intelDepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval)
 static void
 intelRenderMode(GLcontext * ctx, GLenum mode)
 {
-   struct intel_context *intel = intel_context(ctx);
-   FALLBACK(intel, INTEL_FALLBACK_RENDERMODE, (mode != GL_RENDER));
 }
 
 
index 37307b49c5ea1f542a5b2dabc65c70ec1e89558d..b4e440e49a1b70623ec8689f303978c2f0970a56 100644 (file)
@@ -254,38 +254,7 @@ try_pbo_zcopy(struct intel_context *intel,
               GLint width, GLint height,
               GLenum format, GLenum type, const void *pixels)
 {
-   struct intel_buffer_object *pbo = intel_buffer_object(unpack->BufferObj);
-   GLuint src_offset, src_stride;
-   GLuint dst_offset, dst_stride;
-
-   if (!pbo ||
-       intel->ctx._ImageTransferState ||
-       unpack->SkipPixels || unpack->SkipRows) {
-      _mesa_printf("%s: failure 1\n", __FUNCTION__);
-      return GL_FALSE;
-   }
-
-   src_offset = (GLuint) pixels;
-
-   if (unpack->RowLength > 0)
-      src_stride = unpack->RowLength;
-   else
-      src_stride = width;
-
-   dst_offset = intel_miptree_image_offset(intelImage->mt,
-                                           intelImage->face,
-                                           intelImage->level);
-
-   dst_stride = intelImage->mt->pitch;
-
-   if (src_stride != dst_stride || dst_offset != 0 || src_offset != 0) {
-      _mesa_printf("%s: failure 2\n", __FUNCTION__);
-      return GL_FALSE;
-   }
-
-   intel->pipe->region_attach_pbo(intel->pipe, intelImage->mt->region, pbo);
-
-   return GL_TRUE;
+   return GL_FALSE;
 }
 
 
index 8e51daae06137c1b53ce1045a822aaff5e040251..4f5937b8f39e54040b0c5c65e0ec4c989e32ae64 100644 (file)
@@ -175,15 +175,6 @@ struct pipe_context {
                        GLuint width, GLuint height,
                        GLuint value, GLuint mask);
 
-   void (*region_cow)(struct pipe_context *pipe, struct pipe_region *region);
-
-   void (*region_attach_pbo)(struct pipe_context *pipe,
-                             struct pipe_region *region,
-                             struct intel_buffer_object *pbo);
-
-   void (*region_release_pbo)(struct pipe_context *pipe,
-                              struct pipe_region *region);
-
    struct _DriBufferObject *(*region_buffer)(struct pipe_context *pipe,
                                              struct pipe_region *region,
                                              GLuint flag);
index 0767fc2fcb59be15fd6f1e39f1985426207fe516..d6ed514fb1c786d506c75f8ce79fa44be490bbd9 100644 (file)
@@ -238,7 +238,6 @@ struct pipe_sampler_state
 
 
 struct _DriBufferObject;
-struct intel_buffer_object;
 
 struct pipe_region
 {
@@ -252,8 +251,6 @@ struct pipe_region
    GLuint map_refcount;  /**< Reference count for mapping */
 
    GLuint draw_offset; /**< Offset of drawing address within the region */
-
-   struct intel_buffer_object *pbo;     /* zero-copy uploads */
 };