summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/gui/FrameTimestamps.h4
-rw-r--r--include/gui/Surface.h8
-rw-r--r--libs/gui/Surface.cpp16
-rw-r--r--opengl/include/EGL/eglext.h2
-rw-r--r--opengl/libs/EGL/eglApi.cpp12
-rw-r--r--opengl/specs/EGL_ANDROID_get_frame_timestamps.txt16
-rw-r--r--opengl/specs/README2
-rw-r--r--services/surfaceflinger/FenceTracker.cpp19
-rw-r--r--services/surfaceflinger/FenceTracker.h12
-rw-r--r--services/surfaceflinger/Layer.cpp4
-rw-r--r--services/surfaceflinger/Layer.h2
11 files changed, 53 insertions, 44 deletions
diff --git a/include/gui/FrameTimestamps.h b/include/gui/FrameTimestamps.h
index 4dc7467029..17352cc6df 100644
--- a/include/gui/FrameTimestamps.h
+++ b/include/gui/FrameTimestamps.h
@@ -25,7 +25,7 @@ namespace android {
struct FrameTimestamps : public LightFlattenablePod<FrameTimestamps> {
FrameTimestamps() :
frameNumber(0),
- postedTime(0),
+ requestedPresentTime(0),
acquireTime(0),
refreshStartTime(0),
glCompositionDoneTime(0),
@@ -33,7 +33,7 @@ struct FrameTimestamps : public LightFlattenablePod<FrameTimestamps> {
releaseTime(0) {}
uint64_t frameNumber;
- nsecs_t postedTime;
+ nsecs_t requestedPresentTime;
nsecs_t acquireTime;
nsecs_t refreshStartTime;
nsecs_t glCompositionDoneTime;
diff --git a/include/gui/Surface.h b/include/gui/Surface.h
index 1d97d8be71..470992ca03 100644
--- a/include/gui/Surface.h
+++ b/include/gui/Surface.h
@@ -135,10 +135,10 @@ public:
sp<Fence>* outFence, float outTransformMatrix[16]);
// See IGraphicBufferProducer::getFrameTimestamps
- bool getFrameTimestamps(uint64_t frameNumber, nsecs_t* outPostedTime,
- nsecs_t* outAcquireTime, nsecs_t* outRefreshStartTime,
- nsecs_t* outGlCompositionDoneTime, nsecs_t* outDisplayRetireTime,
- nsecs_t* outReleaseTime);
+ bool getFrameTimestamps(uint64_t frameNumber,
+ nsecs_t* outRequestedPresentTime, nsecs_t* outAcquireTime,
+ nsecs_t* outRefreshStartTime, nsecs_t* outGlCompositionDoneTime,
+ nsecs_t* outDisplayRetireTime, nsecs_t* outReleaseTime);
status_t getUniqueId(uint64_t* outId) const;
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index 351d184168..ac93c538e6 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -135,18 +135,18 @@ status_t Surface::getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
outTransformMatrix);
}
-bool Surface::getFrameTimestamps(uint64_t frameNumber, nsecs_t* outPostedTime,
- nsecs_t* outAcquireTime, nsecs_t* outRefreshStartTime,
- nsecs_t* outGlCompositionDoneTime, nsecs_t* outDisplayRetireTime,
- nsecs_t* outReleaseTime) {
+bool Surface::getFrameTimestamps(uint64_t frameNumber,
+ nsecs_t* outRequestedPresentTime, nsecs_t* outAcquireTime,
+ nsecs_t* outRefreshStartTime, nsecs_t* outGlCompositionDoneTime,
+ nsecs_t* outDisplayRetireTime, nsecs_t* outReleaseTime) {
ATRACE_CALL();
FrameTimestamps timestamps;
bool found = mGraphicBufferProducer->getFrameTimestamps(frameNumber,
&timestamps);
if (found) {
- if (outPostedTime) {
- *outPostedTime = timestamps.postedTime;
+ if (outRequestedPresentTime) {
+ *outRequestedPresentTime = timestamps.requestedPresentTime;
}
if (outAcquireTime) {
*outAcquireTime = timestamps.acquireTime;
@@ -795,14 +795,14 @@ int Surface::dispatchSetAutoRefresh(va_list args) {
int Surface::dispatchGetFrameTimestamps(va_list args) {
uint32_t framesAgo = va_arg(args, uint32_t);
- nsecs_t* outPostedTime = va_arg(args, int64_t*);
+ nsecs_t* outRequestedPresentTime = va_arg(args, int64_t*);
nsecs_t* outAcquireTime = va_arg(args, int64_t*);
nsecs_t* outRefreshStartTime = va_arg(args, int64_t*);
nsecs_t* outGlCompositionDoneTime = va_arg(args, int64_t*);
nsecs_t* outDisplayRetireTime = va_arg(args, int64_t*);
nsecs_t* outReleaseTime = va_arg(args, int64_t*);
bool ret = getFrameTimestamps(getNextFrameNumber() - 1 - framesAgo,
- outPostedTime, outAcquireTime, outRefreshStartTime,
+ outRequestedPresentTime, outAcquireTime, outRefreshStartTime,
outGlCompositionDoneTime, outDisplayRetireTime, outReleaseTime);
return ret ? NO_ERROR : BAD_VALUE;
}
diff --git a/opengl/include/EGL/eglext.h b/opengl/include/EGL/eglext.h
index 1c6b4c2f2c..c2fa43f6ec 100644
--- a/opengl/include/EGL/eglext.h
+++ b/opengl/include/EGL/eglext.h
@@ -632,7 +632,7 @@ typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLCREATENATIVECLIENTBUFFERANDROID) (co
#ifndef EGL_ANDROID_get_frame_timestamps
#define EGL_ANDROID_get_frame_timestamps 1
#define EGL_TIMESTAMPS_ANDROID 0x314D
-#define EGL_QUEUE_TIME_ANDROID 0x314E
+#define EGL_REQUESTED_PRESENT_TIME_ANDROID 0x314E
#define EGL_RENDERING_COMPLETE_TIME_ANDROID 0x314F
#define EGL_COMPOSITION_START_TIME_ANDROID 0x3430
#define EGL_COMPOSITION_FINISHED_TIME_ANDROID 0x3431
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index 0bfefd0b8d..1acdeb0851 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -2038,7 +2038,7 @@ EGLBoolean eglGetFrameTimestampsANDROID(EGLDisplay dpy, EGLSurface surface,
return EGL_FALSE;
}
- nsecs_t* postedTime = nullptr;
+ nsecs_t* requestedPresentTime = nullptr;
nsecs_t* acquireTime = nullptr;
nsecs_t* refreshStartTime = nullptr;
nsecs_t* GLCompositionDoneTime = nullptr;
@@ -2047,8 +2047,8 @@ EGLBoolean eglGetFrameTimestampsANDROID(EGLDisplay dpy, EGLSurface surface,
for (int i = 0; i < numTimestamps; i++) {
switch (timestamps[i]) {
- case EGL_QUEUE_TIME_ANDROID:
- postedTime = &values[i];
+ case EGL_REQUESTED_PRESENT_TIME_ANDROID:
+ requestedPresentTime = &values[i];
break;
case EGL_RENDERING_COMPLETE_TIME_ANDROID:
acquireTime = &values[i];
@@ -2072,8 +2072,8 @@ EGLBoolean eglGetFrameTimestampsANDROID(EGLDisplay dpy, EGLSurface surface,
}
status_t ret = native_window_get_frame_timestamps(s->win.get(), framesAgo,
- postedTime, acquireTime, refreshStartTime, GLCompositionDoneTime,
- displayRetireTime, releaseTime);
+ requestedPresentTime, acquireTime, refreshStartTime,
+ GLCompositionDoneTime, displayRetireTime, releaseTime);
if (ret != NO_ERROR) {
setError(EGL_BAD_ACCESS, EGL_FALSE);
@@ -2102,7 +2102,7 @@ EGLBoolean eglQueryTimestampSupportedANDROID(EGLDisplay dpy, EGLSurface surface,
switch (timestamp) {
#if ENABLE_EGL_ANDROID_GET_FRAME_TIMESTAMPS
- case EGL_QUEUE_TIME_ANDROID:
+ case EGL_REQUESTED_PRESENT_TIME_ANDROID:
case EGL_RENDERING_COMPLETE_TIME_ANDROID:
case EGL_COMPOSITION_START_TIME_ANDROID:
case EGL_COMPOSITION_FINISHED_TIME_ANDROID:
diff --git a/opengl/specs/EGL_ANDROID_get_frame_timestamps.txt b/opengl/specs/EGL_ANDROID_get_frame_timestamps.txt
index 30337ad7a9..0882cef7ab 100644
--- a/opengl/specs/EGL_ANDROID_get_frame_timestamps.txt
+++ b/opengl/specs/EGL_ANDROID_get_frame_timestamps.txt
@@ -67,7 +67,7 @@ New Procedures and Functions
New Tokens
EGL_TIMESTAMPS_ANDROID 0x314D
- EGL_QUEUE_TIME_ANDROID 0x314E
+ EGL_REQUESTED_PRESENT_TIME_ANDROID 0x314E
EGL_RENDERING_COMPLETE_TIME_ANDROID 0x314F
EGL_COMPOSITION_START_TIME_ANDROID 0x3430
EGL_COMPOSITION_FINISHED_TIME_ANDROID 0x3431
@@ -98,9 +98,9 @@ Changes to Chapter 3 of the EGL 1.5 Specification (EGL Functions and Errors)
allows querying various timestamps related to the composition and display of
a window surface.
- The framesAgo parameter indicates how many frames before the last posted
+ The framesAgo parameter indicates how many frames before the last queued
frame to query. So a value of zero would indicate that the query is for the
- last posted frame. Note that the implementation maintains a limited history
+ last queued frame. Note that the implementation maintains a limited history
of timestamp data. If a query is made for a frame whose timestamp history
no longer exists then EGL_BAD_ACCESS is generated. If timestamp collection
has not been enabled for the surface then EGL_BAD_SURFACE is generated.
@@ -112,8 +112,10 @@ Changes to Chapter 3 of the EGL 1.5 Specification (EGL Functions and Errors)
The eglGetFrameTimestampsANDROID function takes an array of timestamps to
query and returns timestamps in the corresponding indices of the values
array. The possible timestamps that can be queried are:
- - EGL_QUEUE_TIME_ANDROID - The time this frame was queued by the
- application.
+ - EGL_REQUESTED_PRESENT_TIME_ANDROID - The time the application
+ requested this frame be presented. See EGL_ANDROID_presentation_time.
+ If the application does not request a presentation time explicitly,
+ this will correspond to buffer's queue time.
- EGL_RENDERING_COMPLETE_TIME_ANDROID - The time when all of the
application's rendering to the surface was completed.
- EGL_COMPOSITION_START_TIME_ANDROID - The time at which the compositor
@@ -143,3 +145,7 @@ Revision History
#1 (Pablo Ceballos, May 31, 2016)
- Initial draft.
+
+#2 (Brian Anderson, July 22, 2016)
+ - Replace EGL_QUEUE_TIME_ANDROID with EGL_REQUESTED_PRESENT_TIME_ANDROID.
+
diff --git a/opengl/specs/README b/opengl/specs/README
index f0c024ee66..8414d059a0 100644
--- a/opengl/specs/README
+++ b/opengl/specs/README
@@ -20,7 +20,7 @@ for use by Android extensions.
0x314B EGL_IMAGE_CROP_BOTTOM_ANDROID (EGL_ANDROID_image_crop)
0x314C EGL_FRONT_BUFFER_AUTO_REFRESH_ANDROID (EGL_ANDROID_front_buffer_auto_refresh)
0x314D EGL_TIMESTAMPS_ANDROID (EGL_ANDROID_get_frame_timestamps)
-0x314E EGL_QUEUE_TIME_ANDROID (EGL_ANDROID_get_frame_timestamps)
+0x314E EGL_REQUESTED_PRESENT_TIME_ANDROID (EGL_ANDROID_get_frame_timestamps)
0x314F EGL_RENDERING_COMPLETE_TIME_ANDROID (EGL_ANDROID_get_frame_timestamps)
0x3430 EGL_COMPOSITION_START_TIME_ANDROID (EGL_ANDROID_get_frame_timestamps)
0x3431 EGL_COMPOSITION_FINISHED_TIME_ANDROID (EGL_ANDROID_get_frame_timestamps)
diff --git a/services/surfaceflinger/FenceTracker.cpp b/services/surfaceflinger/FenceTracker.cpp
index 0e18a937e4..276890dc24 100644
--- a/services/surfaceflinger/FenceTracker.cpp
+++ b/services/surfaceflinger/FenceTracker.cpp
@@ -60,8 +60,8 @@ void FenceTracker::dump(String8* outString) {
outString->appendFormat("---- Frame # %" PRIu64 " (%s)\n",
layer.frameNumber,
layer.isGlesComposition ? "GLES" : "HWC");
- outString->appendFormat("---- Posted\t%" PRId64 "\n",
- layer.postedTime);
+ outString->appendFormat("---- Req.Present.\t%" PRId64 "\n",
+ layer.requestedPresentTime);
if (layer.acquireTime) {
outString->appendFormat("---- Acquire\t%" PRId64 "\n",
layer.acquireTime);
@@ -134,25 +134,26 @@ void FenceTracker::addFrame(nsecs_t refreshStartTime, sp<Fence> retireFence,
String8 name;
uint64_t frameNumber;
bool glesComposition;
- nsecs_t postedTime;
+ nsecs_t requestedPresentTime;
sp<Fence> acquireFence;
sp<Fence> prevReleaseFence;
int32_t layerId = layers[i]->getSequence();
layers[i]->getFenceData(&name, &frameNumber, &glesComposition,
- &postedTime, &acquireFence, &prevReleaseFence);
+ &requestedPresentTime, &acquireFence, &prevReleaseFence);
#ifdef USE_HWC2
if (glesComposition) {
frame.layers.emplace(std::piecewise_construct,
std::forward_as_tuple(layerId),
std::forward_as_tuple(name, frameNumber, glesComposition,
- postedTime, 0, 0, acquireFence, prevReleaseFence));
+ requestedPresentTime, 0, 0, acquireFence,
+ prevReleaseFence));
wasGlesCompositionDone = true;
} else {
frame.layers.emplace(std::piecewise_construct,
std::forward_as_tuple(layerId),
std::forward_as_tuple(name, frameNumber, glesComposition,
- postedTime, 0, 0, acquireFence, Fence::NO_FENCE));
+ requestedPresentTime, 0, 0, acquireFence, Fence::NO_FENCE));
auto prevLayer = prevFrame.layers.find(layerId);
if (prevLayer != prevFrame.layers.end()) {
prevLayer->second.releaseFence = prevReleaseFence;
@@ -162,7 +163,7 @@ void FenceTracker::addFrame(nsecs_t refreshStartTime, sp<Fence> retireFence,
frame.layers.emplace(std::piecewise_construct,
std::forward_as_tuple(layerId),
std::forward_as_tuple(name, frameNumber, glesComposition,
- postedTime, 0, 0, acquireFence,
+ requestedPresentTime, 0, 0, acquireFence,
glesComposition ? Fence::NO_FENCE : prevReleaseFence));
if (glesComposition) {
wasGlesCompositionDone = true;
@@ -171,7 +172,7 @@ void FenceTracker::addFrame(nsecs_t refreshStartTime, sp<Fence> retireFence,
frame.layers.emplace(std::piecewise_construct,
std::forward_as_tuple(layerId),
std::forward_as_tuple(name, frameNumber, glesComposition,
- postedTime, 0, 0, acquireFence, prevReleaseFence));
+ requestedPresentTime, 0, 0, acquireFence, prevReleaseFence));
}
frame.frameId = mFrameCounter;
@@ -207,7 +208,7 @@ bool FenceTracker::getFrameTimestamps(const Layer& layer,
const FrameRecord& frameRecord = mFrames[i];
const LayerRecord& layerRecord = mFrames[i].layers[layerId];
outTimestamps->frameNumber = frameNumber;
- outTimestamps->postedTime = layerRecord.postedTime;
+ outTimestamps->requestedPresentTime = layerRecord.requestedPresentTime;
outTimestamps->acquireTime = layerRecord.acquireTime;
outTimestamps->refreshStartTime = frameRecord.refreshStartTime;
outTimestamps->glCompositionDoneTime = frameRecord.glesCompositionDoneTime;
diff --git a/services/surfaceflinger/FenceTracker.h b/services/surfaceflinger/FenceTracker.h
index 4cb14a539d..385c970c9a 100644
--- a/services/surfaceflinger/FenceTracker.h
+++ b/services/surfaceflinger/FenceTracker.h
@@ -50,23 +50,25 @@ protected:
String8 name; // layer name
uint64_t frameNumber; // frame number for this layer
bool isGlesComposition; // was GLES composition used for this layer?
- nsecs_t postedTime; // time when buffer was queued
+ // time the producer requested this frame be presented
+ nsecs_t requestedPresentTime;
nsecs_t acquireTime; // timestamp from the acquire fence
nsecs_t releaseTime; // timestamp from the release fence
sp<Fence> acquireFence; // acquire fence
sp<Fence> releaseFence; // release fence
LayerRecord(const String8& name, uint64_t frameNumber,
- bool isGlesComposition, nsecs_t postedTime,
+ bool isGlesComposition, nsecs_t requestedPresentTime,
nsecs_t acquireTime, nsecs_t releaseTime,
sp<Fence> acquireFence, sp<Fence> releaseFence) :
name(name), frameNumber(frameNumber),
- isGlesComposition(isGlesComposition), postedTime(postedTime),
+ isGlesComposition(isGlesComposition),
+ requestedPresentTime(requestedPresentTime),
acquireTime(acquireTime), releaseTime(releaseTime),
acquireFence(acquireFence), releaseFence(releaseFence) {};
LayerRecord() : name("uninitialized"), frameNumber(0),
- isGlesComposition(false), postedTime(0), acquireTime(0),
- releaseTime(0), acquireFence(Fence::NO_FENCE),
+ isGlesComposition(false), requestedPresentTime(0),
+ acquireTime(0), releaseTime(0), acquireFence(Fence::NO_FENCE),
releaseFence(Fence::NO_FENCE) {};
};
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 5f96f66cd1..20c0261017 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -2159,7 +2159,7 @@ void Layer::getFrameStats(FrameStats* outStats) const {
}
void Layer::getFenceData(String8* outName, uint64_t* outFrameNumber,
- bool* outIsGlesComposition, nsecs_t* outPostedTime,
+ bool* outIsGlesComposition, nsecs_t* outRequestedPresentTime,
sp<Fence>* outAcquireFence, sp<Fence>* outPrevReleaseFence) const {
*outName = mName;
*outFrameNumber = mSurfaceFlingerConsumer->getFrameNumber();
@@ -2171,7 +2171,7 @@ void Layer::getFenceData(String8* outName, uint64_t* outFrameNumber,
#else
*outIsGlesComposition = mIsGlesComposition;
#endif
- *outPostedTime = mSurfaceFlingerConsumer->getTimestamp();
+ *outRequestedPresentTime = mSurfaceFlingerConsumer->getTimestamp();
*outAcquireFence = mSurfaceFlingerConsumer->getCurrentFence();
*outPrevReleaseFence = mSurfaceFlingerConsumer->getPrevReleaseFence();
}
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 64b049cb04..5aba69bd08 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -407,7 +407,7 @@ public:
void getFrameStats(FrameStats* outStats) const;
void getFenceData(String8* outName, uint64_t* outFrameNumber,
- bool* outIsGlesComposition, nsecs_t* outPostedTime,
+ bool* outIsGlesComposition, nsecs_t* outRequestedPresentTime,
sp<Fence>* outAcquireFence, sp<Fence>* outPrevReleaseFence) const;
std::vector<OccupancyTracker::Segment> getOccupancyHistory(bool forceFlush);