nouveau: return buffer map to something sane.
authorBen Skeggs <skeggsb@gmail.com>
Mon, 12 Jan 2009 03:27:13 +0000 (13:27 +1000)
committerBen Skeggs <skeggsb@gmail.com>
Mon, 12 Jan 2009 06:59:33 +0000 (16:59 +1000)
Sorry, but no, we're not doing this..  Correctness always takes precedence
over speed.  Implement this higher up where you know it's safe to do so,
and doesn't break other things in the process.

src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.c

index c8f26d5..683710e 100644 (file)
@@ -121,26 +121,6 @@ nouveau_pipe_bo_map(struct pipe_winsys *pws, struct pipe_buffer *buf,
        if (flags & PIPE_BUFFER_USAGE_CPU_WRITE)
                map_flags |= NOUVEAU_BO_WR;
 
-       /* XXX: Technically incorrect. If the client maps a buffer for write-only
-        * and leaves part of the buffer untouched it probably expects those parts
-        * to remain intact. This is violated because we allocate a whole new buffer
-        * and don't copy the previous buffer's contents, so this optimization is
-        * only valid if the client intends to overwrite the whole buffer.
-        */
-       if ((map_flags & NOUVEAU_BO_RDWR) == NOUVEAU_BO_WR &&
-           !nouveau_bo_busy(nvbuf->bo, map_flags)) {
-               struct nouveau_pipe_winsys *nvpws = (struct nouveau_pipe_winsys *)pws;
-               struct nouveau_context *nv = nvpws->nv;
-               struct nouveau_device *dev = nv->nv_screen->device;
-               struct nouveau_bo *rename;
-               uint32_t flags = nouveau_flags_from_usage(nv, buf->usage);
-
-               if (!nouveau_bo_new(dev, flags, buf->alignment, buf->size, &rename)) {
-                       nouveau_bo_del(&nvbuf->bo);
-                       nvbuf->bo = rename;
-               }
-       }
-
        if (nouveau_bo_map(nvbuf->bo, map_flags))
                return NULL;
        return nvbuf->bo->map;