diff options
-rw-r--r-- | waltham-transmitter/transmitter-plugin/input.c | 4 | ||||
-rw-r--r-- | waltham-transmitter/transmitter-plugin/output.c | 109 | ||||
-rw-r--r-- | waltham-transmitter/transmitter-plugin/plugin.c | 3 | ||||
-rw-r--r-- | waltham-transmitter/transmitter-plugin/plugin.h | 2 | ||||
-rw-r--r-- | waltham-transmitter/waltham-renderer/CMakeLists.txt | 4 |
5 files changed, 77 insertions, 45 deletions
diff --git a/waltham-transmitter/transmitter-plugin/input.c b/waltham-transmitter/transmitter-plugin/input.c index e00546b..9d35f3f 100644 --- a/waltham-transmitter/transmitter-plugin/input.c +++ b/waltham-transmitter/transmitter-plugin/input.c @@ -1271,8 +1271,10 @@ fake_pointer_timer_handler(void *data) struct weston_transmitter_seat *seat = data; wl_fixed_t x, y; uint32_t time; + struct timespec timespec; - time = weston_compositor_get_time(); + weston_compositor_get_time(×pec); + time=timespec.tv_sec * 1000 + timespec.tv_nsec / 1000000; fake_pointer_get_position(seat, 18.0 / 180.0 * M_PI, &x, &y); transmitter_seat_pointer_motion(seat, time, x, y); diff --git a/waltham-transmitter/transmitter-plugin/output.c b/waltham-transmitter/transmitter-plugin/output.c index 6768eee..dc7d5d8 100644 --- a/waltham-transmitter/transmitter-plugin/output.c +++ b/waltham-transmitter/transmitter-plugin/output.c @@ -122,10 +122,10 @@ transmitter_output_destroy(struct weston_transmitter_output *output) { wl_list_remove(&output->link); + struct weston_head *head=weston_output_get_first_head(&output->base); free_mode_list(&output->base.mode_list); - free(output->base.serial_number); - free(output->base.model); - free(output->base.make); + weston_head_release(head); + free(head); weston_output_destroy(&output->base); free(output); @@ -139,20 +139,26 @@ transmitter_output_destroy_(struct weston_output *base) transmitter_output_destroy(output); } +static int +transmitter_output_finish_frame_handler(void *data) +{ + struct weston_transmitter_output *output = data; + struct timespec now; + weston_compositor_read_presentation_clock(output->base.compositor, &now); + weston_output_finish_frame(&output->base, &now, 0); + return 0; +} static void transmitter_start_repaint_loop(struct weston_output *base) { - struct timespec ts; struct weston_transmitter_output *output = wl_container_of(base, output, base); - - weston_compositor_read_presentation_clock(output->base.compositor, &ts); - weston_output_finish_frame(&output->base, &ts, 0); + weston_output_finish_frame(&output->base,NULL, WP_PRESENTATION_FEEDBACK_INVALID); } static int transmitter_output_repaint(struct weston_output *base, - pixman_region32_t *damage) + pixman_region32_t *damage,void *repaint_data) { struct weston_transmitter_output* output = wl_container_of(base, output, base); struct weston_transmitter_remote* remote = output->remote; @@ -222,19 +228,16 @@ transmitter_output_repaint(struct weston_output *base, if (!found_output) goto out; - weston_compositor_read_presentation_clock(output->base.compositor, &ts); - weston_output_finish_frame(&output->base, &ts, 0); - + wl_event_source_timer_update(output->finish_frame_timer,1); return 0; out: - transmitter_start_repaint_loop(base); - + wl_event_source_timer_update(output->finish_frame_timer,1); return 0; } static void -transmitter_assign_planes(struct weston_output *base) { +transmitter_assign_planes(struct weston_output *base,void *repaint_data) { /* * This function prevents compositor releasing buffer early. */ @@ -259,6 +262,7 @@ static int transmitter_output_enable(struct weston_output *base) { struct weston_transmitter_output *output = wl_container_of(base, output, base); + struct wl_event_loop *loop; if (!output) { weston_log("No weston output found\n"); return -1; @@ -268,6 +272,27 @@ transmitter_output_enable(struct weston_output *base) output->base.set_dpms = NULL; output->base.switch_mode = NULL; + loop = wl_display_get_event_loop(base->compositor->wl_display); + output->finish_frame_timer = + wl_event_loop_add_timer(loop, + transmitter_output_finish_frame_handler, + output); + return 0; +} + +/* FIXME:This is a dummy call we just return 0(success)*/ +int transmitter_output_attach_head(struct weston_output *output, + struct weston_head *head) +{ + weston_log("%s is called\n",__func__); + return 0; +} + +/* FIXME:This is a dummy call we just return 0(success)*/ +int transmitter_output_detach_head(struct weston_output *output, + struct weston_head *head) +{ + weston_log("%s is called\n",__func__); return 0; } @@ -277,7 +302,17 @@ transmitter_remote_create_output(struct weston_transmitter_remote *remote, { struct weston_transmitter_output *output; struct weston_transmitter *txr = remote->transmitter; - struct weston_output *def_output; + struct weston_head *head; + const char *make = strdup(WESTON_TRANSMITTER_OUTPUT_MAKE); + const char *model = make_model(remote, 1); + const char *serial_number = strdup("0"); + const char *connector_name = make_model(remote, 1); + + head=zalloc(sizeof *head); + if (!head){ + weston_log("allocation failed for head\n"); + return -1; + } output = zalloc(sizeof *output); if (!output) @@ -285,36 +320,24 @@ transmitter_remote_create_output(struct weston_transmitter_remote *remote, output->parent.draw_initial_frame = true; - output->base.subpixel = info->subpixel; + weston_head_init(head,connector_name); + weston_head_set_subpixel(head, info->subpixel); + weston_head_set_monitor_strings(head, make, model, serial_number); + + head->compositor=remote->transmitter->compositor; - output->base.name = make_model(remote, 1); - output->base.make = strdup(WESTON_TRANSMITTER_OUTPUT_MAKE); - output->base.model = make_model(remote, 1); - output->base.serial_number = strdup("0"); /* x and y is fake value */ wl_list_init(&output->base.mode_list); + output->base.name = make_model(remote, 1); + /* WL_OUTPUT_MODE_CURRENT already set */ + weston_output_init(&output->base, remote->transmitter->compositor,output->base.name); if (make_mode_list(&output->base.mode_list, info) < 0) goto fail; output->base.current_mode = get_current_mode(&output->base.mode_list); output->base.height = output->base.current_mode->height; output->base.width = output->base.current_mode->width; - /* WL_OUTPUT_MODE_CURRENT already set */ - weston_output_init(&output->base, remote->transmitter->compositor); - - /* - * renderer_output_create skipped: - * no renderer awareness is needed for this output - */ - /* - * weston_compositor_add_output() skipped: - * Most other code uses weston_compositor::output_list when traversing - * all outputs, we do not want any of that. - * Also weston_compositor::output_created_signal must not trigger - * for this output, since we must not involve input device management - * or color management or any kind of local management. - */ output->base.enable = transmitter_output_enable; output->base.start_repaint_loop = transmitter_start_repaint_loop; output->base.repaint = transmitter_output_repaint; @@ -330,6 +353,9 @@ transmitter_remote_create_output(struct weston_transmitter_remote *remote, output->base.scale = 1; output->base.transform = WL_OUTPUT_TRANSFORM_NORMAL; + output->base.attach_head = transmitter_output_attach_head; + output->base.detach_head = transmitter_output_detach_head; + output->remote = remote; wl_list_insert(&remote->output_list, &output->link); @@ -338,16 +364,19 @@ transmitter_remote_create_output(struct weston_transmitter_remote *remote, return -1; } - weston_output_enable(&output->base); + if(!weston_output_attach_head(&output->base,head)){ + weston_log("Weston head attached successfully to output\n"); + } + + if(weston_output_enable(&output->base)<0){ + weston_log("Failed to enable weston output\n"); + } return 0; fail: free_mode_list(&output->base.mode_list); - free(output->base.serial_number); - free(output->base.model); - free(output->base.make); - free(output->base.name); + free(head); free(output); return -1; diff --git a/waltham-transmitter/transmitter-plugin/plugin.c b/waltham-transmitter/transmitter-plugin/plugin.c index 92510c2..66c115f 100644 --- a/waltham-transmitter/transmitter-plugin/plugin.c +++ b/waltham-transmitter/transmitter-plugin/plugin.c @@ -381,7 +381,7 @@ conn_ready_notify(struct wl_listener *l, void *data) WL_OUTPUT_TRANSFORM_NORMAL, 1, 0, 0, - 300, 200, + 1024,768, strdup(remote->model), { WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED, @@ -394,6 +394,7 @@ conn_ready_notify(struct wl_listener *l, void *data) if(remote->height != 0) { info.mode.width = remote->width; info.mode.height = remote->height; + info.mode.refresh= 60; } } /* Outputs and seats are dynamic, do not guarantee they are all diff --git a/waltham-transmitter/transmitter-plugin/plugin.h b/waltham-transmitter/transmitter-plugin/plugin.h index 892ba7a..c824a6a 100644 --- a/waltham-transmitter/transmitter-plugin/plugin.h +++ b/waltham-transmitter/transmitter-plugin/plugin.h @@ -198,7 +198,7 @@ struct weston_transmitter_output { struct wl_list link; /* weston_transmitter_remote::output_list */ struct frame *frame; - + struct wl_event_source *finish_frame_timer; struct wl_callback *frame_cb; struct renderer *renderer; }; diff --git a/waltham-transmitter/waltham-renderer/CMakeLists.txt b/waltham-transmitter/waltham-renderer/CMakeLists.txt index 768a7f0..17411b9 100644 --- a/waltham-transmitter/waltham-renderer/CMakeLists.txt +++ b/waltham-transmitter/waltham-renderer/CMakeLists.txt @@ -38,7 +38,7 @@ set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") set(LIBS m - weston-2 + weston-6 gstallocators-1.0 gstvideo-1.0 ${WAYLAND_SERVER_LIBRARIES} @@ -55,5 +55,5 @@ target_link_libraries(${PROJECT_NAME} ${LIBS}) install ( TARGETS ${PROJECT_NAME} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/libweston-2 + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/libweston-6 ) |