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>
This commit is contained in:
jchen10 2022-08-31 01:16:47 +00:00 committed by Dawn LUCI CQ
parent 54bcbdbbf3
commit fb2c8fb6a1

View File

@ -44,11 +44,6 @@ class PlatformTextureGbm : public VideoViewsTestBackend::PlatformTexture {
// 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 @@ class VideoViewsTestBackendGbm : public VideoViewsTestBackend {
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);
}