aboutsummaryrefslogtreecommitdiff
path: root/hwc2_device/hwc2_device.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'hwc2_device/hwc2_device.cpp')
-rw-r--r--hwc2_device/hwc2_device.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/hwc2_device/hwc2_device.cpp b/hwc2_device/hwc2_device.cpp
index 6d258e8..a6dedb4 100644
--- a/hwc2_device/hwc2_device.cpp
+++ b/hwc2_device/hwc2_device.cpp
@@ -74,8 +74,8 @@ static int32_t DisplayHook(hwc2_device_t *dev, hwc2_display_t display_handle,
GetFuncName(__PRETTY_FUNCTION__).c_str());
DrmHwcTwo *hwc = ToDrmHwcTwo(dev);
const std::lock_guard<std::mutex> lock(hwc->GetResMan().GetMainLock());
- HwcDisplay *display = DrmHwcTwo::GetDisplay(hwc, display_handle);
- if (!display)
+ auto *display = hwc->GetDisplay(display_handle);
+ if (display == nullptr)
return static_cast<int32_t>(HWC2::Error::BadDisplay);
return static_cast<int32_t>((display->*func)(std::forward<Args>(args)...));
@@ -88,8 +88,8 @@ static int32_t LayerHook(hwc2_device_t *dev, hwc2_display_t display_handle,
layer_handle, GetFuncName(__PRETTY_FUNCTION__).c_str());
DrmHwcTwo *hwc = ToDrmHwcTwo(dev);
const std::lock_guard<std::mutex> lock(hwc->GetResMan().GetMainLock());
- HwcDisplay *display = DrmHwcTwo::GetDisplay(hwc, display_handle);
- if (!display)
+ auto *display = hwc->GetDisplay(display_handle);
+ if (display == nullptr)
return static_cast<int32_t>(HWC2::Error::BadDisplay);
HwcLayer *layer = display->get_layer(layer_handle);
@@ -390,12 +390,6 @@ static int HookDevOpen(const struct hw_module_t *module, const char *name,
ctx->getCapabilities = HookDevGetCapabilities;
ctx->getFunction = HookDevGetFunction;
- HWC2::Error err = ctx->drmhwctwo.Init();
- if (err != HWC2::Error::None) {
- ALOGE("Failed to initialize DrmHwcTwo err=%d\n", err);
- return -EINVAL;
- }
-
*dev = &ctx.release()->common;
return 0;