From 89ab6d41a0536655d2fdea60f8a68dd0df0bba75 Mon Sep 17 00:00:00 2001 From: foreman Date: Thu, 28 May 2015 11:55:23 -0400 Subject: [PATCH] P4 to Git Change 1155415 by gandryey@gera-w8 on 2015/05/28 11:39:24 ECR #304775 - Mipmaps support - Avoid a bogus error message for a mipmap unmap Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpumemory.cpp#121 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.cpp#219 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.hpp#81 edit --- rocclr/runtime/device/gpu/gpumemory.cpp | 4 +++- rocclr/runtime/device/gpu/gpuresource.cpp | 8 ++++---- rocclr/runtime/device/gpu/gpuresource.hpp | 3 +++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/rocclr/runtime/device/gpu/gpumemory.cpp b/rocclr/runtime/device/gpu/gpumemory.cpp index 45ae2e09c6..3dacc145fc 100644 --- a/rocclr/runtime/device/gpu/gpumemory.cpp +++ b/rocclr/runtime/device/gpu/gpumemory.cpp @@ -875,7 +875,9 @@ Memory::decIndMapCount() amd::ScopedLock lock(owner()->lockMemoryOps()); if (indirectMapCount_ == 0) { - LogError("decIndMapCount() called when indirectMapCount_ already zero"); + if (!mipMapped()) { + LogError("decIndMapCount() called when indirectMapCount_ already zero"); + } return; } diff --git a/rocclr/runtime/device/gpu/gpuresource.cpp b/rocclr/runtime/device/gpu/gpuresource.cpp index 96e7ad21da..0a197a615d 100644 --- a/rocclr/runtime/device/gpu/gpuresource.cpp +++ b/rocclr/runtime/device/gpu/gpuresource.cpp @@ -667,11 +667,11 @@ Resource::create(MemoryType memType, CreateParams* params, bool heap) viewLevel = imageView->level_; gslResource = imageView->resource_->gslResource(); viewOwner_ = imageView->resource_; - if ((viewLevel != 0) || (viewOwner_->cal()->mipLevels_ > 1)) { + if ((viewLevel != 0) || viewOwner_->mipMapped()) { viewFlags |= CAL_RESALLOCSLICEVIEW_LEVEL; } if ((viewOwner_->viewOwner_ != NULL) && - (viewOwner_->viewOwner_->cal()->mipLevels_ > 1)) { + viewOwner_->viewOwner_->mipMapped()) { mipLevelPitchPad = true; } @@ -1598,7 +1598,7 @@ Resource::map(VirtualGPU* gpu, uint flags, uint startLayer, uint numLayers) // Check if memory wasn't mapped yet if (++mapCount_ == 1) { if ((cal()->dimSize_ == 3) || cal()->imageArray_ || - ((cal()->type_ == ImageView) && (viewOwner_->cal()->mipLevels_ > 1))) { + ((cal()->type_ == ImageView) && viewOwner_->mipMapped())) { // Save map info for multilayer map/unmap startLayer_ = startLayer; numLayers_ = numLayers; @@ -1729,7 +1729,7 @@ Resource::unmap(VirtualGPU* gpu) // Check if it's the last unmap if (count == 0) { if ((cal()->dimSize_ == 3) || cal()->imageArray_ || - ((cal()->type_ == ImageView) && (viewOwner_->cal()->mipLevels_ > 1))) { + ((cal()->type_ == ImageView) && viewOwner_->mipMapped())) { // Unmap layers unmapLayers(gpu); } diff --git a/rocclr/runtime/device/gpu/gpuresource.hpp b/rocclr/runtime/device/gpu/gpuresource.hpp index 8eeba3e905..c0aaf4c25a 100644 --- a/rocclr/runtime/device/gpu/gpuresource.hpp +++ b/rocclr/runtime/device/gpu/gpuresource.hpp @@ -277,6 +277,9 @@ public: //! Returns global memory offset uint64_t vmAddress() const { return gslResource()->getSurfaceAddress(); } + //! Returns global memory offset + bool mipMapped() const { return (cal()->mipLevels_ > 1) ? true : false; } + //! Checks if persistent memory can have a direct map bool isPersistentDirectMap() const;