ivi-shell: use weston_output in public APIs
IVI layout APIs now are called with weston_output pointers, instead of ivi_layout_screen pointers. 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>
This commit is contained in:
parent
3a8521e005
commit
273874e3c7
|
@ -130,6 +130,7 @@ struct hmi_controller {
|
|||
struct wl_client *user_interface;
|
||||
struct ui_setting ui_setting;
|
||||
|
||||
struct weston_output * workspace_background_output;
|
||||
int32_t screen_num;
|
||||
};
|
||||
|
||||
|
@ -520,23 +521,6 @@ switch_mode(struct hmi_controller *hmi_ctrl,
|
|||
free(pp_surface);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Internal method to get ivi_layout_screen
|
||||
*/
|
||||
static struct ivi_layout_screen *
|
||||
get_screen(int32_t screen_idx, struct hmi_controller *hmi_ctrl)
|
||||
{
|
||||
struct ivi_layout_screen *iviscrn = NULL;
|
||||
|
||||
if (screen_idx > hmi_ctrl->screen_num - 1)
|
||||
weston_log("Invalid index. Return NULL\n");
|
||||
else
|
||||
iviscrn = ivi_layout_interface->get_screen_from_id(screen_idx);
|
||||
|
||||
return iviscrn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal method for transition
|
||||
*/
|
||||
|
@ -561,10 +545,10 @@ hmi_controller_fade_run(struct hmi_controller *hmi_ctrl, uint32_t is_fade_in,
|
|||
|
||||
/**
|
||||
* Internal method to create ivi_layer with hmi_controller_layer and
|
||||
* add to a ivi_screen
|
||||
* add to a weston_output
|
||||
*/
|
||||
static void
|
||||
create_layer(struct ivi_layout_screen *iviscrn,
|
||||
create_layer(struct weston_output *output,
|
||||
struct hmi_controller_layer *layer)
|
||||
{
|
||||
int32_t ret = 0;
|
||||
|
@ -575,7 +559,7 @@ create_layer(struct ivi_layout_screen *iviscrn,
|
|||
layer->height);
|
||||
assert(layer->ivilayer != NULL);
|
||||
|
||||
ret = ivi_layout_interface->screen_add_layer(iviscrn, layer->ivilayer);
|
||||
ret = ivi_layout_interface->screen_add_layer(output, layer->ivilayer);
|
||||
assert(!ret);
|
||||
|
||||
ret = ivi_layout_interface->layer_set_destination_rectangle(layer->ivilayer,
|
||||
|
@ -771,7 +755,6 @@ hmi_controller_destroy(struct wl_listener *listener, void *data)
|
|||
static struct hmi_controller *
|
||||
hmi_controller_create(struct weston_compositor *ec)
|
||||
{
|
||||
struct ivi_layout_screen *iviscrn = NULL;
|
||||
struct link_layer *tmp_link_layer = NULL;
|
||||
int32_t panel_height = 0;
|
||||
struct hmi_controller *hmi_ctrl = MEM_ALLOC(sizeof(*hmi_ctrl));
|
||||
|
@ -787,14 +770,9 @@ hmi_controller_create(struct weston_compositor *ec)
|
|||
hmi_ctrl->compositor = ec;
|
||||
hmi_ctrl->screen_num = wl_list_length(&ec->output_list);
|
||||
|
||||
/* TODO: shall support hotplug of screens */
|
||||
iviscrn = get_screen(0, hmi_ctrl);
|
||||
|
||||
/* init base ivi_layer*/
|
||||
wl_list_init(&hmi_ctrl->base_layer_list);
|
||||
for (i = 0; i < hmi_ctrl->screen_num; i++) {
|
||||
output = ivi_layout_interface->screen_get_output(get_screen(i, hmi_ctrl));
|
||||
|
||||
wl_list_for_each(output, &ec->output_list, link) {
|
||||
base_layer = MEM_ALLOC(1 * sizeof(struct hmi_controller_layer));
|
||||
base_layer->x = 0;
|
||||
base_layer->y = 0;
|
||||
|
@ -805,16 +783,16 @@ hmi_controller_create(struct weston_compositor *ec)
|
|||
(i * hmi_ctrl->hmi_setting->base_layer_id_offset);
|
||||
wl_list_insert(&hmi_ctrl->base_layer_list, &base_layer->link);
|
||||
|
||||
create_layer(get_screen(i, hmi_ctrl), base_layer);
|
||||
create_layer(output, base_layer);
|
||||
i++;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
panel_height = hmi_ctrl->hmi_setting->panel_height;
|
||||
|
||||
/* init application ivi_layer */
|
||||
wl_list_init(&hmi_ctrl->application_layer_list);
|
||||
for (i = 0; i < hmi_ctrl->screen_num; i++) {
|
||||
output = ivi_layout_interface->screen_get_output(get_screen(i, hmi_ctrl));
|
||||
|
||||
wl_list_for_each(output, &ec->output_list, link) {
|
||||
application_layer = MEM_ALLOC(1 * sizeof(struct hmi_controller_layer));
|
||||
application_layer->x = 0;
|
||||
application_layer->y = 0;
|
||||
|
@ -825,12 +803,13 @@ hmi_controller_create(struct weston_compositor *ec)
|
|||
(i * hmi_ctrl->hmi_setting->base_layer_id_offset);
|
||||
wl_list_insert(&hmi_ctrl->application_layer_list, &application_layer->link);
|
||||
|
||||
create_layer(get_screen(i, hmi_ctrl), application_layer);
|
||||
create_layer(output, application_layer);
|
||||
i++;
|
||||
}
|
||||
|
||||
output = ivi_layout_interface->screen_get_output(iviscrn);
|
||||
|
||||
/* init workspace background ivi_layer */
|
||||
output = wl_container_of(ec->output_list.next, output, link);
|
||||
hmi_ctrl->workspace_background_output = output;
|
||||
hmi_ctrl->workspace_background_layer.x = 0;
|
||||
hmi_ctrl->workspace_background_layer.y = 0;
|
||||
hmi_ctrl->workspace_background_layer.width =
|
||||
|
@ -841,7 +820,7 @@ hmi_controller_create(struct weston_compositor *ec)
|
|||
hmi_ctrl->workspace_background_layer.id_layer =
|
||||
hmi_ctrl->hmi_setting->workspace_background_layer_id;
|
||||
|
||||
create_layer(iviscrn, &hmi_ctrl->workspace_background_layer);
|
||||
create_layer(output, &hmi_ctrl->workspace_background_layer);
|
||||
ivi_layout_interface->layer_set_opacity(
|
||||
hmi_ctrl->workspace_background_layer.ivilayer, 0);
|
||||
ivi_layout_interface->layer_set_visibility(
|
||||
|
@ -1140,7 +1119,6 @@ ivi_hmi_controller_add_launchers(struct hmi_controller *hmi_ctrl,
|
|||
struct ivi_layout_surface* layout_surface = NULL;
|
||||
uint32_t *add_surface_id = NULL;
|
||||
|
||||
struct ivi_layout_screen *iviscrn = NULL;
|
||||
struct link_layer *tmp_link_layer = NULL;
|
||||
|
||||
if (0 == x_count)
|
||||
|
@ -1241,8 +1219,7 @@ ivi_hmi_controller_add_launchers(struct hmi_controller *hmi_ctrl,
|
|||
hmi_ctrl->workspace_layer.id_layer =
|
||||
hmi_ctrl->hmi_setting->workspace_layer_id;
|
||||
|
||||
iviscrn = get_screen(0, hmi_ctrl);
|
||||
create_layer(iviscrn, &hmi_ctrl->workspace_layer);
|
||||
create_layer(hmi_ctrl->workspace_background_output, &hmi_ctrl->workspace_layer);
|
||||
ivi_layout_interface->layer_set_opacity(hmi_ctrl->workspace_layer.ivilayer, 0);
|
||||
ivi_layout_interface->layer_set_visibility(hmi_ctrl->workspace_layer.ivilayer,
|
||||
false);
|
||||
|
|
|
@ -444,12 +444,12 @@ struct ivi_layout_interface {
|
|||
struct ivi_layout_layer ***ppArray);
|
||||
|
||||
/**
|
||||
* \brief Get all Layers of the given screen
|
||||
* \brief Get all Layers of the given weston_output
|
||||
*
|
||||
* \return IVI_SUCCEEDED if the method call was successful
|
||||
* \return IVI_FAILED if the method call was failed
|
||||
*/
|
||||
int32_t (*get_layers_on_screen)(struct ivi_layout_screen *iviscrn,
|
||||
int32_t (*get_layers_on_screen)(struct weston_output *output,
|
||||
int32_t *pLength,
|
||||
struct ivi_layout_layer ***ppArray);
|
||||
|
||||
|
@ -568,32 +568,32 @@ struct ivi_layout_interface {
|
|||
(*get_screen_from_id)(uint32_t id_screen);
|
||||
|
||||
/**
|
||||
* \brief Get the ivi_screens under the given ivi_layer
|
||||
* \brief Get the weston_outputs under the given ivi_layer
|
||||
*
|
||||
* \return IVI_SUCCEEDED if the method call was successful
|
||||
* \return IVI_FAILED if the method call was failed
|
||||
*/
|
||||
int32_t (*get_screens_under_layer)(struct ivi_layout_layer *ivilayer,
|
||||
int32_t *pLength,
|
||||
struct ivi_layout_screen ***ppArray);
|
||||
struct weston_output ***ppArray);
|
||||
|
||||
/**
|
||||
* \brief Add a ivi_layer to a ivi_screen which is currently managed
|
||||
* \brief Add a ivi_layer to a weston_output which is currently managed
|
||||
* by the service
|
||||
*
|
||||
* \return IVI_SUCCEEDED if the method call was successful
|
||||
* \return IVI_FAILED if the method call was failed
|
||||
*/
|
||||
int32_t (*screen_add_layer)(struct ivi_layout_screen *iviscrn,
|
||||
int32_t (*screen_add_layer)(struct weston_output *output,
|
||||
struct ivi_layout_layer *addlayer);
|
||||
|
||||
/**
|
||||
* \brief Sets render order of ivi_layers on a ivi_screen
|
||||
* \brief Sets render order of ivi_layers on a weston_output
|
||||
*
|
||||
* \return IVI_SUCCEEDED if the method call was successful
|
||||
* \return IVI_FAILED if the method call was failed
|
||||
*/
|
||||
int32_t (*screen_set_render_order)(struct ivi_layout_screen *iviscrn,
|
||||
int32_t (*screen_set_render_order)(struct weston_output *output,
|
||||
struct ivi_layout_layer **pLayer,
|
||||
const int32_t number);
|
||||
|
||||
|
|
|
@ -1412,7 +1412,7 @@ ivi_layout_get_properties_of_layer(struct ivi_layout_layer *ivilayer)
|
|||
static int32_t
|
||||
ivi_layout_get_screens_under_layer(struct ivi_layout_layer *ivilayer,
|
||||
int32_t *pLength,
|
||||
struct ivi_layout_screen ***ppArray)
|
||||
struct weston_output ***ppArray)
|
||||
{
|
||||
int32_t length = 0;
|
||||
int32_t n = 0;
|
||||
|
@ -1427,13 +1427,13 @@ ivi_layout_get_screens_under_layer(struct ivi_layout_layer *ivilayer,
|
|||
|
||||
if (length != 0) {
|
||||
/* the Array must be free by module which called this function */
|
||||
*ppArray = calloc(length, sizeof(struct ivi_layout_screen *));
|
||||
*ppArray = calloc(length, sizeof(struct weston_output *));
|
||||
if (*ppArray == NULL) {
|
||||
weston_log("fails to allocate memory\n");
|
||||
return IVI_FAILED;
|
||||
}
|
||||
|
||||
(*ppArray)[n++] = ivilayer->on_screen;
|
||||
(*ppArray)[n++] = ivilayer->on_screen->output;
|
||||
}
|
||||
|
||||
*pLength = length;
|
||||
|
@ -1475,19 +1475,21 @@ ivi_layout_get_layers(int32_t *pLength, struct ivi_layout_layer ***ppArray)
|
|||
}
|
||||
|
||||
static int32_t
|
||||
ivi_layout_get_layers_on_screen(struct ivi_layout_screen *iviscrn,
|
||||
ivi_layout_get_layers_on_screen(struct weston_output *output,
|
||||
int32_t *pLength,
|
||||
struct ivi_layout_layer ***ppArray)
|
||||
{
|
||||
struct ivi_layout_screen *iviscrn = NULL;
|
||||
struct ivi_layout_layer *ivilayer = NULL;
|
||||
int32_t length = 0;
|
||||
int32_t n = 0;
|
||||
|
||||
if (iviscrn == NULL || pLength == NULL || ppArray == NULL) {
|
||||
if (output == NULL || pLength == NULL || ppArray == NULL) {
|
||||
weston_log("ivi_layout_get_layers_on_screen: invalid argument\n");
|
||||
return IVI_FAILED;
|
||||
}
|
||||
|
||||
iviscrn = ivi_layout_get_screen_from_id(output->id);
|
||||
length = wl_list_length(&iviscrn->order.layer_list);
|
||||
|
||||
if (length != 0) {
|
||||
|
@ -1949,14 +1951,18 @@ ivi_layout_surface_set_orientation(struct ivi_layout_surface *ivisurf,
|
|||
}
|
||||
|
||||
static int32_t
|
||||
ivi_layout_screen_add_layer(struct ivi_layout_screen *iviscrn,
|
||||
ivi_layout_screen_add_layer(struct weston_output *output,
|
||||
struct ivi_layout_layer *addlayer)
|
||||
{
|
||||
if (iviscrn == NULL || addlayer == NULL) {
|
||||
struct ivi_layout_screen *iviscrn;
|
||||
|
||||
if (output == NULL || addlayer == NULL) {
|
||||
weston_log("ivi_layout_screen_add_layer: invalid argument\n");
|
||||
return IVI_FAILED;
|
||||
}
|
||||
|
||||
iviscrn = ivi_layout_get_screen_from_id(output->id);
|
||||
|
||||
if (addlayer->on_screen == iviscrn) {
|
||||
weston_log("ivi_layout_screen_add_layer: addlayer is already available\n");
|
||||
return IVI_SUCCEEDED;
|
||||
|
@ -1971,19 +1977,22 @@ ivi_layout_screen_add_layer(struct ivi_layout_screen *iviscrn,
|
|||
}
|
||||
|
||||
static int32_t
|
||||
ivi_layout_screen_set_render_order(struct ivi_layout_screen *iviscrn,
|
||||
ivi_layout_screen_set_render_order(struct weston_output *output,
|
||||
struct ivi_layout_layer **pLayer,
|
||||
const int32_t number)
|
||||
{
|
||||
struct ivi_layout_screen *iviscrn;
|
||||
struct ivi_layout_layer *ivilayer = NULL;
|
||||
struct ivi_layout_layer *next = NULL;
|
||||
int32_t i = 0;
|
||||
|
||||
if (iviscrn == NULL) {
|
||||
if (output == NULL) {
|
||||
weston_log("ivi_layout_screen_set_render_order: invalid argument\n");
|
||||
return IVI_FAILED;
|
||||
}
|
||||
|
||||
iviscrn = ivi_layout_get_screen_from_id(output->id);
|
||||
|
||||
wl_list_for_each_safe(ivilayer, next,
|
||||
&iviscrn->pending.layer_list, pending.link) {
|
||||
wl_list_remove(&ivilayer->pending.link);
|
||||
|
|
|
@ -548,7 +548,7 @@ 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 *iviscrn;
|
||||
struct weston_output *output;
|
||||
struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
|
||||
struct ivi_layout_layer **array;
|
||||
int32_t length = 0;
|
||||
|
@ -557,16 +557,16 @@ test_screen_render_order(struct test_context *ctx)
|
|||
if (wl_list_empty(&ctx->compositor->output_list))
|
||||
return;
|
||||
|
||||
iviscrn = lyt->get_screen_from_id(0);
|
||||
output = wl_container_of(ctx->compositor->output_list.next, output, link);
|
||||
|
||||
for (i = 0; i < LAYER_NUM; i++)
|
||||
ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
|
||||
|
||||
iassert(lyt->screen_set_render_order(iviscrn, ivilayers, LAYER_NUM) == IVI_SUCCEEDED);
|
||||
iassert(lyt->screen_set_render_order(output, ivilayers, LAYER_NUM) == IVI_SUCCEEDED);
|
||||
|
||||
lyt->commit_changes();
|
||||
|
||||
iassert(lyt->get_layers_on_screen(iviscrn, &length, &array) == IVI_SUCCEEDED);
|
||||
iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
|
||||
iassert(length == LAYER_NUM);
|
||||
for (i = 0; i < LAYER_NUM; i++)
|
||||
iassert(array[i] == ivilayers[i]);
|
||||
|
@ -576,11 +576,11 @@ test_screen_render_order(struct test_context *ctx)
|
|||
|
||||
array = NULL;
|
||||
|
||||
iassert(lyt->screen_set_render_order(iviscrn, NULL, 0) == IVI_SUCCEEDED);
|
||||
iassert(lyt->screen_set_render_order(output, NULL, 0) == IVI_SUCCEEDED);
|
||||
|
||||
lyt->commit_changes();
|
||||
|
||||
iassert(lyt->get_layers_on_screen(iviscrn, &length, &array) == IVI_SUCCEEDED);
|
||||
iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
|
||||
iassert(length == 0 && array == NULL);
|
||||
|
||||
for (i = 0; i < LAYER_NUM; i++)
|
||||
|
@ -594,7 +594,7 @@ 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 *iviscrn;
|
||||
struct weston_output *output;
|
||||
struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
|
||||
struct ivi_layout_layer **array;
|
||||
int32_t length = 0;
|
||||
|
@ -603,7 +603,7 @@ test_screen_bad_render_order(struct test_context *ctx)
|
|||
if (wl_list_empty(&ctx->compositor->output_list))
|
||||
return;
|
||||
|
||||
iviscrn = lyt->get_screen_from_id(0);
|
||||
output = wl_container_of(ctx->compositor->output_list.next, output, link);
|
||||
|
||||
for (i = 0; i < LAYER_NUM; i++)
|
||||
ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
|
||||
|
@ -613,8 +613,8 @@ test_screen_bad_render_order(struct test_context *ctx)
|
|||
lyt->commit_changes();
|
||||
|
||||
iassert(lyt->get_layers_on_screen(NULL, &length, &array) == IVI_FAILED);
|
||||
iassert(lyt->get_layers_on_screen(iviscrn, NULL, &array) == IVI_FAILED);
|
||||
iassert(lyt->get_layers_on_screen(iviscrn, &length, NULL) == IVI_FAILED);
|
||||
iassert(lyt->get_layers_on_screen(output, NULL, &array) == IVI_FAILED);
|
||||
iassert(lyt->get_layers_on_screen(output, &length, NULL) == IVI_FAILED);
|
||||
|
||||
for (i = 0; i < LAYER_NUM; i++)
|
||||
lyt->layer_destroy(ivilayers[i]);
|
||||
|
@ -628,19 +628,19 @@ 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 *iviscrn;
|
||||
struct weston_output *output;
|
||||
struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
|
||||
uint32_t i;
|
||||
|
||||
if (wl_list_empty(&ctx->compositor->output_list))
|
||||
return;
|
||||
|
||||
iviscrn = lyt->get_screen_from_id(0);
|
||||
output = wl_container_of(ctx->compositor->output_list.next, output, link);
|
||||
|
||||
for (i = 0; i < LAYER_NUM; i++)
|
||||
ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
|
||||
|
||||
iassert(lyt->screen_set_render_order(iviscrn, ivilayers, LAYER_NUM) == IVI_SUCCEEDED);
|
||||
iassert(lyt->screen_set_render_order(output, ivilayers, LAYER_NUM) == IVI_SUCCEEDED);
|
||||
|
||||
lyt->layer_destroy(ivilayers[1]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue