Remove stride in ExternalImageDescriptorDmaBuf
Use planeLayouts instead. Bug: chromium:1258986 Change-Id: I16c041a8e0b739fa347ea4695988ad1eed82cccc Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92202 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Loko Kung <lokokung@google.com> Commit-Queue: Jie A Chen <jie.a.chen@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
ccc1b2db0b
commit
ad8caa2540
|
@ -102,8 +102,6 @@ struct DAWN_NATIVE_EXPORT PlaneLayout {
|
|||
// Descriptor for dma-buf file descriptor image import
|
||||
struct DAWN_NATIVE_EXPORT ExternalImageDescriptorDmaBuf : ExternalImageDescriptorFD {
|
||||
ExternalImageDescriptorDmaBuf();
|
||||
// To be removed after chromium's switch to planeLayouts.
|
||||
uint32_t stride = 0u; // Stride of the buffer in bytes
|
||||
|
||||
static constexpr uint32_t kMaxPlanes = 3;
|
||||
std::array<PlaneLayout, kMaxPlanes> planeLayouts;
|
||||
|
|
|
@ -320,16 +320,6 @@ ResultOrError<VkImage> Service::CreateImage(const ExternalImageDescriptor* descr
|
|||
planeLayouts[plane].depthPitch = 0; // Not a depth texture
|
||||
}
|
||||
|
||||
// For single plane formats.
|
||||
// To be Removed after chromium's switch to planeLayouts.
|
||||
if (dmaBufDescriptor->stride != 0) {
|
||||
planeLayouts[0].offset = 0;
|
||||
planeLayouts[0].size = 0; // VK_EXT_image_drm_format_modifier mandates size = 0.
|
||||
planeLayouts[0].rowPitch = dmaBufDescriptor->stride;
|
||||
planeLayouts[0].arrayPitch = 0; // Not an array texture
|
||||
planeLayouts[0].depthPitch = 0; // Not a depth texture
|
||||
}
|
||||
|
||||
VkImageDrmFormatModifierExplicitCreateInfoEXT explicitCreateInfo = {};
|
||||
explicitCreateInfo.drmFormatModifier = dmaBufDescriptor->drmModifier;
|
||||
explicitCreateInfo.drmFormatModifierPlaneCount = planeCount;
|
||||
|
|
|
@ -51,8 +51,12 @@ class ExternalSemaphoreDmaBuf : public VulkanImageWrappingTestBackend::ExternalS
|
|||
|
||||
class ExternalTextureDmaBuf : public VulkanImageWrappingTestBackend::ExternalTexture {
|
||||
public:
|
||||
ExternalTextureDmaBuf(gbm_bo* bo, int fd, uint32_t stride, uint64_t drmModifier)
|
||||
: mGbmBo(bo), mFd(fd), stride(stride), drmModifier(drmModifier) {}
|
||||
ExternalTextureDmaBuf(
|
||||
gbm_bo* bo,
|
||||
int fd,
|
||||
std::array<PlaneLayout, ExternalImageDescriptorDmaBuf::kMaxPlanes> planeLayouts,
|
||||
uint64_t drmModifier)
|
||||
: mGbmBo(bo), mFd(fd), planeLayouts(planeLayouts), drmModifier(drmModifier) {}
|
||||
|
||||
~ExternalTextureDmaBuf() override {
|
||||
if (mFd != -1) {
|
||||
|
@ -70,7 +74,7 @@ class ExternalTextureDmaBuf : public VulkanImageWrappingTestBackend::ExternalTex
|
|||
int mFd = -1;
|
||||
|
||||
public:
|
||||
const uint32_t stride;
|
||||
const std::array<PlaneLayout, ExternalImageDescriptorDmaBuf::kMaxPlanes> planeLayouts;
|
||||
const uint64_t drmModifier;
|
||||
};
|
||||
|
||||
|
@ -93,8 +97,13 @@ class VulkanImageWrappingTestBackendDmaBuf : public VulkanImageWrappingTestBacke
|
|||
|
||||
gbm_bo* bo = CreateGbmBo(width, height, true);
|
||||
|
||||
return std::make_unique<ExternalTextureDmaBuf>(
|
||||
bo, gbm_bo_get_fd(bo), gbm_bo_get_stride_for_plane(bo, 0), gbm_bo_get_modifier(bo));
|
||||
std::array<PlaneLayout, ExternalImageDescriptorDmaBuf::kMaxPlanes> planeLayouts;
|
||||
for (int plane = 0; plane < gbm_bo_get_plane_count(bo); ++plane) {
|
||||
planeLayouts[plane].stride = gbm_bo_get_stride_for_plane(bo, plane);
|
||||
planeLayouts[plane].offset = gbm_bo_get_offset(bo, plane);
|
||||
}
|
||||
return std::make_unique<ExternalTextureDmaBuf>(bo, gbm_bo_get_fd(bo), planeLayouts,
|
||||
gbm_bo_get_modifier(bo));
|
||||
}
|
||||
|
||||
wgpu::Texture WrapImage(const wgpu::Device& device,
|
||||
|
@ -115,7 +124,7 @@ class VulkanImageWrappingTestBackendDmaBuf : public VulkanImageWrappingTestBacke
|
|||
descriptorDmaBuf.memoryFD = textureDmaBuf->Dup();
|
||||
descriptorDmaBuf.waitFDs = std::move(waitFDs);
|
||||
|
||||
descriptorDmaBuf.stride = textureDmaBuf->stride;
|
||||
descriptorDmaBuf.planeLayouts = textureDmaBuf->planeLayouts;
|
||||
descriptorDmaBuf.drmModifier = textureDmaBuf->drmModifier;
|
||||
|
||||
return wgpu::Texture::Acquire(
|
||||
|
|
Loading…
Reference in New Issue