Skip to content

Commit 6506df5

Browse files
Fixed mip count programming in surface state for regular images
This commit addresses crashes during AUB playbacks in image scenarios. Change-Id: I6d2f3917cdb3458c62382205c1a17bdc57239bb4
1 parent b6b92ae commit 6506df5

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

runtime/mem_obj/image.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Intel Corporation
2+
* Copyright (c) 2017 - 2018, Intel Corporation
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),
@@ -110,7 +110,7 @@ void ImageHw<GfxFamily>::setImageArg(void *memory, bool setAsMediaBlockImage, ui
110110
surfaceState->setRenderTargetViewExtent(renderTargetViewExtent);
111111
surfaceState->setMinimumArrayElement(minimumArrayElement);
112112
surfaceState->setSurfaceMinLod(this->mipLevel + mipLevel);
113-
surfaceState->setMipCountLod(this->mipCount - 1);
113+
surfaceState->setMipCountLod((this->mipCount > 0) ? (this->mipCount - 1) : 0);
114114

115115
// SurfaceQpitch is in rows but must be a multiple of VALIGN
116116
surfaceState->setSurfaceQpitch(qPitch);

unit_tests/mem_obj/image_set_arg_tests.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Intel Corporation
2+
* Copyright (c) 2017 - 2018, Intel Corporation
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),
@@ -169,6 +169,7 @@ HWTEST_F(ImageSetArgTest, setKernelArgImageUsingNormalImage) {
169169
auto computedWidth = surfaceState.getWidth();
170170

171171
EXPECT_EQ(srcImage->getImageDesc().image_width, computedWidth);
172+
EXPECT_EQ(0u, surfaceState.getMipCountLod());
172173
}
173174

174175
HWTEST_F(ImageSetArgTest, givenCubeMapIndexWhenSetKernelArgImageIsCalledThenModifySurfaceState) {

0 commit comments

Comments
 (0)