diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-05-14 14:40:47 +0100 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-05-14 14:40:47 +0100 |
commit | 167029fad4d2896491093ee313a663f2f057217e (patch) | |
tree | 69c394b9b848094d29b12d8a15766e6b75bf021c | |
parent | 04485758e5aa78f7c7eb548fd117b2001dc416e6 (diff) | |
parent | 1f9745a8df528c030a40a53397dab71f821f98c3 (diff) | |
download | wayland-ivi-extension-baserock/genivi/baseline.tar.gz |
Merge branch 'hawkdevtrove/sam/baserock-14.20' into baserock/genivi/baselinebaserock/genivi/baseline
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c | 4 | ||||
-rw-r--r-- | ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c | 249 | ||||
-rw-r--r-- | ivi-layermanagement-api/test/ilm_control_notification_test.cpp | 7 | ||||
-rw-r--r-- | ivi-layermanagement-api/test/ilm_control_test.cpp | 18 | ||||
-rwxr-xr-x[-rw-r--r--] | weston-ivi-shell/src/ivi-controller.c | 29 |
6 files changed, 263 insertions, 45 deletions
@@ -2,3 +2,4 @@ *~ *patch *.pdf +*build* diff --git a/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c b/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c index b2096cf..a7fb1a9 100644 --- a/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c +++ b/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c @@ -440,6 +440,10 @@ wayland_surfaceCreate(t_ilm_nativehandle nativehandle, (void)width; (void)height; + if (nativehandle == 0) { + return returnValue; + } + if (pSurfaceId != NULL) { if (*pSurfaceId == INVALID_ID) { surfaceid = diff --git a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c index d4cd6d4..e0ad07c 100644 --- a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c +++ b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c @@ -874,7 +874,7 @@ get_surface_context_by_controller(struct wayland_context *ctx, } static void -controller_surface_listener_visibility(void *data, +controller_surface_listener_visibility_child(void *data, struct ivi_controller_surface *controller, int32_t visibility) { @@ -891,7 +891,7 @@ controller_surface_listener_visibility(void *data, } static void -controller_surface_listener_opacity(void *data, +controller_surface_listener_opacity_child(void *data, struct ivi_controller_surface *controller, wl_fixed_t opacity) { @@ -908,7 +908,7 @@ controller_surface_listener_opacity(void *data, } static void -controller_surface_listener_configuration(void *data, +controller_surface_listener_configuration_child(void *data, struct ivi_controller_surface *controller, int32_t width, int32_t height) @@ -929,7 +929,7 @@ controller_surface_listener_configuration(void *data, } static void -controller_surface_listener_source_rectangle(void *data, +controller_surface_listener_source_rectangle_child(void *data, struct ivi_controller_surface *controller, int32_t x, int32_t y, @@ -958,7 +958,7 @@ controller_surface_listener_source_rectangle(void *data, } static void -controller_surface_listener_destination_rectangle(void *data, +controller_surface_listener_destination_rectangle_child(void *data, struct ivi_controller_surface *controller, int32_t x, int32_t y, @@ -981,7 +981,7 @@ controller_surface_listener_destination_rectangle(void *data, } static void -controller_surface_listener_orientation(void *data, +controller_surface_listener_orientation_child(void *data, struct ivi_controller_surface *controller, int32_t orientation) { @@ -1016,7 +1016,7 @@ controller_surface_listener_orientation(void *data, } static void -controller_surface_listener_pixelformat(void *data, +controller_surface_listener_pixelformat_child(void *data, struct ivi_controller_surface *controller, int32_t pixelformat) { @@ -1035,7 +1035,7 @@ controller_surface_listener_pixelformat(void *data, } static void -controller_surface_listener_layer(void *data, +controller_surface_listener_layer_child(void *data, struct ivi_controller_surface *controller, struct ivi_controller_layer *layer) { @@ -1056,7 +1056,7 @@ controller_surface_listener_layer(void *data, } static void -controller_surface_listener_stats(void *data, +controller_surface_listener_stats_child(void *data, struct ivi_controller_surface *controller, uint32_t redraw_count, uint32_t frame_count, @@ -1083,7 +1083,7 @@ controller_surface_listener_stats(void *data, } static void -controller_surface_listener_destroyed(void *data, +controller_surface_listener_destroyed_child(void *data, struct ivi_controller_surface *controller) { struct wayland_context *ctx = data; @@ -1100,7 +1100,7 @@ controller_surface_listener_destroyed(void *data, } static void -controller_surface_listener_content(void *data, +controller_surface_listener_content_child(void *data, struct ivi_controller_surface *controller, int32_t content_state) { @@ -1127,7 +1127,7 @@ controller_surface_listener_content(void *data, } static void -controller_surface_listener_input_focus(void *data, +controller_surface_listener_input_focus_child(void *data, struct ivi_controller_surface *controller, int32_t enabled) { @@ -1136,20 +1136,213 @@ controller_surface_listener_input_focus(void *data, (void)enabled; } -static struct ivi_controller_surface_listener controller_surface_listener = -{ - controller_surface_listener_visibility, - controller_surface_listener_opacity, - controller_surface_listener_source_rectangle, - controller_surface_listener_destination_rectangle, - controller_surface_listener_configuration, - controller_surface_listener_orientation, - controller_surface_listener_pixelformat, - controller_surface_listener_layer, - controller_surface_listener_stats, - controller_surface_listener_destroyed, - controller_surface_listener_content, - controller_surface_listener_input_focus +static struct ivi_controller_surface_listener controller_surface_listener_child = +{ + controller_surface_listener_visibility_child, + controller_surface_listener_opacity_child, + controller_surface_listener_source_rectangle_child, + controller_surface_listener_destination_rectangle_child, + controller_surface_listener_configuration_child, + controller_surface_listener_orientation_child, + controller_surface_listener_pixelformat_child, + controller_surface_listener_layer_child, + controller_surface_listener_stats_child, + controller_surface_listener_destroyed_child, + controller_surface_listener_content_child, + controller_surface_listener_input_focus_child +}; + +static void +controller_surface_listener_visibility_main(void *data, + struct ivi_controller_surface *controller, + int32_t visibility) +{ + (void)data; + (void)controller; + (void)visibility; +} + +static void +controller_surface_listener_opacity_main(void *data, + struct ivi_controller_surface *controller, + wl_fixed_t opacity) +{ + (void)data; + (void)controller; + (void)opacity; +} + +static void +controller_surface_listener_source_rectangle_main(void *data, + struct ivi_controller_surface *controller, + int32_t x, + int32_t y, + int32_t width, + int32_t height) +{ + (void)data; + (void)controller; + (void)x; + (void)y; + (void)width; + (void)height; +} + +static void +controller_surface_listener_destination_rectangle_main(void *data, + struct ivi_controller_surface *controller, + int32_t x, + int32_t y, + int32_t width, + int32_t height) +{ + (void)data; + (void)controller; + (void)x; + (void)y; + (void)width; + (void)height; +} + +static void +controller_surface_listener_configuration_main(void *data, + struct ivi_controller_surface *controller, + int32_t width, + int32_t height) +{ + (void)data; + (void)controller; + (void)width; + (void)height; +} + +static void +controller_surface_listener_orientation_main(void *data, + struct ivi_controller_surface *controller, + int32_t orientation) +{ + (void)data; + (void)controller; + (void)orientation; +} + +static void +controller_surface_listener_pixelformat_main(void *data, + struct ivi_controller_surface *controller, + int32_t pixelformat) +{ + (void)data; + (void)controller; + (void)pixelformat; +} + +static void +controller_surface_listener_layer_main(void *data, + struct ivi_controller_surface *controller, + struct ivi_controller_layer *layer) +{ + struct wayland_context *ctx = data; + struct surface_context *ctx_surf = NULL; + + ctx_surf = get_surface_context_by_controller(ctx, controller); + if (ctx_surf == NULL) { + fprintf(stderr, "Invalid controller_surface in %s\n", __FUNCTION__); + return; + } + + if (layer == NULL) { + remove_ordersurface_from_layer(ctx, ctx_surf); + } else { + add_ordersurface_to_layer(ctx, ctx_surf, layer); + } +} + +static void +controller_surface_listener_stats_main(void *data, + struct ivi_controller_surface *controller, + uint32_t redraw_count, + uint32_t frame_count, + uint32_t update_count, + uint32_t pid, + const char *process_name) +{ + (void)data; + (void)controller; + (void)redraw_count; + (void)frame_count; + (void)update_count; + (void)pid; + (void)process_name; +} + +static void +controller_surface_listener_destroyed_main(void *data, + struct ivi_controller_surface *controller) +{ + struct wayland_context *ctx = data; + struct surface_context *ctx_surf = NULL; + + ctx_surf = get_surface_context_by_controller(ctx, controller); + if (ctx_surf == NULL) { + fprintf(stderr, "Invalid controller_surface in %s\n", __FUNCTION__); + return; + } + + wl_list_remove(&ctx_surf->link); + free(ctx_surf); +} + +static void +controller_surface_listener_content_main(void *data, + struct ivi_controller_surface *controller, + int32_t content_state) +{ + // if client surface (=content) was removed with ilm_surfaceDestroy() + // the expected behavior within ILM API mandates a full removal + // of the surface from the scene. We must remove the controller + // from scene, too. + if (IVI_CONTROLLER_SURFACE_CONTENT_STATE_CONTENT_REMOVED == content_state) + { + struct wayland_context *ctx = data; + struct surface_context *ctx_surf = NULL; + + ctx_surf = get_surface_context_by_controller(ctx, controller); + if (ctx_surf == NULL) { + fprintf(stderr, "Invalid controller_surface in %s\n", __FUNCTION__); + return; + } + + ivi_controller_surface_destroy(controller, IVI_CONTROLLER_OBJECT_TYPE_SURFACE); + + wl_list_remove(&ctx_surf->link); + free(ctx_surf); + } +} + +static void +controller_surface_listener_input_focus_main(void *data, + struct ivi_controller_surface *controller, + int32_t enabled) +{ + (void)data; + (void)controller; + (void)enabled; +} + +static struct ivi_controller_surface_listener controller_surface_listener_main = +{ + controller_surface_listener_visibility_main, + controller_surface_listener_opacity_main, + controller_surface_listener_source_rectangle_main, + controller_surface_listener_destination_rectangle_main, + controller_surface_listener_configuration_main, + controller_surface_listener_orientation_main, + controller_surface_listener_pixelformat_main, + controller_surface_listener_layer_main, + controller_surface_listener_stats_main, + controller_surface_listener_destroyed_main, + controller_surface_listener_content_main, + controller_surface_listener_input_focus_main }; static void @@ -1208,7 +1401,7 @@ controller_listener_surface_for_child(void *data, wl_list_init(&ctx_surf->link); wl_list_insert(&ctx->list_surface, &ctx_surf->link); ivi_controller_surface_add_listener(ctx_surf->controller, - &controller_surface_listener, ctx); + &controller_surface_listener_child, ctx); wl_display_roundtrip(ctx->display); } @@ -1296,6 +1489,8 @@ controller_listener_surface_for_main(void *data, wl_list_init(&ctx_surf->link); wl_list_insert(&ctx->main_ctx.list_surface, &ctx_surf->link); + ivi_controller_surface_add_listener(ctx_surf->controller, + &controller_surface_listener_main, ctx); } static void diff --git a/ivi-layermanagement-api/test/ilm_control_notification_test.cpp b/ivi-layermanagement-api/test/ilm_control_notification_test.cpp index 1a9aff8..2f9f3bc 100644 --- a/ivi-layermanagement-api/test/ilm_control_notification_test.cpp +++ b/ivi-layermanagement-api/test/ilm_control_notification_test.cpp @@ -17,6 +17,7 @@ * ****************************************************************************/ +#include "TestBase.h" #include <gtest/gtest.h> #include <stdio.h> #include <pthread.h> @@ -40,7 +41,7 @@ static pthread_mutex_t notificationMutex = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t waiterVariable = PTHREAD_COND_INITIALIZER; static int timesCalled=0; -class NotificationTest: public ::testing::Test { +class NotificationTest: public TestBase, public ::testing::Test { public: static void SetUpTestCase() { @@ -68,7 +69,7 @@ public: surface = 456; ilm_surfaceRemove(surface); ilm_commitChanges(); - ilm_surfaceCreate(0,10,10,ILM_PIXELFORMAT_RGBA_8888,&surface); + ilm_surfaceCreate((t_ilm_nativehandle)wlSurface,10,10,ILM_PIXELFORMAT_RGBA_8888,&surface); ilm_commitChanges(); timesCalled=0; } @@ -174,7 +175,7 @@ TEST_F(NotificationTest, ilm_surfaceAddNotificationWithoutCallback) // create a layer t_ilm_uint surface = 67; - ilm_surfaceCreate(0,10,10,ILM_PIXELFORMAT_RGBA_8888,&surface); + ilm_surfaceCreate((t_ilm_nativehandle)wlSurface,10,10,ILM_PIXELFORMAT_RGBA_8888,&surface); ilm_commitChanges(); // add notification diff --git a/ivi-layermanagement-api/test/ilm_control_test.cpp b/ivi-layermanagement-api/test/ilm_control_test.cpp index c189448..b4394bf 100644 --- a/ivi-layermanagement-api/test/ilm_control_test.cpp +++ b/ivi-layermanagement-api/test/ilm_control_test.cpp @@ -171,7 +171,7 @@ TEST_F(IlmCommandTest, SetGetLayerOrientation) { ASSERT_EQ(ILM_ZERO, returned); } -TEST_F(IlmCommandTest, DISABLED_SetGetSurfaceOpacity) { +TEST_F(IlmCommandTest, SetGetSurfaceOpacity) { uint surface1 = 36; uint surface2 = 44; t_ilm_float opacity; @@ -190,7 +190,7 @@ TEST_F(IlmCommandTest, DISABLED_SetGetSurfaceOpacity) { EXPECT_FLOAT_EQ(0.001, opacity); } -TEST_F(IlmCommandTest, DISABLED_SetGetLayerOpacity) { +TEST_F(IlmCommandTest, SetGetLayerOpacity) { uint layer1 = 36; uint layer2 = 44; t_ilm_float opacity; @@ -289,7 +289,7 @@ TEST_F(IlmCommandTest, ilm_getLayerIDs) { ASSERT_EQ(layer2, IDs[1]); } -TEST_F(IlmCommandTest, DISABLED_ilm_getLayerIDsOfScreen) { +TEST_F(IlmCommandTest, ilm_getLayerIDsOfScreen) { t_ilm_layer layer1 = 3246; t_ilm_layer layer2 = 46586; t_ilm_uint roLength = 2; @@ -707,7 +707,7 @@ TEST_F(IlmCommandTest, ilm_getPropertiesOfScreen) { ASSERT_EQ(numberOfHardwareLayers, screenProperties.harwareLayerCount); } -TEST_F(IlmCommandTest, DISABLED_DisplaySetRenderOrder_growing) { +TEST_F(IlmCommandTest, DisplaySetRenderOrder_growing) { //prepare needed layers t_ilm_layer renderOrder[] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; t_ilm_uint layerCount = sizeof(renderOrder) / sizeof(renderOrder[0]); @@ -744,7 +744,7 @@ TEST_F(IlmCommandTest, DISABLED_DisplaySetRenderOrder_growing) { } } -TEST_F(IlmCommandTest, DISABLED_DisplaySetRenderOrder_shrinking) { +TEST_F(IlmCommandTest, DisplaySetRenderOrder_shrinking) { //prepare needed layers t_ilm_layer renderOrder[] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; t_ilm_uint layerCount = sizeof(renderOrder) / sizeof(renderOrder[0]); @@ -781,7 +781,7 @@ TEST_F(IlmCommandTest, DISABLED_DisplaySetRenderOrder_shrinking) { } } -TEST_F(IlmCommandTest, DISABLED_LayerSetRenderOrder_growing) { +TEST_F(IlmCommandTest, LayerSetRenderOrder_growing) { //prepare needed layers and surfaces t_ilm_layer renderOrder[] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; t_ilm_uint surfaceCount = sizeof(renderOrder) / sizeof(renderOrder[0]); @@ -833,7 +833,7 @@ TEST_F(IlmCommandTest, DISABLED_LayerSetRenderOrder_growing) { } } -TEST_F(IlmCommandTest, DISABLED_LayerSetRenderOrder_shrinking) { +TEST_F(IlmCommandTest, LayerSetRenderOrder_shrinking) { //prepare needed layers and surfaces t_ilm_layer renderOrder[] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; t_ilm_uint surfaceCount = sizeof(renderOrder) / sizeof(renderOrder[0]); @@ -885,7 +885,7 @@ TEST_F(IlmCommandTest, DISABLED_LayerSetRenderOrder_shrinking) { } } -TEST_F(IlmCommandTest, DISABLED_LayerSetRenderOrder_duplicates) { +TEST_F(IlmCommandTest, LayerSetRenderOrder_duplicates) { //prepare needed layers and surfaces t_ilm_layer renderOrder[] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; t_ilm_uint surfaceCount = sizeof(renderOrder) / sizeof(renderOrder[0]); @@ -918,7 +918,7 @@ TEST_F(IlmCommandTest, DISABLED_LayerSetRenderOrder_duplicates) { ASSERT_EQ(2, layerSurfaceCount); } -TEST_F(IlmCommandTest, DISABLED_LayerSetRenderOrder_empty) { +TEST_F(IlmCommandTest, LayerSetRenderOrder_empty) { //prepare needed layers and surfaces t_ilm_layer renderOrder[] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; t_ilm_uint surfaceCount = sizeof(renderOrder) / sizeof(renderOrder[0]); diff --git a/weston-ivi-shell/src/ivi-controller.c b/weston-ivi-shell/src/ivi-controller.c index dd1c95a..5b27803 100644..100755 --- a/weston-ivi-shell/src/ivi-controller.c +++ b/weston-ivi-shell/src/ivi-controller.c @@ -164,10 +164,12 @@ destroy_ivicontroller_surface(struct wl_resource *resource) wl_list_for_each_safe(ctrlsurf, next, &shell->list_controller_surface, link) { - if (id_surface != ctrlsurf->id_surface) { + + if (resource != ctrlsurf->resource) { continue; } + wl_list_remove(&ctrlsurf->link); free(ctrlsurf); ctrlsurf = NULL; @@ -188,7 +190,8 @@ destroy_ivicontroller_layer(struct wl_resource *resource) wl_list_for_each_safe(ctrllayer, next, &shell->list_controller_layer, link) { - if (id_layer != ctrllayer->id_layer) { + + if (resource != ctrllayer->resource) { continue; } @@ -214,6 +217,11 @@ destroy_ivicontroller_screen(struct wl_resource *resource) continue; } #endif + + if (resource != ctrlscrn->resource) { + continue; + } + wl_list_remove(&ctrlscrn->link); free(ctrlscrn); ctrlscrn = NULL; @@ -708,18 +716,21 @@ controller_surface_destroy(struct wl_client *client, struct ivisurface *ivisurf = wl_resource_get_user_data(resource); struct ivishell *shell = ivisurf->shell; struct ivicontroller_surface *ctrlsurf = NULL; + struct ivicontroller_surface *next = NULL; uint32_t id_surface = weston_layout_getIdOfSurface(ivisurf->layout_surface); (void)client; (void)destroy_scene_object; - wl_list_for_each(ctrlsurf, &shell->list_controller_surface, link) { - if (ctrlsurf->id_surface != id_surface) { + wl_list_for_each_safe(ctrlsurf, next, + &shell->list_controller_surface, link) { + if (ctrlsurf->resource != resource) { continue; } if (!wl_list_empty(&ctrlsurf->link)) { wl_list_remove(&ctrlsurf->link); } + free(ctrlsurf); wl_resource_destroy(resource); break; } @@ -910,6 +921,7 @@ controller_layer_destroy(struct wl_client *client, if (!wl_list_empty(&ctrllayer->link)) { wl_list_remove(&ctrllayer->link); } + free(ctrllayer); wl_resource_destroy(resource); break; } @@ -945,8 +957,13 @@ controller_screen_destroy(struct wl_client *client, wl_list_for_each_safe(ctrlscrn, next, &iviscrn->shell->list_controller_screen, link) { -// TODO : Only Single display - destroy_ivicontroller_screen(ctrlscrn->resource); + if (resource != ctrlscrn->resource) { + continue; + } + + wl_list_remove(&ctrlscrn->link); + free(ctrlscrn); + ctrlscrn = NULL; wl_resource_destroy(ctrlscrn->resource); break; } |