mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Merge "HWC2OnFbAdapter: don't claim present fences work" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1298fdb186
@@ -32,6 +32,8 @@
|
||||
#include <log/log.h>
|
||||
#include <sync/sync.h>
|
||||
|
||||
using namespace HWC2;
|
||||
|
||||
namespace android {
|
||||
|
||||
namespace {
|
||||
@@ -629,9 +631,10 @@ hwc2_function_pointer_t getFunctionHook(hwc2_device_t* /*device*/, int32_t descr
|
||||
}
|
||||
}
|
||||
|
||||
void getCapabilitiesHook(hwc2_device_t* /*device*/, uint32_t* outCount,
|
||||
int32_t* /*outCapabilities*/) {
|
||||
*outCount = 0;
|
||||
void getCapabilitiesHook(hwc2_device_t* device, uint32_t* outCount,
|
||||
int32_t* outCapabilities) {
|
||||
auto& adapter = HWC2OnFbAdapter::cast(device);
|
||||
adapter.getCapabilities(outCount, outCapabilities);
|
||||
}
|
||||
|
||||
int closeHook(hw_device_t* device) {
|
||||
@@ -656,6 +659,10 @@ HWC2OnFbAdapter::HWC2OnFbAdapter(framebuffer_device_t* fbDevice)
|
||||
mFbInfo.xdpi_scaled = int(mFbDevice->xdpi * 1000.0f);
|
||||
mFbInfo.ydpi_scaled = int(mFbDevice->ydpi * 1000.0f);
|
||||
|
||||
// Present fences aren't supported, always indicate PresentFenceIsNotReliable
|
||||
// for FB devices
|
||||
mCapabilities.insert(Capability::PresentFenceIsNotReliable);
|
||||
|
||||
mVsyncThread.start(0, mFbInfo.vsync_period_ns);
|
||||
}
|
||||
|
||||
@@ -791,6 +798,23 @@ void HWC2OnFbAdapter::enableVsync(bool enable) {
|
||||
mVsyncThread.enableCallback(enable);
|
||||
}
|
||||
|
||||
void HWC2OnFbAdapter::getCapabilities(uint32_t* outCount,
|
||||
int32_t* outCapabilities) {
|
||||
if (outCapabilities == nullptr) {
|
||||
*outCount = mCapabilities.size();
|
||||
return;
|
||||
}
|
||||
|
||||
auto capabilityIter = mCapabilities.cbegin();
|
||||
for (size_t written = 0; written < *outCount; ++written) {
|
||||
if (capabilityIter == mCapabilities.cend()) {
|
||||
return;
|
||||
}
|
||||
outCapabilities[written] = static_cast<int32_t>(*capabilityIter);
|
||||
++capabilityIter;
|
||||
}
|
||||
}
|
||||
|
||||
int64_t HWC2OnFbAdapter::VsyncThread::now() {
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
|
||||
@@ -23,7 +23,11 @@
|
||||
#include <thread>
|
||||
#include <unordered_set>
|
||||
|
||||
#define HWC2_INCLUDE_STRINGIFICATION
|
||||
#define HWC2_USE_CPP11
|
||||
#include <hardware/hwcomposer2.h>
|
||||
#undef HWC2_INCLUDE_STRINGIFICATION
|
||||
#undef HWC2_USE_CPP11
|
||||
|
||||
struct framebuffer_device_t;
|
||||
|
||||
@@ -75,6 +79,7 @@ public:
|
||||
|
||||
void setVsyncCallback(HWC2_PFN_VSYNC callback, hwc2_callback_data_t data);
|
||||
void enableVsync(bool enable);
|
||||
void getCapabilities(uint32_t* outCount, int32_t* outCapabilities);
|
||||
|
||||
private:
|
||||
framebuffer_device_t* mFbDevice{nullptr};
|
||||
@@ -90,6 +95,8 @@ private:
|
||||
|
||||
buffer_handle_t mBuffer{nullptr};
|
||||
|
||||
std::unordered_set<HWC2::Capability> mCapabilities;
|
||||
|
||||
class VsyncThread {
|
||||
public:
|
||||
static int64_t now();
|
||||
|
||||
Reference in New Issue
Block a user