Android-x86
Fork
Faire un don

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-drm_hwcomposer: Commit

external/drm_hwcomposer


Commit MetaInfo

Révision792fa3e7ebbeef2817f9c20ea4fc692ae1ae7f67 (tree)
l'heure2018-11-02 16:06:15
AuteurChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Message de Log

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

Modification

--- 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 {
@@ -83,6 +84,19 @@ bool DrmConnector::valid_type() const {
8384 }
8485
8586 int DrmConnector::UpdateModes() {
87+ char value[PROPERTY_VALUE_MAX];
88+ uint32_t xres = 0, yres = 0, rate = 0;
89+ if (property_get("debug.drm.mode.force", value, NULL)) {
90+ // parse <xres>x<yres>[@<refreshrate>]
91+ if (sscanf(value, "%dx%d@%d", &xres, &yres, &rate) != 3) {
92+ rate = 0;
93+ if (sscanf(value, "%dx%d", &xres, &yres) != 2) {
94+ xres = yres = 0;
95+ }
96+ }
97+ ALOGI_IF(xres && yres, "force mode to %dx%d@%dHz", xres, yres, rate);
98+ }
99+
86100 int fd = drm_->fd();
87101
88102 drmModeConnectorPtr c = drmModeGetConnector(fd, id_);
@@ -107,8 +121,14 @@ int DrmConnector::UpdateModes() {
107121 continue;
108122
109123 DrmMode m(&c->modes[i]);
124+ if (xres && yres) {
125+ if (m.h_display() != xres || m.v_display() != yres ||
126+ (rate && uint32_t(m.v_refresh()) != rate))
127+ continue;
128+ }
110129 m.set_id(drm_->next_mode_id());
111130 new_modes.push_back(m);
131+ ALOGD("add new mode %dx%d@%.1f id %d for display %d", m.h_display(), m.v_display(), m.v_refresh(), m.id(), display_);
112132 }
113133 modes_.swap(new_modes);
114134 return 0;
Afficher sur ancien navigateur de dépôt.