mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-25 17:43:44 +00:00
Bug 890541 - (gonk-jb) Call setInteractive() when display is enabled/disable r=mwu
This commit is contained in:
parent
12785ceb9b
commit
1d6572690c
@ -18,6 +18,7 @@
|
||||
|
||||
#include <hardware/hardware.h>
|
||||
#include <hardware/hwcomposer.h>
|
||||
#include <hardware/power.h>
|
||||
#include <suspend/autosuspend.h>
|
||||
|
||||
#include "GraphicBufferAlloc.h"
|
||||
@ -36,6 +37,7 @@ GonkDisplayJB::GonkDisplayJB()
|
||||
, mHwc(nullptr)
|
||||
, mFBDevice(nullptr)
|
||||
, mEnabledCallback(nullptr)
|
||||
, mPowerModule(nullptr)
|
||||
{
|
||||
int err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &mFBModule);
|
||||
ALOGW_IF(err, "%s module not found", GRALLOC_HARDWARE_MODULE_ID);
|
||||
@ -82,6 +84,12 @@ GonkDisplayJB::GonkDisplayJB()
|
||||
surfaceformat = HAL_PIXEL_FORMAT_RGBA_8888;
|
||||
}
|
||||
|
||||
err = hw_get_module(POWER_HARDWARE_MODULE_ID,
|
||||
(hw_module_t const**)&mPowerModule);
|
||||
if (!err)
|
||||
mPowerModule->init(mPowerModule);
|
||||
ALOGW_IF(err, "Couldn't load %s module (%s)", POWER_HARDWARE_MODULE_ID, strerror(-err));
|
||||
|
||||
mAlloc = new GraphicBufferAlloc();
|
||||
mFBSurface = new FramebufferSurface(0, mWidth, mHeight, surfaceformat, mAlloc);
|
||||
|
||||
@ -115,8 +123,10 @@ GonkDisplayJB::GetNativeWindow()
|
||||
void
|
||||
GonkDisplayJB::SetEnabled(bool enabled)
|
||||
{
|
||||
if (enabled)
|
||||
if (enabled) {
|
||||
autosuspend_disable();
|
||||
mPowerModule->setInteractive(mPowerModule, true);
|
||||
}
|
||||
|
||||
if (mHwc)
|
||||
mHwc->blank(mHwc, HWC_DISPLAY_PRIMARY, !enabled);
|
||||
@ -126,8 +136,10 @@ GonkDisplayJB::SetEnabled(bool enabled)
|
||||
if (mEnabledCallback)
|
||||
mEnabledCallback(enabled);
|
||||
|
||||
if (!enabled)
|
||||
if (!enabled) {
|
||||
autosuspend_enable();
|
||||
mPowerModule->setInteractive(mPowerModule, false);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "GonkDisplay.h"
|
||||
#include "FramebufferSurface.h"
|
||||
#include "hardware/hwcomposer.h"
|
||||
#include "hardware/power.h"
|
||||
#include "utils/RefBase.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -49,6 +50,7 @@ private:
|
||||
hw_module_t const* mFBModule;
|
||||
hwc_composer_device_1_t* mHwc;
|
||||
framebuffer_device_t* mFBDevice;
|
||||
power_module_t* mPowerModule;
|
||||
android::sp<android::FramebufferSurface> mFBSurface;
|
||||
android::sp<ANativeWindow> mSTClient;
|
||||
android::sp<android::IGraphicBufferAlloc> mAlloc;
|
||||
|
Loading…
Reference in New Issue
Block a user