From 6506df559b6d4296b43b2de8447dfb0a1bc0947b Mon Sep 17 00:00:00 2001 From: "Milczarek, Slawomir" Date: Wed, 4 Apr 2018 14:52:17 +0200 Subject: [PATCH] Fixed mip count programming in surface state for regular images This commit addresses crashes during AUB playbacks in image scenarios. Change-Id: I6d2f3917cdb3458c62382205c1a17bdc57239bb4 --- runtime/mem_obj/image.inl | 4 ++-- unit_tests/mem_obj/image_set_arg_tests.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/runtime/mem_obj/image.inl b/runtime/mem_obj/image.inl index 7833071167..cfe21c67cf 100644 --- a/runtime/mem_obj/image.inl +++ b/runtime/mem_obj/image.inl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -110,7 +110,7 @@ void ImageHw::setImageArg(void *memory, bool setAsMediaBlockImage, ui surfaceState->setRenderTargetViewExtent(renderTargetViewExtent); surfaceState->setMinimumArrayElement(minimumArrayElement); surfaceState->setSurfaceMinLod(this->mipLevel + mipLevel); - surfaceState->setMipCountLod(this->mipCount - 1); + surfaceState->setMipCountLod((this->mipCount > 0) ? (this->mipCount - 1) : 0); // SurfaceQpitch is in rows but must be a multiple of VALIGN surfaceState->setSurfaceQpitch(qPitch); diff --git a/unit_tests/mem_obj/image_set_arg_tests.cpp b/unit_tests/mem_obj/image_set_arg_tests.cpp index 825f4364d9..e0c881b0f9 100644 --- a/unit_tests/mem_obj/image_set_arg_tests.cpp +++ b/unit_tests/mem_obj/image_set_arg_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -169,6 +169,7 @@ HWTEST_F(ImageSetArgTest, setKernelArgImageUsingNormalImage) { auto computedWidth = surfaceState.getWidth(); EXPECT_EQ(srcImage->getImageDesc().image_width, computedWidth); + EXPECT_EQ(0u, surfaceState.getMipCountLod()); } HWTEST_F(ImageSetArgTest, givenCubeMapIndexWhenSetKernelArgImageIsCalledThenModifySurfaceState) {