ivi-shell: remove ivi_layout_get_screen_resolution API

The controller plugins can get the screen resolution directly from
weston output. 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 d56b90d948
commit ff6a9f8474
  1. 27
      ivi-shell/hmi-controller.c
  2. 10
      ivi-shell/ivi-layout-export.h
  3. 19
      ivi-shell/ivi-layout.c
  4. 52
      tests/ivi_layout-internal-test.c

@ -790,13 +790,12 @@ static struct hmi_controller *
hmi_controller_create(struct weston_compositor *ec) hmi_controller_create(struct weston_compositor *ec)
{ {
struct ivi_layout_screen *iviscrn = NULL; struct ivi_layout_screen *iviscrn = NULL;
int32_t screen_width = 0;
int32_t screen_height = 0;
struct link_layer *tmp_link_layer = NULL; struct link_layer *tmp_link_layer = NULL;
int32_t panel_height = 0; int32_t panel_height = 0;
struct hmi_controller *hmi_ctrl = MEM_ALLOC(sizeof(*hmi_ctrl)); struct hmi_controller *hmi_ctrl = MEM_ALLOC(sizeof(*hmi_ctrl));
struct hmi_controller_layer *base_layer = NULL; struct hmi_controller_layer *base_layer = NULL;
struct hmi_controller_layer *application_layer = NULL; struct hmi_controller_layer *application_layer = NULL;
struct weston_output *output;
int32_t i = 0; int32_t i = 0;
@ -817,15 +816,13 @@ hmi_controller_create(struct weston_compositor *ec)
/* init base ivi_layer*/ /* init base ivi_layer*/
wl_list_init(&hmi_ctrl->base_layer_list); wl_list_init(&hmi_ctrl->base_layer_list);
for (i = 0; i < hmi_ctrl->screen_num; i++) { for (i = 0; i < hmi_ctrl->screen_num; i++) {
ivi_layout_interface->get_screen_resolution(get_screen(i, hmi_ctrl), output = ivi_layout_interface->screen_get_output(get_screen(i, hmi_ctrl));
&screen_width,
&screen_height);
base_layer = MEM_ALLOC(1 * sizeof(struct hmi_controller_layer)); base_layer = MEM_ALLOC(1 * sizeof(struct hmi_controller_layer));
base_layer->x = 0; base_layer->x = 0;
base_layer->y = 0; base_layer->y = 0;
base_layer->width = screen_width; base_layer->width = output->current_mode->width;
base_layer->height = screen_height; base_layer->height = output->current_mode->height;
base_layer->id_layer = base_layer->id_layer =
hmi_ctrl->hmi_setting->base_layer_id + hmi_ctrl->hmi_setting->base_layer_id +
(i * hmi_ctrl->hmi_setting->base_layer_id_offset); (i * hmi_ctrl->hmi_setting->base_layer_id_offset);
@ -839,15 +836,13 @@ hmi_controller_create(struct weston_compositor *ec)
/* init application ivi_layer */ /* init application ivi_layer */
wl_list_init(&hmi_ctrl->application_layer_list); wl_list_init(&hmi_ctrl->application_layer_list);
for (i = 0; i < hmi_ctrl->screen_num; i++) { for (i = 0; i < hmi_ctrl->screen_num; i++) {
ivi_layout_interface->get_screen_resolution(get_screen(i, hmi_ctrl), output = ivi_layout_interface->screen_get_output(get_screen(i, hmi_ctrl));
&screen_width,
&screen_height);
application_layer = MEM_ALLOC(1 * sizeof(struct hmi_controller_layer)); application_layer = MEM_ALLOC(1 * sizeof(struct hmi_controller_layer));
application_layer->x = 0; application_layer->x = 0;
application_layer->y = 0; application_layer->y = 0;
application_layer->width = screen_width; application_layer->width = output->current_mode->width;
application_layer->height = screen_height - panel_height; application_layer->height = output->current_mode->height - panel_height;
application_layer->id_layer = application_layer->id_layer =
hmi_ctrl->hmi_setting->application_layer_id + hmi_ctrl->hmi_setting->application_layer_id +
(i * hmi_ctrl->hmi_setting->base_layer_id_offset); (i * hmi_ctrl->hmi_setting->base_layer_id_offset);
@ -856,15 +851,15 @@ hmi_controller_create(struct weston_compositor *ec)
create_layer(get_screen(i, hmi_ctrl), application_layer); create_layer(get_screen(i, hmi_ctrl), application_layer);
} }
ivi_layout_interface->get_screen_resolution(iviscrn, &screen_width, output = ivi_layout_interface->screen_get_output(iviscrn);
&screen_height);
/* init workspace background ivi_layer */ /* init workspace background ivi_layer */
hmi_ctrl->workspace_background_layer.x = 0; hmi_ctrl->workspace_background_layer.x = 0;
hmi_ctrl->workspace_background_layer.y = 0; hmi_ctrl->workspace_background_layer.y = 0;
hmi_ctrl->workspace_background_layer.width = screen_width; hmi_ctrl->workspace_background_layer.width =
output->current_mode->width;
hmi_ctrl->workspace_background_layer.height = hmi_ctrl->workspace_background_layer.height =
screen_height - panel_height; output->current_mode->height - panel_height;
hmi_ctrl->workspace_background_layer.id_layer = hmi_ctrl->workspace_background_layer.id_layer =
hmi_ctrl->hmi_setting->workspace_background_layer_id; hmi_ctrl->hmi_setting->workspace_background_layer_id;

@ -567,16 +567,6 @@ struct ivi_layout_interface {
struct ivi_layout_screen * struct ivi_layout_screen *
(*get_screen_from_id)(uint32_t id_screen); (*get_screen_from_id)(uint32_t id_screen);
/**
* \brief Get the screen resolution of a specific ivi_screen
*
* \return IVI_SUCCEEDED if the method call was successful
* \return IVI_FAILED if the method call was failed
*/
int32_t (*get_screen_resolution)(struct ivi_layout_screen *iviscrn,
int32_t *pWidth,
int32_t *pHeight);
/** /**
* \brief Get the ivi_screens * \brief Get the ivi_screens
* *

@ -1361,24 +1361,6 @@ ivi_layout_get_screen_from_id(uint32_t id_screen)
return NULL; return NULL;
} }
static int32_t
ivi_layout_get_screen_resolution(struct ivi_layout_screen *iviscrn,
int32_t *pWidth, int32_t *pHeight)
{
struct weston_output *output = NULL;
if (iviscrn == NULL || pWidth == NULL || pHeight == NULL) {
weston_log("ivi_layout_get_screen_resolution: invalid argument\n");
return IVI_FAILED;
}
output = iviscrn->output;
*pWidth = output->current_mode->width;
*pHeight = output->current_mode->height;
return IVI_SUCCEEDED;
}
static int32_t static int32_t
ivi_layout_surface_add_notification(struct ivi_layout_surface *ivisurf, ivi_layout_surface_add_notification(struct ivi_layout_surface *ivisurf,
surface_property_notification_func callback, surface_property_notification_func callback,
@ -2475,7 +2457,6 @@ static struct ivi_layout_interface ivi_layout_interface = {
* screen controller interfaces part1 * screen controller interfaces part1
*/ */
.get_screen_from_id = ivi_layout_get_screen_from_id, .get_screen_from_id = ivi_layout_get_screen_from_id,
.get_screen_resolution = ivi_layout_get_screen_resolution,
.get_screens = ivi_layout_get_screens, .get_screens = ivi_layout_get_screens,
.get_screens_under_layer = ivi_layout_get_screens_under_layer, .get_screens_under_layer = ivi_layout_get_screens_under_layer,
.screen_add_layer = ivi_layout_screen_add_layer, .screen_add_layer = ivi_layout_screen_add_layer,

@ -564,33 +564,6 @@ test_screen_id(struct test_context *ctx)
free(iviscrns); free(iviscrns);
} }
static void
test_screen_resolution(struct test_context *ctx)
{
const struct ivi_layout_interface *lyt = ctx->layout_interface;
struct ivi_layout_screen **iviscrns;
int32_t screen_length = 0;
struct weston_output *output;
int32_t width;
int32_t height;
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(output != NULL);
iassert(lyt->get_screen_resolution(
iviscrns[i], &width, &height) == IVI_SUCCEEDED);
iassert(width == output->current_mode->width);
iassert(height == output->current_mode->height);
}
if (screen_length > 0)
free(iviscrns);
}
static void static void
test_screen_render_order(struct test_context *ctx) test_screen_render_order(struct test_context *ctx)
{ {
@ -643,29 +616,6 @@ test_screen_render_order(struct test_context *ctx)
#undef LAYER_NUM #undef LAYER_NUM
} }
static void
test_screen_bad_resolution(struct test_context *ctx)
{
const struct ivi_layout_interface *lyt = ctx->layout_interface;
struct ivi_layout_screen **iviscrns;
int32_t screen_length = 0;
struct ivi_layout_screen *iviscrn;
int32_t width;
int32_t height;
iassert(lyt->get_screens(&screen_length, &iviscrns) == IVI_SUCCEEDED);
iassert(screen_length > 0);
if (screen_length <= 0)
return;
iviscrn = iviscrns[0];
iassert(lyt->get_screen_resolution(NULL, &width, &height) == IVI_FAILED);
iassert(lyt->get_screen_resolution(iviscrn, NULL, &height) == IVI_FAILED);
iassert(lyt->get_screen_resolution(iviscrn, &width, NULL) == IVI_FAILED);
free(iviscrns);
}
static void static void
test_screen_bad_render_order(struct test_context *ctx) test_screen_bad_render_order(struct test_context *ctx)
{ {
@ -989,9 +939,7 @@ run_internal_tests(void *data)
test_get_layer_after_destory_layer(ctx); test_get_layer_after_destory_layer(ctx);
test_screen_id(ctx); test_screen_id(ctx);
test_screen_resolution(ctx);
test_screen_render_order(ctx); test_screen_render_order(ctx);
test_screen_bad_resolution(ctx);
test_screen_bad_render_order(ctx); test_screen_bad_render_order(ctx);
test_commit_changes_after_render_order_set_layer_destroy(ctx); test_commit_changes_after_render_order_set_layer_destroy(ctx);

Loading…
Cancel
Save