From 706ff60007c7e9f57e2361ff11bc565a37118466 Mon Sep 17 00:00:00 2001 From: foreman Date: Thu, 18 Jun 2015 17:39:39 -0400 Subject: [PATCH] P4 to Git Change 1163090 by gandryey@gera-w8 on 2015/06/18 17:29:32 ECR #304775 - Mipmaps support - Fix the view creation for the host path transfers. GSL can ignore the original mipmap surface dimensions and apply the new settings Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.cpp#220 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp#123 edit --- rocclr/runtime/device/gpu/gpuresource.cpp | 19 +++++++++++++++++-- .../device/gpu/gslbe/src/rt/GSLDevice.cpp | 3 +++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/rocclr/runtime/device/gpu/gpuresource.cpp b/rocclr/runtime/device/gpu/gpuresource.cpp index 0a197a615d..d7a26eb150 100644 --- a/rocclr/runtime/device/gpu/gpuresource.cpp +++ b/rocclr/runtime/device/gpu/gpuresource.cpp @@ -1661,6 +1661,13 @@ Resource::mapLayers(VirtualGPU* gpu, CALuint flags) } dstOffs = startLayer_ * cal()->slice_ * elementSize(); + uint32_t viewFlags = CAL_RESALLOCSLICEVIEW_LEVEL_AND_LAYER; + if ((cal()->type_ == ImageView) && viewOwner_->mipMapped() && + (cal()->dimension_ == GSL_MOA_TEXTURE_2D)) { + // GSL ignores the base surface dimensions if extra flags + // are specified + viewFlags = 0; + } // Loop through all layers for (uint i = startLayer_; i < layers; ++i) { @@ -1681,7 +1688,7 @@ Resource::mapLayers(VirtualGPU* gpu, CALuint flags) sliceResource = dev().resAllocView( gslResource(), gslSize, calOffset, cal()->format_, cal()->channelOrder_, gslDim, - 0, i, CAL_RESALLOCSLICEVIEW_LEVEL_AND_LAYER); + 0, i, viewFlags); if (0 == sliceResource) { LogError("Map layer. resAllocSliceView failed!"); return NULL; @@ -1771,6 +1778,14 @@ Resource::unmapLayers(VirtualGPU* gpu) srcOffs = startLayer_ * cal()->slice_ * elementSize(); + uint32_t viewFlags = CAL_RESALLOCSLICEVIEW_LEVEL_AND_LAYER; + if ((cal()->type_ == ImageView) && viewOwner_->mipMapped() && + (cal()->dimension_ == GSL_MOA_TEXTURE_2D)) { + // GSL ignores the base surface dimensions if extra flags + // are specified + viewFlags = 0; + } + // Check if map is write only if (!(mapFlags_ == GSL_MAP_READ_ONLY)) { // Loop through all layers @@ -1792,7 +1807,7 @@ Resource::unmapLayers(VirtualGPU* gpu) sliceResource = dev().resAllocView( gslResource(), gslSize, calOffset, cal()->format_, cal()->channelOrder_, gslDim, - 0, i, CAL_RESALLOCSLICEVIEW_LEVEL_AND_LAYER); + 0, i, viewFlags); if (0 == sliceResource) { LogError("Unmap layer. resAllocSliceView failed!"); return; diff --git a/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp b/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp index 5f12542de2..581b0cb3e8 100644 --- a/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp +++ b/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp @@ -932,6 +932,9 @@ CALGSLDevice::resAllocView(gslMemObject res, gslResource3D size, CALdomain offse levelobject = m_cs->createSubMemObject(res, GSL_LEVEL, levelParam); attribs.bytePitch = static_cast(levelobject->getPitch()) * (levelobject->getBitsPerElement() / 8); + // GSL doesn't detect that the base surface is mipmaped + // and doesn't apply the height alignment + size.height = levelobject->getHeight(); } if (flags & CAL_RESALLOCSLICEVIEW_LAYER) {