summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bc67a6a)
raw | patch | inline | side by side (parent: bc67a6a)
author | Chia-I Wu <olv@google.com> | |
Fri, 6 Oct 2017 19:29:14 +0000 (12:29 -0700) | ||
committer | Chia-I Wu <olv@google.com> | |
Mon, 6 Nov 2017 23:08:07 +0000 (15:08 -0800) |
After initialization or onRefresh, we want to make sure
validateDisplay is called before presentDisplay.
Bug: 67505273
Test: manual
Change-Id: Id876d9251586aaaf552ca82c52f8f902af364251
validateDisplay is called before presentDisplay.
Bug: 67505273
Test: manual
Change-Id: Id876d9251586aaaf552ca82c52f8f902af364251
graphics/composer/2.1/default/Hwc.cpp | patch | blob | history | |
graphics/composer/2.1/default/Hwc.h | patch | blob | history |
index 862dff138ec795ce8c28139ea5a13694ee249c14..1618dccb69947adeb87793ac68adec86a1dd9f31 100644 (file)
namespace V2_1 {
namespace implementation {
-
HwcHal::HwcHal(const hw_module_t* module)
- : mDevice(nullptr), mDispatch(), mAdapter()
-{
+ : mDevice(nullptr), mDispatch(), mMustValidateDisplay(true), mAdapter() {
// Determine what kind of module is available (HWC2 vs HWC1.X).
hw_device_t* device = nullptr;
int error = module->methods->open(module, HWC_HARDWARE_COMPOSER, &device);
hwc2_display_t display)
{
auto hal = reinterpret_cast<HwcHal*>(callbackData);
+ hal->mMustValidateDisplay = true;
+
auto client = hal->getClient();
if (client != nullptr) {
client->onRefresh(display);
void HwcHal::enableCallback(bool enable)
{
if (enable) {
+ mMustValidateDisplay = true;
+
mDispatch.registerCallback(mDevice, HWC2_CALLBACK_HOTPLUG, this,
reinterpret_cast<hwc2_function_pointer_t>(hotplugHook));
mDispatch.registerCallback(mDevice, HWC2_CALLBACK_REFRESH, this,
uint32_t reqs_count = 0;
int32_t err = mDispatch.validateDisplay(mDevice, display,
&types_count, &reqs_count);
+ mMustValidateDisplay = false;
+
if (err != HWC2_ERROR_NONE && err != HWC2_ERROR_HAS_CHANGES) {
return static_cast<Error>(err);
}
Error HwcHal::presentDisplay(Display display, int32_t* outPresentFence,
std::vector<Layer>* outLayers, std::vector<int32_t>* outReleaseFences)
{
+ if (mMustValidateDisplay) {
+ return Error::NOT_VALIDATED;
+ }
+
*outPresentFence = -1;
int32_t err = mDispatch.presentDisplay(mDevice, display, outPresentFence);
if (err != HWC2_ERROR_NONE) {
index 756132759cbe81bcf02ea4ba1a0f040e39c8298a..cf6a72a197478cae226e95c2faba810bf4d626a4 100644 (file)
#ifndef ANDROID_HARDWARE_GRAPHICS_COMPOSER_V2_1_HWC_H
#define ANDROID_HARDWARE_GRAPHICS_COMPOSER_V2_1_HWC_H
+#include <atomic>
#include <condition_variable>
#include <memory>
#include <mutex>
std::condition_variable mClientDestroyedWait;
wp<ComposerClient> mClient;
+ std::atomic<bool> mMustValidateDisplay;
+
// If the HWC implementation version is < 2.0, use an adapter to interface
// between HWC 2.0 <-> HWC 1.X.
std::unique_ptr<HWC2On1Adapter> mAdapter;