mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
graphics: require validateDisplay after onRefresh am: 8101b24ca7
am: a565609b83
Change-Id: I713f68f0b789acac0ab1340f1a2de9a514a8079d
This commit is contained in:
@@ -35,10 +35,8 @@ namespace composer {
|
||||
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);
|
||||
@@ -283,6 +281,8 @@ void HwcHal::refreshHook(hwc2_callback_data_t callbackData,
|
||||
hwc2_display_t display)
|
||||
{
|
||||
auto hal = reinterpret_cast<HwcHal*>(callbackData);
|
||||
hal->mMustValidateDisplay = true;
|
||||
|
||||
auto client = hal->getClient();
|
||||
if (client != nullptr) {
|
||||
client->onRefresh(display);
|
||||
@@ -302,6 +302,8 @@ void HwcHal::vsyncHook(hwc2_callback_data_t callbackData,
|
||||
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,
|
||||
@@ -549,6 +551,8 @@ Error HwcHal::validateDisplay(Display display,
|
||||
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);
|
||||
}
|
||||
@@ -609,6 +613,10 @@ Error HwcHal::acceptDisplayChanges(Display display)
|
||||
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) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#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>
|
||||
@@ -215,6 +216,8 @@ private:
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user