drm_hwcomposer: Add backend-dependent validation for HwcDisplay class
Different DRM/KMS backends have a variable set of limitations, which is
not always exposed via DRM ioctls.
This implementation of backend-dependent validation provides a register
of platform-specific inherited backend class to the map by BackendManager
class. ValidateDisplay function is moved to generic backend
implementantion and separated into 2 additional methods.
The map key is a string that contains the corresponding DRM driver name.
During DrmHwcTwo class initialization the vendor.hwc.backend_override
system property and driver name will be checked and a backend will be set
for the appropriate display. If the map does not have any backend for the
named driver, the generic backend will be used.
Signed-off-by: Matvii Zorin <matvii.zorin@globallogic.com>
diff --git a/include/drmhwctwo.h b/include/drmhwctwo.h
index df75c41..8b1be4b 100644
--- a/include/drmhwctwo.h
+++ b/include/drmhwctwo.h
@@ -31,6 +31,8 @@
namespace android {
+class Backend;
+
class DrmHwcTwo : public hwc2_device_t {
public:
static int HookDevOpen(const struct hw_module_t *module, const char *name,
@@ -256,6 +258,13 @@
uint32_t frames_flattened_ = 0;
};
+ const Backend *backend() const {
+ return backend_.get();
+ }
+ void set_backend(std::unique_ptr<Backend> backend) {
+ backend_ = std::move(backend);
+ }
+
const std::vector<DrmPlane *> &primary_planes() const {
return primary_planes_;
}
@@ -310,6 +319,8 @@
std::vector<DrmPlane *> primary_planes_;
std::vector<DrmPlane *> overlay_planes_;
+ std::unique_ptr<Backend> backend_;
+
VSyncWorker vsync_worker_;
DrmConnector *connector_ = NULL;
DrmCrtc *crtc_ = NULL;