summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/nouveau')
-rw-r--r--src/gallium/drivers/nouveau/Makefile.sources1
-rw-r--r--src/gallium/drivers/nouveau/nouveau_buffer.c90
-rw-r--r--src/gallium/drivers/nouveau/nouveau_buffer.h36
-rw-r--r--src/gallium/drivers/nouveau/nouveau_context.h4
-rw-r--r--src/gallium/drivers/nouveau/nouveau_fence.c5
-rw-r--r--src/gallium/drivers/nouveau/nouveau_heap.c123
-rw-r--r--src/gallium/drivers/nouveau/nouveau_heap.h52
-rw-r--r--src/gallium/drivers/nouveau/nouveau_mm.c23
-rw-r--r--src/gallium/drivers/nouveau/nouveau_mm.h3
-rw-r--r--src/gallium/drivers/nouveau/nouveau_screen.c149
-rw-r--r--src/gallium/drivers/nouveau/nouveau_screen.h48
-rw-r--r--src/gallium/drivers/nouveau/nouveau_statebuf.h9
-rw-r--r--src/gallium/drivers/nouveau/nouveau_video.c189
-rw-r--r--src/gallium/drivers/nouveau/nouveau_video.h58
-rw-r--r--src/gallium/drivers/nouveau/nouveau_winsys.h69
-rw-r--r--src/gallium/drivers/nouveau/nv_m2mf.xml.h67
-rw-r--r--src/gallium/drivers/nouveau/nv_object.xml.h320
17 files changed, 734 insertions, 512 deletions
diff --git a/src/gallium/drivers/nouveau/Makefile.sources b/src/gallium/drivers/nouveau/Makefile.sources
index 5a5998bca0a..cc9e68f44a8 100644
--- a/src/gallium/drivers/nouveau/Makefile.sources
+++ b/src/gallium/drivers/nouveau/Makefile.sources
@@ -3,4 +3,5 @@ C_SOURCES := \
nouveau_fence.c \
nouveau_mm.c \
nouveau_buffer.c \
+ nouveau_heap.c \
nouveau_video.c
diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c
index f3cef8c288f..653acaa18fe 100644
--- a/src/gallium/drivers/nouveau/nouveau_buffer.c
+++ b/src/gallium/drivers/nouveau/nouveau_buffer.c
@@ -49,6 +49,9 @@ nouveau_buffer_allocate(struct nouveau_screen *screen,
}
}
buf->domain = domain;
+ if (buf->bo)
+ buf->address = buf->bo->offset + buf->offset;
+
return TRUE;
}
@@ -112,10 +115,9 @@ nouveau_buffer_download(struct nouveau_context *nv, struct nv04_resource *buf,
nv->copy_data(nv, bounce, offset, NOUVEAU_BO_GART,
buf->bo, buf->offset + start, NOUVEAU_BO_VRAM, size);
- if (nouveau_bo_map_range(bounce, offset, size, NOUVEAU_BO_RD))
+ if (nouveau_bo_map(bounce, NOUVEAU_BO_RD, nv->screen->client))
return FALSE;
- memcpy(buf->data + start, bounce->map, size);
- nouveau_bo_unmap(bounce);
+ memcpy(buf->data + start, (uint8_t *)bounce->map + offset, size);
buf->status &= ~NOUVEAU_BUFFER_STATUS_GPU_WRITING;
@@ -147,10 +149,8 @@ nouveau_buffer_upload(struct nouveau_context *nv, struct nv04_resource *buf,
if (!bounce)
return FALSE;
- nouveau_bo_map_range(bounce, offset, size,
- NOUVEAU_BO_WR | NOUVEAU_BO_NOSYNC);
- memcpy(bounce->map, buf->data + start, size);
- nouveau_bo_unmap(bounce);
+ nouveau_bo_map(bounce, 0, nv->screen->client);
+ memcpy((uint8_t *)bounce->map + offset, buf->data + start, size);
nv->copy_data(nv, buf->bo, buf->offset + start, NOUVEAU_BO_VRAM,
bounce, offset, NOUVEAU_BO_GART, size);
@@ -246,34 +246,27 @@ static void *
nouveau_buffer_transfer_map(struct pipe_context *pipe,
struct pipe_transfer *transfer)
{
+ struct nouveau_context *nv = nouveau_context(pipe);
struct nouveau_transfer *xfr = nouveau_transfer(transfer);
struct nv04_resource *buf = nv04_resource(transfer->resource);
struct nouveau_bo *bo = buf->bo;
uint8_t *map;
int ret;
uint32_t offset = xfr->base.box.x;
- uint32_t flags;
+ uint32_t flags = 0;
if (buf->domain != NOUVEAU_BO_GART)
return buf->data + offset;
- if (buf->mm)
- flags = NOUVEAU_BO_NOSYNC | NOUVEAU_BO_RDWR;
- else
+ if (!buf->mm)
flags = nouveau_screen_transfer_flags(xfr->base.usage);
offset += buf->offset;
- ret = nouveau_bo_map_range(buf->bo, offset, xfr->base.box.width, flags);
+ ret = nouveau_bo_map(buf->bo, flags, nv->screen->client);
if (ret)
return NULL;
- map = bo->map;
-
- /* Unmap right now. Since multiple buffers can share a single nouveau_bo,
- * not doing so might make future maps fail or trigger "reloc while mapped"
- * errors. For now, mappings to userspace are guaranteed to be persistent.
- */
- nouveau_bo_unmap(bo);
+ map = (uint8_t *)bo->map + offset;
if (buf->mm) {
if (xfr->base.usage & PIPE_TRANSFER_DONTBLOCK) {
@@ -294,6 +287,7 @@ nouveau_buffer_transfer_flush_region(struct pipe_context *pipe,
struct pipe_transfer *transfer,
const struct pipe_box *box)
{
+#if 0
struct nv04_resource *res = nv04_resource(transfer->resource);
struct nouveau_bo *bo = res->bo;
unsigned offset = res->offset + transfer->box.x + box->x;
@@ -303,17 +297,43 @@ nouveau_buffer_transfer_flush_region(struct pipe_context *pipe,
return;
/* XXX: maybe need to upload for VRAM buffers here */
-
- nouveau_screen_bo_map_flush_range(pipe->screen, bo, offset, box->width);
+#endif
}
static void
nouveau_buffer_transfer_unmap(struct pipe_context *pipe,
struct pipe_transfer *transfer)
{
- /* we've called nouveau_bo_unmap right after map */
}
+
+void *
+nouveau_resource_map_offset(struct nouveau_context *nv,
+ struct nv04_resource *res, uint32_t offset,
+ uint32_t flags)
+{
+ if ((res->domain == NOUVEAU_BO_VRAM) &&
+ (res->status & NOUVEAU_BUFFER_STATUS_GPU_WRITING))
+ nouveau_buffer_download(nv, res, 0, res->base.width0);
+
+ if ((res->domain != NOUVEAU_BO_GART) ||
+ (res->status & NOUVEAU_BUFFER_STATUS_USER_MEMORY))
+ return res->data + offset;
+
+ if (res->mm) {
+ unsigned rw;
+ rw = (flags & NOUVEAU_BO_WR) ? PIPE_TRANSFER_WRITE : PIPE_TRANSFER_READ;
+ nouveau_buffer_sync(res, rw);
+ if (nouveau_bo_map(res->bo, 0, NULL))
+ return NULL;
+ } else {
+ if (nouveau_bo_map(res->bo, flags, nv->screen->client))
+ return NULL;
+ }
+ return (uint8_t *)res->bo->map + res->offset + offset;
+}
+
+
const struct u_resource_vtbl nouveau_buffer_vtbl =
{
u_default_resource_get_handle, /* get_handle */
@@ -387,18 +407,17 @@ nouveau_user_buffer_create(struct pipe_screen *pscreen, void *ptr,
/* Like download, but for GART buffers. Merge ? */
static INLINE boolean
-nouveau_buffer_data_fetch(struct nv04_resource *buf, struct nouveau_bo *bo,
- unsigned offset, unsigned size)
+nouveau_buffer_data_fetch(struct nouveau_context *nv, struct nv04_resource *buf,
+ struct nouveau_bo *bo, unsigned offset, unsigned size)
{
if (!buf->data) {
buf->data = MALLOC(size);
if (!buf->data)
return FALSE;
}
- if (nouveau_bo_map_range(bo, offset, size, NOUVEAU_BO_RD))
+ if (nouveau_bo_map(bo, NOUVEAU_BO_RD, nv->screen->client))
return FALSE;
- memcpy(buf->data, bo->map, size);
- nouveau_bo_unmap(bo);
+ memcpy(buf->data, (uint8_t *)bo->map + offset, size);
return TRUE;
}
@@ -420,12 +439,10 @@ nouveau_buffer_migrate(struct nouveau_context *nv,
if (new_domain == NOUVEAU_BO_GART && old_domain == 0) {
if (!nouveau_buffer_allocate(screen, buf, new_domain))
return FALSE;
- ret = nouveau_bo_map_range(buf->bo, buf->offset, size, NOUVEAU_BO_WR |
- NOUVEAU_BO_NOSYNC);
+ ret = nouveau_bo_map(buf->bo, 0, nv->screen->client);
if (ret)
return ret;
- memcpy(buf->bo->map, buf->data, size);
- nouveau_bo_unmap(buf->bo);
+ memcpy((uint8_t *)buf->bo->map + buf->offset, buf->data, size);
FREE(buf->data);
} else
if (old_domain != 0 && new_domain != 0) {
@@ -433,7 +450,7 @@ nouveau_buffer_migrate(struct nouveau_context *nv,
if (new_domain == NOUVEAU_BO_VRAM) {
/* keep a system memory copy of our data in case we hit a fallback */
- if (!nouveau_buffer_data_fetch(buf, buf->bo, buf->offset, size))
+ if (!nouveau_buffer_data_fetch(nv, buf, buf->bo, buf->offset, size))
return FALSE;
if (nouveau_mesa_debug)
debug_printf("migrating %u KiB to VRAM\n", size / 1024);
@@ -469,7 +486,8 @@ nouveau_buffer_migrate(struct nouveau_context *nv,
* the vertex indices ...
*/
boolean
-nouveau_user_buffer_upload(struct nv04_resource *buf,
+nouveau_user_buffer_upload(struct nouveau_context *nv,
+ struct nv04_resource *buf,
unsigned base, unsigned size)
{
struct nouveau_screen *screen = nouveau_screen(buf->base.screen);
@@ -481,12 +499,10 @@ nouveau_user_buffer_upload(struct nv04_resource *buf,
if (!nouveau_buffer_reallocate(screen, buf, NOUVEAU_BO_GART))
return FALSE;
- ret = nouveau_bo_map_range(buf->bo, buf->offset + base, size,
- NOUVEAU_BO_WR | NOUVEAU_BO_NOSYNC);
+ ret = nouveau_bo_map(buf->bo, 0, nv->screen->client);
if (ret)
return FALSE;
- memcpy(buf->bo->map, buf->data + base, size);
- nouveau_bo_unmap(buf->bo);
+ memcpy((uint8_t *)buf->bo->map + buf->offset + base, buf->data + base, size);
return TRUE;
}
diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.h b/src/gallium/drivers/nouveau/nouveau_buffer.h
index c0a781c6fd3..3d97ac33b7d 100644
--- a/src/gallium/drivers/nouveau/nouveau_buffer.h
+++ b/src/gallium/drivers/nouveau/nouveau_buffer.h
@@ -28,6 +28,8 @@ struct nv04_resource {
struct pipe_resource base;
const struct u_resource_vtbl *vtbl;
+ uint64_t address; /* virtual address (nv50+) */
+
uint8_t *data;
struct nouveau_bo *bo;
uint32_t offset;
@@ -52,33 +54,9 @@ boolean
nouveau_buffer_migrate(struct nouveau_context *,
struct nv04_resource *, unsigned domain);
-/* XXX: wait for fence (atm only using this for vertex push) */
-static INLINE void *
-nouveau_resource_map_offset(struct nouveau_context *pipe,
- struct nv04_resource *res, uint32_t offset,
- uint32_t flags)
-{
- void *map;
-
- if ((res->domain == NOUVEAU_BO_VRAM) &&
- (res->status & NOUVEAU_BUFFER_STATUS_GPU_WRITING))
- nouveau_buffer_download(pipe, res, 0, res->base.width0);
-
- if ((res->domain != NOUVEAU_BO_GART) ||
- (res->status & NOUVEAU_BUFFER_STATUS_USER_MEMORY))
- return res->data + offset;
-
- if (res->mm)
- flags |= NOUVEAU_BO_NOSYNC;
-
- if (nouveau_bo_map_range(res->bo, res->offset + offset,
- res->base.width0, flags))
- return NULL;
-
- map = res->bo->map;
- nouveau_bo_unmap(res->bo);
- return map;
-}
+void *
+nouveau_resource_map_offset(struct nouveau_context *, struct nv04_resource *,
+ uint32_t offset, uint32_t flags);
static INLINE void
nouveau_resource_unmap(struct nv04_resource *res)
@@ -108,7 +86,7 @@ nouveau_user_buffer_create(struct pipe_screen *screen, void *ptr,
unsigned bytes, unsigned usage);
boolean
-nouveau_user_buffer_upload(struct nv04_resource *, unsigned base,
- unsigned size);
+nouveau_user_buffer_upload(struct nouveau_context *, struct nv04_resource *,
+ unsigned base, unsigned size);
#endif
diff --git a/src/gallium/drivers/nouveau/nouveau_context.h b/src/gallium/drivers/nouveau/nouveau_context.h
index 92aea76b424..4e6085f6935 100644
--- a/src/gallium/drivers/nouveau/nouveau_context.h
+++ b/src/gallium/drivers/nouveau/nouveau_context.h
@@ -3,10 +3,14 @@
#include "pipe/p_context.h"
+struct nouveau_pushbuf;
+
struct nouveau_context {
struct pipe_context pipe;
struct nouveau_screen *screen;
+ struct nouveau_pushbuf *pushbuf;
+
boolean vbo_dirty;
boolean cb_dirty;
diff --git a/src/gallium/drivers/nouveau/nouveau_fence.c b/src/gallium/drivers/nouveau/nouveau_fence.c
index a2fcafef4a7..d2f98654f31 100644
--- a/src/gallium/drivers/nouveau/nouveau_fence.c
+++ b/src/gallium/drivers/nouveau/nouveau_fence.c
@@ -23,10 +23,9 @@
#include "util/u_double_list.h"
#include "nouveau_screen.h"
+#include "nouveau_winsys.h"
#include "nouveau_fence.h"
-#include "nouveau/nouveau_pushbuf.h"
-
#ifdef PIPE_OS_UNIX
#include <sched.h>
#endif
@@ -197,7 +196,7 @@ nouveau_fence_wait(struct nouveau_fence *fence)
nouveau_fence_new(screen, &screen->fence.current, FALSE);
}
if (fence->state < NOUVEAU_FENCE_STATE_FLUSHED)
- FIRE_RING(screen->channel);
+ nouveau_pushbuf_kick(screen->pushbuf, screen->pushbuf->channel);
do {
nouveau_fence_update(screen, FALSE);
diff --git a/src/gallium/drivers/nouveau/nouveau_heap.c b/src/gallium/drivers/nouveau/nouveau_heap.c
new file mode 100644
index 00000000000..769211b82f0
--- /dev/null
+++ b/src/gallium/drivers/nouveau/nouveau_heap.c
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2007 Nouveau Project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include <errno.h>
+
+#include "nouveau_heap.h"
+
+int
+nouveau_heap_init(struct nouveau_heap **heap,
+ unsigned start, unsigned size)
+{
+ struct nouveau_heap *r;
+
+ r = calloc(1, sizeof(struct nouveau_heap));
+ if (!r)
+ return 1;
+
+ r->start = start;
+ r->size = size;
+ *heap = r;
+ return 0;
+}
+
+void
+nouveau_heap_destroy(struct nouveau_heap **heap)
+{
+ if (!*heap)
+ return;
+ free(*heap);
+ *heap = NULL;
+}
+
+int
+nouveau_heap_alloc(struct nouveau_heap *heap, unsigned size, void *priv,
+ struct nouveau_heap **res)
+{
+ struct nouveau_heap *r;
+
+ if (!heap || !size || !res || *res)
+ return 1;
+
+ while (heap) {
+ if (!heap->in_use && heap->size >= size) {
+ r = calloc(1, sizeof(struct nouveau_heap));
+ if (!r)
+ return 1;
+
+ r->start = (heap->start + heap->size) - size;
+ r->size = size;
+ r->in_use = 1;
+ r->priv = priv;
+
+ heap->size -= size;
+
+ r->next = heap->next;
+ if (heap->next)
+ heap->next->prev = r;
+ r->prev = heap;
+ heap->next = r;
+
+ *res = r;
+ return 0;
+ }
+
+ heap = heap->next;
+ }
+
+ return 1;
+}
+
+void
+nouveau_heap_free(struct nouveau_heap **res)
+{
+ struct nouveau_heap *r;
+
+ if (!res || !*res)
+ return;
+ r = *res;
+ *res = NULL;
+
+ r->in_use = 0;
+
+ if (r->next && !r->next->in_use) {
+ struct nouveau_heap *new = r->next;
+
+ new->prev = r->prev;
+ if (r->prev)
+ r->prev->next = new;
+ new->size += r->size;
+ new->start = r->start;
+
+ free(r);
+ r = new;
+ }
+
+ if (r->prev && !r->prev->in_use) {
+ r->prev->next = r->next;
+ if (r->next)
+ r->next->prev = r->prev;
+ r->prev->size += r->size;
+ free(r);
+ }
+}
diff --git a/src/gallium/drivers/nouveau/nouveau_heap.h b/src/gallium/drivers/nouveau/nouveau_heap.h
new file mode 100644
index 00000000000..34d9a82774e
--- /dev/null
+++ b/src/gallium/drivers/nouveau/nouveau_heap.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2007 Nouveau Project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef __NOUVEAU_HEAP_H__
+#define __NOUVEAU_HEAP_H__
+
+struct nouveau_heap {
+ struct nouveau_heap *prev;
+ struct nouveau_heap *next;
+
+ void *priv;
+
+ unsigned start;
+ unsigned size;
+
+ int in_use;
+};
+
+int
+nouveau_heap_init(struct nouveau_heap **heap, unsigned start,
+ unsigned size);
+
+void
+nouveau_heap_destroy(struct nouveau_heap **heap);
+
+int
+nouveau_heap_alloc(struct nouveau_heap *heap, unsigned size, void *priv,
+ struct nouveau_heap **);
+
+void
+nouveau_heap_free(struct nouveau_heap **);
+
+#endif
diff --git a/src/gallium/drivers/nouveau/nouveau_mm.c b/src/gallium/drivers/nouveau/nouveau_mm.c
index 8d0b7bfe99a..4207084aecf 100644
--- a/src/gallium/drivers/nouveau/nouveau_mm.c
+++ b/src/gallium/drivers/nouveau/nouveau_mm.c
@@ -5,11 +5,10 @@
#include "util/u_memory.h"
#include "util/u_double_list.h"
+#include "nouveau_winsys.h"
#include "nouveau_screen.h"
#include "nouveau_mm.h"
-#include "nouveau/nouveau_bo.h"
-
#define MM_MIN_ORDER 7
#define MM_MAX_ORDER 20
@@ -28,8 +27,8 @@ struct mm_bucket {
struct nouveau_mman {
struct nouveau_device *dev;
struct mm_bucket bucket[MM_NUM_BUCKETS];
- uint32_t storage_type;
uint32_t domain;
+ union nouveau_bo_config config;
uint64_t allocated;
};
@@ -128,8 +127,9 @@ mm_slab_new(struct nouveau_mman *cache, int chunk_order)
memset(&slab->bits[0], ~0, words * 4);
slab->bo = NULL;
- ret = nouveau_bo_new_tile(cache->dev, cache->domain, 0, size,
- 0, cache->storage_type, &slab->bo);
+
+ ret = nouveau_bo_new(cache->dev, cache->domain, 0, size, &cache->config,
+ &slab->bo);
if (ret) {
FREE(slab);
return PIPE_ERROR_OUT_OF_MEMORY;
@@ -155,7 +155,7 @@ mm_slab_new(struct nouveau_mman *cache, int chunk_order)
/* @return token to identify slab or NULL if we just allocated a new bo */
struct nouveau_mm_allocation *
nouveau_mm_allocate(struct nouveau_mman *cache,
- uint32_t size, struct nouveau_bo **bo, uint32_t *offset)
+ uint32_t size, struct nouveau_bo **bo, uint32_t *offset)
{
struct mm_bucket *bucket;
struct mm_slab *slab;
@@ -164,10 +164,11 @@ nouveau_mm_allocate(struct nouveau_mman *cache,
bucket = mm_bucket_by_size(cache, size);
if (!bucket) {
- ret = nouveau_bo_new_tile(cache->dev, cache->domain, 0, size,
- 0, cache->storage_type, bo);
+ ret = nouveau_bo_new(cache->dev, cache->domain, 0, size, &cache->config,
+ bo);
if (ret)
- debug_printf("bo_new(%x, %x): %i\n", size, cache->storage_type, ret);
+ debug_printf("bo_new(%x, %x): %i\n",
+ size, cache->config.nv50.memtype, ret);
*offset = 0;
return NULL;
@@ -233,7 +234,7 @@ nouveau_mm_free_work(void *data)
struct nouveau_mman *
nouveau_mm_create(struct nouveau_device *dev, uint32_t domain,
- uint32_t storage_type)
+ union nouveau_bo_config *config)
{
struct nouveau_mman *cache = MALLOC_STRUCT(nouveau_mman);
int i;
@@ -243,7 +244,7 @@ nouveau_mm_create(struct nouveau_device *dev, uint32_t domain,
cache->dev = dev;
cache->domain = domain;
- cache->storage_type = storage_type;
+ cache->config = *config;
cache->allocated = 0;
for (i = 0; i < MM_NUM_BUCKETS; ++i) {
diff --git a/src/gallium/drivers/nouveau/nouveau_mm.h b/src/gallium/drivers/nouveau/nouveau_mm.h
index 5b57c8ba4f2..8e4f1e5713f 100644
--- a/src/gallium/drivers/nouveau/nouveau_mm.h
+++ b/src/gallium/drivers/nouveau/nouveau_mm.h
@@ -1,6 +1,7 @@
#ifndef __NOUVEAU_MM_H__
#define __NOUVEAU_MM_H__
+union nouveau_bo_config;
struct nouveau_mman;
/* Since a resource can be migrated, we need to decouple allocations from
@@ -14,7 +15,7 @@ struct nouveau_mm_allocation {
extern struct nouveau_mman *
nouveau_mm_create(struct nouveau_device *, uint32_t domain,
- uint32_t storage_type);
+ union nouveau_bo_config *);
extern void
nouveau_mm_destroy(struct nouveau_mman *);
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c
index 8ebae8e27dc..74377799977 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -12,17 +12,15 @@
#include <errno.h>
#include <stdlib.h>
-#include "nouveau/nouveau_bo.h"
-#include "nouveau/nouveau_mm.h"
#include "nouveau_winsys.h"
#include "nouveau_screen.h"
#include "nouveau_fence.h"
+#include "nouveau_mm.h"
+#include "nouveau_buffer.h"
/* XXX this should go away */
#include "state_tracker/drm_driver.h"
-#include "nouveau_drmif.h"
-
int nouveau_mesa_debug = 0;
static const char *
@@ -41,102 +39,6 @@ nouveau_screen_get_vendor(struct pipe_screen *pscreen)
return "nouveau";
}
-
-
-struct nouveau_bo *
-nouveau_screen_bo_new(struct pipe_screen *pscreen, unsigned alignment,
- unsigned usage, unsigned bind, unsigned size)
-{
- struct nouveau_device *dev = nouveau_screen(pscreen)->device;
- struct nouveau_bo *bo = NULL;
- uint32_t flags = NOUVEAU_BO_MAP, tile_mode = 0, tile_flags = 0;
- int ret;
-
- if (bind & PIPE_BIND_VERTEX_BUFFER)
- flags |= nouveau_screen(pscreen)->vertex_buffer_flags;
- else if (bind & PIPE_BIND_INDEX_BUFFER)
- flags |= nouveau_screen(pscreen)->index_buffer_flags;
-
- if (bind & (PIPE_BIND_RENDER_TARGET |
- PIPE_BIND_DEPTH_STENCIL |
- PIPE_BIND_SCANOUT |
- PIPE_BIND_DISPLAY_TARGET |
- PIPE_BIND_SAMPLER_VIEW))
- {
- /* TODO: this may be incorrect or suboptimal */
- if (!(bind & PIPE_BIND_SCANOUT))
- flags |= NOUVEAU_BO_GART;
- if (usage != PIPE_USAGE_DYNAMIC)
- flags |= NOUVEAU_BO_VRAM;
-
- if (dev->chipset == 0x50 || dev->chipset >= 0x80) {
- if (bind & PIPE_BIND_DEPTH_STENCIL)
- tile_flags = 0x2800;
- else
- tile_flags = 0x7000;
- }
- }
-
- ret = nouveau_bo_new_tile(dev, flags, alignment, size,
- tile_mode, tile_flags, &bo);
- if (ret)
- return NULL;
-
- return bo;
-}
-
-void *
-nouveau_screen_bo_map(struct pipe_screen *pscreen,
- struct nouveau_bo *bo,
- unsigned map_flags)
-{
- int ret;
-
- ret = nouveau_bo_map(bo, map_flags);
- if (ret) {
- debug_printf("map failed: %d\n", ret);
- return NULL;
- }
-
- return bo->map;
-}
-
-void *
-nouveau_screen_bo_map_range(struct pipe_screen *pscreen, struct nouveau_bo *bo,
- unsigned offset, unsigned length, unsigned flags)
-{
- int ret;
-
- ret = nouveau_bo_map_range(bo, offset, length, flags);
- if (ret) {
- nouveau_bo_unmap(bo);
- if (!(flags & NOUVEAU_BO_NOWAIT) || ret != -EBUSY)
- debug_printf("map_range failed: %d\n", ret);
- return NULL;
- }
-
- return (char *)bo->map - offset; /* why gallium? why? */
-}
-
-void
-nouveau_screen_bo_map_flush_range(struct pipe_screen *pscreen, struct nouveau_bo *bo,
- unsigned offset, unsigned length)
-{
- nouveau_bo_map_flush(bo, offset, length);
-}
-
-void
-nouveau_screen_bo_unmap(struct pipe_screen *pscreen, struct nouveau_bo *bo)
-{
- nouveau_bo_unmap(bo);
-}
-
-void
-nouveau_screen_bo_release(struct pipe_screen *pscreen, struct nouveau_bo *bo)
-{
- nouveau_bo_ref(NULL, &bo);
-}
-
static void
nouveau_screen_fence_ref(struct pipe_screen *pscreen,
struct pipe_fence_handle **ptr,
@@ -157,7 +59,7 @@ nouveau_screen_fence_finish(struct pipe_screen *screen,
struct pipe_fence_handle *pfence,
uint64_t timeout)
{
- return nouveau_fence_wait(nouveau_fence(pfence));
+ return nouveau_fence_wait(nouveau_fence(pfence));
}
@@ -170,7 +72,7 @@ nouveau_screen_bo_from_handle(struct pipe_screen *pscreen,
struct nouveau_bo *bo = 0;
int ret;
- ret = nouveau_bo_handle_ref(dev, whandle->handle, &bo);
+ ret = nouveau_bo_name_ref(dev, whandle->handle, &bo);
if (ret) {
debug_printf("%s: ref name 0x%08x failed with %d\n",
__FUNCTION__, whandle->handle, ret);
@@ -191,7 +93,7 @@ nouveau_screen_bo_get_handle(struct pipe_screen *pscreen,
whandle->stride = stride;
if (whandle->type == DRM_API_HANDLE_TYPE_SHARED) {
- return nouveau_bo_handle_get(bo, &whandle->handle) == 0;
+ return nouveau_bo_name_get(bo, &whandle->handle) == 0;
} else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {
whandle->handle = bo->handle;
return TRUE;
@@ -204,18 +106,39 @@ int
nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)
{
struct pipe_screen *pscreen = &screen->base;
- int ret;
+ struct nv04_fifo nv04_data = { .vram = 0xbeef0201, .gart = 0xbeef0202 };
+ struct nvc0_fifo nvc0_data = { };
+ int size, ret;
+ void *data;
+ union nouveau_bo_config mm_config;
char *nv_dbg = getenv("NOUVEAU_MESA_DEBUG");
if (nv_dbg)
nouveau_mesa_debug = atoi(nv_dbg);
- ret = nouveau_channel_alloc(dev, 0xbeef0201, 0xbeef0202,
- 512*1024, &screen->channel);
+ if (dev->chipset < 0xc0) {
+ data = &nv04_data;
+ size = sizeof(nv04_data);
+ } else {
+ data = &nvc0_data;
+ size = sizeof(nvc0_data);
+ }
+
+ ret = nouveau_object_new(&dev->object, 0, NOUVEAU_FIFO_CHANNEL_CLASS,
+ data, size, &screen->channel);
if (ret)
return ret;
screen->device = dev;
+ ret = nouveau_client_new(screen->device, &screen->client);
+ if (ret)
+ return ret;
+ ret = nouveau_pushbuf_new(screen->client, screen->channel,
+ 4, 512 * 1024, 1,
+ &screen->pushbuf);
+ if (ret)
+ return ret;
+
pscreen->get_name = nouveau_screen_get_name;
pscreen->get_vendor = nouveau_screen_get_vendor;
@@ -225,10 +148,12 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)
util_format_s3tc_init();
+ memset(&mm_config, 0, sizeof(mm_config));
+
screen->mm_GART = nouveau_mm_create(dev,
NOUVEAU_BO_GART | NOUVEAU_BO_MAP,
- 0x000);
- screen->mm_VRAM = nouveau_mm_create(dev, NOUVEAU_BO_VRAM, 0x000);
+ &mm_config);
+ screen->mm_VRAM = nouveau_mm_create(dev, NOUVEAU_BO_VRAM, &mm_config);
return 0;
}
@@ -238,8 +163,10 @@ nouveau_screen_fini(struct nouveau_screen *screen)
nouveau_mm_destroy(screen->mm_GART);
nouveau_mm_destroy(screen->mm_VRAM);
- nouveau_channel_free(&screen->channel);
+ nouveau_pushbuf_del(&screen->pushbuf);
- nouveau_device_close(&screen->device);
-}
+ nouveau_client_del(&screen->client);
+ nouveau_object_del(&screen->channel);
+ nouveau_device_del(&screen->device);
+}
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h
index d2003e62f51..a2784773143 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.h
+++ b/src/gallium/drivers/nouveau/nouveau_screen.h
@@ -3,6 +3,7 @@
#include "pipe/p_screen.h"
#include "util/u_memory.h"
+
typedef uint32_t u32;
extern int nouveau_mesa_debug;
@@ -12,12 +13,10 @@ struct nouveau_bo;
struct nouveau_screen {
struct pipe_screen base;
struct nouveau_device *device;
- struct nouveau_channel *channel;
+ struct nouveau_object *channel;
+ struct nouveau_client *client;
+ struct nouveau_pushbuf *pushbuf;
- /* note that OpenGL doesn't distinguish between these, so
- * these almost always should be set to the same value */
- unsigned vertex_buffer_flags;
- unsigned index_buffer_flags;
unsigned sysmem_bindings;
struct {
@@ -40,30 +39,6 @@ nouveau_screen(struct pipe_screen *pscreen)
return (struct nouveau_screen *)pscreen;
}
-
-
-/* Not really sure if this is needed, or whether the individual
- * drivers are happy to talk to the bo functions themselves. In a way
- * this is what we'd expect from a regular winsys interface.
- */
-struct nouveau_bo *
-nouveau_screen_bo_new(struct pipe_screen *pscreen, unsigned alignment,
- unsigned usage, unsigned bind, unsigned size);
-void *
-nouveau_screen_bo_map(struct pipe_screen *pscreen,
- struct nouveau_bo *pb,
- unsigned usage);
-void *
-nouveau_screen_bo_map_range(struct pipe_screen *pscreen, struct nouveau_bo *bo,
- unsigned offset, unsigned length, unsigned usage);
-void
-nouveau_screen_bo_map_flush_range(struct pipe_screen *pscreen, struct nouveau_bo *bo,
- unsigned offset, unsigned length);
-void
-nouveau_screen_bo_unmap(struct pipe_screen *pscreen, struct nouveau_bo *bo);
-void
-nouveau_screen_bo_release(struct pipe_screen *pscreen, struct nouveau_bo *bo);
-
boolean
nouveau_screen_bo_get_handle(struct pipe_screen *pscreen,
struct nouveau_bo *bo,
@@ -80,19 +55,4 @@ void nouveau_screen_fini(struct nouveau_screen *);
void nouveau_screen_init_vdec(struct nouveau_screen *);
-
-#ifndef NOUVEAU_NVC0
-static INLINE unsigned
-RING_3D(unsigned mthd, unsigned size)
-{
- return (7 << 13) | (size << 18) | mthd;
-}
-
-static INLINE unsigned
-RING_3D_NI(unsigned mthd, unsigned size)
-{
- return 0x40000000 | (7 << 13) | (size << 18) | mthd;
-}
-#endif
-
#endif
diff --git a/src/gallium/drivers/nouveau/nouveau_statebuf.h b/src/gallium/drivers/nouveau/nouveau_statebuf.h
index dcffdd91154..4f8bd7bdf16 100644
--- a/src/gallium/drivers/nouveau/nouveau_statebuf.h
+++ b/src/gallium/drivers/nouveau/nouveau_statebuf.h
@@ -20,8 +20,13 @@ struct nouveau_statebuf_builder
#define sb_data(sb, v) *(sb).p++ = (v)
#endif
-#define sb_method(sb, v, n) sb_data(sb, RING_3D(v, n));
+static INLINE uint32_t sb_header(unsigned subc, unsigned mthd, unsigned size)
+{
+ return (size << 18) | (subc << 13) | mthd;
+}
+
+#define sb_method(sb, v, n) sb_data(sb, sb_header(SUBC_3D(v), n));
#define sb_len(sb, var) ((sb).p - (var))
-#define sb_emit(chan, sb_buf, sb_len) do {WAIT_RING((chan), (sb_len)); OUT_RINGp((chan), (sb_buf), (sb_len)); } while(0)
+#define sb_emit(push, sb_buf, sb_len) do {PUSH_SPACE((push), (sb_len)); PUSH_DATAp((push), (sb_buf), (sb_len)); } while(0)
#endif
diff --git a/src/gallium/drivers/nouveau/nouveau_video.c b/src/gallium/drivers/nouveau/nouveau_video.c
index 42bc102b1cf..bd8f0961bc4 100644
--- a/src/gallium/drivers/nouveau/nouveau_video.c
+++ b/src/gallium/drivers/nouveau/nouveau_video.c
@@ -27,27 +27,23 @@
#include "nouveau_context.h"
#include "nouveau_video.h"
-#include "nouveau/nouveau_bo.h"
#include "nouveau/nouveau_buffer.h"
#include "util/u_video.h"
#include "util/u_format.h"
#include "util/u_sampler.h"
-#include "nouveau/nouveau_device.h"
-#include "nouveau_winsys.h"
static int
nouveau_vpe_init(struct nouveau_decoder *dec) {
int ret;
if (dec->cmds)
return 0;
- ret = nouveau_bo_map(dec->cmd_bo, NOUVEAU_BO_RDWR);
+ ret = nouveau_bo_map(dec->cmd_bo, NOUVEAU_BO_RDWR, dec->client);
if (ret) {
debug_printf("Mapping cmd bo: %s\n", strerror(-ret));
return ret;
}
- ret = nouveau_bo_map(dec->data_bo, NOUVEAU_BO_RDWR);
+ ret = nouveau_bo_map(dec->data_bo, NOUVEAU_BO_RDWR, dec->client);
if (ret) {
- nouveau_bo_unmap(dec->cmd_bo);
debug_printf("Mapping data bo: %s\n", strerror(-ret));
return ret;
}
@@ -58,39 +54,45 @@ nouveau_vpe_init(struct nouveau_decoder *dec) {
static void
nouveau_vpe_synch(struct nouveau_decoder *dec) {
- struct nouveau_channel *chan = dec->screen->channel;
+ struct nouveau_pushbuf *push = dec->push;
#if 0
if (dec->fence_map) {
- BEGIN_RING(chan, dec->mpeg, NV84_MPEG_QUERY_COUNTER, 1);
- OUT_RING(chan, ++dec->fence_seq);
- FIRE_RING(chan);
+ BEGIN_NV04(push, NV84_MPEG(QUERY_COUNTER), 1);
+ PUSH_DATA (push, ++dec->fence_seq);
+ PUSH_KICK (push);
while (dec->fence_map[0] != dec->fence_seq)
usleep(1000);
} else
#endif
- FIRE_RING(chan);
+ PUSH_KICK(push);
}
static void
nouveau_vpe_fini(struct nouveau_decoder *dec) {
- struct nouveau_channel *chan = dec->screen->channel;
+ struct nouveau_pushbuf *push = dec->push;
if (!dec->cmds)
return;
- nouveau_bo_unmap(dec->data_bo);
- nouveau_bo_unmap(dec->cmd_bo);
+ nouveau_pushbuf_space(push, 8, 2, 0);
+ nouveau_bufctx_reset(dec->bufctx, NV31_VIDEO_BIND_CMD);
- MARK_RING(chan, 8, 2);
- BEGIN_RING(chan, dec->mpeg, NV31_MPEG_CMD_OFFSET, 2);
- OUT_RELOCl(chan, dec->cmd_bo, 0, NOUVEAU_BO_RD|NOUVEAU_BO_GART);
- OUT_RING(chan, dec->ofs * 4);
+#define BCTX_ARGS dec->bufctx, NV31_VIDEO_BIND_CMD, NOUVEAU_BO_RD
- BEGIN_RING(chan, dec->mpeg, NV31_MPEG_DATA_OFFSET, 2);
- OUT_RELOCl(chan, dec->data_bo, 0, NOUVEAU_BO_RD|NOUVEAU_BO_GART);
- OUT_RING(chan, dec->data_pos * 4);
+ BEGIN_NV04(push, NV31_MPEG(CMD_OFFSET), 2);
+ PUSH_MTHDl(push, NV31_MPEG(CMD_OFFSET), dec->cmd_bo, 0, BCTX_ARGS);
+ PUSH_DATA (push, dec->ofs * 4);
- BEGIN_RING(chan, dec->mpeg, NV31_MPEG_EXEC, 1);
- OUT_RING(chan, 1);
+ BEGIN_NV04(push, NV31_MPEG(DATA_OFFSET), 2);
+ PUSH_MTHDl(push, NV31_MPEG(DATA_OFFSET), dec->data_bo, 0, BCTX_ARGS);
+ PUSH_DATA (push, dec->data_pos * 4);
+
+#undef BCTX_ARGS
+
+ if (unlikely(nouveau_pushbuf_validate(dec->push)))
+ return;
+
+ BEGIN_NV04(push, NV31_MPEG(EXEC), 1);
+ PUSH_DATA (push, 1);
nouveau_vpe_synch(dec);
dec->ofs = dec->data_pos = dec->num_surfaces = 0;
@@ -384,9 +386,10 @@ nouveau_decoder_surface_index(struct nouveau_decoder *dec,
struct pipe_video_buffer *buffer)
{
struct nouveau_video_buffer *buf = (struct nouveau_video_buffer *)buffer;
- struct nouveau_channel *chan = dec->screen->channel;
- struct nouveau_bo *bo_y = ((struct nv04_resource *)buf->resources[0])->bo;
- struct nouveau_bo *bo_c = ((struct nv04_resource *)buf->resources[1])->bo;
+ struct nouveau_pushbuf *push = dec->push;
+ struct nouveau_bo *bo_y = nv04_resource(buf->resources[0])->bo;
+ struct nouveau_bo *bo_c = nv04_resource(buf->resources[1])->bo;
+
unsigned i;
if (!buf)
@@ -399,10 +402,14 @@ nouveau_decoder_surface_index(struct nouveau_decoder *dec,
dec->surfaces[i] = buf;
dec->num_surfaces++;
- MARK_RING(chan, 3, 2);
- BEGIN_RING(chan, dec->mpeg, NV31_MPEG_IMAGE_Y_OFFSET(i), 2);
- OUT_RELOCl(chan, bo_y, 0, NOUVEAU_BO_RDWR);
- OUT_RELOCl(chan, bo_c, 0, NOUVEAU_BO_RDWR);
+ nouveau_bufctx_reset(dec->bufctx, NV31_VIDEO_BIND_IMG(i));
+
+#define BCTX_ARGS dec->bufctx, NV31_VIDEO_BIND_IMG(i), NOUVEAU_BO_RDWR
+ BEGIN_NV04(push, NV31_MPEG(IMAGE_Y_OFFSET(i)), 2);
+ PUSH_MTHDl(push, NV31_MPEG(IMAGE_Y_OFFSET(i)), bo_y, 0, BCTX_ARGS);
+ PUSH_MTHDl(push, NV31_MPEG(IMAGE_C_OFFSET(i)), bo_c, 0, BCTX_ARGS);
+#undef BCTX_ARGS
+
return i;
}
@@ -475,18 +482,24 @@ nouveau_decoder_destroy(struct pipe_video_decoder *decoder)
{
struct nouveau_decoder *dec = (struct nouveau_decoder*)decoder;
- if (dec->cmds) {
- nouveau_bo_unmap(dec->data_bo);
- nouveau_bo_unmap(dec->cmd_bo);
- }
-
if (dec->data_bo)
nouveau_bo_ref(NULL, &dec->data_bo);
if (dec->cmd_bo)
nouveau_bo_ref(NULL, &dec->cmd_bo);
if (dec->fence_bo)
nouveau_bo_ref(NULL, &dec->fence_bo);
- nouveau_grobj_free(&dec->mpeg);
+
+ nouveau_object_del(&dec->mpeg);
+
+ if (dec->bufctx)
+ nouveau_bufctx_del(&dec->bufctx);
+ if (dec->push)
+ nouveau_pushbuf_del(&dec->push);
+ if (dec->client)
+ nouveau_client_del(&dec->client);
+ if (dec->chan)
+ nouveau_object_del(&dec->chan);
+
FREE(dec);
}
@@ -499,9 +512,10 @@ nouveau_create_decoder(struct pipe_context *context,
unsigned width, unsigned height,
unsigned max_references, bool expect_chunked_decode)
{
- struct nouveau_channel *chan = screen->channel;
- struct nouveau_grobj *mpeg = NULL;
+ struct nv04_fifo nv04_data = { .vram = 0xbeef0201, .gart = 0xbeef0202 };
+ struct nouveau_object *mpeg = NULL;
struct nouveau_decoder *dec;
+ struct nouveau_pushbuf *push;
int ret;
bool is8274 = screen->device->chipset > 0x80;
@@ -515,23 +529,40 @@ nouveau_create_decoder(struct pipe_context *context,
if (screen->device->chipset >= 0x98 && screen->device->chipset != 0xa0)
goto vl;
+ dec = CALLOC_STRUCT(nouveau_decoder);
+ if (!dec)
+ return NULL;
+
+ ret = nouveau_object_new(&screen->device->object, 0,
+ NOUVEAU_FIFO_CHANNEL_CLASS,
+ &nv04_data, sizeof(nv04_data), &dec->chan);
+ if (ret)
+ goto fail;
+ ret = nouveau_client_new(screen->device, &dec->client);
+ if (ret)
+ goto fail;
+ ret = nouveau_pushbuf_new(dec->client, dec->chan, 2, 4096, 1, &dec->push);
+ if (ret)
+ goto fail;
+ ret = nouveau_bufctx_new(dec->client, NV31_VIDEO_BIND_COUNT, &dec->bufctx);
+ if (ret)
+ goto fail;
+ push = dec->push;
+
width = align(width, 64);
height = align(height, 64);
if (is8274)
- ret = nouveau_grobj_alloc(chan, 0xbeef8274, 0x8274, &mpeg);
+ ret = nouveau_object_new(dec->chan, 0xbeef8274, NV84_MPEG_CLASS, NULL, 0,
+ &mpeg);
else
- ret = nouveau_grobj_alloc(chan, 0xbeef8274, 0x3174, &mpeg);
+ ret = nouveau_object_new(dec->chan, 0xbeef3174, NV31_MPEG_CLASS, NULL, 0,
+ &mpeg);
if (ret < 0) {
debug_printf("Creation failed: %s (%i)\n", strerror(-ret), ret);
return NULL;
}
- dec = CALLOC_STRUCT(nouveau_decoder);
- if (!dec) {
- nouveau_grobj_free(&mpeg);
- goto fail;
- }
dec->mpeg = mpeg;
dec->base.context = context;
dec->base.profile = profile;
@@ -543,61 +574,67 @@ nouveau_create_decoder(struct pipe_context *context,
dec->base.destroy = nouveau_decoder_destroy;
dec->base.begin_frame = nouveau_decoder_begin_frame;
dec->base.decode_macroblock = nouveau_decoder_decode_macroblock;
- dec->base.begin_frame = nouveau_decoder_end_frame;
+ dec->base.end_frame = nouveau_decoder_end_frame;
dec->base.flush = nouveau_decoder_flush;
dec->screen = screen;
- ret = nouveau_bo_new(dec->screen->device, NOUVEAU_BO_GART, 0, 1024 * 1024, &dec->cmd_bo);
+ ret = nouveau_bo_new(dec->screen->device, NOUVEAU_BO_GART | NOUVEAU_BO_MAP,
+ 0, 1024 * 1024, NULL, &dec->cmd_bo);
if (ret)
goto fail;
- ret = nouveau_bo_new(dec->screen->device, NOUVEAU_BO_GART, 0, width * height * 6, &dec->data_bo);
+ ret = nouveau_bo_new(dec->screen->device, NOUVEAU_BO_GART | NOUVEAU_BO_MAP,
+ 0, width * height * 6, NULL, &dec->data_bo);
if (ret)
goto fail;
- ret = nouveau_bo_new(dec->screen->device, NOUVEAU_BO_GART|NOUVEAU_BO_MAP, 0, 4096,
- &dec->fence_bo);
+ /* we don't need the fence, the kernel sync's for us */
+#if 0
+ ret = nouveau_bo_new(dec->screen->device, NOUVEAU_BO_GART | NOUVEAU_BO_MAP,
+ 0, 4096, NULL, &dec->fence_bo);
if (ret)
goto fail;
- nouveau_bo_map(dec->fence_bo, NOUVEAU_BO_RDWR);
+ nouveau_bo_map(dec->fence_bo, NOUVEAU_BO_RDWR, NULL);
dec->fence_map = dec->fence_bo->map;
- nouveau_bo_unmap(dec->fence_bo);
dec->fence_map[0] = 0;
+#endif
- if (is8274)
- MARK_RING(chan, 25, 3);
- else
- MARK_RING(chan, 20, 2);
+ nouveau_pushbuf_bufctx(dec->push, dec->bufctx);
+ nouveau_pushbuf_space(push, 32, 4, 0);
- BEGIN_RING(chan, mpeg, NV31_MPEG_DMA_CMD, 1);
- OUT_RING(chan, chan->vram->handle);
+ BEGIN_NV04(push, SUBC_MPEG(NV01_SUBCHAN_OBJECT), 1);
+ PUSH_DATA (push, dec->mpeg->handle);
- BEGIN_RING(chan, mpeg, NV31_MPEG_DMA_DATA, 1);
- OUT_RING(chan, chan->vram->handle);
+ BEGIN_NV04(push, NV31_MPEG(DMA_CMD), 1);
+ PUSH_DATA (push, nv04_data.gart);
- BEGIN_RING(chan, mpeg, NV31_MPEG_DMA_IMAGE, 1);
- OUT_RING(chan, chan->vram->handle);
+ BEGIN_NV04(push, NV31_MPEG(DMA_DATA), 1);
+ PUSH_DATA (push, nv04_data.gart);
- BEGIN_RING(chan, mpeg, NV31_MPEG_PITCH, 2);
- OUT_RING(chan, width | NV31_MPEG_PITCH_UNK);
- OUT_RING(chan, (height << NV31_MPEG_SIZE_H__SHIFT) | width);
+ BEGIN_NV04(push, NV31_MPEG(DMA_IMAGE), 1);
+ PUSH_DATA (push, nv04_data.vram);
- BEGIN_RING(chan, mpeg, NV31_MPEG_FORMAT, 2);
- OUT_RING(chan, 0);
+ BEGIN_NV04(push, NV31_MPEG(PITCH), 2);
+ PUSH_DATA (push, width | NV31_MPEG_PITCH_UNK);
+ PUSH_DATA (push, (height << NV31_MPEG_SIZE_H__SHIFT) | width);
+
+ BEGIN_NV04(push, NV31_MPEG(FORMAT), 2);
+ PUSH_DATA (push, 0);
switch (entrypoint) {
- case PIPE_VIDEO_ENTRYPOINT_BITSTREAM: OUT_RING(chan, 0x100); break;
- case PIPE_VIDEO_ENTRYPOINT_IDCT: OUT_RING(chan, 1); break;
- case PIPE_VIDEO_ENTRYPOINT_MC: OUT_RING(chan, 0); break;
+ case PIPE_VIDEO_ENTRYPOINT_BITSTREAM: PUSH_DATA (push, 0x100); break;
+ case PIPE_VIDEO_ENTRYPOINT_IDCT: PUSH_DATA (push, 1); break;
+ case PIPE_VIDEO_ENTRYPOINT_MC: PUSH_DATA (push, 0); break;
default: assert(0);
}
if (is8274) {
- BEGIN_RING(chan, mpeg, NV84_MPEG_DMA_QUERY, 1);
- OUT_RING(chan, chan->vram->handle);
-
- BEGIN_RING(chan, mpeg, NV84_MPEG_QUERY_OFFSET, 2);
- OUT_RELOCl(chan, dec->fence_bo, 0, NOUVEAU_BO_WR|NOUVEAU_BO_GART);
- OUT_RING(chan, dec->fence_seq);
+ BEGIN_NV04(push, NV84_MPEG(DMA_QUERY), 1);
+ PUSH_DATA (push, nv04_data.vram);
+#if 0
+ BEGIN_NV04(push, NV84_MPEG(QUERY_OFFSET), 2);
+ PUSH_DATA (push, dec->fence_bo->offset);
+ PUSH_DATA (push, dec->fence_seq);
+#endif
}
ret = nouveau_vpe_init(dec);
diff --git a/src/gallium/drivers/nouveau/nouveau_video.h b/src/gallium/drivers/nouveau/nouveau_video.h
index 22593ff9bbc..1d6ced035fb 100644
--- a/src/gallium/drivers/nouveau/nouveau_video.h
+++ b/src/gallium/drivers/nouveau/nouveau_video.h
@@ -1,8 +1,11 @@
#ifndef __NOUVEAU_VIDEO_H__
-#define __NOUVEAU_SCREEN_H__
+#define __NOUVEAU_VIDEO_H__
#include "nv17_mpeg.xml.h"
#include "nv31_mpeg.xml.h"
+#include "nv_object.xml.h"
+
+#include "nouveau_winsys.h"
struct nouveau_video_buffer {
struct pipe_video_buffer base;
@@ -16,7 +19,11 @@ struct nouveau_video_buffer {
struct nouveau_decoder {
struct pipe_video_decoder base;
struct nouveau_screen *screen;
- struct nouveau_grobj *mpeg;
+ struct nouveau_pushbuf *push;
+ struct nouveau_object *chan;
+ struct nouveau_client *client;
+ struct nouveau_bufctx *bufctx;
+ struct nouveau_object *mpeg;
struct nouveau_bo *cmd_bo, *data_bo, *fence_bo;
unsigned *fence_map;
@@ -34,9 +41,56 @@ struct nouveau_decoder {
struct nouveau_video_buffer *surfaces[8];
};
+#define NV31_VIDEO_BIND_IMG(i) i
+#define NV31_VIDEO_BIND_CMD NV31_MPEG_IMAGE_Y_OFFSET__LEN
+#define NV31_VIDEO_BIND_COUNT (NV31_MPEG_IMAGE_Y_OFFSET__LEN + 1)
+
static INLINE void
nouveau_vpe_write(struct nouveau_decoder *dec, unsigned data) {
dec->cmds[dec->ofs++] = data;
}
+#define SUBC_MPEG(mthd) 1, mthd
+#define NV31_MPEG(mthd) SUBC_MPEG(NV31_MPEG_##mthd)
+#define NV84_MPEG(mthd) SUBC_MPEG(NV84_MPEG_##mthd)
+
+static INLINE uint32_t
+NV04_FIFO_PKHDR(int subc, int mthd, unsigned size)
+{
+ return 0x00000000 | (size << 18) | (subc << 13) | mthd;
+}
+
+static INLINE uint32_t
+NV04_FIFO_PKHDR_NI(int subc, int mthd, unsigned size)
+{
+ return 0x40000000 | (size << 18) | (subc << 13) | mthd;
+}
+
+static INLINE void
+BEGIN_NV04(struct nouveau_pushbuf *push, int subc, int mthd, unsigned size)
+{
+ PUSH_SPACE(push, size + 1);
+ PUSH_DATA (push, NV04_FIFO_PKHDR(subc, mthd, size));
+}
+
+static INLINE void
+BEGIN_NI04(struct nouveau_pushbuf *push, int subc, int mthd, unsigned size)
+{
+ PUSH_SPACE(push, size + 1);
+ PUSH_DATA (push, NV04_FIFO_PKHDR_NI(subc, mthd, size));
+}
+
+static INLINE void
+PUSH_MTHDl(struct nouveau_pushbuf *push, int subc, int mthd,
+ struct nouveau_bo *bo, uint32_t offset,
+ struct nouveau_bufctx *ctx, int bin, uint32_t rw)
+{
+ nouveau_bufctx_mthd(ctx, bin, NV04_FIFO_PKHDR(subc, mthd, 1),
+ bo, offset,
+ NOUVEAU_BO_LOW | (bo->flags & NOUVEAU_BO_APER) | rw,
+ 0, 0);
+
+ PUSH_DATA(push, bo->offset + offset);
+}
+
#endif
diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h b/src/gallium/drivers/nouveau/nouveau_winsys.h
index 5c634771aff..9fb865e170d 100644
--- a/src/gallium/drivers/nouveau/nouveau_winsys.h
+++ b/src/gallium/drivers/nouveau/nouveau_winsys.h
@@ -6,19 +6,54 @@
#include "pipe/p_defines.h"
-#include "nouveau/nouveau_bo.h"
-#include "nouveau/nouveau_channel.h"
-#include "nouveau/nouveau_device.h"
-#include "nouveau/nouveau_grobj.h"
-#include "nouveau/nouveau_notifier.h"
-#ifndef NOUVEAU_NVC0
-#include "nouveau/nv04_pushbuf.h"
-#endif
+#include <libdrm/nouveau.h>
#ifndef NV04_PFIFO_MAX_PACKET_LEN
#define NV04_PFIFO_MAX_PACKET_LEN 2047
#endif
+static INLINE uint32_t
+PUSH_AVAIL(struct nouveau_pushbuf *push)
+{
+ return push->end - push->cur;
+}
+
+static INLINE boolean
+PUSH_SPACE(struct nouveau_pushbuf *push, uint32_t size)
+{
+ if (PUSH_AVAIL(push) < size)
+ return nouveau_pushbuf_space(push, size, 0, 0) == 0;
+ return TRUE;
+}
+
+static INLINE void
+PUSH_DATA(struct nouveau_pushbuf *push, uint32_t data)
+{
+ *push->cur++ = data;
+}
+
+static INLINE void
+PUSH_DATAp(struct nouveau_pushbuf *push, const void *data, uint32_t size)
+{
+ memcpy(push->cur, data, size * 4);
+ push->cur += size;
+}
+
+static INLINE void
+PUSH_DATAf(struct nouveau_pushbuf *push, float f)
+{
+ union { float f; uint32_t i; } u;
+ u.f = f;
+ PUSH_DATA(push, u.i);
+}
+
+static INLINE void
+PUSH_KICK(struct nouveau_pushbuf *push)
+{
+ nouveau_pushbuf_kick(push, push->channel);
+}
+
+
#define NOUVEAU_RESOURCE_FLAG_LINEAR (PIPE_RESOURCE_FLAG_DRV_PRIV << 0)
#define NOUVEAU_RESOURCE_FLAG_DRV_PRIV (PIPE_RESOURCE_FLAG_DRV_PRIV << 1)
@@ -27,16 +62,14 @@ nouveau_screen_transfer_flags(unsigned pipe)
{
uint32_t flags = 0;
- if (pipe & PIPE_TRANSFER_READ)
- flags |= NOUVEAU_BO_RD;
- if (pipe & PIPE_TRANSFER_WRITE)
- flags |= NOUVEAU_BO_WR;
- if (pipe & PIPE_TRANSFER_DISCARD_RANGE)
- flags |= NOUVEAU_BO_INVAL;
- if (pipe & PIPE_TRANSFER_UNSYNCHRONIZED)
- flags |= NOUVEAU_BO_NOSYNC;
- else if (pipe & PIPE_TRANSFER_DONTBLOCK)
- flags |= NOUVEAU_BO_NOWAIT;
+ if (!(pipe & PIPE_TRANSFER_UNSYNCHRONIZED)) {
+ if (pipe & PIPE_TRANSFER_READ)
+ flags |= NOUVEAU_BO_RD;
+ if (pipe & PIPE_TRANSFER_WRITE)
+ flags |= NOUVEAU_BO_WR;
+ if (pipe & PIPE_TRANSFER_DONTBLOCK)
+ flags |= NOUVEAU_BO_NOBLOCK;
+ }
return flags;
}
diff --git a/src/gallium/drivers/nouveau/nv_m2mf.xml.h b/src/gallium/drivers/nouveau/nv_m2mf.xml.h
index ffdaf95de62..dbc96a945ef 100644
--- a/src/gallium/drivers/nouveau/nv_m2mf.xml.h
+++ b/src/gallium/drivers/nouveau/nv_m2mf.xml.h
@@ -1,5 +1,5 @@
-#ifndef NV_M2MF_XML
-#define NV_M2MF_XML
+#ifndef RNNDB_NV_M2MF_XML
+#define RNNDB_NV_M2MF_XML
/* Autogenerated file, DO NOT EDIT manually!
@@ -8,13 +8,14 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng
git clone git://0x04.net/rules-ng-ng
The rules-ng-ng source files this header was generated from are:
-- nv_m2mf.xml ( 2710 bytes, from 2010-08-05 19:38:53)
-- copyright.xml ( 6503 bytes, from 2010-04-10 23:15:50)
-- nv_object.xml ( 10424 bytes, from 2010-08-05 19:38:53)
-- nvchipsets.xml ( 2824 bytes, from 2010-08-05 19:38:53)
-- nv_defs.xml ( 4437 bytes, from 2010-08-05 19:38:53)
-
-Copyright (C) 2006-2010 by the following authors:
+- rnndb/nv_m2mf.xml ( 2696 bytes, from 2011-07-09 13:43:58)
+- ./rnndb/copyright.xml ( 6452 bytes, from 2011-07-09 13:43:58)
+- ./rnndb/nv_object.xml ( 12672 bytes, from 2011-07-17 12:14:32)
+- ./rnndb/nvchipsets.xml ( 3701 bytes, from 2012-04-06 13:21:15)
+- ./rnndb/nv_defs.xml ( 4437 bytes, from 2011-07-09 13:43:58)
+- ./rnndb/nv50_defs.xml ( 5468 bytes, from 2011-07-09 13:43:58)
+
+Copyright (C) 2006-2011 by the following authors:
- Artur Huillet <[email protected]> (ahuillet)
- Ben Skeggs (darktama, darktama_)
- B. R. <[email protected]> (koala_br)
@@ -25,7 +26,7 @@ Copyright (C) 2006-2010 by the following authors:
- Dmitry Eremin-Solenikov <[email protected]> (lumag)
- EdB <[email protected]> (edb_)
- Erik Waling <[email protected]> (erikwaling)
-- Francisco Jerez <[email protected]> (curro, curro_, currojerez)
+- Francisco Jerez <[email protected]> (curro)
- imirkin <[email protected]> (imirkin)
- jb17bsome <[email protected]> (jb17bsome)
- Jeremy Kolb <[email protected]> (kjeremy)
@@ -36,7 +37,7 @@ Copyright (C) 2006-2010 by the following authors:
- Mark Carey <[email protected]> (careym)
- Matthieu Castet <[email protected]> (mat-c)
- nvidiaman <[email protected]> (nvidiaman)
-- Patrice Mandin <[email protected]> (pmandin, pmdata)
+- Patrice Mandin <[email protected]> (pmandin, pmdata)
- Pekka Paalanen <[email protected]> (pq, ppaalanen)
- Peter Popov <[email protected]> (ironpeter)
- Richard Hughes <[email protected]> (hughsient)
@@ -74,11 +75,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#define NV04_M2MF_DMA_NOTIFY 0x00000180
+#define NV03_M2MF_DMA_NOTIFY 0x00000180
-#define NV04_M2MF_DMA_BUFFER_IN 0x00000184
+#define NV03_M2MF_DMA_BUFFER_IN 0x00000184
-#define NV04_M2MF_DMA_BUFFER_OUT 0x00000188
+#define NV03_M2MF_DMA_BUFFER_OUT 0x00000188
#define NV50_M2MF_LINEAR_IN 0x00000200
@@ -121,35 +122,35 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define NV50_M2MF_OFFSET_OUT_HIGH 0x0000023c
-#define NV04_M2MF_OFFSET_IN 0x0000030c
+#define NV03_M2MF_OFFSET_IN 0x0000030c
-#define NV04_M2MF_OFFSET_OUT 0x00000310
+#define NV03_M2MF_OFFSET_OUT 0x00000310
-#define NV04_M2MF_PITCH_IN 0x00000314
+#define NV03_M2MF_PITCH_IN 0x00000314
-#define NV04_M2MF_PITCH_OUT 0x00000318
+#define NV03_M2MF_PITCH_OUT 0x00000318
-#define NV04_M2MF_LINE_LENGTH_IN 0x0000031c
+#define NV03_M2MF_LINE_LENGTH_IN 0x0000031c
-#define NV04_M2MF_LINE_COUNT 0x00000320
+#define NV03_M2MF_LINE_COUNT 0x00000320
-#define NV04_M2MF_FORMAT 0x00000324
-#define NV04_M2MF_FORMAT_INPUT_INC__MASK 0x000000ff
-#define NV04_M2MF_FORMAT_INPUT_INC__SHIFT 0
-#define NV04_M2MF_FORMAT_INPUT_INC_1 0x00000001
-#define NV04_M2MF_FORMAT_INPUT_INC_2 0x00000002
-#define NV04_M2MF_FORMAT_INPUT_INC_4 0x00000004
+#define NV03_M2MF_FORMAT 0x00000324
+#define NV03_M2MF_FORMAT_INPUT_INC__MASK 0x000000ff
+#define NV03_M2MF_FORMAT_INPUT_INC__SHIFT 0
+#define NV03_M2MF_FORMAT_INPUT_INC_1 0x00000001
+#define NV03_M2MF_FORMAT_INPUT_INC_2 0x00000002
+#define NV03_M2MF_FORMAT_INPUT_INC_4 0x00000004
#define NV50_M2MF_FORMAT_INPUT_INC_8 0x00000008
#define NV50_M2MF_FORMAT_INPUT_INC_16 0x00000010
-#define NV04_M2MF_FORMAT_OUTPUT_INC__MASK 0x0000ff00
-#define NV04_M2MF_FORMAT_OUTPUT_INC__SHIFT 8
-#define NV04_M2MF_FORMAT_OUTPUT_INC_1 0x00000100
-#define NV04_M2MF_FORMAT_OUTPUT_INC_2 0x00000200
-#define NV04_M2MF_FORMAT_OUTPUT_INC_4 0x00000400
+#define NV03_M2MF_FORMAT_OUTPUT_INC__MASK 0x0000ff00
+#define NV03_M2MF_FORMAT_OUTPUT_INC__SHIFT 8
+#define NV03_M2MF_FORMAT_OUTPUT_INC_1 0x00000100
+#define NV03_M2MF_FORMAT_OUTPUT_INC_2 0x00000200
+#define NV03_M2MF_FORMAT_OUTPUT_INC_4 0x00000400
#define NV50_M2MF_FORMAT_OUTPUT_INC_8 0x00000800
#define NV50_M2MF_FORMAT_OUTPUT_INC_16 0x00001000
-#define NV04_M2MF_BUF_NOTIFY 0x00000328
+#define NV03_M2MF_BUF_NOTIFY 0x00000328
-#endif /* NV_M2MF_XML */
+#endif /* RNNDB_NV_M2MF_XML */
diff --git a/src/gallium/drivers/nouveau/nv_object.xml.h b/src/gallium/drivers/nouveau/nv_object.xml.h
index 47dc6751041..d87d7139bf3 100644
--- a/src/gallium/drivers/nouveau/nv_object.xml.h
+++ b/src/gallium/drivers/nouveau/nv_object.xml.h
@@ -1,5 +1,10 @@
-#ifndef NV_OBJECT_XML
-#define NV_OBJECT_XML
+#ifndef RNNDB_NV_OBJECT_XML
+#define RNNDB_NV_OBJECT_XML
+
+/* WARNING ABOUT NOT EDITING AUTOGENERATED FILE IGNORED, _CLASS SUFFIX HAS
+ * BEEN ADDED TO ALL THE OBJECT CLASS DEFINITIONS TO AVOID CONFLICTS WITH
+ * THE RING MACROS WE WANT TO USE
+ */
/* Autogenerated file, DO NOT EDIT manually!
@@ -8,12 +13,13 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng
git clone git://0x04.net/rules-ng-ng
The rules-ng-ng source files this header was generated from are:
-- nv_object.xml ( 11547 bytes, from 2010-10-24 15:29:34)
-- copyright.xml ( 6498 bytes, from 2010-10-03 13:18:37)
-- nvchipsets.xml ( 2907 bytes, from 2010-10-15 16:28:21)
-- nv_defs.xml ( 4437 bytes, from 2010-07-06 07:43:58)
+- rnndb/nv_object.xml ( 12672 bytes, from 2011-07-17 12:14:32)
+- ./rnndb/copyright.xml ( 6452 bytes, from 2011-07-09 13:43:58)
+- ./rnndb/nvchipsets.xml ( 3701 bytes, from 2012-04-06 13:21:15)
+- ./rnndb/nv_defs.xml ( 4437 bytes, from 2011-07-09 13:43:58)
+- ./rnndb/nv50_defs.xml ( 5468 bytes, from 2011-07-09 13:43:58)
-Copyright (C) 2006-2010 by the following authors:
+Copyright (C) 2006-2011 by the following authors:
- Artur Huillet <[email protected]> (ahuillet)
- Ben Skeggs (darktama, darktama_)
- B. R. <[email protected]> (koala_br)
@@ -24,7 +30,7 @@ Copyright (C) 2006-2010 by the following authors:
- Dmitry Eremin-Solenikov <[email protected]> (lumag)
- EdB <[email protected]> (edb_)
- Erik Waling <[email protected]> (erikwaling)
-- Francisco Jerez <[email protected]> (curro, curro_, currojerez)
+- Francisco Jerez <[email protected]> (curro)
- imirkin <[email protected]> (imirkin)
- jb17bsome <[email protected]> (jb17bsome)
- Jeremy Kolb <[email protected]> (kjeremy)
@@ -72,114 +78,129 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#define NV01_ROOT 0x00000001
-#define NV01_CONTEXT_DMA 0x00000002
-#define NV01_DEVICE 0x00000003
-#define NV01_TIMER 0x00000004
-#define NV01_NULL 0x00000030
-#define NV01_MEMORY_LOCAL_BANKED 0x0000003d
-#define NV01_MAPPING_SYSTEM 0x0000003e
-#define NV03_MEMORY_LOCAL_CURSOR 0x0000003f
-#define NV01_MEMORY_LOCAL_LINEAR 0x00000040
-#define NV01_MAPPING_LOCAL 0x00000041
-#define NV03_VIDEO_LUT_CURSOR_DAC 0x00000046
-#define NV03_CHANNEL_PIO 0x0000006a
-#define NV03_CHANNEL_DMA 0x0000006b
-#define NV10_VIDEO_DISPLAY 0x0000007c
-#define NV01_CONTEXT_BETA1 0x00000012
-#define NV04_BETA_SOLID 0x00000072
-#define NV01_CONTEXT_COLOR_KEY 0x00000017
-#define NV04_CONTEXT_COLOR_KEY 0x00000057
-#define NV01_CONTEXT_PATTERN 0x00000018
-#define NV01_CONTEXT_CLIP_RECTANGLE 0x00000019
-#define NV03_CONTEXT_ROP 0x00000043
-#define NV04_IMAGE_PATTERN 0x00000044
-#define NV01_RENDER_SOLID_LINE 0x0000001c
-#define NV04_RENDER_SOLID_LINE 0x0000005c
-#define NV30_RENDER_SOLID_LINE 0x0000035c
-#define NV40_RENDER_SOLID_LINE 0x0000305c
-#define NV01_RENDER_SOLID_TRIANGLE 0x0000001d
-#define NV04_RENDER_SOLID_TRIANGLE 0x0000005d
-#define NV01_RENDER_SOLID_RECTANGLE 0x0000001e
-#define NV04_RENDER_SOLID_RECTANGLE 0x0000005e
-#define NV01_IMAGE_BLIT 0x0000001f
-#define NV04_IMAGE_BLIT 0x0000005f
-#define NV11_IMAGE_BLIT 0x0000009f
-#define NV01_IMAGE_FROM_CPU 0x00000021
-#define NV04_IMAGE_FROM_CPU 0x00000061
-#define NV05_IMAGE_FROM_CPU 0x00000065
-#define NV10_IMAGE_FROM_CPU 0x0000008a
-#define NV30_IMAGE_FROM_CPU 0x0000038a
-#define NV40_IMAGE_FROM_CPU 0x0000308a
-#define NV03_STRETCHED_IMAGE_FROM_CPU 0x00000036
-#define NV04_STRETCHED_IMAGE_FROM_CPU 0x00000076
-#define NV05_STRETCHED_IMAGE_FROM_CPU 0x00000066
-#define NV30_STRETCHED_IMAGE_FROM_CPU 0x00000366
-#define NV40_STRETCHED_IMAGE_FROM_CPU 0x00003066
-#define NV03_SCALED_IMAGE_FROM_MEMORY 0x00000037
-#define NV04_SCALED_IMAGE_FROM_MEMORY 0x00000077
-#define NV05_SCALED_IMAGE_FROM_MEMORY 0x00000063
-#define NV10_SCALED_IMAGE_FROM_MEMORY 0x00000089
-#define NV30_SCALED_IMAGE_FROM_MEMORY 0x00000389
-#define NV40_SCALED_IMAGE_FROM_MEMORY 0x00003089
-#define NV50_SCALED_IMAGE_FROM_MEMORY 0x00005089
-#define NV04_DVD_SUBPICTURE 0x00000038
-#define NV10_DVD_SUBPICTURE 0x00000088
-#define NV03_GDI_RECTANGLE_TEXT 0x0000004b
-#define NV04_GDI_RECTANGLE_TEXT 0x0000004a
-#define NV04_SWIZZLED_SURFACE 0x00000052
-#define NV11_SWIZZLED_SURFACE 0x0000009e
-#define NV30_SWIZZLED_SURFACE 0x0000039e
-#define NV40_SWIZZLED_SURFACE 0x0000309e
-#define NV03_CONTEXT_SURFACE_DST 0x00000058
-#define NV03_CONTEXT_SURFACE_SRC 0x00000059
-#define NV04_CONTEXT_SURFACES_2D 0x00000042
-#define NV10_CONTEXT_SURFACES_2D 0x00000062
-#define NV30_CONTEXT_SURFACES_2D 0x00000362
-#define NV40_CONTEXT_SURFACES_2D 0x00003062
-#define NV50_CONTEXT_SURFACES_2D 0x00005062
-#define NV04_INDEXED_IMAGE_FROM_CPU 0x00000060
-#define NV05_INDEXED_IMAGE_FROM_CPU 0x00000064
-#define NV30_INDEXED_IMAGE_FROM_CPU 0x00000364
-#define NV40_INDEXED_IMAGE_FROM_CPU 0x00003064
-#define NV10_TEXTURE_FROM_CPU 0x0000007b
-#define NV30_TEXTURE_FROM_CPU 0x0000037b
-#define NV40_TEXTURE_FROM_CPU 0x0000307b
-#define NV04_M2MF 0x00000039
-#define NV50_M2MF 0x00005039
-#define NVC0_M2MF 0x00009039
-#define NV03_TEXTURED_TRIANGLE 0x00000048
-#define NV04_TEXTURED_TRIANGLE 0x00000054
-#define NV10_TEXTURED_TRIANGLE 0x00000094
-#define NV04_MULTITEX_TRIANGLE 0x00000055
-#define NV10_MULTITEX_TRIANGLE 0x00000095
-#define NV03_CONTEXT_SURFACE_COLOR 0x0000005a
-#define NV03_CONTEXT_SURFACE_ZETA 0x0000005b
-#define NV04_CONTEXT_SURFACES_3D 0x00000053
-#define NV10_CONTEXT_SURFACES_3D 0x00000093
-#define NV10_3D 0x00000056
-#define NV11_3D 0x00000096
-#define NV17_3D 0x00000099
-#define NV20_3D 0x00000097
-#define NV25_3D 0x00000597
-#define NV30_3D 0x00000397
-#define NV35_3D 0x00000497
-#define NV34_3D 0x00000697
-#define NV40_3D 0x00004097
-#define NV44_3D 0x00004497
-#define NV50_3D 0x00005097
-#define NV84_3D 0x00008297
-#define NVA0_3D 0x00008397
-#define NVA3_3D 0x00008597
-#define NVAF_3D 0x00008697
-#define NVC0_3D 0x00009097
-#define NV50_2D 0x0000502d
-#define NVC0_2D 0x0000902d
-#define NV50_COMPUTE 0x000050c0
-#define NVA3_COMPUTE 0x000085c0
-#define NVC0_COMPUTE 0x000090c0
-#define NV84_CRYPT 0x000074c1
-#define NV01_SUBCHAN__SIZE 0x00002000
+#define NV01_DMA_FROM_MEMORY_CLASS 0x00000002
+#define NV01_DMA_TO_MEMORY_CLASS 0x00000003
+#define NV01_NULL_CLASS 0x00000030
+#define NV03_DMA_IN_MEMORY_CLASS 0x0000003d
+#define NV01_OP_CLIP_CLASS 0x00000010
+#define NV01_OP_BLEND_AND_CLASS 0x00000011
+#define NV01_BETA_CLASS 0x00000012
+#define NV04_BETA4_CLASS 0x00000072
+#define NV01_OP_ROP_AND_CLASS 0x00000013
+#define NV01_ROP_CLASS 0x00000014
+#define NV03_ROP_CLASS 0x00000043
+#define NV01_OP_CHROMA_CLASS 0x00000015
+#define NV01_OP_PLANE_SWITCH_CLASS 0x00000016
+#define NV01_CHROMA_CLASS 0x00000017
+#define NV04_CHROMA_CLASS 0x00000057
+#define NV01_PATTERN_CLASS 0x00000018
+#define NV04_PATTERN_CLASS 0x00000044
+#define NV01_CLIP_CLASS 0x00000019
+#define NV01_OP_SRCCOPY_AND_CLASS 0x00000064
+#define NV03_OP_SRCCOPY_CLASS 0x00000065
+#define NV04_OP_SRCCOPY_PREMULT_CLASS 0x00000066
+#define NV04_OP_BLEND_PREMULT_CLASS 0x00000067
+#define NV01_POINT_CLASS 0x0000001a
+#define NV01_LINE_CLASS 0x0000001b
+#define NV01_LIN_CLASS 0x0000001c
+#define NV04_LIN_CLASS 0x0000005c
+#define NV30_LIN_CLASS 0x0000035c
+#define NV40_LIN_CLASS 0x0000305c
+#define NV01_TRI_CLASS 0x0000001d
+#define NV04_TRI_CLASS 0x0000005d
+#define NV01_RECT_CLASS 0x0000001e
+#define NV04_RECT_CLASS 0x0000005e
+#define NV01_BLIT_CLASS 0x0000001f
+#define NV04_BLIT_CLASS 0x0000005f
+#define NV15_BLIT_CLASS 0x0000009f
+#define NV01_IFROMMEM_CLASS 0x00000020
+#define NV01_IFC_CLASS 0x00000021
+#define NV04_IFC_CLASS 0x00000061
+#define NV05_IFC_CLASS 0x00000065
+#define NV10_IFC_CLASS 0x0000008a
+#define NV30_IFC_CLASS 0x0000038a
+#define NV40_IFC_CLASS 0x0000308a
+#define NV01_BITMAP_CLASS 0x00000022
+#define NV01_ITOMEM_CLASS 0x00000025
+#define NV03_SIFC_CLASS 0x00000036
+#define NV04_SIFC_CLASS 0x00000076
+#define NV05_SIFC_CLASS 0x00000066
+#define NV30_SIFC_CLASS 0x00000366
+#define NV40_SIFC_CLASS 0x00003066
+#define NV03_SIFM_CLASS 0x00000037
+#define NV04_SIFM_CLASS 0x00000077
+#define NV05_SIFM_CLASS 0x00000063
+#define NV10_SIFM_CLASS 0x00000089
+#define NV30_SIFM_CLASS 0x00000389
+#define NV40_SIFM_CLASS 0x00003089
+#define NV50_SIFM_CLASS 0x00005089
+#define NV03_SYFM_CLASS 0x00000038
+#define NV03_GDI_CLASS 0x0000004b
+#define NV04_GDI_CLASS 0x0000004a
+#define NV04_SURFACE_SWZ_CLASS 0x00000052
+#define NV20_SURFACE_SWZ_CLASS 0x0000009e
+#define NV30_SURFACE_SWZ_CLASS 0x0000039e
+#define NV40_SURFACE_SWZ_CLASS 0x0000309e
+#define NV03_SURFACE_DST_CLASS 0x00000058
+#define NV03_SURFACE_SRC_CLASS 0x00000059
+#define NV04_SURFACE_2D_CLASS 0x00000042
+#define NV10_SURFACE_2D_CLASS 0x00000062
+#define NV30_SURFACE_2D_CLASS 0x00000362
+#define NV40_SURFACE_2D_CLASS 0x00003062
+#define NV50_SURFACE_2D_CLASS 0x00005062
+#define NV04_INDEX_CLASS 0x00000060
+#define NV05_INDEX_CLASS 0x00000064
+#define NV30_INDEX_CLASS 0x00000364
+#define NV40_INDEX_CLASS 0x00003064
+#define NV10_TEXUPLOAD_CLASS 0x0000007b
+#define NV30_TEXUPLOAD_CLASS 0x0000037b
+#define NV40_TEXUPLOAD_CLASS 0x0000307b
+#define NV04_DVD_SUBPICTURE_CLASS 0x00000038
+#define NV10_DVD_SUBPICTURE_CLASS 0x00000088
+#define NV03_M2MF_CLASS 0x00000039
+#define NV50_M2MF_CLASS 0x00005039
+#define NVC0_M2MF_CLASS 0x00009039
+#define NV03_SURFACE_COLOR_CLASS 0x0000005a
+#define NV03_SURFACE_ZETA_CLASS 0x0000005b
+#define NV03_TEXTURED_TRIANGLE_CLASS 0x00000048
+#define NV04_TEXTURED_TRIANGLE_CLASS 0x00000054
+#define NV10_TEXTURED_TRIANGLE_CLASS 0x00000094
+#define NV04_SURFACE_3D_CLASS 0x00000053
+#define NV10_SURFACE_3D_CLASS 0x00000093
+#define NV04_MULTITEX_TRIANGLE_CLASS 0x00000055
+#define NV10_MULTITEX_TRIANGLE_CLASS 0x00000095
+#define NV10_3D_CLASS 0x00000056
+#define NV15_3D_CLASS 0x00000096
+#define NV11_3D_CLASS 0x00000098
+#define NV17_3D_CLASS 0x00000099
+#define NV20_3D_CLASS 0x00000097
+#define NV25_3D_CLASS 0x00000597
+#define NV30_3D_CLASS 0x00000397
+#define NV35_3D_CLASS 0x00000497
+#define NV34_3D_CLASS 0x00000697
+#define NV40_3D_CLASS 0x00004097
+#define NV44_3D_CLASS 0x00004497
+#define NV50_3D_CLASS 0x00005097
+#define NV84_3D_CLASS 0x00008297
+#define NVA0_3D_CLASS 0x00008397
+#define NVA3_3D_CLASS 0x00008597
+#define NVAF_3D_CLASS 0x00008697
+#define NVC0_3D_CLASS 0x00009097
+#define NVC1_3D_CLASS 0x00009197
+#define NVC8_3D_CLASS 0x00009297
+#define NV50_2D_CLASS 0x0000502d
+#define NVC0_2D_CLASS 0x0000902d
+#define NV50_COMPUTE_CLASS 0x000050c0
+#define NVA3_COMPUTE_CLASS 0x000085c0
+#define NVC0_COMPUTE_CLASS 0x000090c0
+#define NVC8_COMPUTE_CLASS 0x000092c0
+#define NV84_CRYPT_CLASS 0x000074c1
+#define BLOB_NVC0_PCOPY1_CLASS 0x000090b8
+#define BLOB_NVC0_PCOPY0_CLASS 0x000090b5
+#define NV31_MPEG_CLASS 0x00003174
+#define NV84_MPEG_CLASS 0x00008274
+
+#define NV01_SUBCHAN__SIZE 0x00008000
#define NV01_SUBCHAN 0x00000000
#define NV01_SUBCHAN_OBJECT 0x00000000
@@ -217,55 +238,64 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define NV04_GRAPH_NOP 0x00000100
-#define NV01_GRAPH_NOTIFY 0x00000104
-#define NV01_GRAPH_NOTIFY_WRITE 0x00000000
-#define NV01_GRAPH_NOTIFY_WRITE_AND_AWAKEN 0x00000001
-
-#define NV50_GRAPH_WAIT_FOR_IDLE 0x00000110
+#define NV04_GRAPH_NOTIFY 0x00000104
+#define NV04_GRAPH_NOTIFY_WRITE 0x00000000
+#define NV04_GRAPH_NOTIFY_WRITE_AND_AWAKEN 0x00000001
-#define NVA3_GRAPH_UNK0120 0x00000120
+#define NVC0_GRAPH_NOTIFY_ADDRESS_HIGH 0x00000104
-#define NVA3_GRAPH_UNK0124 0x00000124
+#define NVC0_GRAPH_NOTIFY_ADDRESS_LOW 0x00000108
-#define NV40_GRAPH_PM_TRIGGER 0x00000140
+#define NVC0_GRAPH_NOTIFY 0x0000010c
+#define NVC0_GRAPH_NOTIFY_WRITE 0x00000000
+#define NVC0_GRAPH_NOTIFY_WRITE_AND_AWAKEN 0x00000001
-#define NVC0_SUBCHAN__SIZE 0x00008000
-#define NVC0_SUBCHAN 0x00000000
+#define NV50_GRAPH_SERIALIZE 0x00000110
-#define NVC0_SUBCHAN_OBJECT 0x00000000
+#define NVC0_GRAPH_MACRO_UPLOAD_POS 0x00000114
+#define NVC0_GRAPH_MACRO_UPLOAD_DATA 0x00000118
-#define NVC0_SUBCHAN_QUERY_ADDRESS_HIGH 0x00000010
+#define NVC0_GRAPH_MACRO_ID 0x0000011c
-#define NVC0_SUBCHAN_QUERY_ADDRESS_LOW 0x00000014
+#define NVC0_GRAPH_MACRO_POS 0x00000120
-#define NVC0_SUBCHAN_QUERY_SEQUENCE 0x00000018
+#define NVA3_GRAPH_UNK0120 0x00000120
-#define NVC0_SUBCHAN_QUERY_GET 0x0000001c
+#define NVA3_GRAPH_UNK0124 0x00000124
-#define NVC0_SUBCHAN_REF_CNT 0x00000050
+#define NVC0_GRAPH_UNK0124 0x00000124
-#define NVC0_GRAPH 0x00000000
+#define NVC0_GRAPH_COND_ADDRESS_HIGH 0x00000130
-#define NVC0_GRAPH_NOP 0x00000100
+#define NVC0_GRAPH_COND_ADDRESS_LOW 0x00000134
-#define NVC0_GRAPH_NOTIFY_ADDRESS_HIGH 0x00000104
+#define NVC0_GRAPH_COND_MODE 0x00000138
+#define NVC0_GRAPH_COND_MODE_NEVER 0x00000000
+#define NVC0_GRAPH_COND_MODE_ALWAYS 0x00000001
+#define NVC0_GRAPH_COND_MODE_RES_NON_ZERO 0x00000002
+#define NVC0_GRAPH_COND_MODE_EQUAL 0x00000003
+#define NVC0_GRAPH_COND_MODE_NOT_EQUAL 0x00000004
-#define NVC0_GRAPH_NOTIFY_ADDRESS_LOW 0x00000108
+#define NVC0_GRAPH_UNK013C 0x0000013c
-#define NVC0_GRAPH_NOTIFY 0x0000010c
-#define NVC0_GRAPH_NOTIFY_WRITE 0x00000000
-#define NVC0_GRAPH_NOTIFY_WRITE_AND_AWAKEN 0x00000001
+#define NV40_GRAPH_PM_TRIGGER 0x00000140
-#define NVC0_GRAPH_SERIALIZE 0x00000110
+#define NVC0_GRAPH_UNK0150 0x00000150
-#define NVC0_GRAPH_MACRO_UPLOAD_POS 0x00000114
+#define NVC0_GRAPH_UNK0154 0x00000154
-#define NVC0_GRAPH_MACRO_UPLOAD_DATA 0x00000118
+#define NVC0_GRAPH_SCRATCH(i0) (0x00003400 + 0x4*(i0))
+#define NVC0_GRAPH_SCRATCH__ESIZE 0x00000004
+#define NVC0_GRAPH_SCRATCH__LEN 0x00000080
-#define NVC0_GRAPH_MACRO_ID 0x0000011c
+#define NVC0_GRAPH_MACRO(i0) (0x00003800 + 0x8*(i0))
+#define NVC0_GRAPH_MACRO__ESIZE 0x00000008
+#define NVC0_GRAPH_MACRO__LEN 0x00000080
-#define NVC0_GRAPH_MACRO_POS 0x00000120
+#define NVC0_GRAPH_MACRO_PARAM(i0) (0x00003804 + 0x8*(i0))
+#define NVC0_GRAPH_MACRO_PARAM__ESIZE 0x00000008
+#define NVC0_GRAPH_MACRO_PARAM__LEN 0x00000080
-#endif /* NV_OBJECT_XML */
+#endif /* RNNDB_NV_OBJECT_XML */