TDM_BACKEND_RETURN_VAL_IF_FAIL(layer_data, HAL_TDM_ERROR_OPERATION_FAILED);
if (hwc_window_data == NULL || hwc_window_data->surface == NULL) {
- if (layer_data->display_buffer)
- ret = tdm_vc4_layer_unset_buffer(layer_data);
+ if (layer_data->hwc_window_data)
+ layer_data->hwc_window_data->attach_buffer_changed = 1;
+
+ ret = tdm_vc4_layer_set_hwc_window(layer_data, NULL);
TDM_BACKEND_RETURN_VAL_IF_FAIL(ret == HAL_TDM_ERROR_NONE, ret);
- if (layer_data->acquire_fence >= 0)
+ if (layer_data->display_buffer) {
+ ret = tdm_vc4_layer_unset_buffer(layer_data);
+ TDM_BACKEND_RETURN_VAL_IF_FAIL(ret == HAL_TDM_ERROR_NONE, ret);
+ }
+
+ if (layer_data->acquire_fence >= 0) {
ret = tdm_vc4_layer_set_acquire_fence(layer_data, -1);
- TDM_BACKEND_RETURN_VAL_IF_FAIL(ret == HAL_TDM_ERROR_NONE, ret);
+ TDM_BACKEND_RETURN_VAL_IF_FAIL(ret == HAL_TDM_ERROR_NONE, ret);
+ }
} else {
+ TDM_BACKEND_RETURN_VAL_IF_FAIL(hwc_window_data->surface != NULL, HAL_TDM_ERROR_INVALID_PARAMETER);
+
+ if ((layer_data->hwc_window_data) && (layer_data->hwc_window_data != hwc_window_data))
+ layer_data->hwc_window_data->attach_buffer_changed = 1;
+
+ ret = tdm_vc4_layer_set_hwc_window(layer_data, hwc_window_data);
+ TDM_BACKEND_RETURN_VAL_IF_FAIL(ret == HAL_TDM_ERROR_NONE, ret);
+
ret = tdm_vc4_layer_set_info((tdm_vc4_layer *)layer_data, (tdm_vc4_layer_info *)&(hwc_window_data->info));
TDM_BACKEND_RETURN_VAL_IF_FAIL(ret == HAL_TDM_ERROR_NONE, ret);
- TDM_BACKEND_RETURN_VAL_IF_FAIL(hwc_window_data->surface != NULL, HAL_TDM_ERROR_INVALID_PARAMETER);
+
ret = tdm_vc4_layer_set_buffer(layer_data, hwc_window_data->surface);
TDM_BACKEND_RETURN_VAL_IF_FAIL(ret == HAL_TDM_ERROR_NONE, ret);
+
+ if (layer_data->display_buffer_changed)
+ hwc_window_data->attach_buffer_changed = 1;
+
ret = tdm_vc4_layer_set_acquire_fence(layer_data, hwc_window_data->acquire_fence);
TDM_BACKEND_RETURN_VAL_IF_FAIL(ret == HAL_TDM_ERROR_NONE, ret);
}
{
tdm_vc4_hwc_window *hwc_window_data = NULL;
tdm_vc4_layer *layer_data = NULL;
- int use_layers_zpos[NUM_LAYERS] = {0,};
+ tdm_vc4_hwc_window *use_layer_windows[NUM_LAYERS] = {NULL, };
int lzpos = 0;
int cursor_enabled = 0;
- /* set target hwc window to the layer_data */
- if (hwc_data->need_target_window) {
- layer_data = tdm_vc4_output_get_layer_data(hwc_data->output_data, hwc_data->target_hwc_window->lzpos);
- _vc4_hwc_layer_attach_window(layer_data, hwc_data->target_hwc_window);
- use_layers_zpos[hwc_data->target_hwc_window->lzpos] = 1;
- }
+ /* set target hwc window to the layer */
+ hwc_data->target_hwc_window->attach_buffer_changed = 0;
+ if (hwc_data->need_target_window)
+ use_layer_windows[hwc_data->target_hwc_window->lzpos] = hwc_data->target_hwc_window;
/* set the hwc_windows to the layers */
LIST_FOR_EACH_ENTRY_REV(hwc_window_data, &hwc_data->hwc_window_list, link) {
- if (hwc_window_data->validated_type == HAL_TDM_HWC_WIN_COMPOSITION_NONE ||
- hwc_window_data->validated_type == HAL_TDM_HWC_WIN_COMPOSITION_CLIENT) {
+ hwc_window_data->attach_buffer_changed = 0;
+
+ if ((hwc_window_data->validated_type == HAL_TDM_HWC_WIN_COMPOSITION_NONE) ||
+ (hwc_window_data->validated_type == HAL_TDM_HWC_WIN_COMPOSITION_CLIENT)) {
if (hwc_window_data->cursor_img_surface)
_vc4_hwc_cursor_window_surface_clear(hwc_window_data);
continue;
}
- if (hwc_window_data == hwc_data->target_hwc_window)
- continue;
-
/* set the cursor buffer HERE if it needs */
if (hwc_window_data->validated_type == HAL_TDM_HWC_WIN_COMPOSITION_CURSOR) {
_vc4_hwc_cursor_buffer_set(hwc_data, hwc_window_data);
cursor_enabled = 1;
}
- layer_data = tdm_vc4_output_get_layer_data(hwc_data->output_data, hwc_window_data->lzpos);
- _vc4_hwc_layer_attach_window(layer_data, hwc_window_data);
- use_layers_zpos[hwc_window_data->lzpos] = 1;
+ use_layer_windows[hwc_window_data->lzpos] = hwc_window_data;
}
/* unset the unused layers */
for (lzpos = 0; lzpos < NUM_LAYERS; lzpos++) {
- if (use_layers_zpos[lzpos])
- continue;
-
layer_data = tdm_vc4_output_get_layer_data(hwc_data->output_data, lzpos);
if (!layer_data)
continue;
- _vc4_hwc_layer_attach_window(layer_data, NULL);
+ _vc4_hwc_layer_attach_window(layer_data, use_layer_windows[lzpos]);
}
if (!cursor_enabled)
_vc4_hwc_cursor_buffer_unset(hwc_data);
/* for debug */
- for (lzpos = NUM_LAYERS -1 ; lzpos >= 0; lzpos--) {
- if (use_layers_zpos[lzpos])
- TDM_BACKEND_DBG(" lzpos(%d) : %s", lzpos, use_layers_zpos[lzpos] ? "SET" : "UNSET");
- }
+ for (lzpos = NUM_LAYERS -1 ; lzpos >= 0; lzpos--)
+ TDM_BACKEND_DBG(" lzpos(%d) : %s", lzpos, use_layer_windows[lzpos] ? "SET" : "UNSET");
return HAL_TDM_ERROR_NONE;
}
TDM_BACKEND_RETURN_VAL_IF_FAIL(output_data, HAL_TDM_ERROR_INVALID_PARAMETER);
LIST_FOR_EACH_ENTRY_REV(hwc_window_data, &hwc_data->hwc_window_list, link) {
- if ((hwc_window_data->validated_type != HAL_TDM_HWC_WIN_COMPOSITION_DEVICE) &&
- (hwc_window_data->validated_type != HAL_TDM_HWC_WIN_COMPOSITION_VIDEO))
+ if (!hwc_window_data->attach_buffer_changed)
continue;
if (hwc_wnds && fences) {