From: lsj119 Date: Mon, 15 Apr 2019 23:30:04 +0000 (+0900) Subject: output: push the first drift X-Git-Tag: submit/tizen/20190530.092249~83 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=73d433a6a57a9855ce87b95fd6d58d6e36690d42;p=platform%2Fcore%2Fuifw%2Fpepper.git output: push the first drift Change-Id: Ib84351d09cef6e7d76c2a78f67c70d1077ff7753 --- diff --git a/src/bin/headless/Makefile.am b/src/bin/headless/Makefile.am index 50c1ba0..7e95a66 100644 --- a/src/bin/headless/Makefile.am +++ b/src/bin/headless/Makefile.am @@ -5,4 +5,5 @@ bin_PROGRAMS += headless_server headless_server_CFLAGS = $(HEADLESS_SERVER_CFLAGS) headless_server_LDADD = $(HEADLESS_SERVER_LIBS) -headless_server_SOURCES = headless_server.c +headless_server_SOURCES = headless_server.c \ + output/output_led.c diff --git a/src/bin/headless/headless_server.c b/src/bin/headless/headless_server.c index dda6ddd..c8602fa 100644 --- a/src/bin/headless/headless_server.c +++ b/src/bin/headless/headless_server.c @@ -1,4 +1,5 @@ #include +#include int main(int argc, char *argv[]) { @@ -14,9 +15,14 @@ int main(int argc, char *argv[]) compositor = pepper_compositor_create(socket_name); PEPPER_CHECK(compositor, return EXIT_FAILURE, "Failed to create compositor !"); + /* Init Output */ + pepper_output_led_init(compositor); + /* run event loop */ wl_display_run(pepper_compositor_get_display(compositor)); + /* Deinit Process */ + pepper_output_led_deinit(compositor); pepper_compositor_destroy(compositor); return EXIT_SUCCESS; diff --git a/src/bin/headless/headless_server.h b/src/bin/headless/headless_server.h new file mode 100644 index 0000000..d1c8910 --- /dev/null +++ b/src/bin/headless/headless_server.h @@ -0,0 +1,41 @@ +/* +* Copyright © 2018 Samsung Electronics co., Ltd. All Rights Reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#ifndef HEADLESS_SERVER_H +#define HEADLESS_SERVER_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +PEPPER_API pepper_bool_t pepper_output_led_init(pepper_compositor_t *compositor); +PEPPER_API void pepper_output_led_deinit(pepper_compositor_t *compositor); + +#ifdef __cplusplus +} +#endif + +#endif /* HEADLESS_SERVER_H */ + diff --git a/src/bin/headless/output/output_led.c b/src/bin/headless/output/output_led.c new file mode 100644 index 0000000..f767b1e --- /dev/null +++ b/src/bin/headless/output/output_led.c @@ -0,0 +1,182 @@ +/* +* Copyright © 2018 Samsung Electronics co., Ltd. All Rights Reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ +#include +#include +#include +#include + +#include + +typedef struct { + pepper_compositor_t *compositor; + pepper_output_t *output; + pepper_plane_t *plane; + + int num_led; +}led_output_t; + +static const int KEY_OUTPUT; + +static void +led_output_destroy(void *o) +{ + led_output_t *output = (led_output_t *)o; + PEPPER_TRACE("Output Destroy %p base %p\n", output, output->output); + free(output); +} + +static int32_t +led_output_get_subpixel_order(void *o) +{ + return 0; +} + +static const char * +led_output_get_maker_name(void *o) +{ + return "PePPer LED"; +} + +static const char * +led_output_get_model_name(void *o) +{ + return "PePPer LED"; +} + +static int +led_output_get_mode_count(void *o) +{ + return 1; +} + +static void +led_output_get_mode(void *o, int index, pepper_output_mode_t *mode) +{ + led_output_t *output = (led_output_t *)o; + + if (index != 0) + return; + + mode->flags = WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED; + mode->w = output->num_led; + mode->h = output->num_led; + mode->refresh = 60000; +} + +static pepper_bool_t +led_output_set_mode(void *o, const pepper_output_mode_t *mode) +{ + return PEPPER_FALSE; +} + +static void +led_output_assign_planes(void *o, const pepper_list_t *view_list) +{ +} + +static void +led_output_start_repaint_loop(void *o) +{ + led_output_t *output = (led_output_t *)o; + struct timespec ts; + + pepper_compositor_get_time(output->compositor, &ts); + pepper_output_finish_frame(output->output, &ts); +} + +static void +led_output_repaint(void *o, const pepper_list_t *plane_list) +{ +} + +static void +led_output_attach_surface(void *o, pepper_surface_t *surface, int *w, int *h) +{ +} + +static void +led_output_flush_surface_damage(void *o, pepper_surface_t *surface, + pepper_bool_t *keep_buffer) +{ +} + +struct pepper_output_backend led_output_backend = { + led_output_destroy, + + led_output_get_subpixel_order, + led_output_get_maker_name, + led_output_get_model_name, + + led_output_get_mode_count, + led_output_get_mode, + led_output_set_mode, + + led_output_assign_planes, + led_output_start_repaint_loop, + led_output_repaint, + led_output_attach_surface, + led_output_flush_surface_damage, +}; + +pepper_bool_t +pepper_output_led_init(pepper_compositor_t *compositor) +{ + led_output_t *output = (led_output_t*)calloc(sizeof(led_output_t), 1); + + PEPPER_TRACE("Output Init\n"); + + if (!output) { + PEPPER_ERROR("Failed to allocate memory in %s\n", __FUNCTION__); + goto error; + } + + output->compositor = compositor; + output->output = pepper_compositor_add_output(compositor, + &led_output_backend, "led_output", + output, WL_OUTPUT_TRANSFORM_NORMAL, 1); + PEPPER_CHECK(output->output, goto error, "pepper_compositor_add_output() failed.\n"); + + output->plane = pepper_output_add_plane(output->output, NULL); + PEPPER_CHECK(output->plane, goto error, "pepper_output_add_plane() failed.\n"); + + pepper_object_set_user_data((pepper_object_t *)compositor, + &KEY_OUTPUT, output, led_output_destroy); + PEPPER_TRACE("\t Add Output %p, base %p\n", output, output->output); + PEPPER_TRACE("\t Add Output %p, plane %p\n", output, output->plane); + PEPPER_TRACE("\t Userdata %p\n", pepper_object_get_user_data(compositor,&KEY_OUTPUT)); + return PEPPER_TRUE; + + error: + if (output->output) + pepper_output_destroy(output->output); + + if (output) + free(output); + return PEPPER_FALSE; +} + +void +pepper_output_led_deinit(pepper_compositor_t *compositor) +{ + PEPPER_TRACE("Output Deinit ... DONE\n"); +}