ivi-shell: remove ivi_layout_get_screens API

The compositor data struct already has a list of weston outputs.
Therefore, this API is not required.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Wataru Natsume <wnatsume@jp.adit-jv.com>
dev
Ucan, Emre (ADITG/SW1) 9 years ago committed by Pekka Paalanen
parent ff6a9f8474
commit 3a8521e005
  1. 27
      ivi-shell/hmi-controller.c
  2. 8
      ivi-shell/ivi-layout-export.h
  3. 34
      ivi-shell/ivi-layout.c
  4. 53
      tests/ivi_layout-internal-test.c

@ -131,7 +131,6 @@ struct hmi_controller {
struct ui_setting ui_setting;
int32_t screen_num;
struct ivi_layout_screen **pp_screen;
};
struct launcher_info {
@ -521,22 +520,6 @@ switch_mode(struct hmi_controller *hmi_ctrl,
free(pp_surface);
}
/**
* Internal method to get screens from weston core
* TODO: shall support hotplug of screens
*/
static int32_t
get_screens(struct hmi_controller *hmi_ctrl)
{
hmi_ctrl->pp_screen = NULL;
hmi_ctrl->screen_num = 0;
ivi_layout_interface->get_screens(&hmi_ctrl->screen_num, &hmi_ctrl->pp_screen);
if (hmi_ctrl->pp_screen == NULL)
return -1;
else
return 0;
}
/**
* Internal method to get ivi_layout_screen
@ -549,7 +532,7 @@ get_screen(int32_t screen_idx, struct hmi_controller *hmi_ctrl)
if (screen_idx > hmi_ctrl->screen_num - 1)
weston_log("Invalid index. Return NULL\n");
else
iviscrn = hmi_ctrl->pp_screen[screen_idx];
iviscrn = ivi_layout_interface->get_screen_from_id(screen_idx);
return iviscrn;
}
@ -767,7 +750,6 @@ hmi_controller_destroy(struct wl_listener *listener, void *data)
wl_array_release(&hmi_ctrl->ui_widgets);
free(hmi_ctrl->hmi_setting);
free(hmi_ctrl->pp_screen);
free(hmi_ctrl);
}
@ -803,14 +785,9 @@ hmi_controller_create(struct weston_compositor *ec)
hmi_ctrl->layout_mode = IVI_HMI_CONTROLLER_LAYOUT_MODE_TILING;
hmi_ctrl->hmi_setting = hmi_server_setting_create(ec);
hmi_ctrl->compositor = ec;
hmi_ctrl->screen_num = wl_list_length(&ec->output_list);
/* TODO: shall support hotplug of screens */
if (get_screens(hmi_ctrl) < 0) {
weston_log("ivi-shell: Failed to get screens\n");
hmi_ctrl = NULL;
return hmi_ctrl;
}
iviscrn = get_screen(0, hmi_ctrl);
/* init base ivi_layer*/

@ -567,14 +567,6 @@ struct ivi_layout_interface {
struct ivi_layout_screen *
(*get_screen_from_id)(uint32_t id_screen);
/**
* \brief Get the ivi_screens
*
* \return IVI_SUCCEEDED if the method call was successful
* \return IVI_FAILED if the method call was failed
*/
int32_t (*get_screens)(int32_t *pLength, struct ivi_layout_screen ***ppArray);
/**
* \brief Get the ivi_screens under the given ivi_layer
*

@ -1409,39 +1409,6 @@ ivi_layout_get_properties_of_layer(struct ivi_layout_layer *ivilayer)
return &ivilayer->prop;
}
static int32_t
ivi_layout_get_screens(int32_t *pLength, struct ivi_layout_screen ***ppArray)
{
struct ivi_layout *layout = get_instance();
struct ivi_layout_screen *iviscrn = NULL;
int32_t length = 0;
int32_t n = 0;
if (pLength == NULL || ppArray == NULL) {
weston_log("ivi_layout_get_screens: invalid argument\n");
return IVI_FAILED;
}
length = wl_list_length(&layout->screen_list);
if (length != 0) {
/* the Array must be free by module which called this function */
*ppArray = calloc(length, sizeof(struct ivi_layout_screen *));
if (*ppArray == NULL) {
weston_log("fails to allocate memory\n");
return IVI_FAILED;
}
wl_list_for_each(iviscrn, &layout->screen_list, link) {
(*ppArray)[n++] = iviscrn;
}
}
*pLength = length;
return IVI_SUCCEEDED;
}
static int32_t
ivi_layout_get_screens_under_layer(struct ivi_layout_layer *ivilayer,
int32_t *pLength,
@ -2457,7 +2424,6 @@ static struct ivi_layout_interface ivi_layout_interface = {
* screen controller interfaces part1
*/
.get_screen_from_id = ivi_layout_get_screen_from_id,
.get_screens = ivi_layout_get_screens,
.get_screens_under_layer = ivi_layout_get_screens_under_layer,
.screen_add_layer = ivi_layout_screen_add_layer,
.screen_set_render_order = ivi_layout_screen_set_render_order,

@ -543,47 +543,21 @@ test_get_layer_after_destory_layer(struct test_context *ctx)
iassert(ivilayer == NULL);
}
static void
test_screen_id(struct test_context *ctx)
{
const struct ivi_layout_interface *lyt = ctx->layout_interface;
struct ivi_layout_screen **iviscrns;
struct weston_output *output;
int32_t screen_length = 0;
int32_t i;
iassert(lyt->get_screens(&screen_length, &iviscrns) == IVI_SUCCEEDED);
iassert(screen_length > 0);
for (i = 0; i < screen_length; ++i) {
output = lyt->screen_get_output(iviscrns[i]);
iassert(lyt->get_screen_from_id(output->id) == iviscrns[i]);
}
if (screen_length > 0)
free(iviscrns);
}
static void
test_screen_render_order(struct test_context *ctx)
{
#define LAYER_NUM (3)
const struct ivi_layout_interface *lyt = ctx->layout_interface;
struct ivi_layout_screen **iviscrns;
int32_t screen_length = 0;
struct ivi_layout_screen *iviscrn;
struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
struct ivi_layout_layer **array;
int32_t length = 0;
uint32_t i;
iassert(lyt->get_screens(&screen_length, &iviscrns) == IVI_SUCCEEDED);
iassert(screen_length > 0);
if (screen_length <= 0)
if (wl_list_empty(&ctx->compositor->output_list))
return;
iviscrn = iviscrns[0];
iviscrn = lyt->get_screen_from_id(0);
for (i = 0; i < LAYER_NUM; i++)
ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
@ -612,7 +586,6 @@ test_screen_render_order(struct test_context *ctx)
for (i = 0; i < LAYER_NUM; i++)
lyt->layer_destroy(ivilayers[i]);
free(iviscrns);
#undef LAYER_NUM
}
@ -621,21 +594,16 @@ test_screen_bad_render_order(struct test_context *ctx)
{
#define LAYER_NUM (3)
const struct ivi_layout_interface *lyt = ctx->layout_interface;
struct ivi_layout_screen **iviscrns;
int32_t screen_length;
struct ivi_layout_screen *iviscrn;
struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
struct ivi_layout_layer **array;
int32_t length = 0;
uint32_t i;
iassert(lyt->get_screens(&screen_length, &iviscrns) == IVI_SUCCEEDED);
iassert(screen_length > 0);
if (screen_length <= 0)
if (wl_list_empty(&ctx->compositor->output_list))
return;
iviscrn = iviscrns[0];
iviscrn = lyt->get_screen_from_id(0);
for (i = 0; i < LAYER_NUM; i++)
ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
@ -651,7 +619,6 @@ test_screen_bad_render_order(struct test_context *ctx)
for (i = 0; i < LAYER_NUM; i++)
lyt->layer_destroy(ivilayers[i]);
free(iviscrns);
#undef LAYER_NUM
}
@ -661,19 +628,14 @@ test_commit_changes_after_render_order_set_layer_destroy(
{
#define LAYER_NUM (3)
const struct ivi_layout_interface *lyt = ctx->layout_interface;
struct ivi_layout_screen **iviscrns;
int32_t screen_length;
struct ivi_layout_screen *iviscrn;
struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
uint32_t i;
iassert(lyt->get_screens(&screen_length, &iviscrns) == IVI_SUCCEEDED);
iassert(screen_length > 0);
if (screen_length <= 0)
if (wl_list_empty(&ctx->compositor->output_list))
return;
iviscrn = iviscrns[0];
iviscrn = lyt->get_screen_from_id(0);
for (i = 0; i < LAYER_NUM; i++)
ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
@ -686,8 +648,6 @@ test_commit_changes_after_render_order_set_layer_destroy(
lyt->layer_destroy(ivilayers[0]);
lyt->layer_destroy(ivilayers[2]);
free(iviscrns);
#undef LAYER_NUM
}
@ -938,7 +898,6 @@ run_internal_tests(void *data)
test_layer_create_duplicate(ctx);
test_get_layer_after_destory_layer(ctx);
test_screen_id(ctx);
test_screen_render_order(ctx);
test_screen_bad_render_order(ctx);
test_commit_changes_after_render_order_set_layer_destroy(ctx);

Loading…
Cancel
Save