Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-drm_hwcomposer: Commit

external/drm_hwcomposer


Commit MetaInfo

Revisionefbe9752bb685a138c4fadf96f199e173278e328 (tree)
Time2019-10-17 13:24:14
AuthorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

drm_hwcomposer: allow to force mode by a property

The desired resolution could be set by property debug.drm.mode.force.
The other modes are ignored.

Change Summary

Incremental Difference

--- a/drmconnector.cpp
+++ b/drmconnector.cpp
@@ -23,6 +23,7 @@
2323 #include <stdint.h>
2424
2525 #include <cutils/log.h>
26+#include <cutils/properties.h>
2627 #include <xf86drmMode.h>
2728
2829 namespace android {
@@ -74,6 +75,19 @@ bool DrmConnector::built_in() const {
7475 }
7576
7677 int DrmConnector::UpdateModes() {
78+ char value[PROPERTY_VALUE_MAX];
79+ uint32_t xres = 0, yres = 0, rate = 0;
80+ if (property_get("debug.drm.mode.force", value, NULL)) {
81+ // parse <xres>x<yres>[@<refreshrate>]
82+ if (sscanf(value, "%dx%d@%d", &xres, &yres, &rate) != 3) {
83+ rate = 0;
84+ if (sscanf(value, "%dx%d", &xres, &yres) != 2) {
85+ xres = yres = 0;
86+ }
87+ }
88+ ALOGI_IF(xres && yres, "force mode to %dx%d@%dHz", xres, yres, rate);
89+ }
90+
7791 int fd = drm_->fd();
7892
7993 drmModeConnectorPtr c = drmModeGetConnector(fd, id_);
@@ -98,8 +112,14 @@ int DrmConnector::UpdateModes() {
98112 continue;
99113
100114 DrmMode m(&c->modes[i]);
115+ if (xres && yres) {
116+ if (m.h_display() != xres || m.v_display() != yres ||
117+ (rate && uint32_t(m.v_refresh()) != rate))
118+ continue;
119+ }
101120 m.set_id(drm_->next_mode_id());
102121 new_modes.push_back(m);
122+ ALOGD("add new mode %dx%d@%.1f id %d for display %d", m.h_display(), m.v_display(), m.v_refresh(), m.id(), display_);
103123 }
104124 modes_.swap(new_modes);
105125 return 0;
Show on old repository browser