-
Notifications
You must be signed in to change notification settings - Fork 368
Fix a ULT fail issue when driver dynamically links gmmlib. #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,4 @@ typedef enum | |
igfx_MAX = 4, | ||
} Platform_t; | ||
|
||
extern const char *g_platformName[]; | ||
|
||
#endif // __DEVCONFIG_H__ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,7 +87,7 @@ struct DriverSymbols | |
void Clear() | ||
{ | ||
auto p = (const void **)this; | ||
for (auto i = 0; i < sizeof(this) / sizeof(const void *); i++) | ||
for (auto i = 0; i < sizeof(*this) / sizeof(const void *); i++) | ||
{ | ||
p[i] = nullptr; | ||
} | ||
|
@@ -96,7 +96,7 @@ struct DriverSymbols | |
bool Initialized() const | ||
{ | ||
auto p = (const void * const *)this; | ||
for (auto i = 0; i < sizeof(this) / sizeof(const void *); i++) | ||
for (auto i = 0; i < sizeof(*this) / sizeof(const void *); i++) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Folks, please, remove this and check pointers directly. This is simply a freak over complex implementation of very simple thing: check 5 pointers that they are not NULL. You don't need any loop here!! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, checking 5 pointers is simpler and easier to understand than previous code. |
||
{ | ||
if (p[i] == nullptr) | ||
{ | ||
|
@@ -131,9 +131,9 @@ class DriverDllLoader | |
|
||
const DriverSymbols &GetDriverSymbols() const { return m_drvSyms; } | ||
|
||
VAStatus InitDriver(int platform_id); | ||
VAStatus InitDriver(Platform_t platform_id); | ||
|
||
VAStatus CloseDriver(); | ||
VAStatus CloseDriver(bool detectMemLeak = true); | ||
|
||
public: | ||
|
||
|
@@ -147,11 +147,12 @@ class DriverDllLoader | |
|
||
private: | ||
|
||
const char *m_driver_path; | ||
void *m_umdhandle; | ||
DriverSymbols m_drvSyms; | ||
const char *m_driver_path = nullptr; | ||
void *m_umdhandle = nullptr; | ||
DriverSymbols m_drvSyms = {}; | ||
drm_state m_drmstate = {}; | ||
Platform_t m_currentPlatform = igfxSKLAKE; | ||
std::vector<Platform_t> m_platformArray; | ||
drm_state m_drmstate; | ||
}; | ||
|
||
#endif // __DRIVER_LOADER_H__ |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Folks, I strongly suggest to remove constructor and Clear() entirely, You have class with all public members. C++11 already has a way to reset a structure to default value-initialization which is: m_drvSyms = {}.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for catching this, "m_drvSyms = {}" is much better than a Clear function.