Currently the drm_hwcomposer can look at EDID data to determine
the DPI for the screen. However, on many 21"+ monitors, the DPI may
be quite low (sub-100), despite having resonable resolution.
Since Android will scale the display to the DPI with touch targets
sized for a phone (assuming you're holding the device), this
results in insanely tiny fonts and very small icons, providing a
bad expeirence on a standard monitor.
To try to remedy this, set a minimum DPI (160dpi) to ensure that
we don't try to scale things down too far.
Change-Id: I39a1376a2c2ed1c27f09e5d716a6941b507fc5f8
Cc: Rob Herring <rob.herring@linaro.org>
Cc: Vishal Bhoj <vishal.bhoj@linaro.org>
Cc: Amit Pundir <amit.pundir@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
#include <utils/Trace.h>
#define UM_PER_INCH 25400
+#define MIN_DPI 160 /* Min 160 DPI value to keep things sane*/
namespace android {
values[i] = mode.v_display();
break;
case HWC_DISPLAY_DPI_X:
- /* Dots per 1000 inches */
- values[i] = mm_width ? (mode.h_display() * UM_PER_INCH) / mm_width : 0;
+ if (mm_width) {
+ /* Dots per 1000 inches */
+ int32_t dpki = (mode.h_display() * UM_PER_INCH) / mm_width;
+ values[i] = std::max(dpki, MIN_DPI*1000);
+ } else
+ values[i] = 0;
break;
case HWC_DISPLAY_DPI_Y:
- /* Dots per 1000 inches */
- values[i] =
- mm_height ? (mode.v_display() * UM_PER_INCH) / mm_height : 0;
+ if (mm_height) {
+ /* Dots per 1000 inches */
+ int32_t dpki = (mode.v_display() * UM_PER_INCH) / mm_height;
+ values[i] = std::max(dpki, MIN_DPI*1000);
+ } else
+ values[i] = 0;
break;
}
}