From 09c96ae91cb7d2c8f88832584332c0567b314bf5 Mon Sep 17 00:00:00 2001
From: foreman
Date: Thu, 1 Sep 2016 17:44:19 -0400
Subject: [PATCH] P4 to Git Change 1310014 by gandryey@gera-w8 on 2016/09/01
17:32:18
SWDEV-101621 - [CQE OCL][OpenCL on PAL] 6 WF Conformance tests are failing
- Make sure the rowPitch is aligned to pixels for images created from buffer
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#20 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palresource.cpp#10 edit
---
rocclr/runtime/device/pal/paldevice.cpp | 2 +-
rocclr/runtime/device/pal/palresource.cpp | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/rocclr/runtime/device/pal/paldevice.cpp b/rocclr/runtime/device/pal/paldevice.cpp
index 9aad82d063..c087db01a1 100644
--- a/rocclr/runtime/device/pal/paldevice.cpp
+++ b/rocclr/runtime/device/pal/paldevice.cpp
@@ -347,7 +347,7 @@ void NullDevice::fillDeviceInfo(
info_.image3DMaxHeight_ = std::min(2 * Ki, maxTextureSize);
info_.image3DMaxDepth_ = std::min(2 * Ki, maxTextureSize);
- info_.imagePitchAlignment_ = 1; // PAL uses LINEAR_GENERAL
+ info_.imagePitchAlignment_ = 256; // PAL uses LINEAR_ALIGNED
info_.imageBaseAddressAlignment_ = 256; // XXX: 256 byte base address alignment for now
info_.bufferFromImageSupport_ = CL_TRUE;
diff --git a/rocclr/runtime/device/pal/palresource.cpp b/rocclr/runtime/device/pal/palresource.cpp
index 29269710b8..1773ca3c42 100644
--- a/rocclr/runtime/device/pal/palresource.cpp
+++ b/rocclr/runtime/device/pal/palresource.cpp
@@ -819,6 +819,21 @@ Resource::create(MemoryType memType, CreateParams* params)
else if (memoryType() == ImageView) {
tiling = viewOwner_->image_->GetImageCreateInfo().tiling;
}
+
+ if (memoryType() == ImageBuffer) {
+ uint32_t rowPitch;
+ if ((params->owner_ != NULL) && params->owner_->asImage() &&
+ (params->owner_->asImage()->getRowPitch() != 0)) {
+ rowPitch = params->owner_->asImage()->getRowPitch() / elementSize();
+ }
+ else {
+ rowPitch = desc().width_;
+ }
+ // Make sure the row pitch is aligned to pixels
+ imgCreateInfo.rowPitch = elementSize() *
+ amd::alignUp(rowPitch, dev().info().imagePitchAlignment_);
+ imgCreateInfo.depthPitch = imgCreateInfo.rowPitch * desc().height_;
+ }
imgCreateInfo.tiling = tiling;
size_t imageSize = dev().iDev()->GetImageSize(imgCreateInfo, &result);