return 0;
}
-int drv_dumb_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
- uint64_t use_flags)
+int drv_dumb_bo_create_ex(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
+ uint64_t use_flags, uint64_t quirks)
{
int ret;
size_t plane;
}
memset(&create_dumb, 0, sizeof(create_dumb));
- create_dumb.height = aligned_height;
+ if (quirks & BO_QUIRK_DUMB32BPP) {
+ aligned_width =
+ DIV_ROUND_UP(aligned_width * layout_from_format(format)->bytes_per_pixel[0], 4);
+ create_dumb.bpp = 32;
+ } else {
+ create_dumb.bpp = layout_from_format(format)->bytes_per_pixel[0] * 8;
+ }
create_dumb.width = aligned_width;
- create_dumb.bpp = layout_from_format(format)->bytes_per_pixel[0] * 8;
+ create_dumb.height = aligned_height;
create_dumb.flags = 0;
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_MODE_CREATE_DUMB, &create_dumb);
return 0;
}
+int drv_dumb_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
+ uint64_t use_flags)
+{
+ return drv_dumb_bo_create_ex(bo, width, height, format, use_flags, BO_QUIRK_NONE);
+}
+
int drv_dumb_bo_destroy(struct bo *bo)
{
struct drm_mode_destroy_dumb destroy_dumb;
int drv_bo_from_format(struct bo *bo, uint32_t stride, uint32_t aligned_height, uint32_t format);
int drv_dumb_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
uint64_t use_flags);
+int drv_dumb_bo_create_ex(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
+ uint64_t use_flags, uint64_t quirks);
int drv_dumb_bo_destroy(struct bo *bo);
int drv_gem_bo_destroy(struct bo *bo);
int drv_prime_bo_import(struct bo *bo, struct drv_import_fd_data *data);
height = ALIGN(height, MESA_LLVMPIPE_TILE_SIZE);
}
- return drv_dumb_bo_create(bo, width, height, format, use_flags);
+ return drv_dumb_bo_create_ex(bo, width, height, format, use_flags, BO_QUIRK_DUMB32BPP);
}
static inline void handle_flag(uint64_t *flag, uint64_t check_flag, uint32_t *bind,
priv->has_3d = 0;
}
- /* This doesn't mean host can scanout everything, it just means host
- * hypervisor can show it. */
- drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
- &LINEAR_METADATA, BO_USE_RENDER_MASK | BO_USE_SCANOUT);
-
if (priv->has_3d) {
+ /* This doesn't mean host can scanout everything, it just means host
+ * hypervisor can show it. */
+ drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
+ &LINEAR_METADATA, BO_USE_RENDER_MASK | BO_USE_SCANOUT);
drv_add_combinations(drv, texture_source_formats,
ARRAY_SIZE(texture_source_formats), &LINEAR_METADATA,
BO_USE_TEXTURE_MASK);
} else {
+ /* Virtio primary plane only allows this format. */
+ drv_add_combination(drv, DRM_FORMAT_XRGB8888, &LINEAR_METADATA,
+ BO_USE_RENDER_MASK | BO_USE_SCANOUT);
+ /* Virtio cursor plane only allows this format and Chrome cannot live without
+ * ARGB888 renderable format. */
+ drv_add_combination(drv, DRM_FORMAT_ARGB8888, &LINEAR_METADATA,
+ BO_USE_RENDER_MASK | BO_USE_CURSOR);
+ /* Android needs more, but they cannot be bound as scanouts anymore after
+ * "drm/virtio: fix DRM_FORMAT_* handling" */
+ drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
+ &LINEAR_METADATA, BO_USE_RENDER_MASK);
drv_add_combinations(drv, dumb_texture_source_formats,
ARRAY_SIZE(dumb_texture_source_formats), &LINEAR_METADATA,
BO_USE_TEXTURE_MASK);