int bpp = 0, vstride, fd, err;
unsigned int heap_mask = _select_heap(usage);
- if (format == HAL_PIXEL_FORMAT_RGBA_8888 && (usage & GRALLOC_USAGE_HW_FB)) {
- ALOGW_IF(usage & (GRALLOC_USAGE_SW_READ_MASK |
- GRALLOC_USAGE_SW_WRITE_MASK),
- "framebuffer target should not have SW usage bits; ignoring");
- format = HAL_PIXEL_FORMAT_BGRA_8888;
+ if (format == HAL_PIXEL_FORMAT_RGBA_8888) {
+ bool sw_usage = !!(usage & (GRALLOC_USAGE_SW_READ_MASK |
+ GRALLOC_USAGE_SW_WRITE_MASK));
+
+ if (usage & GRALLOC_USAGE_HW_FB) {
+ ALOGW_IF(sw_usage,
+ "framebuffer target should not have SW usage bits; ignoring");
+ format = HAL_PIXEL_FORMAT_BGRA_8888;
+ } else if (usage & GRALLOC_USAGE_HW_VIDEO_ENCODER) {
+ if (sw_usage)
+ return -EINVAL;
+ format = HAL_PIXEL_FORMAT_BGRA_8888;
+ }
}
switch (format) {