mesa: Branch 'master'

Ben Skeggs darktama at kemper.freedesktop.org
Fri Dec 22 15:54:59 PST 2006


 src/mesa/drivers/dri/nouveau/nouveau_buffers.c |    1 +
 src/mesa/drivers/dri/nouveau/nouveau_context.c |    5 ++++-
 src/mesa/drivers/dri/nouveau/nouveau_screen.c  |    7 ++++---
 src/mesa/drivers/dri/nouveau/nv30_state.c      |    5 ++++-
 4 files changed, 13 insertions(+), 5 deletions(-)

New commits:
diff-tree 1dd6759c059e054a9a2279d2339a5bd8bb83f6b4 (from b766643e5c3c9ed174c59b54e520f94e3420e39a)
Author: Ben Skeggs <darktama at iinet.net.au>
Date:   Sat Dec 23 10:56:19 2006 +1100

    nouveau: get 16bpp working

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_buffers.c b/src/mesa/drivers/dri/nouveau/nouveau_buffers.c
index 42d8691..f30e593 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_buffers.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_buffers.c
@@ -89,6 +89,7 @@ nouveau_renderbuffer_pixelformat(nouveau
 	 nrb->mesa.AlphaBits	= 8;
 	 nrb->cpp		= 4;
 	 break;
+      case GL_RGB:
       case GL_RGB5:
 	 nrb->mesa._BaseFormat	= GL_RGB;
 	 nrb->mesa._ActualFormat= GL_RGB5;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 22c1f58..ac940ac 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -319,7 +319,10 @@ static void nouveauDoSwapBuffers(nouveau
 	if (nbox) {
 		BEGIN_RING_SIZE(NvSubCtxSurf2D,
 				NV10_CONTEXT_SURFACES_2D_FORMAT, 4);
-		OUT_RING       (6); /* X8R8G8B8 */
+		if (src->mesa._ActualFormat == GL_RGBA8)
+			OUT_RING       (6); /* X8R8G8B8 */
+		else
+			OUT_RING       (4); /* R5G6B5 */
 		OUT_RING       ((dst->pitch << 16) | src->pitch);
 		OUT_RING       (src->offset);
 		OUT_RING       (dst->offset);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index 8e548db..140db49 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -129,6 +129,7 @@ nouveauCreateBuffer(__DRIscreenPrivate *
 	struct gl_framebuffer *fb;
 	const GLboolean swAccum = mesaVis->accumRedBits > 0;
 	const GLboolean swStencil = mesaVis->stencilBits > 0 && mesaVis->depthBits != 24;
+	GLenum color_format = screen->fbFormat == 4 ? GL_RGBA8 : GL_RGB5;
 
 	if (isPixmap)
 		return GL_FALSE; /* not implemented */
@@ -138,10 +139,10 @@ nouveauCreateBuffer(__DRIscreenPrivate *
 		return GL_FALSE;
 
 	/* Front buffer */
-	nrb = nouveau_renderbuffer_new(GL_RGBA,
+	nrb = nouveau_renderbuffer_new(color_format,
 				       driScrnPriv->pFB + screen->frontOffset,
 				       screen->frontOffset,
-				       screen->frontPitch * 4,
+				       screen->frontPitch * screen->fbFormat,
 				       driDrawPriv);
 	nouveauSpanSetFunctions(nrb, mesaVis);
 	_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &nrb->mesa);
@@ -149,7 +150,7 @@ nouveauCreateBuffer(__DRIscreenPrivate *
 	if (0 /* unified buffers if we choose to support them.. */) {
 	} else {
 		if (mesaVis->doubleBufferMode) {
-			nrb = nouveau_renderbuffer_new(GL_RGBA, NULL,
+			nrb = nouveau_renderbuffer_new(color_format, NULL,
 						       0, 0,
 						       driDrawPriv);
 			nouveauSpanSetFunctions(nrb, mesaVis);
diff --git a/src/mesa/drivers/dri/nouveau/nv30_state.c b/src/mesa/drivers/dri/nouveau/nv30_state.c
index 7592c3f..4169dad 100644
--- a/src/mesa/drivers/dri/nouveau/nv30_state.c
+++ b/src/mesa/drivers/dri/nouveau/nv30_state.c
@@ -790,7 +790,10 @@ static GLboolean nv30BindBuffers(nouveau
    BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_VIEWPORT_COLOR_BUFFER_DIM0, 5);
    OUT_RING        (((w+x)<<16)|x);
    OUT_RING        (((h+y)<<16)|y);
-   OUT_RING        (0x148);
+   if (color[0]->mesa._ActualFormat == GL_RGBA8)
+      OUT_RING        (0x148);
+   else
+      OUT_RING        (0x143);
    OUT_RING        (color[0]->pitch);
    OUT_RING        (color[0]->offset);
 


More information about the mesa-commit mailing list