}
}
-tdm_vc4_layer_data *
-_vc4_hwc_get_layer(tdm_vc4_hwc_data *hwc_data, int layer_zops)
-{
- tdm_vc4_output_data *output_data = hwc_data->output_data;
- tdm_vc4_layer_data *l = NULL;
-
- LIST_FOR_EACH_ENTRY(l, &output_data->layer_list, link)
- if (l->zpos == layer_zops)
- return l;
-
- return NULL;
-}
-
static int
_vc4_hwc_window_can_set_on_hw_layer(tdm_vc4_hwc_window_data *hwc_window_data)
{
return 1;
}
+static tbm_surface_queue_h
+_vc4_hwc_window_get_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error)
+{
+ tdm_vc4_hwc_window_data *hwc_window_data = NULL;
+ tbm_surface_queue_h tqueue = NULL;
+ int width, height;
+ tbm_format format;
+
+ if (error)
+ *error = TDM_ERROR_INVALID_PARAMETER;
+
+ RETURN_VAL_IF_FAIL(hwc_window != NULL, NULL);
+
+ hwc_window_data = hwc_window;
+
+ width = hwc_window_data->info.src_config.size.h;
+ height = hwc_window_data->info.src_config.size.v;
+ format = hwc_window_data->info.src_config.format;
+
+ tqueue = tbm_surface_queue_create(NUM_BUFFERS, width, height, format, TBM_BO_SCANOUT);
+ if (error)
+ *error = TDM_ERROR_OPERATION_FAILED;
+ RETURN_VAL_IF_FAIL(tqueue != NULL, NULL);
+
+ if (error)
+ *error = TDM_ERROR_NONE;
+
+ return tqueue;
+}
+
+tdm_vc4_layer_data *
+_vc4_hwc_get_layer(tdm_vc4_hwc_data *hwc_data, int layer_zops)
+{
+ tdm_vc4_output_data *output_data = hwc_data->output_data;
+ tdm_vc4_layer_data *l = NULL;
+
+ LIST_FOR_EACH_ENTRY(l, &output_data->layer_list, link)
+ if (l->zpos == layer_zops)
+ return l;
+
+ return NULL;
+}
+
+static tdm_error
+_vc4_hwc_layer_attach_window(tdm_vc4_layer_data *layer_data, tdm_vc4_hwc_window_data *hwc_window_data)
+{
+ tdm_error ret = TDM_ERROR_NONE;
+
+ RETURN_VAL_IF_FAIL(layer_data, TDM_ERROR_OPERATION_FAILED);
+
+ if (hwc_window_data == NULL || hwc_window_data->surface == NULL) {
+ if (layer_data->display_buffer)
+ ret = vc4_layer_unset_buffer(layer_data);
+ RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, ret);
+ } else {
+ ret = vc4_layer_set_info((tdm_layer *)layer_data, (tdm_info_layer *)&(hwc_window_data->info));
+ RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, ret);
+ RETURN_VAL_IF_FAIL(hwc_window_data->surface != NULL, TDM_ERROR_INVALID_PARAMETER);
+ ret = vc4_layer_set_buffer(layer_data, hwc_window_data->surface);
+ RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, ret);
+ }
+
+ return ret;
+}
+
+static tdm_error
+_vc4_hwc_prepare_commit(tdm_vc4_hwc_data *hwc_data)
+{
+ tdm_vc4_hwc_window_data *hwc_window_data = NULL;
+ tdm_vc4_layer_data *layer_data = NULL;
+ int use_layers_zpos[NUM_LAYERS] = {0,};
+ int lzpos = 0;
+
+ /* set target hwc window to the layer */
+ if (hwc_data->need_target_window) {
+ layer_data = _vc4_hwc_get_layer(hwc_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 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 == TDM_HWC_WIN_COMPOSITION_NONE ||
+ hwc_window_data->validated_type == TDM_HWC_WIN_COMPOSITION_CLIENT)
+ continue;
+
+ if (hwc_window_data == hwc_data->target_hwc_window)
+ continue;
+
+ layer_data = _vc4_hwc_get_layer(hwc_data, hwc_window_data->lzpos);
+ _vc4_hwc_layer_attach_window(layer_data, hwc_window_data);
+ use_layers_zpos[hwc_window_data->lzpos] = 1;
+ }
+
+ /* unset the unused layers */
+ for (lzpos = 0; lzpos < NUM_LAYERS; lzpos++) {
+ if (use_layers_zpos[lzpos])
+ continue;
+
+ layer_data = _vc4_hwc_get_layer(hwc_data, lzpos);
+ if (!layer_data)
+ continue;
+
+ _vc4_hwc_layer_attach_window(layer_data, NULL);
+ }
+
+ /* for debug */
+ for (lzpos = NUM_LAYERS -1 ; lzpos >= 0; lzpos--) {
+ if (use_layers_zpos[lzpos])
+ TDM_DBG(" lzpos(%d) : %s", lzpos, use_layers_zpos[lzpos] ? "SET" : "UNSET");
+ }
+
+ return TDM_ERROR_NONE;
+}
+
/* assign the validated_type to the composited_wnds
* assign the layer_zpos to the composited_wnds
*/
hwc_data->target_hwc_window->lzpos = ZPOS_0;
}
-static tdm_error
-_vc4_hwc_layer_attach_window(tdm_vc4_layer_data *layer_data, tdm_vc4_hwc_window_data *hwc_window_data)
-{
- tdm_error ret = TDM_ERROR_NONE;
-
- if (hwc_window_data == NULL || hwc_window_data->surface == NULL) {
- if (layer_data->display_buffer)
- ret = vc4_layer_unset_buffer(layer_data);
- RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, ret);
- } else {
- ret = vc4_layer_set_info((tdm_layer *)layer_data, (tdm_info_layer *)&(hwc_window_data->info));
- RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, ret);
- RETURN_VAL_IF_FAIL(hwc_window_data->surface != NULL, TDM_ERROR_INVALID_PARAMETER);
- ret = vc4_layer_set_buffer(layer_data, hwc_window_data->surface);
- RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, ret);
- }
-
- return ret;
-}
-
-static void
-_vc4_hwc_prepare_commit(tdm_vc4_hwc_data *hwc_data)
-{
- tdm_vc4_hwc_window_data *hwc_window_data = NULL;
- tdm_vc4_layer_data *layer_data = NULL;
- int use_layers_zpos[NUM_LAYERS] = {0,};
- int lzpos = 0;
-
- /* set target hwc window to the layer */
- if (hwc_data->need_target_window) {
- layer_data = _vc4_hwc_get_layer(hwc_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 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 == TDM_HWC_WIN_COMPOSITION_NONE ||
- hwc_window_data->validated_type == TDM_HWC_WIN_COMPOSITION_CLIENT)
- continue;
-
- if (hwc_window_data == hwc_data->target_hwc_window)
- continue;
-
- layer_data = _vc4_hwc_get_layer(hwc_data, hwc_window_data->lzpos);
- _vc4_hwc_layer_attach_window(layer_data, hwc_window_data);
- use_layers_zpos[hwc_window_data->lzpos] = 1;
- }
-
- /* unset the unused layers */
- for (lzpos = 0; lzpos < NUM_LAYERS; lzpos++) {
- if (use_layers_zpos[lzpos])
- continue;
-
- layer_data = _vc4_hwc_get_layer(hwc_data, lzpos);
- if (!layer_data)
- continue;
-
- _vc4_hwc_layer_attach_window(layer_data, NULL);
- }
-
- /* for debug */
- for (lzpos = NUM_LAYERS -1 ; lzpos >= 0; lzpos--) {
- if (use_layers_zpos[lzpos])
- TDM_INFO(" lzpos(%d) : %s", lzpos, use_layers_zpos[lzpos] ? "SET" : "UNSET");
- }
-}
-
static int
_vc4_hwc_get_changed_number(tdm_vc4_hwc_data *hwc_data)
{
LIST_FOR_EACH_ENTRY(hwc_window_data, &hwc_data->hwc_window_list, link) {
if (hwc_window_data->client_type == TDM_HWC_WIN_COMPOSITION_NONE)
continue;
+
if (hwc_window_data->client_type != hwc_window_data->validated_type)
num++;
}
return num;
}
-static tbm_surface_queue_h
-_vc4_hwc_window_get_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error)
-{
- tdm_vc4_hwc_window_data *hwc_window_data = NULL;
- tbm_surface_queue_h tqueue = NULL;
- int width, height;
- tbm_format format;
-
- if (error)
- *error = TDM_ERROR_INVALID_PARAMETER;
-
- RETURN_VAL_IF_FAIL(hwc_window != NULL, NULL);
-
- hwc_window_data = hwc_window;
-
- width = hwc_window_data->info.src_config.size.h;
- height = hwc_window_data->info.src_config.size.v;
- format = hwc_window_data->info.src_config.format;
-
- tqueue = tbm_surface_queue_create(NUM_BUFFERS, width, height, format, TBM_BO_SCANOUT);
- if (error)
- *error = TDM_ERROR_OPERATION_FAILED;
- RETURN_VAL_IF_FAIL(tqueue != NULL, NULL);
-
- if (error)
- *error = TDM_ERROR_NONE;
-
- return tqueue;
-
-}
-
tdm_hwc_window *
_vc4_hwc_create_window(tdm_hwc *hwc, tdm_hwc_window_info *info, tdm_error *error)
{
return hwc_window_data;
}
-tdm_error
-vc4_hwc_initailize_target_window(tdm_vc4_hwc_data *hwc_data, int width, int height)
-{
- tdm_hwc_window_info info = {0};
- tdm_error ret = TDM_ERROR_NONE;
- tdm_vc4_hwc_window_data *target_hwc_window;
-
- RETURN_VAL_IF_FAIL(hwc_data, TDM_ERROR_INVALID_PARAMETER);
-
- info.dst_pos.x = 0;
- info.dst_pos.y = 0;
- info.dst_pos.h = height;
- info.dst_pos.w = width;
-
- info.src_config.pos.x = 0;
- info.src_config.pos.y = 0;
- info.src_config.pos.h = height;
- info.src_config.pos.w = width;
-
- info.src_config.size.h = width;
- info.src_config.size.v = height;
- info.src_config.format = TBM_FORMAT_ARGB8888;
-
- target_hwc_window = _vc4_hwc_create_window(hwc_data, &info, &ret);
- if (ret != TDM_ERROR_NONE) {
- TDM_ERR("create target hwc window failed (%d)", ret);
- return TDM_ERROR_OPERATION_FAILED;
- }
-
- if (hwc_data->target_hwc_window)
- vc4_hwc_window_destroy(hwc_data->target_hwc_window);
-
- hwc_data->target_hwc_window = target_hwc_window;
- hwc_data->need_set_crtc = 1;
-
- return TDM_ERROR_NONE;
-}
-
tdm_hwc_window *
vc4_hwc_create_window(tdm_hwc *hwc, tdm_error *error)
{
hwc_data->commit_func = func;
return TDM_ERROR_NONE;
-}
\ No newline at end of file
+}
+
+tdm_error
+vc4_hwc_initailize_target_window(tdm_vc4_hwc_data *hwc_data, int width, int height)
+{
+ tdm_hwc_window_info info = {0};
+ tdm_error ret = TDM_ERROR_NONE;
+ tdm_vc4_hwc_window_data *target_hwc_window;
+
+ RETURN_VAL_IF_FAIL(hwc_data, TDM_ERROR_INVALID_PARAMETER);
+
+ info.dst_pos.x = 0;
+ info.dst_pos.y = 0;
+ info.dst_pos.h = height;
+ info.dst_pos.w = width;
+
+ info.src_config.pos.x = 0;
+ info.src_config.pos.y = 0;
+ info.src_config.pos.h = height;
+ info.src_config.pos.w = width;
+
+ info.src_config.size.h = width;
+ info.src_config.size.v = height;
+ info.src_config.format = TBM_FORMAT_ARGB8888;
+
+ target_hwc_window = _vc4_hwc_create_window(hwc_data, &info, &ret);
+ if (ret != TDM_ERROR_NONE) {
+ TDM_ERR("create target hwc window failed (%d)", ret);
+ return TDM_ERROR_OPERATION_FAILED;
+ }
+
+ if (hwc_data->target_hwc_window)
+ vc4_hwc_window_destroy(hwc_data->target_hwc_window);
+
+ hwc_data->target_hwc_window = target_hwc_window;
+ hwc_data->need_set_crtc = 1;
+
+ return TDM_ERROR_NONE;
+}