Home | History | Annotate | Download | only in ui
      1 /*
      2  * Copyright (C) 2014 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef ANDROID_UI_FRAME_STATS_H
     18 #define ANDROID_UI_FRAME_STATS_H
     19 
     20 #include <utils/Flattenable.h>
     21 #include <utils/Timers.h>
     22 #include <utils/Vector.h>
     23 
     24 namespace android {
     25 
     26 class FrameStats : public LightFlattenable<FrameStats> {
     27 public:
     28 
     29     /*
     30      * Approximate refresh time, in nanoseconds.
     31      */
     32     nsecs_t refreshPeriodNano;
     33 
     34    /*
     35     * The times in nanoseconds for when the frame contents were posted by the producer (e.g.
     36     * the application). They are either explicitly set or defaulted to the time when
     37     * Surface::queueBuffer() was called.
     38     */
     39     Vector<nsecs_t> desiredPresentTimesNano;
     40 
     41    /*
     42     * The times in milliseconds for when the frame contents were presented on the screen.
     43     */
     44     Vector<nsecs_t> actualPresentTimesNano;
     45 
     46    /*
     47     * The times in nanoseconds for when the frame contents were ready to be presented. Note that
     48     * a frame can be posted and still it contents being rendered asynchronously in GL. In such a
     49     * case these are the times when the frame contents were completely rendered (i.e. their fences
     50     * signaled).
     51     */
     52     Vector<nsecs_t> frameReadyTimesNano;
     53 
     54     // LightFlattenable
     55     bool isFixedSize() const;
     56     size_t getFlattenedSize() const;
     57     status_t flatten(void* buffer, size_t size) const;
     58     status_t unflatten(void const* buffer, size_t size);
     59 };
     60 
     61 }; // namespace android
     62 
     63 #endif // ANDROID_UI_FRAME_STATS_H
     64