nouveau: create swizzled surface + scaled image objects
authorBen Skeggs <skeggsb@gmail.com>
Fri, 4 Apr 2008 06:14:15 +0000 (16:14 +1000)
committerBen Skeggs <skeggsb@gmail.com>
Fri, 4 Apr 2008 06:18:58 +0000 (16:18 +1000)
src/gallium/winsys/dri/nouveau/nouveau_context.c
src/gallium/winsys/dri/nouveau/nouveau_context.h
src/gallium/winsys/dri/nouveau/nv04_surface.c

index aaeaebd27188d563c69e631781cb0753fbf92eb1..ff08a870db1113527c1e39b1a5f2543db5bc760d 100644 (file)
@@ -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);
 
index acb58fab44801c94b0884f39260035d56c973d29..872ef93807a3296324c0461855fa07738d2eb6a7 100644 (file)
@@ -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;
index cdcd71eaad6fa950fec4d3f104c8005846c4ff98..f61bd1477ffa911f5756da77213c8c3bc4e2ebbb 100644 (file)
@@ -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;
 }