Enable gbm VideoViewsTests
When writting texels into the mapped texture, we need to take
'stride' into consideration.
chromium:1258986
Change-Id: Icc892d4ce324539e6280307d1699599d59204a9d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100480
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/dawn/tests/end2end/VideoViewsTests_gbm.cpp b/src/dawn/tests/end2end/VideoViewsTests_gbm.cpp
index 55535ce..a7d64eb 100644
--- a/src/dawn/tests/end2end/VideoViewsTests_gbm.cpp
+++ b/src/dawn/tests/end2end/VideoViewsTests_gbm.cpp
@@ -44,11 +44,6 @@
// TODO(chromium:1258986): Add DISJOINT vkImage support for multi-plannar formats.
bool CanWrapAsWGPUTexture() override {
- // TODO(chromium:1258986): Figure out the failure incurred by the change to explicit vkImage
- // create when importing.
- if (gbm_bo_get_modifier(mGbmBo) == DRM_FORMAT_MOD_LINEAR) {
- return false;
- }
ASSERT(mGbmBo != nullptr);
// Checks if all plane handles of a multi-planar gbm_bo are same.
gbm_bo_handle plane0Handle = gbm_bo_get_handle_for_plane(mGbmBo, 0);
@@ -161,7 +156,13 @@
EXPECT_NE(addr, nullptr);
std::vector<uint8_t> initialData =
VideoViewsTests::GetTestTextureData(format, isCheckerboard);
- std::memcpy(addr, initialData.data(), initialData.size());
+ uint8_t* srcBegin = initialData.data();
+ uint8_t* srcEnd = srcBegin + initialData.size();
+ uint8_t* dstBegin = static_cast<uint8_t*>(addr);
+ for (; srcBegin < srcEnd;
+ srcBegin += VideoViewsTests::kYUVImageDataWidthInTexels, dstBegin += strideBytes) {
+ std::memcpy(dstBegin, srcBegin, VideoViewsTests::kYUVImageDataWidthInTexels);
+ }
gbm_bo_unmap(gbmBo, mapHandle);
}