nouveau: get 16bpp working

This commit is contained in:
Ben Skeggs 2006-12-23 10:56:19 +11:00
parent b766643e5c
commit 1dd6759c05
4 changed files with 13 additions and 5 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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);