- LP_DBG(DEBUG_RAST, "%s 0x%x,0x%x,0x%x,0x%x\n", __FUNCTION__,
- clear_color[0],
- clear_color[1],
- clear_color[2],
- clear_color[3]);
-
- if (clear_color[0] == clear_color[1] &&
- clear_color[1] == clear_color[2] &&
- clear_color[2] == clear_color[3]) {
- /* clear to grayscale value {x, x, x, x} */
- for (i = 0; i < scene->fb.nr_cbufs; i++) {
- uint8_t *ptr =
- lp_rast_get_color_tile_pointer(task, i, LP_TEX_USAGE_WRITE_ALL);
- memset(ptr, clear_color[0], TILE_SIZE * TILE_SIZE * 4);
- }
- }
- else {
- /* Non-gray color.
- * Note: if the swizzled tile layout changes (see TILE_PIXEL) this code
- * will need to change. It'll be pretty obvious when clearing no longer
- * works.
- */
- const unsigned chunk = TILE_SIZE / 4;
- for (i = 0; i < scene->fb.nr_cbufs; i++) {
- uint8_t *c =
- lp_rast_get_color_tile_pointer(task, i, LP_TEX_USAGE_WRITE_ALL);
- unsigned j;
-
- for (j = 0; j < 4 * TILE_SIZE; j++) {
- memset(c, clear_color[0], chunk);
- c += chunk;
- memset(c, clear_color[1], chunk);
- c += chunk;
- memset(c, clear_color[2], chunk);
- c += chunk;
- memset(c, clear_color[3], chunk);
- c += chunk;
- }
- }
- }