drm_hwcomposer: Add DrmMode::SameSize Helper function to check if two modes have the same size by comparing the vdisplay and hdisplay of the underlying drmModeModeInfo. Change-Id: Idb1923e6f7ff42d886f9e851e15fdac99af54fb9 Signed-off-by: Drew Davenport <ddavenport@google.com>
diff --git a/drm/DrmMode.cpp b/drm/DrmMode.cpp index 7cbea44..d9fdb37 100644 --- a/drm/DrmMode.cpp +++ b/drm/DrmMode.cpp
@@ -28,6 +28,11 @@ return memcmp(&m, &mode_, offsetof(drmModeModeInfo, name)) == 0; } +bool DrmMode::SameSize(const DrmMode &mode) const { + return (mode_.vdisplay == mode.mode_.vdisplay) && + (mode_.hdisplay == mode.mode_.hdisplay); +} + auto DrmMode::CreateModeBlob(const DrmDevice &drm) -> DrmModeUserPropertyBlobUnique { struct drm_mode_modeinfo drm_mode = {};
diff --git a/drm/DrmMode.h b/drm/DrmMode.h index 5450daf..7520824 100644 --- a/drm/DrmMode.h +++ b/drm/DrmMode.h
@@ -35,6 +35,8 @@ bool operator==(const drmModeModeInfo &m) const; + bool SameSize(const DrmMode &mode) const; + auto &GetRawMode() const { return mode_; }