rendered paste bodydiff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 4132c30..3f5422b 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -255,3 +255,18 @@ nouveau_fallback(GLcontext *ctx, enum nouveau_fallback mode)
else
FIRE_RING(context_chan(ctx));
}
+
+void
+nouveau_validate_frontbuffer(GLcontext *ctx)
+{
+ __DRIcontext *dri_ctx = to_nouveau_context(ctx)->dri_context;
+
+ ctx->Driver.Flush(ctx);
+
+ /* Make sure our renderbuffers are up-to-date. */
+ nouveau_update_renderbuffers(dri_ctx, dri_ctx->driDrawablePriv);
+ if (dri_ctx->driDrawablePriv != dri_ctx->driReadablePriv)
+ nouveau_update_renderbuffers(dri_ctx, dri_ctx->driReadablePriv);
+
+ FIRE_RING(context_chan(ctx));
+}
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h
index 4a38521..70db08b 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h
@@ -89,5 +89,8 @@ nouveau_context_unbind(__DRIcontext *dri_ctx);
void
nouveau_fallback(GLcontext *ctx, enum nouveau_fallback mode);
+void
+nouveau_validate_frontbuffer(GLcontext *ctx);
+
#endif
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c
index bcfc1d6..826ee82 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
@@ -363,9 +363,12 @@ nouveau_update_state(GLcontext *ctx, GLbitfield new_state)
context_dirty(ctx, PROJECTION);
if (new_state & _NEW_MODELVIEW)
context_dirty(ctx, MODELVIEW);
+ if (new_state & _NEW_VIEWPORT)
+ nouveau_validate_frontbuffer(ctx);
_swrast_InvalidateState(ctx, new_state);
_tnl_InvalidateState(ctx, new_state);
+
nouveau_state_emit(ctx);
}
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index ab6e93c..683b217 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -130,7 +130,7 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint internalFormat,
case GL_ALPHA12:
case GL_ALPHA16:
case GL_ALPHA8:
- return MESA_FORMAT_A8;
+ return MESA_FORMAT_ARGB8888; // was A8
case 1:
case GL_LUMINANCE:
@@ -138,7 +138,7 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint internalFormat,
case GL_LUMINANCE12:
case GL_LUMINANCE16:
case GL_LUMINANCE8:
- return MESA_FORMAT_L8;
+ return MESA_FORMAT_ARGB8888; // was L8
case 2:
case GL_LUMINANCE_ALPHA:
diff --git a/src/mesa/drivers/dri/nouveau/nv04_render.c b/src/mesa/drivers/dri/nouveau/nv04_render.c
index dcf7d52..15760a5 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_render.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_render.c
@@ -51,7 +51,7 @@ swtnl_update_viewport(GLcontext *ctx)
}
static void
-swtnl_emit_attr(GLcontext *ctx, struct tnl_attr_map *m, int attr, int emit)
+nv04_swtnl_emit_attr(GLcontext *ctx, struct tnl_attr_map *m, int attr, int emit)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
@@ -68,7 +68,7 @@ swtnl_emit_attr(GLcontext *ctx, struct tnl_attr_map *m, int attr, int emit)
}
static void
-swtnl_choose_attrs(GLcontext *ctx)
+nv04_swtnl_choose_attrs(GLcontext *ctx)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct nouveau_grobj *fahrenheit = nv04_context_engine(ctx);
@@ -78,13 +78,13 @@ swtnl_choose_attrs(GLcontext *ctx)
tnl->vb.AttribPtr[VERT_ATTRIB_POS] = tnl->vb.NdcPtr;
- swtnl_emit_attr(ctx, &map[n++], _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT);
- swtnl_emit_attr(ctx, &map[n++], _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA);
- swtnl_emit_attr(ctx, &map[n++], _TNL_ATTRIB_FOG, EMIT_1UB_1F);
- swtnl_emit_attr(ctx, &map[n++], _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR);
- swtnl_emit_attr(ctx, &map[n++], _TNL_ATTRIB_TEX0, EMIT_2F);
+ nv04_swtnl_emit_attr(ctx, &map[n++], _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT);
+ nv04_swtnl_emit_attr(ctx, &map[n++], _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA);
+ nv04_swtnl_emit_attr(ctx, &map[n++], _TNL_ATTRIB_FOG, EMIT_1UB_1F);
+ nv04_swtnl_emit_attr(ctx, &map[n++], _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR);
+ nv04_swtnl_emit_attr(ctx, &map[n++], _TNL_ATTRIB_TEX0, EMIT_2F);
if (nv04_mtex_engine(fahrenheit))
- swtnl_emit_attr(ctx, &map[n++], _TNL_ATTRIB_TEX1, EMIT_2F);
+ nv04_swtnl_emit_attr(ctx, &map[n++], _TNL_ATTRIB_TEX1, EMIT_2F);
swtnl_update_viewport(ctx);
@@ -94,25 +94,25 @@ swtnl_choose_attrs(GLcontext *ctx)
/* TnL renderer entry points */
static void
-swtnl_start(GLcontext *ctx)
+nv04_swtnl_start(GLcontext *ctx)
{
- swtnl_choose_attrs(ctx);
+ nv04_swtnl_choose_attrs(ctx);
}
static void
-swtnl_finish(GLcontext *ctx)
+nv04_swtnl_finish(GLcontext *ctx)
{
struct nouveau_channel *chan = context_chan(ctx);
FIRE_RING(chan);
}
static void
-swtnl_primitive(GLcontext *ctx, GLenum mode)
+nv04_swtnl_primitive(GLcontext *ctx, GLenum mode)
{
}
static void
-swtnl_reset_stipple(GLcontext *ctx)
+nv04_swtnl_reset_stipple(GLcontext *ctx)
{
}
@@ -147,17 +147,17 @@ swtnl_reset_stipple(GLcontext *ctx)
}
static void
-swtnl_points(GLcontext *ctx, GLuint first, GLuint last)
+nv04_swtnl_points(GLcontext *ctx, GLuint first, GLuint last)
{
}
static void
-swtnl_line(GLcontext *ctx, GLuint v1, GLuint v2)
+nv04_swtnl_line(GLcontext *ctx, GLuint v1, GLuint v2)
{
}
static void
-swtnl_triangle(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3)
+nv04_swtnl_triangle(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3)
{
BEGIN_PRIMITIVE(3);
OUT_VERTEX(v1);
@@ -167,7 +167,7 @@ swtnl_triangle(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3)
}
static void
-swtnl_quad(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4)
+nv04_swtnl_quad(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4)
{
BEGIN_PRIMITIVE(4);
OUT_VERTEX(v1);
@@ -190,15 +190,15 @@ nv04_render_init(GLcontext *ctx)
tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine;
tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.Start = swtnl_start;
- tnl->Driver.Render.Finish = swtnl_finish;
- tnl->Driver.Render.PrimitiveNotify = swtnl_primitive;
- tnl->Driver.Render.ResetLineStipple = swtnl_reset_stipple;
+ tnl->Driver.Render.Start = nv04_swtnl_start;
+ tnl->Driver.Render.Finish = nv04_swtnl_finish;
+ tnl->Driver.Render.PrimitiveNotify = nv04_swtnl_primitive;
+ tnl->Driver.Render.ResetLineStipple = nv04_swtnl_reset_stipple;
- tnl->Driver.Render.Points = swtnl_points;
- tnl->Driver.Render.Line = swtnl_line;
- tnl->Driver.Render.Triangle = swtnl_triangle;
- tnl->Driver.Render.Quad = swtnl_quad;
+ tnl->Driver.Render.Points = nv04_swtnl_points;
+ tnl->Driver.Render.Line = nv04_swtnl_line;
+ tnl->Driver.Render.Triangle = nv04_swtnl_triangle;
+ tnl->Driver.Render.Quad = nv04_swtnl_quad;
_tnl_need_projected_coords(ctx, GL_TRUE);
_tnl_init_vertices(ctx, tnl->vb.Size,
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
index 053af5b..700de21 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
@@ -37,8 +37,8 @@ get_tex_format(struct gl_texture_image *ti)
{
switch (ti->TexFormat) {
case MESA_FORMAT_A8:
- case MESA_FORMAT_L8:
- return NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_Y8;
+ case MESA_FORMAT_L8:
+ return NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_A8R8G8B8; // was Y8
case MESA_FORMAT_ARGB1555:
return NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_A1R5G5B5;
case MESA_FORMAT_ARGB4444:
diff --git a/src/mesa/drivers/dri/nouveau/nv04_surface.c b/src/mesa/drivers/dri/nouveau/nv04_surface.c
index 6762c11..b6ad35e 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_surface.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_surface.c
@@ -10,10 +10,10 @@ swzsurf_format(gl_format format)
switch (format) {
case MESA_FORMAT_A8:
case MESA_FORMAT_L8:
- case MESA_FORMAT_I8:
- case MESA_FORMAT_RGB332:
- case MESA_FORMAT_CI8:
- return NV04_SWIZZLED_SURFACE_FORMAT_COLOR_Y8;
+ case MESA_FORMAT_I8:
+ case MESA_FORMAT_RGB332:
+ case MESA_FORMAT_CI8:
+ return NV04_SWIZZLED_SURFACE_FORMAT_COLOR_A8R8G8B8; // was Y8
case MESA_FORMAT_RGB565:
case MESA_FORMAT_RGB565_REV:
@@ -84,6 +84,7 @@ surf2d_format(gl_format format)
}
}
+
static INLINE int
rect_format(gl_format format)
{
@@ -124,6 +125,8 @@ rect_format(gl_format format)
}
}
+
+
static INLINE int
sifm_format(gl_format format)
{
@@ -131,9 +134,9 @@ sifm_format(gl_format format)
case MESA_FORMAT_A8:
case MESA_FORMAT_L8:
case MESA_FORMAT_I8:
- case MESA_FORMAT_RGB332:
+ case MESA_FORMAT_RGB332:
case MESA_FORMAT_CI8:
- return NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_AY8;
+ return NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A8R8G8B8; // was AY8
case MESA_FORMAT_RGB565:
case MESA_FORMAT_RGB565_REV:
@@ -143,7 +146,7 @@ sifm_format(gl_format format)
case MESA_FORMAT_RGBA5551:
case MESA_FORMAT_ARGB1555_REV:
case MESA_FORMAT_AL88:
- case MESA_FORMAT_AL88_REV:
+ case MESA_FORMAT_AL88_REV:
case MESA_FORMAT_YCBCR:
case MESA_FORMAT_YCBCR_REV:
case MESA_FORMAT_Z16: