drm_hwcomposer: CI: Bump-up clang toolchain to v15
Address new clang-tidy findings, in most cases 'misc-const-correctness' check was addressed by adding 'const' modifier, or in some cases changed to 'auto' (where it's better for formatting). Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
This commit is contained in:
parent
ce2ce75a36
commit
a7913de518
30 changed files with 117 additions and 96 deletions
|
|
@ -50,7 +50,7 @@ git log --pretty='%h' FETCH_HEAD..HEAD | while read h; do
|
|||
exit 1
|
||||
fi
|
||||
|
||||
git show "$h" -- | clang-format-diff-14 -p 1 -style=file > /tmp/format-fixup.patch
|
||||
git show "$h" -- | clang-format-diff-15 -p 1 -style=file > /tmp/format-fixup.patch
|
||||
if [ -s /tmp/format-fixup.patch ]; then
|
||||
cat /tmp/format-fixup.patch >&2
|
||||
exit 1
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
INCLUDE_DIRS := . ../libdrm/include/drm include ./.ci/android_headers ./tests/test_include
|
||||
SYSTEM_INCLUDE_DIRS := /usr/include/libdrm
|
||||
|
||||
CLANG := clang++-14
|
||||
CLANG_TIDY := clang-tidy-14
|
||||
CLANG := clang++-15
|
||||
CLANG_TIDY := clang-tidy-15
|
||||
OUT_DIR := /tmp/drm_hwcomposer/build
|
||||
SRC_DIR := .
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
image: ubuntu:22.04
|
||||
image: ubuntu:22.10
|
||||
|
||||
variables:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
|
||||
before_script:
|
||||
- apt-get --quiet update --yes >/dev/null
|
||||
- apt-get --quiet install --yes clang-14 clang-tidy-14 clang-format-14 git libdrm-dev blueprint-tools libgtest-dev make >/dev/null
|
||||
- apt-get --quiet install --yes clang-15 clang-tidy-15 clang-format-15 git libdrm-dev blueprint-tools libgtest-dev make >/dev/null
|
||||
|
||||
stages:
|
||||
- build
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ A short list of contribution guidelines:
|
|||
you with formatting of your patches:
|
||||
|
||||
```
|
||||
git diff | clang-format-diff-14 -p 1 -style=file
|
||||
git diff | clang-format-diff-15 -p 1 -style=file
|
||||
```
|
||||
|
||||
* Hardware specific changes should be tested on relevant platforms before
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ HWC2::Error Backend::ValidateDisplay(HwcDisplay *display, uint32_t *num_types,
|
|||
|
||||
MarkValidated(layers, client_start, client_size);
|
||||
|
||||
bool testing_needed = !(client_start == 0 && client_size == layers.size());
|
||||
auto testing_needed = client_start != 0 || client_size != layers.size();
|
||||
|
||||
AtomicCommitArgs a_args = {.test_only = true};
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ uint32_t Backend::CalcPixOps(const std::vector<HwcLayer *> &layers,
|
|||
uint32_t pixops = 0;
|
||||
for (size_t z_order = 0; z_order < layers.size(); ++z_order) {
|
||||
if (z_order >= first_z && z_order < first_z + size) {
|
||||
hwc_rect_t &df = layers[z_order]->GetLayerData().pi.display_frame;
|
||||
auto &df = layers[z_order]->GetLayerData().pi.display_frame;
|
||||
pixops += (df.right - df.left) * (df.bottom - df.top);
|
||||
}
|
||||
}
|
||||
|
|
@ -129,16 +129,16 @@ std::tuple<int, int> Backend::GetExtraClientRange(
|
|||
if (avail_planes < display->layers().size())
|
||||
avail_planes--;
|
||||
|
||||
int extra_client = int(layers.size() - client_size) - int(avail_planes);
|
||||
const int extra_client = int(layers.size() - client_size) - int(avail_planes);
|
||||
|
||||
if (extra_client > 0) {
|
||||
int start = 0;
|
||||
size_t steps = 0;
|
||||
if (client_size != 0) {
|
||||
int prepend = std::min(client_start, extra_client);
|
||||
int append = std::min(int(layers.size()) -
|
||||
int(client_start + client_size),
|
||||
extra_client);
|
||||
const int prepend = std::min(client_start, extra_client);
|
||||
const int append = std::min(int(layers.size()) -
|
||||
int(client_start + client_size),
|
||||
extra_client);
|
||||
start = client_start - (int)prepend;
|
||||
client_size += extra_client;
|
||||
steps = 1 + std::min(std::min(append, prepend),
|
||||
|
|
@ -150,7 +150,7 @@ std::tuple<int, int> Backend::GetExtraClientRange(
|
|||
|
||||
uint32_t gpu_pixops = UINT32_MAX;
|
||||
for (size_t i = 0; i < steps; i++) {
|
||||
uint32_t po = CalcPixOps(layers, start + i, client_size);
|
||||
const uint32_t po = CalcPixOps(layers, start + i, client_size);
|
||||
if (po < gpu_pixops) {
|
||||
gpu_pixops = po;
|
||||
client_start = start + int(i);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ int BackendManager::RegisterBackend(const std::string &name,
|
|||
}
|
||||
|
||||
int BackendManager::SetBackendForDisplay(HwcDisplay *display) {
|
||||
std::string driver_name(display->GetPipe().device->GetName());
|
||||
auto driver_name(display->GetPipe().device->GetName());
|
||||
char backend_override[PROPERTY_VALUE_MAX];
|
||||
property_get("vendor.hwc.backend_override", backend_override,
|
||||
driver_name.c_str());
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ std::optional<BufferUniqueId> BufferInfoGetter::GetUniqueId(
|
|||
}
|
||||
|
||||
int LegacyBufferInfoGetter::Init() {
|
||||
int ret = hw_get_module(
|
||||
const int ret = hw_get_module(
|
||||
GRALLOC_HARDWARE_MODULE_ID,
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
|
||||
reinterpret_cast<const hw_module_t **>(&gralloc_));
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ bool BufferInfoLibdrm::GetYuvPlaneInfo(uint32_t hal_format, int num_fds,
|
|||
if (num_fds == 1) {
|
||||
bo->prime_fds[2] = bo->prime_fds[1] = bo->prime_fds[0];
|
||||
} else {
|
||||
int expected_planes = (ycbcr.chroma_step == 2) ? 2 : 3;
|
||||
const int expected_planes = (ycbcr.chroma_step == 2) ? 2 : 3;
|
||||
if (num_fds != expected_planes)
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ auto BufferInfoMaliHisi::GetBoInfo(buffer_handle_t handle)
|
|||
if (!(hnd->usage & GRALLOC_USAGE_HW_FB))
|
||||
return {};
|
||||
|
||||
uint32_t fmt = ConvertHalFormatToDrm(hnd->req_format);
|
||||
const uint32_t fmt = ConvertHalFormatToDrm(hnd->req_format);
|
||||
if (fmt == DRM_FORMAT_INVALID)
|
||||
return {};
|
||||
|
||||
|
|
@ -100,10 +100,10 @@ auto BufferInfoMaliHisi::GetBoInfo(buffer_handle_t handle)
|
|||
if (hnd->usage &
|
||||
(GRALLOC_USAGE_SW_READ_MASK | GRALLOC_USAGE_SW_WRITE_MASK))
|
||||
align = 16;
|
||||
int adjusted_height = MALI_ALIGN(hnd->height, 2);
|
||||
int y_size = adjusted_height * hnd->byte_stride;
|
||||
int vu_stride = MALI_ALIGN(hnd->byte_stride / 2, align);
|
||||
int v_size = vu_stride * (adjusted_height / 2);
|
||||
const int adjusted_height = MALI_ALIGN(hnd->height, 2);
|
||||
const int y_size = adjusted_height * hnd->byte_stride;
|
||||
const int vu_stride = MALI_ALIGN(hnd->byte_stride / 2, align);
|
||||
const int v_size = vu_stride * (adjusted_height / 2);
|
||||
|
||||
/* V plane*/
|
||||
bi.prime_fds[1] = hnd->share_fd;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ auto BufferInfoMaliMediatek::GetBoInfo(buffer_handle_t handle)
|
|||
if (!hnd)
|
||||
return {};
|
||||
|
||||
uint32_t fmt = ConvertHalFormatToDrm(hnd->req_format);
|
||||
const uint32_t fmt = ConvertHalFormatToDrm(hnd->req_format);
|
||||
if (fmt == DRM_FORMAT_INVALID)
|
||||
return {};
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ auto BufferInfoMaliMeson::GetBoInfo(buffer_handle_t handle)
|
|||
if (!(hnd->usage & GRALLOC_USAGE_HW_FB))
|
||||
return {};
|
||||
|
||||
uint32_t fmt = ConvertHalFormatToDrm(hnd->req_format);
|
||||
const uint32_t fmt = ConvertHalFormatToDrm(hnd->req_format);
|
||||
if (fmt == DRM_FORMAT_INVALID)
|
||||
return {};
|
||||
|
||||
|
|
|
|||
|
|
@ -49,14 +49,14 @@ struct PresentInfo {
|
|||
hwc_rect_t display_frame{};
|
||||
|
||||
bool RequireScalingOrPhasing() const {
|
||||
float src_width = source_crop.right - source_crop.left;
|
||||
float src_height = source_crop.bottom - source_crop.top;
|
||||
const float src_width = source_crop.right - source_crop.left;
|
||||
const float src_height = source_crop.bottom - source_crop.top;
|
||||
|
||||
auto dest_width = float(display_frame.right - display_frame.left);
|
||||
auto dest_height = float(display_frame.bottom - display_frame.top);
|
||||
|
||||
bool scaling = src_width != dest_width || src_height != dest_height;
|
||||
bool phasing = (source_crop.left - std::floor(source_crop.left) != 0) ||
|
||||
auto scaling = src_width != dest_width || src_height != dest_height;
|
||||
auto phasing = (source_crop.left - std::floor(source_crop.left) != 0) ||
|
||||
(source_crop.top - std::floor(source_crop.top) != 0);
|
||||
return scaling || phasing;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ namespace android {
|
|||
|
||||
// NOLINTNEXTLINE (readability-function-cognitive-complexity): Fixme
|
||||
auto DrmAtomicStateManager::CommitFrame(AtomicCommitArgs &args) -> int {
|
||||
// NOLINTNEXTLINE(misc-const-correctness)
|
||||
ATRACE_CALL();
|
||||
|
||||
if (args.active && *args.active == active_frame_state_.crtc_active_state) {
|
||||
|
|
@ -141,10 +142,11 @@ auto DrmAtomicStateManager::CommitFrame(AtomicCommitArgs &args) -> int {
|
|||
}
|
||||
|
||||
if (last_present_fence_) {
|
||||
// NOLINTNEXTLINE(misc-const-correctness)
|
||||
ATRACE_NAME("WaitPriorFramePresented");
|
||||
|
||||
constexpr int kTimeoutMs = 500;
|
||||
int err = sync_wait(last_present_fence_.Get(), kTimeoutMs);
|
||||
const int err = sync_wait(last_present_fence_.Get(), kTimeoutMs);
|
||||
if (err != 0) {
|
||||
ALOGE("sync_wait(fd=%i) returned: %i (errno: %i)",
|
||||
last_present_fence_.Get(), err, errno);
|
||||
|
|
@ -157,7 +159,7 @@ auto DrmAtomicStateManager::CommitFrame(AtomicCommitArgs &args) -> int {
|
|||
flags |= DRM_MODE_ATOMIC_NONBLOCK;
|
||||
}
|
||||
|
||||
int err = drmModeAtomicCommit(drm->GetFd(), pset.get(), flags, drm);
|
||||
auto err = drmModeAtomicCommit(drm->GetFd(), pset.get(), flags, drm);
|
||||
|
||||
if (err != 0) {
|
||||
ALOGE("Failed to commit pset ret=%d\n", err);
|
||||
|
|
@ -223,9 +225,10 @@ void PresentTrackerThread::PresentTrackerThreadFn() {
|
|||
}
|
||||
|
||||
{
|
||||
// NOLINTNEXTLINE(misc-const-correctness)
|
||||
ATRACE_NAME("AsyncWaitForBuffersSwap");
|
||||
constexpr int kTimeoutMs = 500;
|
||||
int err = sync_wait(present_fence.Get(), kTimeoutMs);
|
||||
auto err = sync_wait(present_fence.Get(), kTimeoutMs);
|
||||
if (err != 0) {
|
||||
ALOGE("sync_wait(fd=%i) returned: %i (errno: %i)", present_fence.Get(),
|
||||
err, errno);
|
||||
|
|
@ -233,7 +236,7 @@ void PresentTrackerThread::PresentTrackerThreadFn() {
|
|||
}
|
||||
|
||||
{
|
||||
std::unique_lock lk(*mutex_);
|
||||
const std::unique_lock lk(*mutex_);
|
||||
if (st_man_ == nullptr) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -250,6 +253,7 @@ void DrmAtomicStateManager::CleanupPriorFrameResources() {
|
|||
assert(frames_staged_ - frames_tracked_ == 1);
|
||||
assert(last_present_fence_);
|
||||
|
||||
// NOLINTNEXTLINE(misc-const-correctness)
|
||||
ATRACE_NAME("CleanupPriorFrameResources");
|
||||
frames_tracked_++;
|
||||
active_frame_state_ = std::move(staged_frame_state_);
|
||||
|
|
@ -257,7 +261,7 @@ void DrmAtomicStateManager::CleanupPriorFrameResources() {
|
|||
}
|
||||
|
||||
auto DrmAtomicStateManager::ExecuteAtomicCommit(AtomicCommitArgs &args) -> int {
|
||||
int err = CommitFrame(args);
|
||||
auto err = CommitFrame(args);
|
||||
|
||||
if (!args.test_only) {
|
||||
if (err != 0) {
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ int DrmConnector::UpdateModes() {
|
|||
}
|
||||
|
||||
if (!exists) {
|
||||
modes_.emplace_back(DrmMode(&connector_->modes[i]));
|
||||
modes_.emplace_back(&connector_->modes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ auto DrmDevice::RegisterUserPropertyBlob(void *data, size_t length) const
|
|||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-cstyle-cast)
|
||||
create_blob.data = (__u64)data;
|
||||
|
||||
int ret = drmIoctl(GetFd(), DRM_IOCTL_MODE_CREATEPROPBLOB, &create_blob);
|
||||
auto ret = drmIoctl(GetFd(), DRM_IOCTL_MODE_CREATEPROPBLOB, &create_blob);
|
||||
if (ret != 0) {
|
||||
ALOGE("Failed to create mode property blob %d", ret);
|
||||
return {};
|
||||
|
|
@ -171,8 +171,8 @@ auto DrmDevice::RegisterUserPropertyBlob(void *data, size_t length) const
|
|||
new uint32_t(create_blob.blob_id), [this](const uint32_t *it) {
|
||||
struct drm_mode_destroy_blob destroy_blob {};
|
||||
destroy_blob.blob_id = (__u32)*it;
|
||||
int err = drmIoctl(GetFd(), DRM_IOCTL_MODE_DESTROYPROPBLOB,
|
||||
&destroy_blob);
|
||||
auto err = drmIoctl(GetFd(), DRM_IOCTL_MODE_DESTROYPROPBLOB,
|
||||
&destroy_blob);
|
||||
if (err != 0) {
|
||||
ALOGE("Failed to destroy mode property blob %" PRIu32 "/%d", *it,
|
||||
err);
|
||||
|
|
@ -231,7 +231,7 @@ auto DrmDevice::IsKMSDev(const char *path) -> bool {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool is_kms = res->count_crtcs > 0 && res->count_connectors > 0 &&
|
||||
auto is_kms = res->count_crtcs > 0 && res->count_connectors > 0 &&
|
||||
res->count_encoders > 0;
|
||||
|
||||
return is_kms;
|
||||
|
|
|
|||
|
|
@ -171,9 +171,9 @@ auto DrmDisplayPipeline::GetUsablePlanes()
|
|||
std::vector<std::shared_ptr<BindingOwner<DrmPlane>>> planes;
|
||||
planes.emplace_back(primary_plane);
|
||||
|
||||
static bool use_overlay_planes = ReadUseOverlayProperty();
|
||||
const static bool kUseOverlayPlanes = ReadUseOverlayProperty();
|
||||
|
||||
if (use_overlay_planes) {
|
||||
if (kUseOverlayPlanes) {
|
||||
for (const auto &plane : device->GetPlanes()) {
|
||||
if (plane->IsCrtcSupported(*crtc->Get())) {
|
||||
if (plane->GetType() == DRM_PLANE_TYPE_OVERLAY) {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ namespace android {
|
|||
auto DrmFbIdHandle::CreateInstance(BufferInfo *bo, GemHandle first_gem_handle,
|
||||
DrmDevice &drm)
|
||||
-> std::shared_ptr<DrmFbIdHandle> {
|
||||
// NOLINTNEXTLINE(misc-const-correctness)
|
||||
ATRACE_NAME("Import dmabufs and register FB");
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory): priv. constructor usage
|
||||
|
|
@ -61,7 +62,7 @@ auto DrmFbIdHandle::CreateInstance(BufferInfo *bo, GemHandle first_gem_handle,
|
|||
}
|
||||
}
|
||||
|
||||
bool has_modifiers = bo->modifiers[0] != DRM_FORMAT_MOD_NONE &&
|
||||
auto has_modifiers = bo->modifiers[0] != DRM_FORMAT_MOD_NONE &&
|
||||
bo->modifiers[0] != DRM_FORMAT_MOD_INVALID;
|
||||
|
||||
if (!drm.HasAddFb2ModifiersSupport() && has_modifiers) {
|
||||
|
|
@ -92,6 +93,7 @@ auto DrmFbIdHandle::CreateInstance(BufferInfo *bo, GemHandle first_gem_handle,
|
|||
}
|
||||
|
||||
DrmFbIdHandle::~DrmFbIdHandle() {
|
||||
// NOLINTNEXTLINE(misc-const-correctness)
|
||||
ATRACE_NAME("Close FB and dmabufs");
|
||||
|
||||
/* Destroy framebuffer object */
|
||||
|
|
@ -116,7 +118,7 @@ DrmFbIdHandle::~DrmFbIdHandle() {
|
|||
continue;
|
||||
}
|
||||
gem_close.handle = gem_handles_[i];
|
||||
int32_t err = drmIoctl(drm_->GetFd(), DRM_IOCTL_GEM_CLOSE, &gem_close);
|
||||
auto err = drmIoctl(drm_->GetFd(), DRM_IOCTL_GEM_CLOSE, &gem_close);
|
||||
if (err != 0) {
|
||||
ALOGE("Failed to close gem handle %d, errno: %d", gem_handles_[i], errno);
|
||||
}
|
||||
|
|
@ -127,8 +129,7 @@ auto DrmFbImporter::GetOrCreateFbId(BufferInfo *bo)
|
|||
-> std::shared_ptr<DrmFbIdHandle> {
|
||||
/* Lookup DrmFbIdHandle in cache first. First handle serves as a cache key. */
|
||||
GemHandle first_handle = 0;
|
||||
int32_t err = drmPrimeFDToHandle(drm_->GetFd(), bo->prime_fds[0],
|
||||
&first_handle);
|
||||
auto err = drmPrimeFDToHandle(drm_->GetFd(), bo->prime_fds[0], &first_handle);
|
||||
|
||||
if (err != 0) {
|
||||
ALOGE("Failed to import prime fd %d ret=%d", bo->prime_fds[0], err);
|
||||
|
|
|
|||
|
|
@ -169,6 +169,11 @@ bool DrmPlane::IsCrtcSupported(const DrmCrtc &crtc) const {
|
|||
}
|
||||
|
||||
bool DrmPlane::IsValidForLayer(LayerData *layer) {
|
||||
if (layer == nullptr || !layer->bi) {
|
||||
ALOGE("%s: Invalid parameters", __func__);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!rotation_property_) {
|
||||
if (layer->pi.transform != LayerTransform::kIdentity) {
|
||||
ALOGV("No rotation property on plane %d", GetId());
|
||||
|
|
@ -193,7 +198,7 @@ bool DrmPlane::IsValidForLayer(LayerData *layer) {
|
|||
return false;
|
||||
}
|
||||
|
||||
uint32_t format = layer->bi->format;
|
||||
auto format = layer->bi->format;
|
||||
if (!IsFormatSupported(format)) {
|
||||
ALOGV("Plane %d does not supports %c%c%c%c format", GetId(), format,
|
||||
format >> 8, format >> 16, format >> 24);
|
||||
|
|
@ -241,8 +246,8 @@ static int To1616FixPt(float in) {
|
|||
|
||||
auto DrmPlane::AtomicSetState(drmModeAtomicReq &pset, LayerData &layer,
|
||||
uint32_t zpos, uint32_t crtc_id) -> int {
|
||||
if (!layer.fb) {
|
||||
ALOGE("Expected a valid framebuffer for pset");
|
||||
if (!layer.fb || !layer.bi) {
|
||||
ALOGE("%s: Invalid arguments", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -317,8 +322,8 @@ auto DrmPlane::AtomicDisablePlane(drmModeAtomicReq &pset) -> int {
|
|||
|
||||
auto DrmPlane::GetPlaneProperty(const char *prop_name, DrmProperty &property,
|
||||
Presence presence) -> bool {
|
||||
int err = drm_->GetProperty(GetId(), DRM_MODE_OBJECT_PLANE, prop_name,
|
||||
&property);
|
||||
auto err = drm_->GetProperty(GetId(), DRM_MODE_OBJECT_PLANE, prop_name,
|
||||
&property);
|
||||
if (err != 0) {
|
||||
if (presence == Presence::kMandatory) {
|
||||
ALOGE("Could not get mandatory property \"%s\" from plane %d", prop_name,
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ void DrmProperty::Init(uint32_t obj_id, drmModePropertyPtr p, uint64_t value) {
|
|||
values_.emplace_back(p->values[i]);
|
||||
|
||||
for (int i = 0; i < p->count_enums; ++i)
|
||||
enums_.emplace_back(DrmPropertyEnum(&p->enums[i]));
|
||||
enums_.emplace_back(&p->enums[i]);
|
||||
|
||||
for (int i = 0; i < p->count_blobs; ++i)
|
||||
blob_ids_.emplace_back(p->blob_ids[i]);
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ void ResourceManager::Init() {
|
|||
char path_pattern[PROPERTY_VALUE_MAX];
|
||||
// Could be a valid path or it can have at the end of it the wildcard %
|
||||
// which means that it will try open all devices until an error is met.
|
||||
int path_len = property_get("vendor.hwc.drm.device", path_pattern,
|
||||
"/dev/dri/card%");
|
||||
auto path_len = property_get("vendor.hwc.drm.device", path_pattern,
|
||||
"/dev/dri/card%");
|
||||
if (path_pattern[path_len - 1] != '%') {
|
||||
auto dev = DrmDevice::CreateInstance(path_pattern, this);
|
||||
if (dev) {
|
||||
|
|
@ -123,8 +123,8 @@ void ResourceManager::UpdateFrontendDisplays() {
|
|||
|
||||
for (auto *conn : ordered_connectors) {
|
||||
conn->UpdateModes();
|
||||
bool connected = conn->IsConnected();
|
||||
bool attached = attached_pipelines_.count(conn) != 0;
|
||||
auto connected = conn->IsConnected();
|
||||
auto attached = attached_pipelines_.count(conn) != 0;
|
||||
|
||||
if (connected != attached) {
|
||||
ALOGI("%s connector %s", connected ? "Attaching" : "Detaching",
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ void UEventListener::Routine() {
|
|||
if (!hotplug_handler_ || !uevent_str)
|
||||
continue;
|
||||
|
||||
bool drm_event = uevent_str->find("DEVTYPE=drm_minor") != std::string::npos;
|
||||
bool hotplug_event = uevent_str->find("HOTPLUG=1") != std::string::npos;
|
||||
auto drm_event = uevent_str->find("DEVTYPE=drm_minor") != std::string::npos;
|
||||
auto hotplug_event = uevent_str->find("HOTPLUG=1") != std::string::npos;
|
||||
|
||||
if (drm_event && hotplug_event) {
|
||||
constexpr useconds_t kDelayAfterUeventUs = 200000;
|
||||
|
|
|
|||
|
|
@ -84,10 +84,10 @@ int VSyncWorker::SyntheticWaitVBlank(int64_t *timestamp) {
|
|||
refresh = pipe_->connector->Get()->GetActiveMode().v_refresh();
|
||||
}
|
||||
|
||||
int64_t phased_timestamp = GetPhasedVSync(kOneSecondNs /
|
||||
static_cast<int>(refresh),
|
||||
vsync.tv_sec * kOneSecondNs +
|
||||
vsync.tv_nsec);
|
||||
auto phased_timestamp = GetPhasedVSync(kOneSecondNs /
|
||||
static_cast<int>(refresh),
|
||||
vsync.tv_sec * kOneSecondNs +
|
||||
vsync.tv_nsec);
|
||||
vsync.tv_sec = phased_timestamp / kOneSecondNs;
|
||||
vsync.tv_nsec = int(phased_timestamp - (vsync.tv_sec * kOneSecondNs));
|
||||
do {
|
||||
|
|
@ -120,8 +120,8 @@ void VSyncWorker::Routine() {
|
|||
drmVBlank vblank{};
|
||||
|
||||
if (pipe != nullptr) {
|
||||
uint32_t high_crtc = (pipe->crtc->Get()->GetIndexInResArray()
|
||||
<< DRM_VBLANK_HIGH_CRTC_SHIFT);
|
||||
auto high_crtc = (pipe->crtc->Get()->GetIndexInResArray()
|
||||
<< DRM_VBLANK_HIGH_CRTC_SHIFT);
|
||||
|
||||
vblank.request.type = (drmVBlankSeqType)(DRM_VBLANK_RELATIVE |
|
||||
(high_crtc &
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace android {
|
|||
std::string HwcDisplay::DumpDelta(HwcDisplay::Stats delta) {
|
||||
if (delta.total_pixops_ == 0)
|
||||
return "No stats yet";
|
||||
double ratio = 1.0 - double(delta.gpu_pixops_) / double(delta.total_pixops_);
|
||||
auto ratio = 1.0 - double(delta.gpu_pixops_) / double(delta.total_pixops_);
|
||||
|
||||
std::stringstream ss;
|
||||
ss << " Total frames count: " << delta.total_frames_ << "\n"
|
||||
|
|
@ -69,9 +69,9 @@ std::string HwcDisplay::Dump() {
|
|||
" VSync remains";
|
||||
}
|
||||
|
||||
std::string connector_name = IsInHeadlessMode()
|
||||
? "NULL-DISPLAY"
|
||||
: GetPipe().connector->Get()->GetName();
|
||||
auto connector_name = IsInHeadlessMode()
|
||||
? std::string("NULL-DISPLAY")
|
||||
: GetPipe().connector->Get()->GetName();
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "- Display on: " << connector_name << "\n"
|
||||
|
|
@ -236,7 +236,7 @@ HWC2::Error HwcDisplay::GetChangedCompositionTypes(uint32_t *num_elements,
|
|||
}
|
||||
|
||||
uint32_t num_changes = 0;
|
||||
for (std::pair<const hwc2_layer_t, HwcLayer> &l : layers_) {
|
||||
for (auto &l : layers_) {
|
||||
if (l.second.IsTypeChanged()) {
|
||||
if (layers && num_changes < *num_elements)
|
||||
layers[num_changes] = l.first;
|
||||
|
|
@ -257,8 +257,8 @@ HWC2::Error HwcDisplay::GetClientTargetSupport(uint32_t width, uint32_t height,
|
|||
return HWC2::Error::None;
|
||||
}
|
||||
|
||||
std::pair<uint32_t, uint32_t> min = pipeline_->device->GetMinResolution();
|
||||
std::pair<uint32_t, uint32_t> max = pipeline_->device->GetMaxResolution();
|
||||
auto min = pipeline_->device->GetMinResolution();
|
||||
auto max = pipeline_->device->GetMaxResolution();
|
||||
|
||||
if (width < min.first || height < min.second)
|
||||
return HWC2::Error::Unsupported;
|
||||
|
|
@ -296,8 +296,8 @@ HWC2::Error HwcDisplay::GetDisplayAttribute(hwc2_config_t config,
|
|||
auto &hwc_config = configs_.hwc_configs[conf];
|
||||
|
||||
static const int32_t kUmPerInch = 25400;
|
||||
uint32_t mm_width = configs_.mm_width;
|
||||
uint32_t mm_height = configs_.mm_height;
|
||||
auto mm_width = configs_.mm_width;
|
||||
auto mm_height = configs_.mm_height;
|
||||
auto attribute = static_cast<HWC2::Attribute>(attribute_in);
|
||||
switch (attribute) {
|
||||
case HWC2::Attribute::Width:
|
||||
|
|
@ -364,8 +364,8 @@ HWC2::Error HwcDisplay::GetDisplayName(uint32_t *size, char *name) {
|
|||
} else {
|
||||
stream << "display-" << GetPipe().connector->Get()->GetId();
|
||||
}
|
||||
std::string string = stream.str();
|
||||
size_t length = string.length();
|
||||
auto string = stream.str();
|
||||
auto length = string.length();
|
||||
if (!name) {
|
||||
*size = length;
|
||||
return HWC2::Error::None;
|
||||
|
|
@ -450,7 +450,7 @@ HWC2::Error HwcDisplay::CreateComposition(AtomicCommitArgs &a_args) {
|
|||
return HWC2::Error::None;
|
||||
}
|
||||
|
||||
int PrevModeVsyncPeriodNs = static_cast<int>(
|
||||
auto PrevModeVsyncPeriodNs = static_cast<int>(
|
||||
1E9 / GetPipe().connector->Get()->GetActiveMode().v_refresh());
|
||||
|
||||
auto mode_update_commited_ = false;
|
||||
|
|
@ -477,7 +477,7 @@ HWC2::Error HwcDisplay::CreateComposition(AtomicCommitArgs &a_args) {
|
|||
for (std::pair<const hwc2_layer_t, HwcLayer> &l : layers_) {
|
||||
switch (l.second.GetValidatedType()) {
|
||||
case HWC2::Composition::Device:
|
||||
z_map.emplace(std::make_pair(l.second.GetZOrder(), &l.second));
|
||||
z_map.emplace(l.second.GetZOrder(), &l.second);
|
||||
break;
|
||||
case HWC2::Composition::Client:
|
||||
// Place it at the z_order of the lowest client layer
|
||||
|
|
@ -489,7 +489,7 @@ HWC2::Error HwcDisplay::CreateComposition(AtomicCommitArgs &a_args) {
|
|||
}
|
||||
}
|
||||
if (use_client_layer)
|
||||
z_map.emplace(std::make_pair(client_z_order, &client_layer_));
|
||||
z_map.emplace(client_z_order, &client_layer_);
|
||||
|
||||
if (z_map.empty())
|
||||
return HWC2::Error::BadLayer;
|
||||
|
|
@ -530,7 +530,7 @@ HWC2::Error HwcDisplay::CreateComposition(AtomicCommitArgs &a_args) {
|
|||
|
||||
a_args.composition = current_plan_;
|
||||
|
||||
int ret = GetPipe().atomic_state_manager->ExecuteAtomicCommit(a_args);
|
||||
auto ret = GetPipe().atomic_state_manager->ExecuteAtomicCommit(a_args);
|
||||
|
||||
if (ret) {
|
||||
if (!a_args.test_only)
|
||||
|
|
@ -632,10 +632,15 @@ HWC2::Error HwcDisplay::SetClientTarget(buffer_handle_t target,
|
|||
}
|
||||
|
||||
auto &bi = client_layer_.GetLayerData().bi;
|
||||
hwc_frect_t source_crop = {.left = 0.0F,
|
||||
.top = 0.0F,
|
||||
.right = static_cast<float>(bi->width),
|
||||
.bottom = static_cast<float>(bi->height)};
|
||||
if (!bi) {
|
||||
ALOGE("%s: Invalid state", __func__);
|
||||
return HWC2::Error::BadLayer;
|
||||
}
|
||||
|
||||
auto source_crop = (hwc_frect_t){.left = 0.0F,
|
||||
.top = 0.0F,
|
||||
.right = static_cast<float>(bi->width),
|
||||
.bottom = static_cast<float>(bi->height)};
|
||||
client_layer_.SetLayerSourceCrop(source_crop);
|
||||
|
||||
return HWC2::Error::None;
|
||||
|
|
@ -709,7 +714,7 @@ HWC2::Error HwcDisplay::SetPowerMode(int32_t mode_in) {
|
|||
: HWC2::Error::BadParameter;
|
||||
};
|
||||
|
||||
int err = GetPipe().atomic_state_manager->ExecuteAtomicCommit(a_args);
|
||||
auto err = GetPipe().atomic_state_manager->ExecuteAtomicCommit(a_args);
|
||||
if (err) {
|
||||
ALOGE("Failed to apply the dpms composition err=%d", err);
|
||||
return HWC2::Error::BadParameter;
|
||||
|
|
@ -940,7 +945,7 @@ void HwcDisplay::set_backend(std::unique_ptr<Backend> backend) {
|
|||
|
||||
/* returns true if composition should be sent to client */
|
||||
bool HwcDisplay::ProcessClientFlatteningState(bool skip) {
|
||||
int flattenning_state = flattenning_state_;
|
||||
const int flattenning_state = flattenning_state_;
|
||||
if (flattenning_state == ClientFlattenningState::Disabled) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ HWC2::Error HwcDisplayConfigs::Update(DrmConnector &connector) {
|
|||
* mode*/
|
||||
FillHeadless();
|
||||
/* Read real configs */
|
||||
int ret = connector.UpdateModes();
|
||||
auto ret = connector.UpdateModes();
|
||||
if (ret != 0) {
|
||||
ALOGE("Failed to update display modes %d", ret);
|
||||
return HWC2::Error::BadDisplay;
|
||||
|
|
@ -79,7 +79,7 @@ HWC2::Error HwcDisplayConfigs::Update(DrmConnector &connector) {
|
|||
preferred_config_id = 0;
|
||||
uint32_t preferred_config_group_id = 0;
|
||||
|
||||
uint32_t first_config_id = last_config_id;
|
||||
auto first_config_id = last_config_id;
|
||||
uint32_t last_group_id = 1;
|
||||
|
||||
/* Group modes */
|
||||
|
|
@ -143,7 +143,7 @@ HWC2::Error HwcDisplayConfigs::Update(DrmConnector &connector) {
|
|||
}
|
||||
}
|
||||
|
||||
bool has_both = has_interlaced && has_progressive;
|
||||
auto has_both = has_interlaced && has_progressive;
|
||||
if (!has_both) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -159,7 +159,7 @@ HWC2::Error HwcDisplayConfigs::Update(DrmConnector &connector) {
|
|||
continue;
|
||||
}
|
||||
|
||||
bool disable = group_contains_preferred_interlaced
|
||||
auto disable = group_contains_preferred_interlaced
|
||||
? !hwc_config.second.IsInterlaced()
|
||||
: hwc_config.second.IsInterlaced();
|
||||
|
||||
|
|
|
|||
|
|
@ -205,6 +205,11 @@ void HwcLayer::ImportFb() {
|
|||
void HwcLayer::PopulateLayerData(bool test) {
|
||||
ImportFb();
|
||||
|
||||
if (!layer_data_.bi) {
|
||||
ALOGE("%s: Invalid state", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (blend_mode_ != BufferBlendMode::kUndefined) {
|
||||
layer_data_.bi->blend_mode = blend_mode_;
|
||||
}
|
||||
|
|
@ -227,7 +232,7 @@ bool HwcLayer::SwChainGetBufferFromCache(BufferUniqueId unique_id) {
|
|||
return false;
|
||||
}
|
||||
|
||||
int seq = swchain_lookup_table_[unique_id];
|
||||
auto seq = swchain_lookup_table_[unique_id];
|
||||
|
||||
if (swchain_cache_.count(seq) == 0) {
|
||||
return false;
|
||||
|
|
@ -274,7 +279,7 @@ void HwcLayer::SwChainAddCurrentBuffer(BufferUniqueId unique_id) {
|
|||
return;
|
||||
}
|
||||
|
||||
int seq = swchain_lookup_table_[unique_id];
|
||||
auto seq = swchain_lookup_table_[unique_id];
|
||||
|
||||
if (swchain_cache_.count(seq) == 0) {
|
||||
swchain_cache_[seq] = {};
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ namespace android {
|
|||
* to the short "android::HwcLayer::SetLayerBuffer" for better logs readability
|
||||
*/
|
||||
static std::string GetFuncName(const char *pretty_function) {
|
||||
std::string str(pretty_function);
|
||||
const std::string str(pretty_function);
|
||||
const char *start = "func = &";
|
||||
size_t p1 = str.find(start);
|
||||
auto p1 = str.find(start);
|
||||
p1 += strlen(start);
|
||||
size_t p2 = str.find(',', p1);
|
||||
auto p2 = str.find(',', p1);
|
||||
return str.substr(p1, p2 - p1);
|
||||
}
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ static int32_t LayerHook(hwc2_device_t *dev, hwc2_display_t display_handle,
|
|||
static int HookDevClose(hw_device_t *dev) {
|
||||
// NOLINTNEXTLINE (cppcoreguidelines-pro-type-reinterpret-cast): Safe
|
||||
auto *hwc2_dev = reinterpret_cast<hwc2_device_t *>(dev);
|
||||
std::unique_ptr<DrmHwcTwo> ctx(ToDrmHwcTwo(hwc2_dev));
|
||||
const std::unique_ptr<DrmHwcTwo> ctx(ToDrmHwcTwo(hwc2_dev));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ struct TestWorker : public Worker {
|
|||
void Routine() override {
|
||||
Lock();
|
||||
if (!enabled_) {
|
||||
int ret = WaitForSignalOrExitLocked();
|
||||
auto ret = WaitForSignalOrExitLocked();
|
||||
if (ret == -EINTR) {
|
||||
Unlock();
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class UEvent {
|
|||
addr.nl_groups = UINT32_MAX;
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-cstyle-cast)
|
||||
int ret = bind(fd.Get(), (struct sockaddr *)&addr, sizeof(addr));
|
||||
const int ret = bind(fd.Get(), (struct sockaddr *)&addr, sizeof(addr));
|
||||
if (ret != 0) {
|
||||
ALOGE("Failed to bind uevent socket: errno=%i", errno);
|
||||
return {};
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
namespace android {
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ Worker::~Worker() {
|
|||
}
|
||||
|
||||
int Worker::InitWorker() {
|
||||
std::lock_guard<std::mutex> lk(mutex_);
|
||||
const std::lock_guard<std::mutex> lk(mutex_);
|
||||
if (initialized())
|
||||
return -EALREADY;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue