summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_buffers.c1
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.c5
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_screen.c7
-rw-r--r--src/mesa/drivers/dri/nouveau/nv30_state.c5
4 files changed, 13 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_buffers.c b/src/mesa/drivers/dri/nouveau/nouveau_buffers.c
index 42d86917526..f30e59323d2 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_renderbuffer *nrb,
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 22c1f588742..ac940ac595f 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(nouveauContextPtr nmesa,
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 8e548dbcbdf..140db496b2e 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 *driScrnPriv,
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 *driScrnPriv,
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 *driScrnPriv,
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 7592c3fa0af..4169dad6616 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(nouveauContextPtr nmesa, int num_color,
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);