drm_hwcomposer: Add DRM_CURSOR_CAP to DrmDevice
This change reads the DRM_CURSOR_CAP_{WIDTH|HEIGHT} capabilities of
DrmDevice, and exposes their values. These values can be used to
convey a reasonable cursor plane size [1].
[1] https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#c.DRM_CAP_CURSOR_WIDTH
Change-Id: Iecf01d00a9562656c6d5b5aa8e0ac49b1dc739e5
Signed-off-by: Andrew Wolfers <aswolfers@google.com>
diff --git a/drm/DrmDevice.cpp b/drm/DrmDevice.cpp
index fa5849f..f6141d4 100644
--- a/drm/DrmDevice.cpp
+++ b/drm/DrmDevice.cpp
@@ -90,6 +90,14 @@
}
HasAddFb2ModifiersSupport_ = cap_value != 0;
+ uint64_t cursor_width = 0;
+ uint64_t cursor_height = 0;
+ if (drmGetCap(*GetFd(), DRM_CAP_CURSOR_WIDTH, &cursor_width) == 0 &&
+ drmGetCap(*GetFd(), DRM_CAP_CURSOR_HEIGHT, &cursor_height) == 0) {
+ cap_cursor_size_ = std::pair<uint64_t, uint64_t>(cursor_width,
+ cursor_height);
+ }
+
drmSetMaster(*GetFd());
if (drmIsMaster(*GetFd()) == 0) {
ALOGE("DRM/KMS master access required");