nouveau: nv10: clear a buffer
authorPatrice Mandin <pmandin@caramail.com>
Thu, 16 Aug 2007 19:50:34 +0000 (21:50 +0200)
committerPatrice Mandin <pmandin@caramail.com>
Thu, 16 Aug 2007 19:50:34 +0000 (21:50 +0200)
src/mesa/drivers/dri/nouveau/nv10_state.c

index 0c746325c6fa0611dc71fd0f402ab655194d2a9f..4a3646ea4f1d5b6ed366a0bf61fa93ae4bb28d20 100644 (file)
@@ -114,12 +114,35 @@ static void nv10BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB, GLenum dfac
 static void nv10ClearBuffer(GLcontext *ctx, nouveau_renderbuffer_t *buffer, int fill, int mask)
 {
        nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
+       int dimensions;
 
        if (!buffer) {
                return;
        }
 
-       /* TODO */
+       /* Surface that we will work on */
+       nouveauObjectOnSubchannel(nmesa, NvSubCtxSurf2D, NvCtxSurf2D);
+
+       BEGIN_RING_SIZE(NvSubCtxSurf2D, NV10_CONTEXT_SURFACES_2D_FORMAT, 4);
+       OUT_RING(0x0b); /* Y32 color format */
+       OUT_RING((buffer->pitch<<16)|buffer->pitch);
+       OUT_RING(buffer->offset);
+       OUT_RING(buffer->offset);
+
+       /* Now clear a rectangle */
+       dimensions = ((buffer->mesa.Height)<<16) | (buffer->mesa.Width);
+
+       nouveauObjectOnSubchannel(nmesa, NvSubGdiRectText, NvGdiRectText);
+
+       BEGIN_RING_SIZE(NvSubGdiRectText, NV04_GDI_RECTANGLE_TEXT_OPERATION, 1);
+       OUT_RING(3);    /* SRCCOPY */
+
+       BEGIN_RING_SIZE(NvSubGdiRectText, NV04_GDI_RECTANGLE_TEXT_BLOCK_LEVEL1_TL, 5);
+       OUT_RING(0);    /* top left */
+       OUT_RING(dimensions);   /* bottom right */
+       OUT_RING(fill);
+       OUT_RING(0);    /* top left */
+       OUT_RING(dimensions);   /* bottom right */
 }
 
 static void nv10Clear(GLcontext *ctx, GLbitfield mask)