Fix formatting
Test: Local build 32+64
Change-Id: Iceac897b0085a62ec55db7203a990c33cb56bfbf
Merged-In: Iceac897b0085a62ec55db7203a990c33cb56bfbf
(cherry picked from commit 8ee95e5f936461dbba0633cf0562e6747a643788)
diff --git a/guest/hals/hwcomposer/hwcomposer.cpp b/guest/hals/hwcomposer/hwcomposer.cpp
index 125b510..7b91f46 100644
--- a/guest/hals/hwcomposer/hwcomposer.cpp
+++ b/guest/hals/hwcomposer/hwcomposer.cpp
@@ -15,8 +15,8 @@
*/
#include <pthread.h>
-#include <sys/time.h>
#include <sys/resource.h>
+#include <sys/time.h>
#include <hardware/hwcomposer.h>
#include <hardware/hwcomposer_defs.h>
@@ -47,11 +47,8 @@
ALOGE(
"%s: Malformed rectangle (displayFrame): [left = %d, right = %d, top = "
"%d, bottom = %d]",
- __FUNCTION__,
- layer.displayFrame.left,
- layer.displayFrame.right,
- layer.displayFrame.top,
- layer.displayFrame.bottom);
+ __FUNCTION__, layer.displayFrame.left, layer.displayFrame.right,
+ layer.displayFrame.top, layer.displayFrame.bottom);
return -EINVAL;
}
// Check sourceCrop
@@ -60,11 +57,8 @@
ALOGE(
"%s: Malformed rectangle (sourceCrop): [left = %d, right = %d, top = "
"%d, bottom = %d]",
- __FUNCTION__,
- layer.sourceCrop.left,
- layer.sourceCrop.right,
- layer.sourceCrop.top,
- layer.sourceCrop.bottom);
+ __FUNCTION__, layer.sourceCrop.left, layer.sourceCrop.right,
+ layer.sourceCrop.top, layer.sourceCrop.bottom);
return -EINVAL;
}
const vsoc_buffer_handle_t* p_handle =
@@ -80,12 +74,8 @@
"%s: Invalid sourceCrop for buffer handle: sourceCrop = [left = %d, "
"right = %d, top = %d, bottom = %d], handle = [width = %d, height = "
"%d]",
- __FUNCTION__,
- layer.sourceCrop.left,
- layer.sourceCrop.right,
- layer.sourceCrop.top,
- layer.sourceCrop.bottom,
- p_handle->x_res,
+ __FUNCTION__, layer.sourceCrop.left, layer.sourceCrop.right,
+ layer.sourceCrop.top, layer.sourceCrop.bottom, p_handle->x_res,
p_handle->y_res);
return -EINVAL;
}
@@ -125,7 +115,7 @@
rt.tv_sec = timestamp / 1e9;
rt.tv_nsec = timestamp % static_cast<int32_t>(1e9);
int err = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &rt, NULL);
- if ( err == -1) {
+ if (err == -1) {
ALOGE("error in vsync thread: %s", strerror(errno));
if (errno == EINTR) {
continue;
@@ -144,8 +134,7 @@
return NULL;
}
-int hwc_prepare(struct hwc_composer_device_1* /*dev*/,
- size_t numDisplays,
+int hwc_prepare(struct hwc_composer_device_1* /*dev*/, size_t numDisplays,
hwc_display_contents_1_t** displays) {
if (!numDisplays || !displays) return 0;
hwc_display_contents_1_t* list = displays[HWC_DISPLAY_PRIMARY];
@@ -161,8 +150,7 @@
return 0;
}
-int hwc_set(struct hwc_composer_device_1* dev,
- size_t numDisplays,
+int hwc_set(struct hwc_composer_device_1* dev, size_t numDisplays,
hwc_display_contents_1_t** displays) {
if (!numDisplays || !displays) return 0;
hwc_display_contents_1_t* list = displays[HWC_DISPLAY_PRIMARY];
@@ -194,9 +182,7 @@
return 0;
}
-int hwc_eventControl(struct hwc_composer_device_1* /*dev*/,
- int disp,
- int event,
+int hwc_eventControl(struct hwc_composer_device_1* /*dev*/, int disp, int event,
int /*enabled*/) {
if (event == HWC_EVENT_VSYNC || disp != HWC_DISPLAY_PRIMARY) {
return 0;
@@ -238,13 +224,11 @@
reinterpret_cast<vsoc_hwc_device*>(dev)->procs = procs;
}
-void hwc_dump(struct hwc_composer_device_1* /*dev*/,
- char* /*buff*/, int /*buff_len*/) {}
+void hwc_dump(struct hwc_composer_device_1* /*dev*/, char* /*buff*/,
+ int /*buff_len*/) {}
-int hwc_getDisplayConfigs(struct hwc_composer_device_1* /*dev*/,
- int disp,
- uint32_t* configs,
- size_t* numConfigs) {
+int hwc_getDisplayConfigs(struct hwc_composer_device_1* /*dev*/, int disp,
+ uint32_t* configs, size_t* numConfigs) {
if (*numConfigs == 0) return 0;
if (disp == HWC_DISPLAY_PRIMARY) {
@@ -259,7 +243,7 @@
int32_t vsoc_hwc_attribute(vsoc_hwc_device* pdev, uint32_t attribute) {
switch (attribute) {
case HWC_DISPLAY_VSYNC_PERIOD:
- return 1000000000/pdev->fb_broadcast->refresh_rate_hz();
+ return 1000000000 / pdev->fb_broadcast->refresh_rate_hz();
case HWC_DISPLAY_WIDTH:
return pdev->fb_broadcast->x_res();
case HWC_DISPLAY_HEIGHT:
@@ -277,10 +261,8 @@
}
}
-int hwc_getDisplayAttributes(struct hwc_composer_device_1* dev,
- int disp,
- uint32_t /*config*/,
- const uint32_t* attributes,
+int hwc_getDisplayAttributes(struct hwc_composer_device_1* dev, int disp,
+ uint32_t /*config*/, const uint32_t* attributes,
int32_t* values) {
vsoc_hwc_device* pdev = reinterpret_cast<vsoc_hwc_device*>(dev);
@@ -323,9 +305,7 @@
dev->vsync_period_ns = 1000000000 / refreshRate;
struct timespec rt;
if (clock_gettime(CLOCK_MONOTONIC, &rt) == -1) {
- ALOGE("%s:%d error in clock_gettime: %s",
- __FILE__,
- __LINE__,
+ ALOGE("%s:%d error in clock_gettime: %s", __FILE__, __LINE__,
strerror(errno));
}
dev->vsync_base_timestamp = int64_t(rt.tv_sec) * 1e9 + rt.tv_nsec;
@@ -363,9 +343,9 @@
return -ret;
}
-struct hw_module_methods_t hwc_module_methods = { hwc_open };
+struct hw_module_methods_t hwc_module_methods = {hwc_open};
-} // namespace
+} // namespace
hwc_module_t HAL_MODULE_INFO_SYM = {{HARDWARE_MODULE_TAG,
HWC_MODULE_API_VERSION_0_1,
diff --git a/guest/hals/hwcomposer/legacy/base_composer.cpp b/guest/hals/hwcomposer/legacy/base_composer.cpp
index 561ce6f..7228aba 100644
--- a/guest/hals/hwcomposer/legacy/base_composer.cpp
+++ b/guest/hals/hwcomposer/legacy/base_composer.cpp
@@ -17,21 +17,22 @@
#include "base_composer.h"
#include <cutils/log.h>
-#include "guest/libs/legacy_framebuffer/vsoc_framebuffer_control.h"
#include "guest/hals/gralloc//legacy/gralloc_vsoc_priv.h"
+#include "guest/libs/legacy_framebuffer/vsoc_framebuffer_control.h"
namespace cvd {
namespace {
-int BroadcastFrameBufferChanged (int yoffset) {
+int BroadcastFrameBufferChanged(int yoffset) {
return VSoCFrameBufferControl::getInstance().BroadcastFrameBufferChanged(
yoffset);
}
-}
+} // namespace
-BaseComposer::BaseComposer(int64_t vsync_base_timestamp, int32_t vsync_period_ns)
+BaseComposer::BaseComposer(int64_t vsync_base_timestamp,
+ int32_t vsync_period_ns)
: fb_broadcaster_(BroadcastFrameBufferChanged),
vsync_base_timestamp_(vsync_base_timestamp),
vsync_period_ns_(vsync_period_ns) {
@@ -42,8 +43,7 @@
BaseComposer::~BaseComposer() {}
-FbBroadcaster BaseComposer::ReplaceFbBroadcaster(
- FbBroadcaster fb_broadcaster) {
+FbBroadcaster BaseComposer::ReplaceFbBroadcaster(FbBroadcaster fb_broadcaster) {
FbBroadcaster tmp = fb_broadcaster_;
fb_broadcaster_ = fb_broadcaster;
return tmp;
@@ -51,13 +51,12 @@
void BaseComposer::Dump(char* buff __unused, int buff_len __unused) {}
-
int BaseComposer::PostFrameBuffer(buffer_handle_t buffer) {
const int yoffset = YOffsetFromHandle(buffer);
// If the broadcaster is NULL or could not get a good yoffset just ignore it.
if (fb_broadcaster_ && yoffset >= 0) {
int retval = fb_broadcaster_(yoffset);
- if (retval){
+ if (retval) {
ALOGI("Failed to post framebuffer");
return -1;
}
diff --git a/guest/hals/hwcomposer/legacy/base_composer.h b/guest/hals/hwcomposer/legacy/base_composer.h
index 5a084fd..fd9db9d 100644
--- a/guest/hals/hwcomposer/legacy/base_composer.h
+++ b/guest/hals/hwcomposer/legacy/base_composer.h
@@ -41,9 +41,11 @@
// broadcast at all.
FbBroadcaster ReplaceFbBroadcaster(FbBroadcaster);
void Dump(char* buff, int buff_len);
+
protected:
int64_t vsync_base_timestamp_;
int32_t vsync_period_ns_;
+
private:
FbBroadcaster fb_broadcaster_;
};
diff --git a/guest/hals/hwcomposer/legacy/hwc_tests.cpp b/guest/hals/hwcomposer/legacy/hwc_tests.cpp
index 5cfe797..46362c2 100644
--- a/guest/hals/hwcomposer/legacy/hwc_tests.cpp
+++ b/guest/hals/hwcomposer/legacy/hwc_tests.cpp
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include "vsoc_composer.h"
#include <stdio.h>
+#include "vsoc_composer.h"
// This executable is only intended to perform simple tests on the hwcomposer
// functionality. It should not be part of the images, but rather be included
@@ -28,32 +28,25 @@
// Allocate two buffers (1x1 and 800x1280)
buffer_handle_t src_handle;
int src_stride;
- int res = gralloc_dev_->device.alloc(&gralloc_dev_->device,
- 1,
- 1,
- HAL_PIXEL_FORMAT_RGBA_8888,
- GRALLOC_USAGE_SW_READ_OFTEN,
- &src_handle,
- &src_stride);
+ int res = gralloc_dev_->device.alloc(
+ &gralloc_dev_->device, 1, 1, HAL_PIXEL_FORMAT_RGBA_8888,
+ GRALLOC_USAGE_SW_READ_OFTEN, &src_handle, &src_stride);
if (res) {
fprintf(stderr, "Error allocating source buffer, see logs for details\n");
return -1;
}
buffer_handle_t dst_handle;
int dst_stride;
- res = gralloc_dev_->device.alloc(&gralloc_dev_->device,
- 800,
- 1280,
- HAL_PIXEL_FORMAT_RGBA_8888,
- GRALLOC_USAGE_SW_WRITE_OFTEN,
- &dst_handle,
- &dst_stride);
+ res = gralloc_dev_->device.alloc(
+ &gralloc_dev_->device, 800, 1280, HAL_PIXEL_FORMAT_RGBA_8888,
+ GRALLOC_USAGE_SW_WRITE_OFTEN, &dst_handle, &dst_stride);
if (res) {
fprintf(stderr,
"Error allocating destination buffer, see logs for details\n");
return -1;
}
- // Create a mock layer requesting a sinple copy of the pixels so that DoCopy gets called
+ // Create a mock layer requesting a sinple copy of the pixels so that DoCopy
+ // gets called
vsoc_hwc_layer src_layer;
src_layer.compositionType = HWC_OVERLAY;
src_layer.hints = 0;
diff --git a/guest/hals/hwcomposer/legacy/hwcomposer.cpp b/guest/hals/hwcomposer/legacy/hwcomposer.cpp
index 82b0aac..fc81c3a 100644
--- a/guest/hals/hwcomposer/legacy/hwcomposer.cpp
+++ b/guest/hals/hwcomposer/legacy/hwcomposer.cpp
@@ -49,18 +49,17 @@
#include <utils/String8.h>
#include <utils/Vector.h>
+#include <guest/hals/gralloc/legacy/gralloc_vsoc_priv.h>
#include <guest/libs/legacy_framebuffer/vsoc_framebuffer.h>
#include <guest/libs/legacy_framebuffer/vsoc_framebuffer_control.h>
-#include <guest/hals/gralloc/legacy/gralloc_vsoc_priv.h>
#include <guest/libs/remoter/remoter_framework_pkt.h>
#include <sync/sync.h>
-#include "vsoc_composer.h"
+#include "base_composer.h"
#include "geometry_utils.h"
#include "hwcomposer_common.h"
-#include "base_composer.h"
#include "stats_keeper.h"
-
+#include "vsoc_composer.h"
#ifdef USE_OLD_HWCOMPOSER
typedef cvd::BaseComposer InnerComposerType;
@@ -68,7 +67,6 @@
typedef cvd::VSoCComposer InnerComposerType;
#endif
-
#ifdef GATHER_STATS
typedef cvd::StatsKeepingComposer<InnerComposerType> ComposerType;
#else
@@ -98,7 +96,7 @@
static int vsoc_hwc_prepare(vsoc_hwc_device* dev, hwc_layer_list_t* list) {
#else
static int vsoc_hwc_prepare(vsoc_hwc_device* dev, size_t numDisplays,
- hwc_display_contents_1_t** displays) {
+ hwc_display_contents_1_t** displays) {
if (!numDisplays || !displays) return 0;
hwc_display_contents_1_t* list = displays[HWC_DISPLAY_PRIMARY];
@@ -113,14 +111,14 @@
#if VSOC_PLATFORM_SDK_BEFORE(J_MR1)
int vsoc_hwc_set(struct hwc_composer_device* dev, hwc_display_t dpy,
- hwc_surface_t sur, hwc_layer_list_t* list) {
+ hwc_surface_t sur, hwc_layer_list_t* list) {
reinterpret_cast<vsoc_hwc_composer_device_1_t*>(dev)->composer->SetLayers(
list->numHwLayers, &list->hwLayers[0]);
return 0;
}
#else
static int vsoc_hwc_set(vsoc_hwc_device* dev, size_t numDisplays,
- hwc_display_contents_1_t** displays) {
+ hwc_display_contents_1_t** displays) {
if (!numDisplays || !displays) return 0;
hwc_display_contents_1_t* contents = displays[HWC_DISPLAY_PRIMARY];
@@ -150,7 +148,7 @@
#endif
static void vsoc_hwc_register_procs(vsoc_hwc_device* dev,
- const hwc_procs_t* procs) {
+ const hwc_procs_t* procs) {
struct vsoc_hwc_composer_device_1_t* pdev =
(struct vsoc_hwc_composer_device_1_t*)dev;
pdev->procs = procs;
@@ -215,7 +213,7 @@
rt.tv_sec = timestamp / 1e9;
rt.tv_nsec = timestamp % static_cast<int32_t>(1e9);
int err = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &rt, NULL);
- if ( err == -1) {
+ if (err == -1) {
ALOGE("error in vsync thread: %s", strerror(errno));
if (errno == EINTR) {
continue;
@@ -242,12 +240,12 @@
}
static void vsoc_hwc_dump(vsoc_hwc_device* dev, char* buff, int buff_len) {
- reinterpret_cast<vsoc_hwc_composer_device_1_t*>(dev)->composer->Dump(buff,
- buff_len);
+ reinterpret_cast<vsoc_hwc_composer_device_1_t*>(dev)->composer->Dump(
+ buff, buff_len);
}
static int vsoc_hwc_get_display_configs(vsoc_hwc_device* dev, int disp,
- uint32_t* configs, size_t* numConfigs) {
+ uint32_t* configs, size_t* numConfigs) {
struct vsoc_hwc_composer_device_1_t* pdev =
(struct vsoc_hwc_composer_device_1_t*)dev;
@@ -264,7 +262,7 @@
#if VSOC_PLATFORM_SDK_AFTER(J)
static int32_t vsoc_hwc_attribute(struct vsoc_hwc_composer_device_1_t* pdev,
- const uint32_t attribute) {
+ const uint32_t attribute) {
const VSoCFrameBuffer& config = VSoCFrameBuffer::getInstance();
switch (attribute) {
case HWC_DISPLAY_VSYNC_PERIOD:
@@ -286,9 +284,9 @@
}
static int vsoc_hwc_get_display_attributes(vsoc_hwc_device* dev, int disp,
- uint32_t config __unused,
- const uint32_t* attributes,
- int32_t* values) {
+ uint32_t config __unused,
+ const uint32_t* attributes,
+ int32_t* values) {
struct vsoc_hwc_composer_device_1_t* pdev =
(struct vsoc_hwc_composer_device_1_t*)dev;
@@ -317,14 +315,14 @@
}
static int vsoc_hwc_open(const struct hw_module_t* module, const char* name,
- struct hw_device_t** device) {
+ struct hw_device_t** device) {
ALOGI("%s", __FUNCTION__);
if (strcmp(name, HWC_HARDWARE_COMPOSER)) {
ALOGE("%s called with bad name %s", __FUNCTION__, name);
return -EINVAL;
}
- vsoc_hwc_composer_device_1_t* dev = new vsoc_hwc_composer_device_1_t();
+ vsoc_hwc_composer_device_1_t* dev = new vsoc_hwc_composer_device_1_t();
if (!dev) {
ALOGE("%s failed to allocate dev", __FUNCTION__);
return -ENOMEM;
diff --git a/guest/hals/hwcomposer/legacy/stats_keeper.cpp b/guest/hals/hwcomposer/legacy/stats_keeper.cpp
index 86b786b..900fa5a 100644
--- a/guest/hals/hwcomposer/legacy/stats_keeper.cpp
+++ b/guest/hals/hwcomposer/legacy/stats_keeper.cpp
@@ -24,13 +24,13 @@
#include "geometry_utils.h"
#include "stats_keeper.h"
-using cvd::time::TimeDifference;
-using cvd::time::Nanoseconds;
-using cvd::time::Microseconds;
-using cvd::time::Seconds;
-using cvd::time::MonotonicTimePoint;
-using cvd::Mutex;
using cvd::LockGuard;
+using cvd::Mutex;
+using cvd::time::Microseconds;
+using cvd::time::MonotonicTimePoint;
+using cvd::time::Nanoseconds;
+using cvd::time::Seconds;
+using cvd::time::TimeDifference;
namespace cvd {
@@ -53,8 +53,7 @@
} // namespace
-StatsKeeper::StatsKeeper(TimeDifference timespan,
- int64_t vsync_base,
+StatsKeeper::StatsKeeper(TimeDifference timespan, int64_t vsync_base,
int32_t vsync_period)
: period_length_(timespan, 1),
num_layers_(0),
@@ -77,13 +76,14 @@
last_composition_stats_.num_prepare_calls++;
num_prepare_calls_++;
last_composition_stats_.prepare_start = MonotonicTimePoint::Now();
- // Calculate the (expected) time of last VSYNC event. We can only make a guess about it because
- // the vsync thread could run late or surfaceflinger could run late and call prepare from a
- // previous vsync cycle.
+ // Calculate the (expected) time of last VSYNC event. We can only make a guess
+ // about it because the vsync thread could run late or surfaceflinger could
+ // run late and call prepare from a previous vsync cycle.
int64_t last_vsync =
Nanoseconds(last_composition_stats_.set_start.SinceEpoch()).count();
last_vsync -= (last_vsync - vsync_base_) % vsync_period_;
- last_composition_stats_.last_vsync = MonotonicTimePoint() + Nanoseconds(last_vsync);
+ last_composition_stats_.last_vsync =
+ MonotonicTimePoint() + Nanoseconds(last_vsync);
}
void StatsKeeper::RecordPrepareEnd(int num_hwcomposited_layers) {
@@ -129,10 +129,12 @@
last_composition_stats_.prepare_start);
Nanoseconds last_set_call_total_time_(last_composition_stats_.set_end -
last_composition_stats_.set_start);
- raw_composition_data_.push_back(CompositionData(
- last_composition_stats_.set_end, last_composition_stats_.num_prepare_calls,
- last_composition_stats_.num_layers, last_composition_stats_.num_hwc_layers, last_prepare_call_time_,
- last_set_call_total_time_));
+ raw_composition_data_.push_back(
+ CompositionData(last_composition_stats_.set_end,
+ last_composition_stats_.num_prepare_calls,
+ last_composition_stats_.num_layers,
+ last_composition_stats_.num_hwc_layers,
+ last_prepare_call_time_, last_set_call_total_time_));
const CompositionData& back = raw_composition_data_.back();
@@ -144,21 +146,22 @@
Nanoseconds(prepare_call_total_time_ + last_prepare_call_time_);
set_call_total_time_ =
Nanoseconds(set_call_total_time_ + last_set_call_total_time_);
- prepare_calls_per_set_calls_.insert(last_composition_stats_.num_prepare_calls);
+ prepare_calls_per_set_calls_.insert(
+ last_composition_stats_.num_prepare_calls);
layers_per_compositions_.insert(last_composition_stats_.num_layers);
prepare_call_times_.insert(last_prepare_call_time_);
set_call_times_.insert(last_set_call_total_time_);
if (last_composition_stats_.num_hwc_layers != 0) {
set_call_times_per_hwcomposited_layer_ns_.insert(
- last_set_call_total_time_.count() / last_composition_stats_.num_hwc_layers);
+ last_set_call_total_time_.count() /
+ last_composition_stats_.num_hwc_layers);
}
// Reset the counter
last_composition_stats_.num_prepare_calls = 0;
}
-void StatsKeeper::SynchronizedDump(char* buffer,
- int buffer_size) const {
+void StatsKeeper::SynchronizedDump(char* buffer, int buffer_size) const {
LockGuard<Mutex> lock(mutex_);
int chars_written = 0;
// Make sure there is enough space to write the next line
@@ -172,7 +175,8 @@
"HWComposer stats from the %lld seconds just before the last call to "
"set() (which happended %lld seconds ago):\n",
Seconds(period_length_).count(),
- Seconds(MonotonicTimePoint::Now() - last_composition_stats_.set_end).count());
+ Seconds(MonotonicTimePoint::Now() - last_composition_stats_.set_end)
+ .count());
bprintf(" Layer count: %d\n", num_layers_);
if (num_layers_ == 0 || num_prepare_calls_ == 0 || num_set_calls_ == 0) {
diff --git a/guest/hals/hwcomposer/legacy/stats_keeper.h b/guest/hals/hwcomposer/legacy/stats_keeper.h
index 8612cd1..43d791f 100644
--- a/guest/hals/hwcomposer/legacy/stats_keeper.h
+++ b/guest/hals/hwcomposer/legacy/stats_keeper.h
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-#include <guest/libs/legacy_framebuffer/vsoc_framebuffer_control.h>
-#include <common/libs/time/monotonic_time.h>
-#include <common/libs/threads/cuttlefish_thread.h>
#include <android-base/thread_annotations.h>
+#include <common/libs/threads/cuttlefish_thread.h>
+#include <common/libs/time/monotonic_time.h>
+#include <guest/libs/legacy_framebuffer/vsoc_framebuffer_control.h>
#include <deque>
#include <set>
@@ -28,8 +28,8 @@
class CompositionData {
public:
- CompositionData(cvd::time::MonotonicTimePoint time_point,
- int num_prepares, int num_layers, int num_hwcomposited_layers,
+ CompositionData(cvd::time::MonotonicTimePoint time_point, int num_prepares,
+ int num_layers, int num_hwcomposited_layers,
cvd::time::Nanoseconds prepare_time,
cvd::time::Nanoseconds set_calls_time)
: time_point_(time_point),
@@ -39,9 +39,7 @@
prepare_time_(prepare_time),
set_calls_time_(set_calls_time) {}
- cvd::time::MonotonicTimePoint time_point() const {
- return time_point_;
- }
+ cvd::time::MonotonicTimePoint time_point() const { return time_point_; }
int num_prepare_calls() const { return num_prepare_calls_; }
@@ -49,13 +47,9 @@
int num_hwcomposited_layers() const { return num_hwcomposited_layers_; }
- cvd::time::Nanoseconds prepare_time() const {
- return prepare_time_;
- }
+ cvd::time::Nanoseconds prepare_time() const { return prepare_time_; }
- cvd::time::Nanoseconds set_calls_time() const {
- return set_calls_time_;
- }
+ cvd::time::Nanoseconds set_calls_time() const { return set_calls_time_; }
private:
cvd::time::MonotonicTimePoint time_point_;
@@ -70,8 +64,7 @@
public:
// The timespan parameter indicates for how long we keep stats about the past
// compositions.
- StatsKeeper(cvd::time::TimeDifference timespan,
- int64_t vsync_base,
+ StatsKeeper(cvd::time::TimeDifference timespan, int64_t vsync_base,
int32_t vsync_period);
StatsKeeper();
~StatsKeeper();
@@ -85,7 +78,9 @@
void RecordSetStart();
void RecordSetEnd() EXCLUDES(mutex_);
- const CompositionStats& last_composition_stats() { return last_composition_stats_; }
+ const CompositionStats& last_composition_stats() {
+ return last_composition_stats_;
+ }
// Calls to this function are synchronized with calls to 'RecordSetEnd' with a
// mutex. The other Record* functions do not need such synchronization because
@@ -93,7 +88,6 @@
void SynchronizedDump(char* buffer, int buffer_size) const EXCLUDES(mutex_);
private:
-
cvd::time::TimeDifference period_length_;
// Base and period of the VSYNC signal, allows to accurately calculate the
@@ -119,10 +113,8 @@
// changing sets of (not necessarily different) values.
std::multiset<int> prepare_calls_per_set_calls_ GUARDED_BY(mutex_);
std::multiset<int> layers_per_compositions_ GUARDED_BY(mutex_);
- std::multiset<cvd::time::Nanoseconds> prepare_call_times_
- GUARDED_BY(mutex_);
- std::multiset<cvd::time::Nanoseconds> set_call_times_
- GUARDED_BY(mutex_);
+ std::multiset<cvd::time::Nanoseconds> prepare_call_times_ GUARDED_BY(mutex_);
+ std::multiset<cvd::time::Nanoseconds> set_call_times_ GUARDED_BY(mutex_);
std::multiset<int64_t> set_call_times_per_hwcomposited_layer_ns_
GUARDED_BY(mutex_);
@@ -147,8 +139,7 @@
StatsKeepingComposer(int64_t vsync_base_timestamp, int32_t vsync_period_ns)
: composer_(vsync_base_timestamp, vsync_period_ns),
stats_keeper_(cvd::time::TimeDifference(cvd::time::Seconds(10), 1),
- vsync_base_timestamp,
- vsync_period_ns) {
+ vsync_base_timestamp, vsync_period_ns) {
// Don't let the composer broadcast by itself, allow it to return to collect
// the timings and broadcast then.
composer_.ReplaceFbBroadcaster(NULL);
diff --git a/guest/hals/hwcomposer/legacy/vsoc_composer.cpp b/guest/hals/hwcomposer/legacy/vsoc_composer.cpp
index 5fcaccb..0fe02cd 100644
--- a/guest/hals/hwcomposer/legacy/vsoc_composer.cpp
+++ b/guest/hals/hwcomposer/legacy/vsoc_composer.cpp
@@ -15,9 +15,9 @@
*/
#include "vsoc_composer.h"
+#include <cutils/log.h>
#include <guest/libs/legacy_framebuffer/vsoc_framebuffer.h>
#include <guest/libs/legacy_framebuffer/vsoc_framebuffer_control.h>
-#include <cutils/log.h>
#include <hardware/hwcomposer.h>
#include <hardware/hwcomposer_defs.h>
#include <libyuv.h>
@@ -41,11 +41,8 @@
ALOGE(
"%s: Malformed rectangle (displayFrame): [left = %d, right = %d, top = "
"%d, bottom = %d]",
- __FUNCTION__,
- layer.displayFrame.left,
- layer.displayFrame.right,
- layer.displayFrame.top,
- layer.displayFrame.bottom);
+ __FUNCTION__, layer.displayFrame.left, layer.displayFrame.right,
+ layer.displayFrame.top, layer.displayFrame.bottom);
return -EINVAL;
}
// Check sourceCrop
@@ -54,11 +51,8 @@
ALOGE(
"%s: Malformed rectangle (sourceCrop): [left = %d, right = %d, top = "
"%d, bottom = %d]",
- __FUNCTION__,
- layer.sourceCrop.left,
- layer.sourceCrop.right,
- layer.sourceCrop.top,
- layer.sourceCrop.bottom);
+ __FUNCTION__, layer.sourceCrop.left, layer.sourceCrop.right,
+ layer.sourceCrop.top, layer.sourceCrop.bottom);
return -EINVAL;
}
const private_handle_t* p_handle =
@@ -74,12 +68,8 @@
"%s: Invalid sourceCrop for buffer handle: sourceCrop = [left = %d, "
"right = %d, top = %d, bottom = %d], handle = [width = %d, height = "
"%d]",
- __FUNCTION__,
- layer.sourceCrop.left,
- layer.sourceCrop.right,
- layer.sourceCrop.top,
- layer.sourceCrop.bottom,
- p_handle->x_res,
+ __FUNCTION__, layer.sourceCrop.left, layer.sourceCrop.right,
+ layer.sourceCrop.top, layer.sourceCrop.bottom, p_handle->x_res,
p_handle->y_res);
return -EINVAL;
}
@@ -152,9 +142,7 @@
}
// Whether we support a given format
-bool IsFormatSupported(uint32_t format) {
- return GetConverter(format) != NULL;
-}
+bool IsFormatSupported(uint32_t format) { return GetConverter(format) != NULL; }
bool CanCompositeLayer(const vsoc_hwc_layer& layer) {
if (layer.handle == NULL) {
@@ -351,7 +339,7 @@
// - the next hwc-only framebuffer otherwise
// Takes care of rotating the hwc-only framebuffers
buffer_handle_t VSoCComposer::FindFrameBuffer(int num_layers,
- vsoc_hwc_layer* layers) {
+ vsoc_hwc_layer* layers) {
buffer_handle_t* fb_handle = NULL;
bool use_hwc_fb = true;
// The framebuffer target is usually the last layer in the list, so iterate in
@@ -375,7 +363,7 @@
}
void VSoCComposer::CompositeLayer(vsoc_hwc_layer* src_layer,
- buffer_handle_t dst_handle) {
+ buffer_handle_t dst_handle) {
libyuv::RotationMode rotation =
GetRotationFromTransform(src_layer->transform);
@@ -589,7 +577,8 @@
/* static */ const int VSoCComposer::kNumTmpBufferPieces = 2;
-VSoCComposer::VSoCComposer(int64_t vsync_base_timestamp, int32_t vsync_period_ns)
+VSoCComposer::VSoCComposer(int64_t vsync_base_timestamp,
+ int32_t vsync_period_ns)
: BaseComposer(vsync_base_timestamp, vsync_period_ns),
tmp_buffer_(kNumTmpBufferPieces *
VSoCFrameBuffer::getInstance().bufferSize()),
@@ -598,8 +587,7 @@
reinterpret_cast<const hw_module_t**>(&gralloc_module_));
gralloc_module_->common.methods->open(
reinterpret_cast<const hw_module_t*>(gralloc_module_),
- GRALLOC_HARDWARE_GPU0,
- reinterpret_cast<hw_device_t**>(&gralloc_dev_));
+ GRALLOC_HARDWARE_GPU0, reinterpret_cast<hw_device_t**>(&gralloc_dev_));
for (int i = 0; i < VSoCFrameBuffer::kNumHwcBuffers; ++i) {
buffer_handle_t tmp;
gralloc_dev_->alloc_hwc_framebuffer(
@@ -616,7 +604,8 @@
}
// close devices
- gralloc_dev_->device.common.close(reinterpret_cast<hw_device_t*>(gralloc_dev_));
+ gralloc_dev_->device.common.close(
+ reinterpret_cast<hw_device_t*>(gralloc_dev_));
}
int VSoCComposer::PrepareLayers(size_t num_layers, vsoc_hwc_layer* layers) {
diff --git a/guest/hals/hwcomposer/legacy/vsoc_composer.h b/guest/hals/hwcomposer/legacy/vsoc_composer.h
index cd455a5..892515c 100644
--- a/guest/hals/hwcomposer/legacy/vsoc_composer.h
+++ b/guest/hals/hwcomposer/legacy/vsoc_composer.h
@@ -16,9 +16,9 @@
*/
#include <hardware/gralloc.h>
+#include "base_composer.h"
#include "guest/hals/gralloc/legacy/gralloc_vsoc_priv.h"
#include "hwcomposer_common.h"
-#include "base_composer.h"
#include <vector>