Reland "i915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag"

This is a reland of 1bd7b04a3ae68c0314bdee06c559093de9e5a304

We've landed CL:1070995 which fixes the missing modifier that
caused tiling corruption on pre-KBL Intel devices and CL:1072638
which makes the failing vda unittests use SCANOUT_VDA_WRITE as
they were supposed to.

Original change's description:
> i915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag
>
> This flag is used to indicate that the platform video decoder will be
> writing into this buffer and that it should be allocated
> accordingly. On Intel, this means that we have to allocate y-tiled
> NV12 for libva to be able to decode to the buffer.
>
> We force gralloc NV12 allocations to be linear for now, since ARC++
> doesn't properly pass modifiers to ChromeOS.
>
> BUG=822346
> TEST=test_that graphics_Gbm
>
> Change-Id: I840c30d22355d26816df718b49717407e2e4620f
> Reviewed-on: https://chromium-review.googlesource.com/996648
> Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
> Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
> Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

Bug: 822346
Change-Id: Icf0921dc91ac422da26371bffea34b26550b8234
Reviewed-on: https://chromium-review.googlesource.com/1073877
Commit-Ready: Kristian H. Kristensen <hoegsberg@chromium.org>
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
diff --git a/i915.c b/i915.c
index 8e1871a..6df6dcc 100644
--- a/i915.c
+++ b/i915.c
@@ -101,6 +101,10 @@
 			combo->use_flags |= item->use_flags & ~BO_USE_CURSOR;
 		}
 
+		/* If we can scanout NV12, we support all tiling modes. */
+		if (item->format == DRM_FORMAT_NV12)
+			combo->use_flags |= item->use_flags;
+
 		if (combo->metadata.modifier == item->modifier)
 			combo->use_flags |= item->use_flags;
 	}
@@ -178,6 +182,11 @@
 			     ARRAY_SIZE(tileable_texture_source_formats), &metadata,
 			     texture_use_flags);
 
+	/* Support y-tiled NV12 for libva */
+	const uint32_t nv12_format = DRM_FORMAT_NV12;
+	drv_add_combinations(drv, &nv12_format, 1, &metadata,
+			     BO_USE_TEXTURE | BO_USE_HW_VIDEO_DECODER);
+
 	kms_items = drv_query_kms(drv);
 	if (!kms_items)
 		return 0;