summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/glamo/glamo_context.h7
-rw-r--r--src/mesa/drivers/dri/glamo/glamo_state.c22
2 files changed, 19 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/glamo/glamo_context.h b/src/mesa/drivers/dri/glamo/glamo_context.h
index ed4f525a8a..d02041d205 100644
--- a/src/mesa/drivers/dri/glamo/glamo_context.h
+++ b/src/mesa/drivers/dri/glamo/glamo_context.h
@@ -65,6 +65,8 @@ struct glamo_context {
unsigned int count; /**< Number of vertices */
} prim;
+ uint16_t col_clear;
+
};
#define GLAMO_CONTEXT(ctx) ((glamoContextPtr)(ctx->DriverCtx))
@@ -80,4 +82,9 @@ extern GLboolean glamoUnbindContext(__DRIcontext *driContextPriv);
extern void glamo_update_renderbuffers(__DRIcontext *context,
__DRIdrawable *drawable);
+#define GLAMO_PACKCOLOR565(r, g, b) \
+ ((((r) & 0xf8) << 8) \
+ | (((g) & 0xfc) << 3) \
+ | (((b) & 0xf8) >> 3))
+
#endif /* __GLAMO_CONTEXT_H */
diff --git a/src/mesa/drivers/dri/glamo/glamo_state.c b/src/mesa/drivers/dri/glamo/glamo_state.c
index d7bbf1c3fd..e93bc71a1c 100644
--- a/src/mesa/drivers/dri/glamo/glamo_state.c
+++ b/src/mesa/drivers/dri/glamo/glamo_state.c
@@ -110,7 +110,7 @@ static void glamoClear(GLcontext *ctx, GLbitfield mask)
grb->pitch & 0x7ff);
glamoDRMAddCommand(gCtx, GLAMO_REG_2D_DST_HEIGHT,
grb->height);
- glamoDRMAddCommand(gCtx, GLAMO_REG_2D_PAT_FG, 0xabcd);
+ glamoDRMAddCommand(gCtx, GLAMO_REG_2D_PAT_FG, gCtx->col_clear);
glamoDRMAddCommand(gCtx, GLAMO_REG_2D_COMMAND2, 0xf0 << 8);
glamoDRMAddCommand(gCtx, GLAMO_REG_2D_DST_X, fb->_Xmin);
glamoDRMAddCommand(gCtx, GLAMO_REG_2D_DST_Y, fb->_Ymin);
@@ -120,15 +120,6 @@ static void glamoClear(GLcontext *ctx, GLbitfield mask)
fb->_Ymax-fb->_Ymin);
glamoDRMAddCommand(gCtx, GLAMO_REG_2D_COMMAND3, 0);
- glamoDRMAddCommand(gCtx, GLAMO_REG_2D_PAT_FG, 0x1234);
- glamoDRMAddCommand(gCtx, GLAMO_REG_2D_DST_X, fb->_Xmin+1);
- glamoDRMAddCommand(gCtx, GLAMO_REG_2D_DST_Y, fb->_Ymin+1);
- glamoDRMAddCommand(gCtx, GLAMO_REG_2D_RECT_WIDTH,
- fb->_Xmax-fb->_Xmin-2);
- glamoDRMAddCommand(gCtx, GLAMO_REG_2D_RECT_HEIGHT,
- fb->_Ymax-fb->_Ymin-2);
- glamoDRMAddCommand(gCtx, GLAMO_REG_2D_COMMAND3, 0);
-
}
glamoDRMDispatch(gCtx);
@@ -137,8 +128,19 @@ static void glamoClear(GLcontext *ctx, GLbitfield mask)
static void glamoClearColor(GLcontext *ctx, const GLfloat color[4])
{
+ struct glamo_context *gCtx = GLAMO_CONTEXT(ctx);
+ GLubyte col_byte[4];
+
printf("glamoClearColor (%f %f %f %f)\n", color[0], color[1], color[2],
color[3]); fflush(stdout);
+
+ CLAMPED_FLOAT_TO_UBYTE(col_byte[0], color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(col_byte[1], color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(col_byte[2], color[2]);
+ CLAMPED_FLOAT_TO_UBYTE(col_byte[3], color[3]);
+
+ gCtx->col_clear = GLAMO_PACKCOLOR565(col_byte[0], col_byte[1],
+ col_byte[2]);
}