summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGowtham Tammana2017-12-21 14:17:33 -0600
committerGowtham Tammana2018-01-02 16:34:21 -0600
commit01ce70d558cfa06a6aa2f56cb7be1c0d2d286780 (patch)
treed3fefbee3caf2c2a6acd88b2a6249fea329a2e28
parent93ebb954edaf5c76a9ee84a98cf2dd18e25ceba9 (diff)
downloadhardware-ti-dra7xx-01ce70d558cfa06a6aa2f56cb7be1c0d2d286780.tar.gz
hardware-ti-dra7xx-01ce70d558cfa06a6aa2f56cb7be1c0d2d286780.tar.xz
hardware-ti-dra7xx-01ce70d558cfa06a6aa2f56cb7be1c0d2d286780.zip
hwc: Add support for pageflip display update mode
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 := \
28 sw_vsync.c \ 28 sw_vsync.c \
29 utils.c 29 utils.c
30 30
31ifeq ($(HWC_USE_DRM_PAGEFLIP_MODE),true)
32 LOCAL_CFLAGS += -DHWC_USE_DRM_PAGEFLIP_MODE
33endif
34
31LOCAL_MODULE_TAGS := optional 35LOCAL_MODULE_TAGS := optional
32 36
33LOCAL_MODULE := hwcomposer.$(TARGET_BOARD_PLATFORM) 37LOCAL_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)
840 ALOGE("failed to set DRM_CLIENT_CAP_UNIVERSAL_PLANES"); 840 ALOGE("failed to set DRM_CLIENT_CAP_UNIVERSAL_PLANES");
841 goto close; 841 goto close;
842 } 842 }
843
844#ifndef HWC_USE_DRM_PAGEFLIP_API
843 i = drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC, 1); 845 i = drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC, 1);
844 if (i) { 846 if (i) {
845 ALOGE("omapdrm is not capable of atomic modesetting"); 847 ALOGE("omapdrm is not capable of atomic modesetting");
846 goto close; 848 goto close;
847 } 849 }
850#endif
848 851
849 resources = drmModeGetResources(drm_fd); 852 resources = drmModeGetResources(drm_fd);
850 if (!resources) { 853 if (!resources) {
@@ -1200,14 +1203,16 @@ static int display_configure_pipes(display_t *display)
1200 } 1203 }
1201 plane_info->fb_info = fb_info; 1204 plane_info->fb_info = fb_info;
1202 1205
1206#ifndef HWC_USE_DRM_PAGEFLIP_MODE
1203 err = set_plane_properties(kdisp->atomic_req, plane_info, &fb_info); 1207 err = set_plane_properties(kdisp->atomic_req, plane_info, &fb_info);
1204 if (err) { 1208 if (err) {
1205 ALOGE("Failed to configure plane %d (error: %s)", 1209 ALOGE("Failed to configure plane %d (error: %s)",
1206 plane_info->plane_id, strerror(err)); 1210 plane_info->plane_id, strerror(err));
1207 } 1211 }
1212#endif
1208 } 1213 }
1209 } 1214 }
1210 if (comp->used_ovls == 1 && display->layer_stats.nv12) { 1215 if (comp->used_ovls == 1 && comp->use_dss && display->layer_stats.nv12) {
1211 plane_info = &comp->plane_info[comp->ovl_indices[1]]; 1216 plane_info = &comp->plane_info[comp->ovl_indices[1]];
1212 plane_info->crtc_w = kdisp->dummy_fb.width; 1217 plane_info->crtc_w = kdisp->dummy_fb.width;
1213 plane_info->crtc_h = kdisp->dummy_fb.height; 1218 plane_info->crtc_h = kdisp->dummy_fb.height;
@@ -1308,13 +1313,21 @@ int update_display(omap_hwc_device_t *ctx, int disp,
1308 fence_fd = timeline_create_fence(&display->retire_sync, "hwc_retire_fence2", 1313 fence_fd = timeline_create_fence(&display->retire_sync, "hwc_retire_fence2",
1309 TWO_FLIP_EVENTS); 1314 TWO_FLIP_EVENTS);
1310 1315
1316#ifndef HWC_USE_DRM_PAGEFLIP_MODE
1311 kdisp->atomic_req = drmModeAtomicAlloc(); 1317 kdisp->atomic_req = drmModeAtomicAlloc();
1318#endif
1312 1319
1313 ret = display_configure_pipes(display); 1320 ret = display_configure_pipes(display);
1321#ifndef HWC_USE_DRM_PAGEFLIP_MODE
1314 ret = drmModeAtomicCommit(ctx->drm_fd, kdisp->atomic_req, 1322 ret = drmModeAtomicCommit(ctx->drm_fd, kdisp->atomic_req,
1315 DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK, display); 1323 DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK, display);
1324#else
1325 ret = drmModePageFlip(ctx->drm_fd, kdisp->crtc_id,
1326 comp->plane_info[comp->ovl_indices[0]].fb_info.fb_id,
1327 DRM_MODE_PAGE_FLIP_EVENT, display);
1328#endif
1316 if (ret) { 1329 if (ret) {
1317 ALOGE("cannot do atomic commit %d (%s): %d", 1330 ALOGE("cannot do atomic commit/page flip %d (%s): %d",
1318 errno, strerror(errno), ret); 1331 errno, strerror(errno), ret);
1319 pthread_mutex_unlock(&display->lock); 1332 pthread_mutex_unlock(&display->lock);
1320 close(fence_fd); 1333 close(fence_fd);
@@ -1323,7 +1336,9 @@ int update_display(omap_hwc_device_t *ctx, int disp,
1323 goto fb_cleanup; 1336 goto fb_cleanup;
1324 } 1337 }
1325 1338
1339#ifndef HWC_USE_DRM_PAGEFLIP_MODE
1326 drmModeAtomicFree(kdisp->atomic_req); 1340 drmModeAtomicFree(kdisp->atomic_req);
1341#endif
1327 1342
1328 for (i = 0; i < DSS_AVAILABLE_PIPES; i++) { 1343 for (i = 0; i < DSS_AVAILABLE_PIPES; i++) {
1329 kdisp->fb_bufs[i].next = comp->plane_info[comp->ovl_indices[i]].fb_info; 1344 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)
160 hwc_layer_1_t *layer = NULL; 160 hwc_layer_1_t *layer = NULL;
161 uint32_t i, j; 161 uint32_t i, j;
162 162
163#ifdef HWC_USE_DRM_PAGEFLIP_MODE
164 /* DSS composition is supported only for atomic mode API usage */
165 return;
166#endif
167
163 if (disp || list->numHwLayers == 1 || comp->use_blitter) 168 if (disp || list->numHwLayers == 1 || comp->use_blitter)
164 return; 169 return;
165 170
@@ -876,6 +881,10 @@ static int hwc_device_open(const hw_module_t* module, const char* name, hw_devic
876 hwc_dev->upscaled_nv12_limit = 2.; 881 hwc_dev->upscaled_nv12_limit = 2.;
877 } 882 }
878 883
884#ifdef HWC_USE_DRM_PAGEFLIP_MODE
885 ALOGI("Using older drm pageflip API to update display");
886#endif
887
879 hwc_dev->tiler1d_slot_size = 32*1024*1024; //32MB 888 hwc_dev->tiler1d_slot_size = 32*1024*1024; //32MB
880 889
881 /* 890 /*