@@ -386,7 +386,7 @@ bo_create(int fd, unsigned int format,
break;
}
- util_fill_pattern(format, pattern, planes, width, height, pitches[0]);
+ util_fill_pattern(format, pattern, 0x38383838, planes, width, height, pitches[0]);
bo_unmap(bo);
return bo;
@@ -1719,18 +1719,24 @@ static void fill_tiles(const struct util_format_info *info, void *planes[3],
static void fill_plain(const struct util_format_info *info, void *planes[3],
unsigned int height,
- unsigned int stride)
+ unsigned int stride, unsigned int color)
{
+ int i;
+ char *p;
+
switch (info->format) {
case DRM_FORMAT_XRGB16161616F:
case DRM_FORMAT_XBGR16161616F:
case DRM_FORMAT_ARGB16161616F:
case DRM_FORMAT_ABGR16161616F:
- /* 0x3838 = 0.5273 */
- memset(planes[0], 0x38, stride * height);
- break;
default:
- memset(planes[0], 0x77, stride * height);
+ for (i = 0; i < height * stride; i += 4) {
+ int j;
+
+ p = planes[0] + i;
+ for (j = 0; j < 4; j++)
+ p[j] = (color >> (j * 8)) & 0xFF;
+ }
break;
}
}
@@ -1862,6 +1868,7 @@ static void fill_gradient(const struct util_format_info *info, void *planes[3],
* Supported formats vary depending on the selected pattern.
*/
void util_fill_pattern(uint32_t format, enum util_fill_pattern pattern,
+ unsigned int color,
void *planes[3], unsigned int width,
unsigned int height, unsigned int stride)
{
@@ -1879,7 +1886,7 @@ void util_fill_pattern(uint32_t format, enum util_fill_pattern pattern,
return fill_smpte(info, planes, width, height, stride);
case UTIL_PATTERN_PLAIN:
- return fill_plain(info, planes, height, stride);
+ return fill_plain(info, planes, height, stride, color);
case UTIL_PATTERN_GRADIENT:
return fill_gradient(info, planes, width, height, stride);
@@ -36,6 +36,7 @@ enum util_fill_pattern {
};
void util_fill_pattern(uint32_t format, enum util_fill_pattern pattern,
+ unsigned int color,
void *planes[3], unsigned int width,
unsigned int height, unsigned int stride);