Some of files require small adjustments to move into NORMAL checks list.
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
tests/worker_test.cpp \
utils/autolock.cpp \
utils/Worker.cpp \
+ utils/hwcutils.cpp \
#bufferinfo/BufferInfoMapperMetadata.cpp
-#utils/hwcutils.cpp
TIDY_CHECKS_NORMAL := * \
-hicpp-* -llvmlibc-* -fuchsia-* -altera-* \
- -llvm-header-guard \
-cppcoreguidelines-special-member-functions \
- -cppcoreguidelines-pro-type-cstyle-cast \
- -cppcoreguidelines-macro-usage \
+ -llvm-header-guard \
-cppcoreguidelines-avoid-c-arrays \
+ -cppcoreguidelines-pro-type-vararg \
+ -cppcoreguidelines-pro-bounds-array-to-pointer-decay \
+ -cppcoreguidelines-pro-bounds-constant-array-index \
+ -cppcoreguidelines-avoid-magic-numbers \
-google-readability-braces-around-statements \
-google-readability-casting \
-misc-non-private-member-variables-in-classes \
-modernize-avoid-c-arrays \
+ -modernize-use-nodiscard \
-modernize-use-trailing-return-type \
-readability-braces-around-statements \
- -readability-convert-member-functions-to-static \
- -readability-implicit-bool-conversion \
- -readability-identifier-naming \
TIDY_CHECKS_COARSE := \
$(TIDY_CHECKS_NORMAL) \
-readability-use-anyofallof \
TIDY_FILES := \
- drm/UEventListener.h:COARSE \
+ drm/UEventListener.h:NORMAL \
drm/DrmFbImporter.h:FINE \
- drm/ResourceManager.h:COARSE \
+ drm/ResourceManager.h:NORMAL \
drm/DrmMode.h:COARSE \
drm/DrmDevice.h:COARSE \
drm/DrmProperty.h:COARSE \
drm/DrmConnector.h:COARSE \
drm/DrmCrtc.h:COARSE \
- drm/VSyncWorker.h:COARSE \
- drm/DrmPlane.h:COARSE \
+ drm/VSyncWorker.h:NORMAL \
+ drm/DrmPlane.h:NORMAL \
drm/DrmUnique.h:FINE \
drm/DrmEncoder.h:COARSE \
- bufferinfo/legacy/BufferInfoMinigbm.h:COARSE \
- bufferinfo/legacy/BufferInfoLibdrm.h:COARSE \
- bufferinfo/legacy/BufferInfoMaliMediatek.h:COARSE \
- bufferinfo/legacy/BufferInfoMaliHisi.h:COARSE \
- bufferinfo/legacy/BufferInfoImagination.h:COARSE \
- bufferinfo/legacy/BufferInfoMaliMeson.h:COARSE \
- bufferinfo/BufferInfoGetter.h:COARSE \
- bufferinfo/BufferInfoMapperMetadata.h:COARSE \
- include/drmhwcgralloc.h:COARSE \
- include/drmhwcomposer.h:COARSE \
+ bufferinfo/legacy/BufferInfoMinigbm.h:NORMAL \
+ bufferinfo/legacy/BufferInfoLibdrm.h:NORMAL \
+ bufferinfo/legacy/BufferInfoMaliMediatek.h:NORMAL \
+ bufferinfo/legacy/BufferInfoMaliHisi.h:NORMAL \
+ bufferinfo/legacy/BufferInfoImagination.h:NORMAL \
+ bufferinfo/legacy/BufferInfoMaliMeson.h:NORMAL \
+ bufferinfo/BufferInfoGetter.h:NORMAL \
+ bufferinfo/BufferInfoMapperMetadata.h:NORMAL \
+ include/drmhwcgralloc.h:NORMAL \
+ include/drmhwcomposer.h:NORMAL \
utils/Worker.h:COARSE \
utils/UniqueFd.h:FINE \
- utils/autolock.h:COARSE \
+ utils/autolock.h:NORMAL \
utils/log.h:FINE \
utils/properties.h:FINE \
compositor/DrmDisplayCompositor.h:COARSE \
- compositor/Planner.h:COARSE \
+ compositor/Planner.h:NORMAL \
compositor/DrmDisplayComposition.h:COARSE \
backend/BackendManager.h:COARSE \
- backend/BackendClient.h:COARSE \
- backend/Backend.h:COARSE \
- backend/BackendRCarDu.h:COARSE \
+ backend/BackendClient.h:NORMAL \
+ backend/Backend.h:NORMAL \
+ backend/BackendRCarDu.h:NORMAL \
DrmHwcTwo.h:COARSE \
TIDY_FILES += \
- backend/BackendClient.cpp:COARSE \
- backend/Backend.cpp:COARSE \
- backend/BackendManager.cpp:COARSE \
- backend/BackendRCarDu.cpp:COARSE \
- bufferinfo/BufferInfoGetter.cpp:COARSE \
+ backend/BackendClient.cpp:NORMAL \
+ backend/Backend.cpp:NORMAL \
+ backend/BackendManager.cpp:NORMAL \
+ backend/BackendRCarDu.cpp:NORMAL \
+ bufferinfo/BufferInfoGetter.cpp:NORMAL \
bufferinfo/legacy/BufferInfoImagination.cpp:COARSE \
bufferinfo/legacy/BufferInfoLibdrm.cpp:COARSE \
bufferinfo/legacy/BufferInfoMaliHisi.cpp:COARSE \
bufferinfo/legacy/BufferInfoMinigbm.cpp:COARSE \
compositor/DrmDisplayComposition.cpp:COARSE \
compositor/DrmDisplayCompositor.cpp:COARSE \
- compositor/Planner.cpp:COARSE \
+ compositor/Planner.cpp:NORMAL \
drm/DrmConnector.cpp:COARSE \
- drm/DrmCrtc.cpp:COARSE \
+ drm/DrmCrtc.cpp:NORMAL \
drm/DrmDevice.cpp:COARSE \
- drm/DrmEncoder.cpp:COARSE \
- drm/DrmFbImporter.cpp:COARSE \
- drm/DrmMode.cpp:COARSE \
+ drm/DrmEncoder.cpp:NORMAL \
+ drm/DrmFbImporter.cpp:NORMAL \
+ drm/DrmMode.cpp:NORMAL \
drm/DrmPlane.cpp:COARSE \
drm/DrmProperty.cpp:COARSE \
DrmHwcTwo.cpp:COARSE \
- drm/ResourceManager.cpp:COARSE \
+ drm/ResourceManager.cpp:NORMAL \
drm/UEventListener.cpp:COARSE \
drm/VSyncWorker.cpp:COARSE \
tests/worker_test.cpp:COARSE \
- utils/autolock.cpp:COARSE \
- utils/Worker.cpp:COARSE \
+ utils/autolock.cpp:NORMAL \
+ utils/Worker.cpp:NORMAL \
+ utils/hwcutils.cpp:NORMAL \
.PHONY: all build tidy tidy-fine clean
value: lower_case
- key: readability-identifier-naming.IgnoreMainLikeFunctions
value: 1
+ - key: cppcoreguidelines-macro-usage.AllowedRegexp
+ value: "LOG_TAG|ATRACE_TAG"
+ - key: readability-magic-numbers.IgnoredFloatingPointValues
+ value: '1000.0'
}
HWC2::Error ret = HWC2::Error::None;
- for (int i = 0; i < resource_manager_.getDisplayCount(); i++) {
+ for (int i = 0; i < resource_manager_.GetDisplayCount(); i++) {
ret = CreateDisplay(i, HWC2::DisplayType::Physical);
if (ret != HWC2::Error::None) {
ALOGE("Failed to create display %d with error %d", i, ret);
case HWC2::Callback::Hotplug: {
hotplug_callback_ = std::make_pair(HWC2_PFN_HOTPLUG(function), data);
lock.unlock();
- const auto &drm_devices = resource_manager_.getDrmDevices();
+ const auto &drm_devices = resource_manager_.GetDrmDevices();
for (const auto &device : drm_devices)
HandleInitialHotplugState(device.get());
break;
"1");
bool use_overlay_planes = strtol(use_overlay_planes_prop, nullptr, 10);
for (auto &plane : *planes) {
- if (plane->type() == DRM_PLANE_TYPE_PRIMARY)
+ if (plane->GetType() == DRM_PLANE_TYPE_PRIMARY)
primary_planes_.push_back(plane);
- else if (use_overlay_planes && (plane)->type() == DRM_PLANE_TYPE_OVERLAY)
+ else if (use_overlay_planes && (plane)->GetType() == DRM_PLANE_TYPE_OVERLAY)
overlay_planes_.push_back(plane);
}
/* TODO: Do not update source_crop every call.
* It makes sense to do it once after every hotplug event. */
- hwc_drm_bo bo{};
+ HwcDrmBo bo{};
BufferInfoGetter::GetInstance()->ConvertBoInfo(target, &bo);
hwc_frect_t source_crop = {.left = 0.0F,
}
void DrmHwcTwo::HandleHotplugUEvent() {
- for (const auto &drm : resource_manager_.getDrmDevices()) {
+ for (const auto &drm : resource_manager_.GetDrmDevices()) {
for (const auto &conn : drm->connectors()) {
drmModeConnection old_state = conn->state();
drmModeConnection cur_state = conn->UpdateModes()
client_size);
display->total_stats().total_pixops_ += CalcPixOps(layers, 0, layers.size());
- return *num_types ? HWC2::Error::HasChanges : HWC2::Error::None;
+ return *num_types != 0 ? HWC2::Error::HasChanges : HWC2::Error::None;
}
std::tuple<int, size_t> Backend::GetClientLayers(
DrmHwcTwo::HwcLayer *layer);
protected:
- bool HardwareSupportsLayerType(HWC2::Composition comp_type);
- uint32_t CalcPixOps(const std::vector<DrmHwcTwo::HwcLayer *> &layers,
- size_t first_z, size_t size);
- void MarkValidated(std::vector<DrmHwcTwo::HwcLayer *> &layers,
- size_t client_first_z, size_t client_size);
- std::tuple<int, int> GetExtraClientRange(
+ static bool HardwareSupportsLayerType(HWC2::Composition comp_type);
+ static uint32_t CalcPixOps(const std::vector<DrmHwcTwo::HwcLayer *> &layers,
+ size_t first_z, size_t size);
+ static void MarkValidated(std::vector<DrmHwcTwo::HwcLayer *> &layers,
+ size_t client_first_z, size_t client_size);
+ static std::tuple<int, int> GetExtraClientRange(
DrmHwcTwo::HwcDisplay *display,
const std::vector<DrmHwcTwo::HwcLayer *> &layers, int client_start,
size_t client_size);
std::string backend_name(backend_override);
display->set_backend(GetBackendByName(backend_name));
- if (!display->backend()) {
+ if (display->backend() == nullptr) {
ALOGE("Failed to set backend '%s' for '%s' and driver '%s'",
backend_name.c_str(), display->connector()->name().c_str(),
driver_name.c_str());
int ret = BufferInfoGetter::GetInstance()->ConvertBoInfo(layer->buffer(),
&bo);
- if (ret)
+ if (ret != 0)
return true;
if (bo.format == DRM_FORMAT_ABGR8888)
}
int LegacyBufferInfoGetter::Init() {
- int ret = hw_get_module(GRALLOC_HARDWARE_MODULE_ID,
- (const hw_module_t **)&gralloc_);
- if (ret) {
+ int ret = hw_get_module(
+ GRALLOC_HARDWARE_MODULE_ID,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
+ reinterpret_cast<const hw_module_t **>(&gralloc_));
+ if (ret != 0) {
ALOGE("Failed to open gralloc module");
return ret;
}
static std::unique_ptr<LegacyBufferInfoGetter> CreateInstance();
static uint32_t ConvertHalFormatToDrm(uint32_t hal_format);
+
+ // NOLINTNEXTLINE:(readability-identifier-naming)
const gralloc_module_t *gralloc_;
};
#ifdef DISABLE_LEGACY_GETTERS
#define LEGACY_BUFFER_INFO_GETTER(getter_)
#else
+// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define LEGACY_BUFFER_INFO_GETTER(getter_) \
std::unique_ptr<LegacyBufferInfoGetter> \
LegacyBufferInfoGetter::CreateInstance() { \
return android::BAD_VALUE;
}
- for (int i = 0; i < HWC_DRM_BO_MAX_PLANES; i++) {
+ for (int i = 0; i < kHwcDrmBoMaxPlanes; i++) {
/* If no size, we're out of usable planes */
if (bo->sizes[i] <= 0) {
if (i == 0) {
int BufferInfoMapperMetadata::ConvertBoInfo(buffer_handle_t handle,
hwc_drm_bo_t *bo) {
GraphicBufferMapper &mapper = GraphicBufferMapper::getInstance();
- if (!handle)
+ if (handle == nullptr)
return -EINVAL;
uint64_t usage = 0;
int err = mapper.getUsage(handle, &usage);
- if (err) {
+ if (err != 0) {
ALOGE("Failed to get usage err=%d", err);
return err;
}
ui::PixelFormat hal_format;
err = mapper.getPixelFormatRequested(handle, &hal_format);
- if (err) {
+ if (err != 0) {
ALOGE("Failed to get HAL Pixel Format err=%d", err);
return err;
}
bo->hal_format = static_cast<uint32_t>(hal_format);
err = mapper.getPixelFormatFourCC(handle, &bo->format);
- if (err) {
+ if (err != 0) {
ALOGE("Failed to get FourCC format err=%d", err);
return err;
}
err = mapper.getPixelFormatModifier(handle, &bo->modifiers[0]);
- if (err) {
+ if (err != 0) {
ALOGE("Failed to get DRM Modifier err=%d", err);
return err;
}
uint64_t width = 0;
err = mapper.getWidth(handle, &width);
- if (err) {
+ if (err != 0) {
ALOGE("Failed to get Width err=%d", err);
return err;
}
uint64_t height = 0;
err = mapper.getHeight(handle, &height);
- if (err) {
+ if (err != 0) {
ALOGE("Failed to get Height err=%d", err);
return err;
}
std::vector<ui::PlaneLayout> layouts;
err = mapper.getPlaneLayouts(handle, &layouts);
- if (err) {
+ if (err != 0) {
ALOGE("Failed to get Plane Layouts err=%d", err);
return err;
}
continue;
std::vector<DrmPlane *> *container = nullptr;
- if (i.plane()->type() == DRM_PLANE_TYPE_PRIMARY)
+ if (i.plane()->GetType() == DRM_PLANE_TYPE_PRIMARY)
container = primary_planes;
else
container = overlay_planes;
}
DrmHwcLayer &layer = layers[source_layer];
- new_frame_state.used_framebuffers.emplace_back(layer.FbIdHandle);
+ new_frame_state.used_framebuffers.emplace_back(layer.fb_id_handle);
new_frame_state.used_planes.emplace_back(plane);
/* Remove from 'unused' list, since plane is re-used */
// Go through the provisioning stages and provision planes
int ret = ProvisionPlanesInternal(&composition, layers, &planes);
- if (ret) {
+ if (ret != 0) {
ALOGV("Failed provision stage with ret %d", ret);
return std::make_tuple(ret, std::vector<DrmCompositionPlane>());
}
if (ret == -ENOENT)
break;
- if (ret) {
+ if (ret != 0) {
ALOGV("Failed to emplace layer %zu, dropping it", i->first);
return ret;
}
DrmPlane *plane = PopPlane(planes);
std::vector<DrmPlane *> unused_planes;
int ret = -ENOENT;
- while (plane) {
+ while (plane != nullptr) {
ret = plane->IsValidForLayer(layer.second) ? 0 : -EINVAL;
- if (!ret)
+ if (ret == 0)
break;
- if (!plane->zpos_property().is_immutable())
+ if (!plane->GetZPosProperty().is_immutable())
unused_planes.push_back(plane);
plane = PopPlane(planes);
}
- if (!ret) {
+ if (ret == 0) {
composition->emplace_back(plane, layer.first);
planes->insert(planes->begin(), unused_planes.begin(),
unused_planes.end());
return ret;
}
- int ProvisionPlanesInternal(std::vector<DrmCompositionPlane> *composition,
- std::map<size_t, DrmHwcLayer *> &layers,
- std::vector<DrmPlane *> *planes);
+ static int ProvisionPlanesInternal(
+ std::vector<DrmCompositionPlane> *composition,
+ std::map<size_t, DrmHwcLayer *> &layers, std::vector<DrmPlane *> *planes);
public:
// Creates a planner instance
//
// Returns: A tuple with the status of the operation (0 for success) and
// a vector of the resulting plan (ie: layer->plane mapping).
- std::tuple<int, std::vector<DrmCompositionPlane>> ProvisionPlanes(
+ static std::tuple<int, std::vector<DrmCompositionPlane>> ProvisionPlanes(
std::map<size_t, DrmHwcLayer *> &layers, DrmCrtc *crtc,
std::vector<DrmPlane *> *primary_planes,
std::vector<DrmPlane *> *overlay_planes);
private:
- std::vector<DrmPlane *> GetUsablePlanes(
+ static std::vector<DrmPlane *> GetUsablePlanes(
DrmCrtc *crtc, std::vector<DrmPlane *> *primary_planes,
std::vector<DrmPlane *> *overlay_planes);
};
int DrmCrtc::Init() {
int ret = drm_->GetCrtcProperty(*this, "ACTIVE", &active_property_);
- if (ret) {
+ if (ret != 0) {
ALOGE("Failed to get ACTIVE property");
return ret;
}
ret = drm_->GetCrtcProperty(*this, "MODE_ID", &mode_property_);
- if (ret) {
+ if (ret != 0) {
ALOGE("Failed to get MODE_ID property");
return ret;
}
ret = drm_->GetCrtcProperty(*this, "OUT_FENCE_PTR", &out_fence_ptr_property_);
- if (ret) {
+ if (ret != 0) {
ALOGE("Failed to get OUT_FENCE_PTR property");
return ret;
}
return nullptr;
}
-DrmPlane *DrmDevice::GetPlane(uint32_t id) const {
- for (const auto &plane : planes_) {
- if (plane->id() == id)
- return plane.get();
- }
- return nullptr;
-}
-
const std::vector<std::unique_ptr<DrmCrtc>> &DrmDevice::crtcs() const {
return crtcs_;
}
DrmConnector *GetWritebackConnectorForDisplay(int display) const;
DrmConnector *AvailableWritebackConnector(int display) const;
DrmCrtc *GetCrtcForDisplay(int display) const;
- DrmPlane *GetPlane(uint32_t id) const;
int GetCrtcProperty(const DrmCrtc &crtc, const char *prop_name,
DrmProperty *property) const;
const std::shared_ptr<DrmDevice> drm_;
uint32_t fb_id_{};
- std::array<GemHandle, HWC_DRM_BO_MAX_PLANES> gem_handles_{};
+ std::array<GemHandle, kHwcDrmBoMaxPlanes> gem_handles_{};
};
class DrmFbImporter {
return 0;
}
-uint32_t DrmPlane::id() const {
- return id_;
-}
-
bool DrmPlane::GetCrtcSupported(const DrmCrtc &crtc) const {
return ((1 << crtc.pipe()) & possible_crtc_mask_) != 0;
}
return true;
}
-uint32_t DrmPlane::type() const {
+uint32_t DrmPlane::GetType() const {
return type_;
}
auto DrmPlane::AtomicSetState(drmModeAtomicReq &pset, DrmHwcLayer &layer,
uint32_t zpos, uint32_t crtc_id) -> int {
- if (!layer.FbIdHandle) {
+ if (!layer.fb_id_handle) {
ALOGE("Expected a valid framebuffer for pset");
return -EINVAL;
}
}
if (!crtc_property_.AtomicSet(pset, crtc_id) ||
- !fb_property_.AtomicSet(pset, layer.FbIdHandle->GetFbId()) ||
+ !fb_property_.AtomicSet(pset, layer.fb_id_handle->GetFbId()) ||
!crtc_x_property_.AtomicSet(pset, layer.display_frame.left) ||
!crtc_y_property_.AtomicSet(pset, layer.display_frame.top) ||
!crtc_w_property_.AtomicSet(pset, layer.display_frame.right -
return 0;
}
-const DrmProperty &DrmPlane::zpos_property() const {
+const DrmProperty &DrmPlane::GetZPosProperty() const {
return zpos_property_;
}
int Init();
- uint32_t id() const;
-
bool GetCrtcSupported(const DrmCrtc &crtc) const;
bool IsValidForLayer(DrmHwcLayer *layer);
- uint32_t type() const;
+ uint32_t GetType() const;
bool IsFormatSupported(uint32_t format) const;
bool HasNonRgbFormat() const;
auto AtomicSetState(drmModeAtomicReq &pset, DrmHwcLayer &layer, uint32_t zpos,
uint32_t crtc_id) -> int;
auto AtomicDisablePlane(drmModeAtomicReq &pset) -> int;
- const DrmProperty &zpos_property() const;
+ const DrmProperty &GetZPosProperty() const;
private:
DrmDevice *drm_;
ret = AddDrmDevice(std::string(path_pattern));
} else {
path_pattern[path_len - 1] = '\0';
- for (int idx = 0; !ret; ++idx) {
+ for (int idx = 0; ret == 0; ++idx) {
std::ostringstream path;
path << path_pattern << idx;
struct stat buf {};
- if (stat(path.str().c_str(), &buf))
+ if (stat(path.str().c_str(), &buf) != 0)
break;
if (DrmDevice::IsKMSDev(path.str().c_str()))
}
}
- if (!num_displays_) {
+ if (num_displays_ == 0) {
ALOGE("Failed to initialize any displays");
- return ret ? -EINVAL : ret;
+ return ret != 0 ? -EINVAL : ret;
}
char scale_with_gpu[PROPERTY_VALUE_MAX];
property_get("vendor.hwc.drm.scale_with_gpu", scale_with_gpu, "0");
scale_with_gpu_ = bool(strncmp(scale_with_gpu, "0", 1));
- if (!BufferInfoGetter::GetInstance()) {
+ if (BufferInfoGetter::GetInstance() == nullptr) {
ALOGE("Failed to initialize BufferInfoGetter");
return -EINVAL;
}
ret = uevent_listener_.Init();
- if (ret) {
+ if (ret != 0) {
ALOGE("Can't initialize event listener %d", ret);
return ret;
}
int Init();
DrmDevice *GetDrmDevice(int display);
- const std::vector<std::unique_ptr<DrmDevice>> &getDrmDevices() const {
+ const std::vector<std::unique_ptr<DrmDevice>> &GetDrmDevices() const {
return drms_;
}
- int getDisplayCount() const {
+ int GetDisplayCount() const {
return num_displays_;
}
bool ForcedScalingWithGpu() const {
#include <cstdint>
-#define HWC_DRM_BO_MAX_PLANES 4
-struct hwc_drm_bo {
+constexpr int kHwcDrmBoMaxPlanes = 4;
+
+struct HwcDrmBo {
uint32_t width;
uint32_t height;
uint32_t format; /* DRM_FORMAT_* from drm_fourcc.h */
uint32_t hal_format; /* HAL_PIXEL_FORMAT_* */
uint32_t usage;
- uint32_t pitches[HWC_DRM_BO_MAX_PLANES];
- uint32_t offsets[HWC_DRM_BO_MAX_PLANES];
+ uint32_t pitches[kHwcDrmBoMaxPlanes];
+ uint32_t offsets[kHwcDrmBoMaxPlanes];
/* sizes[] is used only by mapper@4 metadata getter for internal purposes */
- uint32_t sizes[HWC_DRM_BO_MAX_PLANES];
- int prime_fds[HWC_DRM_BO_MAX_PLANES];
- uint64_t modifiers[HWC_DRM_BO_MAX_PLANES];
+ uint32_t sizes[kHwcDrmBoMaxPlanes];
+ int prime_fds[kHwcDrmBoMaxPlanes];
+ uint64_t modifiers[kHwcDrmBoMaxPlanes];
int acquire_fence_fd;
};
-using hwc_drm_bo_t = hwc_drm_bo;
+// NOLINTNEXTLINE(readability-identifier-naming)
+using hwc_drm_bo_t = HwcDrmBo;
#endif // ANDROID_DRMHWCGRALLOC_H_
struct DrmHwcLayer {
buffer_handle_t sf_handle = nullptr;
hwc_drm_bo_t buffer_info{};
- std::shared_ptr<DrmFbIdHandle> FbIdHandle;
+ std::shared_ptr<DrmFbIdHandle> fb_id_handle;
int gralloc_buffer_usage = 0;
DrmHwcTransform transform{};
DrmHwcBlending blending = DrmHwcBlending::kNone;
- uint16_t alpha = 0xffff;
+ uint16_t alpha = UINT16_MAX;
hwc_frect_t source_crop;
hwc_rect_t display_frame;
DrmHwcColorSpace color_space;
UniqueFd acquire_fence;
- int ImportBuffer(DrmDevice *drmDevice);
+ int ImportBuffer(DrmDevice *drm_device);
- bool protected_usage() const {
+ bool IsProtected() const {
return (gralloc_buffer_usage & GRALLOC_USAGE_PROTECTED) ==
GRALLOC_USAGE_PROTECTED;
}
return -EINVAL;
}
int ret = pthread_mutex_lock(mutex_);
- if (ret) {
+ if (ret != 0) {
ALOGE("Failed to acquire %s lock %d", name_, ret);
return ret;
}
return -EINVAL;
}
int ret = pthread_mutex_unlock(mutex_);
- if (ret) {
+ if (ret != 0) {
ALOGE("Failed to release %s lock %d", name_, ret);
return ret;
}
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
#define LOG_TAG "hwc-drm-utils"
-#include <log/log.h>
-#include <ui/Gralloc.h>
-#include <ui/GraphicBufferMapper.h>
+#include <utils/log.h>
+
+#include <cerrno>
#include "bufferinfo/BufferInfoGetter.h"
#include "drm/DrmFbImporter.h"
#include "drmhwcomposer.h"
-#define UNUSED(x) (void)(x)
-
namespace android {
-int DrmHwcLayer::ImportBuffer(DrmDevice *drmDevice) {
+int DrmHwcLayer::ImportBuffer(DrmDevice *drm_device) {
buffer_info = hwc_drm_bo_t{};
int ret = BufferInfoGetter::GetInstance()->ConvertBoInfo(sf_handle,
&buffer_info);
- if (ret) {
+ if (ret != 0) {
ALOGE("Failed to convert buffer info %d", ret);
return ret;
}
- FbIdHandle = drmDevice->GetDrmFbImporter().GetOrCreateFbId(&buffer_info);
- if (!FbIdHandle) {
+ fb_id_handle = drm_device->GetDrmFbImporter().GetOrCreateFbId(&buffer_info);
+ if (!fb_id_handle) {
ALOGE("Failed to import buffer");
return -EINVAL;
}