diff options
author | Changyeon Lee <cyeon.lee@samsung.com> | 2023-09-13 15:01:46 +0900 |
---|---|---|
committer | Changyeon Lee <cyeon.lee@samsung.com> | 2023-09-13 19:30:38 +0900 |
commit | 43ba54dafee6ed31c7ac052ff775e70f9c7ab101 (patch) | |
tree | 1c7c44bcff4c6f80a1d12a7558ca122987d57d9c | |
parent | c0986b9d09579f30f9b675947bffdb8d23a328e6 (diff) | |
download | libtdm-vc4-43ba54dafee6ed31c7ac052ff775e70f9c7ab101.tar.gz libtdm-vc4-43ba54dafee6ed31c7ac052ff775e70f9c7ab101.tar.bz2 libtdm-vc4-43ba54dafee6ed31c7ac052ff775e70f9c7ab101.zip |
hwc: do not fix the video layer below the ui layer
if all windows use hw layer, the video layer does
not need to be located below the ui layer.
Change-Id: Ifcf7cb8a8c50f5b687658ff56223f6dc679d75c4
-rw-r--r-- | src/tdm_vc4_hwc.c | 62 |
1 files changed, 34 insertions, 28 deletions
diff --git a/src/tdm_vc4_hwc.c b/src/tdm_vc4_hwc.c index fb77552..5692263 100644 --- a/src/tdm_vc4_hwc.c +++ b/src/tdm_vc4_hwc.c @@ -526,13 +526,13 @@ _vc4_hwc_apply_policy(tdm_vc4_hwc *hwc_data , hal_tdm_hwc_window **composited_wn tdm_vc4_hwc_window *hwc_window_data = NULL; tdm_vc4_hwc_window **composited_list = NULL; int client_count = 0, device_count = 0, video_count = 0, cursor_count = 0; - int ui_lzpos_top = 0, ui_lzpos_bottom = 0, num_ui_layers = 0, video_lzpos_top = 0; + int lzpos_top = 0, lzpos_bottom = 0, num_layers = 0; int set_clients_below = 0; int i = 0; - num_ui_layers = output_data->overlay_layer_count + 1; - ui_lzpos_top = output_data->overlay_layer_count; - ui_lzpos_bottom = 0; + num_layers = output_data->overlay_layer_count + 1; + lzpos_top = output_data->overlay_layer_count; + lzpos_bottom = 0; composited_list = (tdm_vc4_hwc_window **)composited_wnds; @@ -548,7 +548,7 @@ _vc4_hwc_apply_policy(tdm_vc4_hwc *hwc_data , hal_tdm_hwc_window **composited_wn /* use the target_window to commit when there is no window. */ if (num_wnds == 0) { hwc_data->need_target_window = 1; - hwc_data->target_hwc_window->lzpos = ui_lzpos_bottom; + hwc_data->target_hwc_window->lzpos = lzpos_bottom; return; } @@ -556,6 +556,7 @@ _vc4_hwc_apply_policy(tdm_vc4_hwc *hwc_data , hal_tdm_hwc_window **composited_wn for (i = 0; i < num_wnds; i++) { switch (composited_list[i]->client_type) { case HAL_TDM_HWC_WIN_COMPOSITION_VIDEO: + if (num_layers <= 0) break; composited_list[i]->validated_type = HAL_TDM_HWC_WIN_COMPOSITION_VIDEO; video_count++; continue; @@ -569,12 +570,12 @@ _vc4_hwc_apply_policy(tdm_vc4_hwc *hwc_data , hal_tdm_hwc_window **composited_wn continue; case HAL_TDM_HWC_WIN_COMPOSITION_DEVICE: if (set_clients_below) break; - if (num_ui_layers <= 0) break; + if (num_layers <= 0) break; if (!_vc4_hwc_window_can_set_on_hw_layer(composited_list[i])) break; composited_list[i]->validated_type = HAL_TDM_HWC_WIN_COMPOSITION_DEVICE; device_count++; - num_ui_layers--; + num_layers--; continue; default: break; @@ -586,40 +587,45 @@ _vc4_hwc_apply_policy(tdm_vc4_hwc *hwc_data , hal_tdm_hwc_window **composited_wn } /* 2. check need target window and set ui_lzpos top and bottom */ - num_ui_layers = output_data->overlay_layer_count + 1; + num_layers = output_data->overlay_layer_count + 1; - if (video_count > 0) { - ui_lzpos_bottom += video_count; - num_ui_layers -= video_count; - video_lzpos_top = video_count - 1; - } - - if ((client_count > 0) || (device_count > num_ui_layers)) { + if ((client_count > 0) || ((device_count + video_count) > num_layers)) { hwc_data->need_target_window = 1; - hwc_data->target_hwc_window->lzpos = ui_lzpos_bottom; - ui_lzpos_bottom++; - num_ui_layers--; + hwc_data->target_hwc_window->lzpos = video_count; + lzpos_bottom += video_count; + num_layers--; } - if (num_ui_layers > device_count) - ui_lzpos_top = ui_lzpos_bottom + device_count - 1; + if (num_layers > (device_count + video_count)) { + if (hwc_data->need_target_window) + lzpos_top = lzpos_bottom + device_count - 1; + else + lzpos_top = lzpos_bottom + device_count + video_count - 1; + } /* 3. set lzpos and modify validate_type with target_window */ for (i = 0; i < num_wnds; i++) { switch (composited_list[i]->validated_type) { - case HAL_TDM_HWC_WIN_COMPOSITION_VIDEO: - composited_list[i]->lzpos = video_lzpos_top; - video_lzpos_top--; - continue; case HAL_TDM_HWC_WIN_COMPOSITION_CURSOR: if (!output_data->cursor_layer) break; composited_list[i]->lzpos = output_data->cursor_layer->zpos; continue; + case HAL_TDM_HWC_WIN_COMPOSITION_VIDEO: + if (num_layers <= 0) break; + if (hwc_data->need_target_window) { + composited_list[i]->lzpos = video_count - 1; + video_count--; + } else { + composited_list[i]->lzpos = lzpos_top; + lzpos_top--; + } + num_layers--; + continue; case HAL_TDM_HWC_WIN_COMPOSITION_DEVICE: - if (num_ui_layers <= 0) break; - composited_list[i]->lzpos = ui_lzpos_top; - ui_lzpos_top--; - num_ui_layers--; + if (num_layers <= 0) break; + composited_list[i]->lzpos = lzpos_top; + lzpos_top--; + num_layers--; continue; default: break; |