From ce768b26571c66e176fa6d10c64ded578da937d9 Mon Sep 17 00:00:00 2001 From: "Mike J. Chen" Date: Mon, 21 May 2012 17:18:20 -0700 Subject: hwc: Stash hdmi mode resolution in a property The property can be read by apps like YouTube to choose lower resolution videos if the hdmi mode is < 1080p. Saves bandwidth, latency, and time wasted scaling. Change-Id: Iab46699f4ea2208f1f9475420d57ccf1e16214df Signed-off-by: Mike J. Chen --- hwc/hwc.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/hwc/hwc.c b/hwc/hwc.c index 4a18fc9f..49c22f0c 100644 --- a/hwc/hwc.c +++ b/hwc/hwc.c @@ -1015,8 +1015,23 @@ static int omap4_hwc_set_best_hdmi_mode(omap4_hwc_device_t *hwc_dev, __u32 xres, sdis.mode = d.dis.modedb[best]; LOGD("picking #%d", best); /* only reconfigure on change */ - if (ext->last_mode != ~best) + if (ext->last_mode != ~best) { + /* set a property that apps that care (e.g. YouTube) can use + * to determine whether or not to stream lower resolution + * videos when the hdmi mode is < 1080p. + * otherwise, they'd give us 1080p and we'd just scale it + * down to the hdmi mode res. UI apps are always going + * to draw at 1080p and we'll scale down because the + * system can't support dynamic dpi changes. + */ + char display[PROPERTY_VALUE_MAX]; + snprintf(display, sizeof(display), "%dx%d", + d.modedb[best].xres, d.modedb[best].yres); + LOGD("setting property sys.display-size to %s", display); + property_set("sys.display-size", display); + ioctl(hwc_dev->dsscomp_fd, DSSCIOC_SETUP_DISPLAY, &sdis); + } ext->last_mode = ~best; } else { __u32 ext_width = d.dis.width_in_mm; -- cgit v1.2.3