From 4a55d5fdffc2c759bf98dd0a2e2d80d91d36a7a7 Mon Sep 17 00:00:00 2001
From: foreman
Date: Tue, 26 May 2015 16:35:34 -0400
Subject: [PATCH] P4 to Git Change 1154572 by gandryey@gera-w8 on 2015/05/26
16:21:11
ECR #304775 - Mipmaps support in OpenCL
- Enable PAD2 bit for miplevel views
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.cpp#218 edit
[ROCm/clr commit: 5c0f3858ff9e7ce72a1a0b693f4258ff44163f5c]
---
.../rocclr/runtime/device/gpu/gpuresource.cpp | 23 ++++++++++++++-----
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpuresource.cpp b/projects/clr/rocclr/runtime/device/gpu/gpuresource.cpp
index 6f2274faaf..96e7ad21da 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpuresource.cpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpuresource.cpp
@@ -347,6 +347,7 @@ Resource::create(MemoryType memType, CreateParams* params, bool heap)
CALresourceDesc desc;
uint64 bytePitch = (uint64)-1;
bool useRowPitch = false;
+ bool mipLevelPitchPad = false;
desc.vaBase = 0;
desc.minAlignment = 0;
@@ -669,6 +670,11 @@ Resource::create(MemoryType memType, CreateParams* params, bool heap)
if ((viewLevel != 0) || (viewOwner_->cal()->mipLevels_ > 1)) {
viewFlags |= CAL_RESALLOCSLICEVIEW_LEVEL;
}
+ if ((viewOwner_->viewOwner_ != NULL) &&
+ (viewOwner_->viewOwner_->cal()->mipLevels_ > 1)) {
+ mipLevelPitchPad = true;
+ }
+
if (viewLayer != 0) {
viewFlags |= CAL_RESALLOCSLICEVIEW_LEVEL_AND_LAYER;
}
@@ -1014,12 +1020,17 @@ Resource::create(MemoryType memType, CreateParams* params, bool heap)
hwState_[8] = GetHSAILImageFormatType(cal()->format_);
hwState_[9] = GetHSAILImageOrderType(cal()->channelOrder_, cal()->format_);
hwState_[10] = static_cast(cal()->width_);
- // Workaround for depth view, change tileIndex to the parent for depth view
- if ((memoryType() == ImageView) &&
- (viewChannelOrder == GSL_CHANNEL_ORDER_REPLICATE_R)) {
- if ((hwState_[3] & 0x1f00000) == 0xe00000) {
- hwState_[3] = (hwState_[3] & 0xfe0fffff) |
- (viewOwner_->hwState_[3] & 0x1f00000);
+ if (memoryType() == ImageView) {
+ // Workaround for depth view, change tileIndex to the parent for depth view
+ if (viewChannelOrder == GSL_CHANNEL_ORDER_REPLICATE_R) {
+ if ((hwState_[3] & 0x1f00000) == 0xe00000) {
+ hwState_[3] = (hwState_[3] & 0xfe0fffff) |
+ (viewOwner_->hwState_[3] & 0x1f00000);
+ }
+ }
+ // Update the POW2_PAD flag, otherwise HW uses a wrong pitch value
+ if ((viewFlags & CAL_RESALLOCSLICEVIEW_LEVEL) || mipLevelPitchPad) {
+ hwState_[3] |= (viewOwner_->hwState_[3] & 0x2000000);
}
}
hwState_[11] = 0; // one extra reserved field in the argument