virtgpu_virgl: Add basic support for modifiers
In recent kernel versions virtgpu reports support for the linear modifier due to commit "drm: add support modifiers for drivers whose planes only support linear layout" [1]. This causes the UI to when it calls gbm_bo_create_with_modifiers; it hits an early return in drv_bo_create_with_modifiers due to the virtgpu backend setting neither bo_create_with_modifiers nor bo_compute_metadata. Fix by adding a virgl_bo_create_with_modifiers modeled on dumb_bo_create_with_modifiers. If the requested modifiers include the linear modifier, pass the request on to virgl_bo_create. Otherwise fail with EINVAL. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8be576837b6e62b2ad0de2f9ba31cef618fa2891 BUG=b:243569755 TEST=Deploy minigbm to a reven-kernelnext VM TEST=Restart UI, observe UI is no longer black TEST=Logs don't show "Failed to create scanout buffer" errors Change-Id: If8d02225a7a50600b5ae4685cc963ad391bd9bf7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3862241 Reviewed-by: Dominik Behr <dbehr@chromium.org> Commit-Queue: Dominik Behr <dbehr@chromium.org> Tested-by: Nicholas Bishop <nicholasbishop@google.com> Auto-Submit: Nicholas Bishop <nicholasbishop@google.com>
This commit is contained in:
parent
c9f6462456
commit
dbe7f03f0c
1 changed files with 15 additions and 0 deletions
|
|
@ -776,6 +776,20 @@ static int virgl_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint3
|
|||
return virgl_2d_dumb_bo_create(bo, width, height, format, use_flags);
|
||||
}
|
||||
|
||||
static int virgl_bo_create_with_modifiers(struct bo *bo, uint32_t width, uint32_t height,
|
||||
uint32_t format, const uint64_t *modifiers, uint32_t count)
|
||||
{
|
||||
uint64_t use_flags = 0;
|
||||
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
if (modifiers[i] == DRM_FORMAT_MOD_LINEAR) {
|
||||
return virgl_bo_create(bo, width, height, format, use_flags);
|
||||
}
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int virgl_bo_destroy(struct bo *bo)
|
||||
{
|
||||
if (params[param_3d].value)
|
||||
|
|
@ -1100,6 +1114,7 @@ const struct backend virtgpu_virgl = { .name = "virtgpu_virgl",
|
|||
.init = virgl_init,
|
||||
.close = virgl_close,
|
||||
.bo_create = virgl_bo_create,
|
||||
.bo_create_with_modifiers = virgl_bo_create_with_modifiers,
|
||||
.bo_destroy = virgl_bo_destroy,
|
||||
.bo_import = drv_prime_bo_import,
|
||||
.bo_map = virgl_bo_map,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue