aboutsummaryrefslogtreecommitdiff
path: root/hwcomposer.cpp
diff options
context:
space:
mode:
authorSean Paul <seanpaul@chromium.org>2015-02-04 10:34:47 -0800
committerSean Paul <seanpaul@google.com>2015-02-04 14:46:27 -0800
commit24a26e3e5f975c6552e30a946792821ba69b654e (patch)
tree6473320e2b545c343f0c92a66953407dfd3757b8 /hwcomposer.cpp
parentdffca95b7b29cbaf3a7ca2dcdc077b283d8004b1 (diff)
downloaddrm_hwcomposer-24a26e3e5f975c6552e30a946792821ba69b654e.tar.gz
drm_hwcomposer: Set display config on initialization
We shouldn't wait for surfaceflinger to set active config, initialize the display with a config. For now we just choose the first config in the list. This should change to a more sane choice, such as the preferred mode or something similar. Signed-off-by: Sean Paul <seanpaul@chromium.org> Change-Id: Ib063080c282cec28c9b0218c0ba5151d48b367ce
Diffstat (limited to 'hwcomposer.cpp')
-rw-r--r--hwcomposer.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/hwcomposer.cpp b/hwcomposer.cpp
index 214b40d..2ed2073 100644
--- a/hwcomposer.cpp
+++ b/hwcomposer.cpp
@@ -1116,6 +1116,36 @@ err_cond:
return ret;
}
+/*
+ * TODO: This function sets the active config to the first one in the list. This
+ * should be fixed such that it selects the preferred mode for the display, or
+ * some other, saner, method of choosing the config.
+ */
+static int hwc_set_initial_config(struct hwc_drm_display *hd)
+{
+ int ret;
+ uint32_t config;
+ size_t num_configs = 1;
+
+ ret = hwc_get_display_configs(&hd->ctx->device, hd->display, &config,
+ &num_configs);
+ if (ret) {
+ ALOGE("Failed to get display configs d=%d ret=%d", hd->display,
+ ret);
+ }
+ if (!num_configs)
+ return 0;
+
+ ret = hwc_set_active_config(&hd->ctx->device, hd->display, 0);
+ if (ret) {
+ ALOGE("Failed to set active config d=%d ret=%d", hd->display,
+ ret);
+ return ret;
+ }
+
+ return ret;
+}
+
static int hwc_initialize_display(struct hwc_context_t *ctx, int display,
uint32_t connector_id)
{
@@ -1139,6 +1169,13 @@ static int hwc_initialize_display(struct hwc_context_t *ctx, int display,
}
hd->timeline_fd = ret;
+ ret = hwc_set_initial_config(hd);
+ if (ret) {
+ ALOGE("Failed to set initial config for d=%d ret=%d", display,
+ ret);
+ return ret;
+ }
+
ret = hwc_initialize_worker(hd, &hd->set_worker, hwc_set_worker);
if (ret) {
ALOGE("Failed to create set worker %d\n", ret);