LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS)
endif
-ifeq ($(TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK),true)
- LOCAL_CFLAGS += -DRUNNING_WITHOUT_SYNC_FRAMEWORK
-endif
-
LOCAL_CFLAGS += -fvisibility=hidden -Werror=format
LOCAL_HEADER_LIBRARIES := \
return BAD_VALUE;
}
- // This method is only here to handle the kIgnorePresentFences case.
+ // This method is only here to handle the !SurfaceFlinger::hasSyncFramework
+ // case.
bool hasAnyEventListeners() {
if (kTraceDetailedInfo) ATRACE_CALL();
Mutex::Autolock lock(mMutex);
DispSync::DispSync(const char* name) :
mName(name),
mRefreshSkipCount(0),
- mThread(new DispSyncThread(name)) {
+ mThread(new DispSyncThread(name)),
+ mIgnorePresentFences(!SurfaceFlinger::hasSyncFramework){
mPresentTimeOffset = SurfaceFlinger::dispSyncPresentTimeOffset;
mThread->run("DispSync", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE);
// Even if we're just ignoring the fences, the zero-phase tracing is
// not needed because any time there is an event registered we will
// turn on the HW vsync events.
- if (!kIgnorePresentFences && kEnableZeroPhaseTracer) {
+ if (!mIgnorePresentFences && kEnableZeroPhaseTracer) {
addEventListener("ZeroPhaseTracer", 0, new ZeroPhaseTracer());
}
}
resetErrorLocked();
}
- if (kIgnorePresentFences) {
+ if (mIgnorePresentFences) {
// If we don't have the sync framework we will never have
// addPresentFence called. This means we have no way to know whether
// or not we're synchronized with the HW vsyncs, so we just request
void DispSync::dump(String8& result) const {
Mutex::Autolock lock(mMutex);
result.appendFormat("present fences are %s\n",
- kIgnorePresentFences ? "ignored" : "used");
+ mIgnorePresentFences ? "ignored" : "used");
result.appendFormat("mPeriod: %" PRId64 " ns (%.3f fps; skipCount=%d)\n",
mPeriod, 1000000000.0 / mPeriod, mRefreshSkipCount);
result.appendFormat("mPhase: %" PRId64 " ns\n", mPhase);
namespace android {
-// Ignore present (retire) fences if the device doesn't have support for the
-// sync framework
-#if defined(RUNNING_WITHOUT_SYNC_FRAMEWORK)
-static const bool kIgnorePresentFences = true;
-#else
-static const bool kIgnorePresentFences = false;
-#endif
-
-
class String8;
class Fence;
class DispSyncThread;
// This is the offset from the present fence timestamps to the corresponding
// vsync event.
int64_t mPresentTimeOffset;
+
+ // Ignore present (retire) fences if the device doesn't have support for the
+ // sync framework
+ bool mIgnorePresentFences;
};
}
int64_t SurfaceFlinger::dispSyncPresentTimeOffset;
bool SurfaceFlinger::useHwcForRgbToYuv;
uint64_t SurfaceFlinger::maxVirtualDisplaySize;
+bool SurfaceFlinger::hasSyncFramework;
SurfaceFlinger::SurfaceFlinger()
: BnSurfaceComposer(),
,mEnterVrMode(false)
#endif
{
+ ALOGI("SurfaceFlinger is starting");
vsyncPhaseOffsetNs = getInt64< ISurfaceFlingerConfigs,
&ISurfaceFlingerConfigs::vsyncEventPhaseOffsetNs>(1000000);
sfVsyncPhaseOffsetNs = getInt64< ISurfaceFlingerConfigs,
&ISurfaceFlingerConfigs::vsyncSfEventPhaseOffsetNs>(1000000);
- ALOGI("SurfaceFlinger is starting");
+ hasSyncFramework = getBool< ISurfaceFlingerConfigs,
+ &ISurfaceFlingerConfigs::hasSyncFramework>(true);
useContextPriority = getBool< ISurfaceFlingerConfigs,
&ISurfaceFlingerConfigs::useContextPriority>(false);
}
}
- if (kIgnorePresentFences) {
+ if (!hasSyncFramework) {
if (hw->isDisplayOn()) {
enableHardwareVsync();
}
result.appendFormat(" PRESENT_TIME_OFFSET=%" PRId64 , dispSyncPresentTimeOffset);
result.appendFormat(" FORCE_HWC_FOR_RBG_TO_YUV=%d", useHwcForRgbToYuv);
result.appendFormat(" MAX_VIRT_DISPLAY_DIM=%" PRIu64, maxVirtualDisplaySize);
+ result.appendFormat(" RUNNING_WITHOUT_SYNC_FRAMEWORK=%d", !hasSyncFramework);
result.append("]");
}
static int64_t vsyncPhaseOffsetNs;
static int64_t sfVsyncPhaseOffsetNs;
+ // If fences from sync Framework are supported.
+ static bool hasSyncFramework;
+
// Instruct the Render Engine to use EGL_IMG_context_priority is available.
static bool useContextPriority;
int64_t SurfaceFlinger::dispSyncPresentTimeOffset;
bool SurfaceFlinger::useHwcForRgbToYuv;
uint64_t SurfaceFlinger::maxVirtualDisplaySize;
+bool SurfaceFlinger::hasSyncFramework;
SurfaceFlinger::SurfaceFlinger()
: BnSurfaceComposer(),
mLastSwapTime(0),
mNumLayers(0)
{
-
ALOGI("SurfaceFlinger is starting");
vsyncPhaseOffsetNs = getInt64< ISurfaceFlingerConfigs,
maxVirtualDisplaySize = getUInt64<ISurfaceFlingerConfigs,
&ISurfaceFlingerConfigs::maxVirtualDisplaySize>(0);
+ hasSyncFramework = getBool< ISurfaceFlingerConfigs,
+ &ISurfaceFlingerConfigs::hasSyncFramework>(true);
+
useContextPriority = getBool< ISurfaceFlingerConfigs,
&ISurfaceFlingerConfigs::useContextPriority>(false);
}
}
- if (kIgnorePresentFences) {
+ if (!hasSyncFramework) {
if (hw->isDisplayOn()) {
enableHardwareVsync();
}
result.appendFormat(" PRESENT_TIME_OFFSET=%" PRId64, dispSyncPresentTimeOffset);
result.appendFormat(" FORCE_HWC_FOR_RBG_TO_YUV=%d", useHwcForRgbToYuv);
result.appendFormat(" MAX_VIRT_DISPLAY_DIM=%" PRIu64, maxVirtualDisplaySize);
+ result.appendFormat(" RUNNING_WITHOUT_SYNC_FRAMEWORK=%d", !hasSyncFramework);
result.append("]");
}