virtgpu_cross_domain: force LINEAR for YVU420_ANDROID
Metadata query sent to host minigbm detects the YVU420 + LINEAR
combination and internally handle as YVU420_ANDROID to obey Android's
specific layout requirements.
This matches a similar hack applied to the virtgpu_virgl backend long
ago: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2596704
BUG=b:360937659
TEST=Fixes instagram video decode artifacts
Change-Id: I591e427a926327b841be6e280ca57eefab598965
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5849472
Reviewed-by: Chia-I Wu <[email protected]>
Tested-by: Ryan Neph <[email protected]>
Auto-Submit: Ryan Neph <[email protected]>
Commit-Queue: Ryan Neph <[email protected]>
diff --git a/virtgpu_cross_domain.c b/virtgpu_cross_domain.c
index 85589dc..07da390 100644
--- a/virtgpu_cross_domain.c
+++ b/virtgpu_cross_domain.c
@@ -170,10 +170,18 @@
cmd_get_reqs.width = metadata->width;
cmd_get_reqs.height = metadata->height;
- cmd_get_reqs.drm_format =
- (metadata->format == DRM_FORMAT_YVU420_ANDROID) ? DRM_FORMAT_YVU420 : metadata->format;
+ cmd_get_reqs.drm_format = metadata->format;
cmd_get_reqs.flags = metadata->use_flags;
+ // HACK(b/360937659): see also: b/172389166, for history
+ // host minigbm has a hack that recognizes DRM_FORMAT_YVU420 + BO_USE_LINEAR and replaces
+ // the format internally back to DRM_FORMAT_YVU420_ANDROID to use the approrpriate layout
+ // rules.
+ if (cmd_get_reqs.drm_format == DRM_FORMAT_YVU420_ANDROID) {
+ cmd_get_reqs.drm_format = DRM_FORMAT_YVU420;
+ cmd_get_reqs.flags |= BO_USE_LINEAR;
+ }
+
/*
* It is possible to avoid blocking other bo_create() calls by unlocking before
* cross_domain_submit_cmd() and re-locking afterwards. However, that would require