Fix a bug in Graphics Allocations constructors.

- There was a wrong cast in Graphics Allocation constructor resulting
in wrong GPU address generation in some sporadic scenarios.
- Problem appears in 32 bit applications where void* address is cast to
uint64_t value, if c style cast is used it makes trailing bit to be
populated to higher bits constructing wrong value

0xf000000 is being casted to 0xfffffffff0000000 while it should be casted to
0x00000000f0000000
- added special cast function for further use.

Change-Id: I56d53a8e13e17cbacd127566442eea3f6a089977
This commit is contained in:
Mrozek, Michal
2018-04-19 09:42:00 +02:00
parent d900bdffc6
commit 5bae27ae51
4 changed files with 34 additions and 4 deletions

View File

@@ -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"),
@@ -61,3 +61,7 @@ inline void patchWithRequiredSize(void *memoryToBePatched, uint32_t patchSize, u
*curbeAddress = (uint32_t)patchValue;
}
}
inline uint64_t castToUint64(void *address) {
return static_cast<uint64_t>(reinterpret_cast<uintptr_t>(address));
}