summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/dri/nouveau
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2008-04-04 16:14:15 +1000
committerBen Skeggs <skeggsb@gmail.com>2008-04-04 16:18:58 +1000
commitbc67533f29abe578e2306be2a24db392a0c62fc4 (patch)
treeaa1ed71264c438f3ec29381ca1092a90adddb600 /src/gallium/winsys/dri/nouveau
parenta45a12e757a8f4d41daea2a3f632d4772ff69e38 (diff)
nouveau: create swizzled surface + scaled image objects
Diffstat (limited to 'src/gallium/winsys/dri/nouveau')
-rw-r--r--src/gallium/winsys/dri/nouveau/nouveau_context.c2
-rw-r--r--src/gallium/winsys/dri/nouveau/nouveau_context.h7
-rw-r--r--src/gallium/winsys/dri/nouveau/nv04_surface.c48
3 files changed, 56 insertions, 1 deletions
diff --git a/src/gallium/winsys/dri/nouveau/nouveau_context.c b/src/gallium/winsys/dri/nouveau/nouveau_context.c
index aaeaebd271..ff08a870db 100644
--- a/src/gallium/winsys/dri/nouveau/nouveau_context.c
+++ b/src/gallium/winsys/dri/nouveau/nouveau_context.c
@@ -32,6 +32,8 @@ nouveau_channel_context_destroy(struct nouveau_channel_context *nvc)
nouveau_grobj_free(&nvc->NvGdiRect);
nouveau_grobj_free(&nvc->NvM2MF);
nouveau_grobj_free(&nvc->Nv2D);
+ nouveau_grobj_free(&nvc->NvSwzSurf);
+ nouveau_grobj_free(&nvc->NvSIFM);
nouveau_notifier_free(&nvc->sync_notifier);
diff --git a/src/gallium/winsys/dri/nouveau/nouveau_context.h b/src/gallium/winsys/dri/nouveau/nouveau_context.h
index acb58fab44..872ef93807 100644
--- a/src/gallium/winsys/dri/nouveau/nouveau_context.h
+++ b/src/gallium/winsys/dri/nouveau/nouveau_context.h
@@ -27,11 +27,16 @@ struct nouveau_channel_context {
struct nouveau_notifier *sync_notifier;
+ /* Common */
struct nouveau_grobj *NvNull;
+ struct nouveau_grobj *NvM2MF;
+ /* NV04-NV40 */
struct nouveau_grobj *NvCtxSurf2D;
+ struct nouveau_grobj *NvSwzSurf;
struct nouveau_grobj *NvImageBlit;
struct nouveau_grobj *NvGdiRect;
- struct nouveau_grobj *NvM2MF;
+ struct nouveau_grobj *NvSIFM;
+ /* G80 */
struct nouveau_grobj *Nv2D;
uint32_t next_handle;
diff --git a/src/gallium/winsys/dri/nouveau/nv04_surface.c b/src/gallium/winsys/dri/nouveau/nv04_surface.c
index cdcd71eaad..f61bd1477f 100644
--- a/src/gallium/winsys/dri/nouveau/nv04_surface.c
+++ b/src/gallium/winsys/dri/nouveau/nv04_surface.c
@@ -237,6 +237,54 @@ nouveau_surface_channel_create_nv04(struct nouveau_channel_context *nvc)
NV04_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT, 1);
OUT_RING (chan, NV04_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT_LE);
+ switch (nvc->chipset & 0xf0) {
+ case 0x00:
+ case 0x10:
+ class = NV04_SWIZZLED_SURFACE;
+ break;
+ case 0x20:
+ class = NV20_SWIZZLED_SURFACE;
+ break;
+ case 0x30:
+ class = NV30_SWIZZLED_SURFACE;
+ break;
+ case 0x40:
+ case 0x60:
+ class = NV40_SWIZZLED_SURFACE;
+ break;
+ default:
+ /* Famous last words: this really can't happen.. */
+ assert(0);
+ break;
+ }
+
+ ret = nouveau_grobj_alloc(chan, nvc->next_handle++, class,
+ &nvc->NvSwzSurf);
+ if (ret) {
+ NOUVEAU_ERR("Error creating swizzled surface: %d\n", ret);
+ return 1;
+ }
+
+ BIND_RING (chan, nvc->NvSwzSurf, nvc->next_subchannel++);
+
+ if (nvc->chipset < 0x10) {
+ class = NV04_SCALED_IMAGE_FROM_MEMORY;
+ } else
+ if (nvc->chipset < 0x40) {
+ class = NV10_SCALED_IMAGE_FROM_MEMORY;
+ } else {
+ class = NV40_SCALED_IMAGE_FROM_MEMORY;
+ }
+
+ ret = nouveau_grobj_alloc(chan, nvc->next_handle++, class,
+ &nvc->NvSIFM);
+ if (ret) {
+ NOUVEAU_ERR("Error creating scaled image object: %d\n", ret);
+ return 1;
+ }
+
+ BIND_RING (chan, nvc->NvSIFM, nvc->next_subchannel++);
+
return 0;
}