Mesa (refs/tags/staging-dw-good): nouveau: minor post cleanup
Emil Velikov
evelikov at kemper.freedesktop.org
Mon Sep 1 00:17:35 UTC 2014
Module: Mesa
Branch: refs/tags/staging-dw-good
Commit: 9dd9b1fa78a6791356c36855d8db0a89ffccf832
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9dd9b1fa78a6791356c36855d8db0a89ffccf832
Author: Emil Velikov <emil.l.velikov at gmail.com>
Date: Thu Jun 13 18:17:56 2013 +0100
nouveau: minor post cleanup
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
src/gallium/drivers/nouveau/nouveau_buffer.c | 26 +++++++++++---------------
src/gallium/drivers/nouveau/nouveau_screen.h | 2 +-
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c
index 2740a5f..2190ef9 100644
--- a/src/gallium/drivers/nouveau/nouveau_buffer.c
+++ b/src/gallium/drivers/nouveau/nouveau_buffer.c
@@ -130,6 +130,7 @@ nouveau_transfer_staging(struct nouveau_context *nv,
/*
const unsigned adj = tx->base.box.x & NOUVEAU_MIN_BUFFER_MAP_ALIGN_MASK;
const unsigned size = align(tx->base.box.width, 4) + adj;
+
*/
const unsigned adj = 0;
const unsigned size = tx->base.box.width;
@@ -157,10 +158,9 @@ nouveau_transfer_staging(struct nouveau_context *nv,
return tx->map;
}
-
/* Maybe just migrate to GART right away if we actually need to do this. */
static boolean
-nouveau_buffer_download(struct nouveau_context *nv, struct nouveau_transfer *tx)
+nouveau_transfer_read(struct nouveau_context *nv, struct nouveau_transfer *tx)
{
struct nv04_resource *buf = nv04_resource(tx->base.resource);
const unsigned base = tx->base.box.x;
@@ -174,10 +174,11 @@ nouveau_buffer_download(struct nouveau_context *nv, struct nouveau_transfer *tx)
NOUVEAU_DRV_STAT(nv->screen, buf_read_bytes_staging_vid, size);
nv->copy_data(nv, tx->bo, tx->offset, NOUVEAU_BO_GART,
- buf->bo, buf->offset + base, NOUVEAU_BO_VRAM, size);
+ buf->bo, buf->offset + base, buf->domain, size);
if (nouveau_bo_wait(tx->bo, NOUVEAU_BO_RD, nv->client))
return FALSE;
+
if (buf->data)
memcpy(buf->data + base, tx->map, size);
else {
@@ -306,11 +307,10 @@ nouveau_buffer_cache(struct nouveau_context *nv, struct nv04_resource *buf)
if (!buf->data)
return FALSE;
-// if (!nouveau_transfer_staging(nv, NOUVEAU_BO_RD, nv->client, tx, FALSE))
if (!nouveau_transfer_staging(nv, NOUVEAU_BO_RD, nv->client, &tx, FALSE))
return FALSE;
- ret = nouveau_buffer_download(nv, &tx);
+ ret = nouveau_transfer_read(nv, &tx);
return ret;
}
@@ -323,13 +323,12 @@ nouveau_buffer_transfer_map(struct pipe_context *pipe,
{
struct nouveau_context *nv = nouveau_context(pipe);
struct nv04_resource *buf = nv04_resource(resource);
- struct nouveau_transfer *tx = CALLOC_STRUCT(nouveau_transfer);
+ struct nouveau_transfer *tx = MALLOC_STRUCT(nouveau_transfer);
uint8_t *map;
int ret;
if (!tx)
return NULL;
-
nouveau_buffer_transfer_init(tx, resource, box, usage);
*ptransfer = &tx->base;
@@ -343,7 +342,7 @@ nouveau_buffer_transfer_map(struct pipe_context *pipe,
if (buf->status & NOUVEAU_BUFFER_STATUS_GPU_WRITING)
// XXX: No error checking
nouveau_transfer_staging(nv, NOUVEAU_BO_RD, nv->client, tx, TRUE);
- nouveau_buffer_download(nv, tx);
+ nouveau_transfer_read(nv, tx);
}
}
@@ -403,9 +402,8 @@ nouveau_buffer_transfer_unmap(struct pipe_context *pipe,
struct nv04_resource *buf = nv04_resource(transfer->resource);
if (tx->base.usage & PIPE_TRANSFER_WRITE) {
- if (buf->domain == NOUVEAU_BO_VRAM) {
+ if (buf->domain == NOUVEAU_BO_VRAM)
nouveau_buffer_upload(nv, buf, transfer->box.x, transfer->box.width);
- }
if (likely(buf->domain)) {
const uint8_t bind = buf->base.bind;
@@ -417,7 +415,7 @@ nouveau_buffer_transfer_unmap(struct pipe_context *pipe,
}
}
- if (tx->base.usage & PIPE_TRANSFER_WRITE)
+ if (!tx->bo && (tx->base.usage & PIPE_TRANSFER_WRITE))
NOUVEAU_DRV_STAT(nv->screen, buf_write_bytes_direct, tx->base.box.width);
FREE(tx);
@@ -465,15 +463,13 @@ nouveau_resource_map_offset(struct nouveau_context *nv,
if (unlikely(res->status & NOUVEAU_BUFFER_STATUS_USER_MEMORY))
return res->data + offset;
-
if (res->domain == NOUVEAU_BO_VRAM) {
if (!res->data && (!(res->status & NOUVEAU_BUFFER_STATUS_GPU_WRITING)))
fprintf(stderr, "%s:%d no data and NO GPU WRITING\n", __func__, __LINE__);
- if (res->status & NOUVEAU_BUFFER_STATUS_GPU_WRITING)
+ if (!res->data || (res->status & NOUVEAU_BUFFER_STATUS_GPU_WRITING))
nouveau_buffer_cache(nv, res);
}
-
if (res->domain != NOUVEAU_BO_GART)
return res->data + offset;
@@ -553,6 +549,7 @@ nouveau_buffer_create(struct pipe_screen *pscreen,
goto fail;
NOUVEAU_DRV_STAT(screen, buf_obj_current_count, 1);
+
return &buffer->base;
fail:
@@ -587,7 +584,6 @@ nouveau_user_buffer_create(struct pipe_screen *pscreen, void *ptr,
return &buffer->base;
}
-/* Like download, but for GART buffers. Merge ? */
static INLINE boolean
nouveau_buffer_data_fetch(struct nouveau_context *nv, struct nv04_resource *buf,
struct nouveau_bo *bo, unsigned offset, unsigned size)
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h
index 2790fa8..9b6b4e9 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.h
+++ b/src/gallium/drivers/nouveau/nouveau_screen.h
@@ -26,7 +26,7 @@ struct nouveau_screen {
unsigned sysmem_bindings; /* PIPE_BIND_* where GART placement is desired */
unsigned lowmem_bindings; /* PIPE_BIND_* that require an address < 4 GiB */
/*
- * For bindings with (vidmem & sysmem) bits set set, PIPE_USAGE_* decides
+ * For bindings with (vidmem & sysmem) bits set, PIPE_USAGE_* decides
* placement.
*/
More information about the mesa-commit
mailing list