summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGowtham Tammana <g-tammana@ti.com>2017-12-21 14:17:33 -0600
committerGowtham Tammana <g-tammana@ti.com>2018-01-02 16:34:21 -0600
commit01ce70d558cfa06a6aa2f56cb7be1c0d2d286780 (patch)
treed3fefbee3caf2c2a6acd88b2a6249fea329a2e28
parent93ebb954edaf5c76a9ee84a98cf2dd18e25ceba9 (diff)
downloaddra7xx-d-oreo-r6-release.tar.gz
hwc: Add support for pageflip display update moded-oreo-r6-release
Currently the hwc implementation is using atomic modeset API to update display. Adding support for pageflip way of updating display to support some demo/test usecases. To enable pageflip option set the following through either makefile or Board config file. Makefile option: - {m,mm,mmm} HWC_USE_DRM_PAGEFLIP_MODE=true <project> or add below to BoardConfig.mk file - HWC_USE_DRM_PAGEFLIP_MODE := true Change-Id: Icefc82e49c95f7bee34bb553adc7b109d28ef2bb Signed-off-by: Gowtham Tammana <g-tammana@ti.com>
-rw-r--r--hwcomposer/Android.mk4
-rw-r--r--hwcomposer/display.c19
-rw-r--r--hwcomposer/hwc.c9
3 files changed, 30 insertions, 2 deletions
diff --git a/hwcomposer/Android.mk b/hwcomposer/Android.mk
index 3b5e940..d76dd8d 100644
--- a/hwcomposer/Android.mk
+++ b/hwcomposer/Android.mk
@@ -28,6 +28,10 @@ LOCAL_SRC_FILES := \
sw_vsync.c \
utils.c
+ifeq ($(HWC_USE_DRM_PAGEFLIP_MODE),true)
+ LOCAL_CFLAGS += -DHWC_USE_DRM_PAGEFLIP_MODE
+endif
+
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := hwcomposer.$(TARGET_BOARD_PLATFORM)
diff --git a/hwcomposer/display.c b/hwcomposer/display.c
index b58d3f9..098643f 100644
--- a/hwcomposer/display.c
+++ b/hwcomposer/display.c
@@ -840,11 +840,14 @@ int init_primary_display(omap_hwc_device_t *hwc_dev)
ALOGE("failed to set DRM_CLIENT_CAP_UNIVERSAL_PLANES");
goto close;
}
+
+#ifndef HWC_USE_DRM_PAGEFLIP_API
i = drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC, 1);
if (i) {
ALOGE("omapdrm is not capable of atomic modesetting");
goto close;
}
+#endif
resources = drmModeGetResources(drm_fd);
if (!resources) {
@@ -1200,14 +1203,16 @@ static int display_configure_pipes(display_t *display)
}
plane_info->fb_info = fb_info;
+#ifndef HWC_USE_DRM_PAGEFLIP_MODE
err = set_plane_properties(kdisp->atomic_req, plane_info, &fb_info);
if (err) {
ALOGE("Failed to configure plane %d (error: %s)",
plane_info->plane_id, strerror(err));
}
+#endif
}
}
- if (comp->used_ovls == 1 && display->layer_stats.nv12) {
+ if (comp->used_ovls == 1 && comp->use_dss && display->layer_stats.nv12) {
plane_info = &comp->plane_info[comp->ovl_indices[1]];
plane_info->crtc_w = kdisp->dummy_fb.width;
plane_info->crtc_h = kdisp->dummy_fb.height;
@@ -1308,13 +1313,21 @@ int update_display(omap_hwc_device_t *ctx, int disp,
fence_fd = timeline_create_fence(&display->retire_sync, "hwc_retire_fence2",
TWO_FLIP_EVENTS);
+#ifndef HWC_USE_DRM_PAGEFLIP_MODE
kdisp->atomic_req = drmModeAtomicAlloc();
+#endif
ret = display_configure_pipes(display);
+#ifndef HWC_USE_DRM_PAGEFLIP_MODE
ret = drmModeAtomicCommit(ctx->drm_fd, kdisp->atomic_req,
DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK, display);
+#else
+ ret = drmModePageFlip(ctx->drm_fd, kdisp->crtc_id,
+ comp->plane_info[comp->ovl_indices[0]].fb_info.fb_id,
+ DRM_MODE_PAGE_FLIP_EVENT, display);
+#endif
if (ret) {
- ALOGE("cannot do atomic commit %d (%s): %d",
+ ALOGE("cannot do atomic commit/page flip %d (%s): %d",
errno, strerror(errno), ret);
pthread_mutex_unlock(&display->lock);
close(fence_fd);
@@ -1323,7 +1336,9 @@ int update_display(omap_hwc_device_t *ctx, int disp,
goto fb_cleanup;
}
+#ifndef HWC_USE_DRM_PAGEFLIP_MODE
drmModeAtomicFree(kdisp->atomic_req);
+#endif
for (i = 0; i < DSS_AVAILABLE_PIPES; i++) {
kdisp->fb_bufs[i].next = comp->plane_info[comp->ovl_indices[i]].fb_info;
diff --git a/hwcomposer/hwc.c b/hwcomposer/hwc.c
index dbe3450..8016d36 100644
--- a/hwcomposer/hwc.c
+++ b/hwcomposer/hwc.c
@@ -160,6 +160,11 @@ static void hwc_check_dss_composition(omap_hwc_device_t *hwc_dev, int disp)
hwc_layer_1_t *layer = NULL;
uint32_t i, j;
+#ifdef HWC_USE_DRM_PAGEFLIP_MODE
+ /* DSS composition is supported only for atomic mode API usage */
+ return;
+#endif
+
if (disp || list->numHwLayers == 1 || comp->use_blitter)
return;
@@ -876,6 +881,10 @@ static int hwc_device_open(const hw_module_t* module, const char* name, hw_devic
hwc_dev->upscaled_nv12_limit = 2.;
}
+#ifdef HWC_USE_DRM_PAGEFLIP_MODE
+ ALOGI("Using older drm pageflip API to update display");
+#endif
+
hwc_dev->tiler1d_slot_size = 32*1024*1024; //32MB
/*