[PATCH v2] Restoring alpha after the shell effects.
After the fade or zoom effects, alpha could not have been 1.0, preventing not redrawing behind opaque windows. Signed-off-by: Axel Davy axel.d...@ens.fr --- src/animation.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/animation.c b/src/animation.c index 0b2fa95..9603115 100644 --- a/src/animation.c +++ b/src/animation.c @@ -134,6 +134,7 @@ weston_surface_animation_destroy(struct weston_surface_animation *animation) wl_list_remove(animation-animation.link); wl_list_remove(animation-listener.link); wl_list_remove(animation-transform.link); + animation-surface-alpha = 1.0; weston_surface_geometry_dirty(animation-surface); if (animation-done) animation-done(animation, animation-data); -- 1.8.1.2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Weston simple-egl on Raspberry PI
Hello. I have been playing with Weston on Raspberry pi via rpi-backend. It run just fine (but slowly for example for smoke clients), but I am not able to run simple-egl. I have just read that it requires wayland-egl library which is not available for Raspberry PI. So my question is: is there a way how we can run simple-egl on Raspberry Pi? Thanks. ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH v2] Restoring alpha after the shell effects.
Shouldn't this set the alpha to the target alpha instead of 1? What if i fade from 1 to 0, this will set it back to 1 when it's done. 2013/9/12 Axel Davy axel.d...@ens.fr After the fade or zoom effects, alpha could not have been 1.0, preventing not redrawing behind opaque windows. Signed-off-by: Axel Davy axel.d...@ens.fr --- src/animation.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/animation.c b/src/animation.c index 0b2fa95..9603115 100644 --- a/src/animation.c +++ b/src/animation.c @@ -134,6 +134,7 @@ weston_surface_animation_destroy(struct weston_surface_animation *animation) wl_list_remove(animation-animation.link); wl_list_remove(animation-listener.link); wl_list_remove(animation-transform.link); + animation-surface-alpha = 1.0; weston_surface_geometry_dirty(animation-surface); if (animation-done) animation-done(animation, animation-data); -- 1.8.1.2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH v2] Restoring alpha after the shell effects.
You are right, but if we use the slide effect, the target value has no meaning for alpha. The only time we use the fade effect with a target alpha value of 0 is the shell_fade effect with the FADE_IN parameter: at the end the surface is destroyed anyway. I think however the first patch was better, but I should add too to set surface-alpha to 1.0 for the shell_fade effect and the FADE_OUT parameter. Kristian, what do you like better? Axel Davy Le 12/09/2013 10:27, Giulio Camuffo a écrit : Shouldn't this set the alpha to the target alpha instead of 1? What if i fade from 1 to 0, this will set it back to 1 when it's done. 2013/9/12 Axel Davy axel.d...@ens.fr mailto:axel.d...@ens.fr After the fade or zoom effects, alpha could not have been 1.0, preventing not redrawing behind opaque windows. Signed-off-by: Axel Davy axel.d...@ens.fr mailto:axel.d...@ens.fr --- src/animation.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/animation.c b/src/animation.c index 0b2fa95..9603115 100644 --- a/src/animation.c +++ b/src/animation.c @@ -134,6 +134,7 @@ weston_surface_animation_destroy(struct weston_surface_animation *animation) wl_list_remove(animation-animation.link); wl_list_remove(animation-listener.link); wl_list_remove(animation-transform.link); + animation-surface-alpha = 1.0; weston_surface_geometry_dirty(animation-surface); if (animation-done) animation-done(animation, animation-data); -- 1.8.1.2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org mailto:wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston 0/6] ivi-shell proposal
On Mon, 9 Sep 2013 08:01:51 + michael.schu...@bmw.de wrote: Hi all, let me give some technical background on the extension, and why we have decided to design the first approach of the extensions like it is published from Tanibata-san. In general, we would like to get the feedback on the extensions, to get it fitting in the FOSS approach, fulfilling the ivi requirements. See my comments in line. Jason Ekstrand had an excellent point asking which parts you are actually looking for to standardize. Hi, I would like to get feedback about that if somebody has a similar motivation to support ivi as well as desktop and tablet. So it is not a stone, just a proposal. If somebody has good idea, I would like to use it or collaborate it. Ok, I just had the understanding that the layer manager simply has to be a separate process and not built into the compositor. Not really. Currently in the compliance from genivi, we have the separation of Graphic Backend Server and LayerManagement. But this should now change we want to skip that approach and want define a protocol + ivi extensions, including a reference compositor. We have decided to use wayland + ivi extension as compositor protocol and weston as the reference implementation for that. Very cool! If that is not the case, then that is very good news indeed. Everything that manages surfaces, layers, windows, or whatever belongs into the compositor process, where they are much easier to implement and you don't need to introduce interfaces and IPC which are later hard to develop further and cause latencies. Sure that is the technical best fitting solution for that, we do not want to use separate IPC for the composition approach. So I'm roughly on the same track as Andreas Pokorny. We too, but unfortunately it is not possible all the time to get the complete user interface included in the compositor itself. We have to guarantee fast startup time to get early video running in 2 seconds. On different systems we can not achieve that with complete HMI-UI is up. Oh, no, I am not suggesting to put user interfaces in the compositor, not at all. Only the window management, which means window positioning, z-order, etc. For instance, in Weston virtual desktops are implemented in the compositor, and not by an external process juggling window lists via IPC and setting visibilities and positions. Proposing just like with weston and desktop-shell, there is the weston plugin called desktop-shell.so which does window management, and then there is the helper program weston-desktop-shell, that does all the UI drawing in a separate process. Like Jason Ekstrand explained, desktop-shell.so and weston-desktop-shell communicate with each other not only using the core Wayland protocol, but also using a private (or proprietary) protocol extension. While the basic IPC mechanism is all the same (Wayland), there are different parts: extensions. The desktop-shell extension is actually a protected one, only weston-desktop-shell as started by desktop-shell.so can access it. Have you tried to map your IVI concepts of surface/layer/display to Wayland wl_surface, wl_subsurface, and wl_output? I don't really see what kind of interfaces your applications (Wayland clients?) expect to use. When I look at the protocol in ivi-shell.xml, I get the feeling that: - Interfaces ivi_layer, ivi_controller_surface, ivi_controller_layer, ivi_controller_screen, and ivi_controller should be internal implementation details inside the weston process, not protocol. Having these as interfaces looks like the X architecture, where the X server process and window manager process continuously struggle to keep each other up-to-date, and carefully try to keep state in sync (and fail), which also makes races and glitches practically unavoidable. - Interface ivi_client is just a reinvention of wl_compositor and wl_subcompositor. - Interface ivi_surface is a reinvention of wl_surface. Let me explain, why this separation occurs. From the ivi perspective we have separated the different applications in ivi-client, ivi-control. ivi-client: Is just a client, like browser, navigation which is embedded in the browser. That belongs to the ivi-surface. These process have really limited access the can just create the surface and that's all. The only important point which the want to know is if the visibility has changed and the size to adapt the rendered content. A navigation should not render the content if it is not visible or assigned to a layer. That is actually very well fitting to what we already have in Wayland. Just replace ivi-client with a wl_client (that's not a protocol object, it represents a display connection from a client process), and ivi-surface with wl_surface+wl_shell_surface. The limited access is already there: in Weston, clients are free to create any number of wl_surfaces. However, no
Re: [PATCH weston 0/6] ivi-shell proposal
On Tue, 10 Sep 2013 11:13:06 + michael.schu...@bmw.de wrote: Hi Jason, Tanibata-san Hi Jason, Thank you very much for feedback. Michale Nobuhiko, First of all, thank you for the clarification and thank you for sending this to the list and being willing to work with the FOSS community to try and make a standard. I'm sorry that this reply is not inline. I think that would get disorganized and more confusing but I'll try to hit everything I saw. The first distinction that needs to be made (and I think Pekka was trying to hint at this) is what should be standardized. If you look at the current [wayland core protocol][1] there is only one shell protocol called wl_shell. I have proposed another which will probably get called [wl_fullscreen_shell][2]. Both of these have something in common: they are purely client-side. There is nothing whatsoever in the standard about managing surfaces. I think that we should focus on what you have designated ivi_client. Ok, now I got it. No we do not want to push it to the core protocol. We want to define a IVI-Shell like desktop shell and want to use weston for the reference implementation. The ivi-shell extension should be the minimum subset which shall provided by each ivi-compositor. But in terms of the genivi compliance we are able to define a shell protocol and say this is the minimal subset which is supported, and therefore we need a reference implementation too. Maybe we have mixed something here from our side. We will clarify that Standardizing does not necessarily mean Wayland core. It could be an IVI standard, as opposed to a private protocol in some IVI implementation. I think your proposal could be split into an IVI standard part, and something that is private to your specific implementation, depending on how you want to be in your IVI standard. But if you IVI-standardize the control protocol interfaces, does that mean that all implementations must then support that regardless? Maybe some implementations would just have that as compositor-internal APIs. What about the controller? If you look in the [weston protocol folder][3] you will find a number of different protocol files. Some of these are for experimental extensions such as subsurfaces which have not yet made it into wayland core. However, a number of them such as desktop-shell, screenshooter, etc. will *never* be standardized in the wayland core. These protocols are completely internal to weston and are considered implementation details. The primary example is desktop-shell. This protocol exists for the purpose of allowing the out-of-process shell controller manage surfaces similar to what you propose with ivi_shell. There are other shell plugins for weston (hawaii orbital) that each have their own shell plugin and can have their own protocol for talking to an out-of-process controller. Yes this is our focus too, like I have described above. How does this impact your proposed protocol? Unless you are convinced that every single IVI system manufacturer will want to manage surfaces the same way, the controller should be left as a private implementation detail. You are free to do it out-of-process and talk the wayland protocol to do so (desktop-shell does) but there is no need to expose it as part of a standard protocol. By only standardizing the client interface you leave app developers (GPS, Media players, etc.) free to design their apps however they want and you leave IVI system manufacturers free to handle those clients and surfaces in whatever way they want. Ok, now on to actual suggestions. From this point forward, I am going to completely ignore the controller side of things. First, I would propose to follow the pattern of wl_shell and make two interfaces for clients to talk to the compositor. For now, I am going to call them wl_ivi_shell and wl_ivi_surface. We can come up with different names if you'd like, but those seem reasonable. If we follow the pattern of wl_shell, wl_ivi_shell will probably exist for the sole purpose of creating wl_ivi_surface objects. This pattern is common in the protocol (wl_shell, wl_subcompositor, wl_compositor, etc.). The main question, then, becomes what to put in wl_ivi_surface. I'm not 100% sure what you intend with some of this surface and layer stuff, so I'm afraid I don't have a whole lot of specific suggestions on that for now. I do, however have some general thoughts and questions: First, I agree with Pekka that you can probably avoid the layers thing by simply using subsurfaces. I see. However, we have a use case that several application, different process share a layer. E.g. Navigation map and Route guidance are separated into other application. It may kind of grouping parent surfaces. Do you really need layers as protocol objects, anyway? Can't you just arrange surfaces into layers
[PATCH 0/4] Table driven tests for the vertex clipping code
This is the third series of patches for adding table driven tests for the vertex clipping code. From the last series I fixed some a stray use of .a when it should have been .la and also rebased on some recent work that happened in git master. Sam Spilsbury (4): Remove AM_LDFLAGS usage Add support for table-driven testing. Split vertex clipping code out into vertex-clipping.c in shared/ Added tests for the vertex clipping code. shared/Makefile.am | 4 +- shared/vertex-clipping.c | 317 + shared/vertex-clipping.h | 65 ++ src/gl-renderer.c | 292 + tests/Makefile.am | 42 -- tests/vertex-clip-test.c | 219 +++ tests/weston-test-runner.c | 123 +++--- tests/weston-test-runner.h | 52 +--- 8 files changed, 751 insertions(+), 363 deletions(-) create mode 100644 shared/vertex-clipping.c create mode 100644 shared/vertex-clipping.h create mode 100644 tests/vertex-clip-test.c -- 1.8.3.2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 1/4] Remove AM_LDFLAGS usage
We are not building everything here as a module, only the test modules. --- tests/Makefile.am | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 398a275..3a36619 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -7,6 +7,8 @@ module_tests = \ surface-test.la \ surface-global-test.la +weston_test = weston-test.la + weston_tests = \ keyboard.weston \ event.weston\ @@ -45,7 +47,7 @@ AM_CPPFLAGS = \ -I$(top_builddir)/src \ -DUNIT_TEST \ $(COMPOSITOR_CFLAGS) -AM_LDFLAGS = -module -avoid-version -rpath $(libdir) + config_parser_test_LDADD = \ ../shared/libshared.la \ @@ -54,11 +56,13 @@ config_parser_test_SOURCES =\ config-parser-test.c surface_global_test_la_SOURCES = surface-global-test.c +surface_global_test_la_LDFLAGS = -module -avoid-version -rpath $(libdir) surface_test_la_SOURCES = surface-test.c +surface_test_la_LDFLAGS = -module -avoid-version -rpath $(libdir) -weston_test = weston-test.la weston_test_la_LIBADD = $(COMPOSITOR_LIBS) \ ../shared/libshared.la +weston_test_la_LDFLAGS = -module -avoid-version -rpath $(libdir) weston_test_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS) weston_test_la_SOURCES = \ weston-test.c \ -- 1.8.3.2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 2/4] Add support for table-driven testing.
The new TEST_P macro takes a function name and a data argument to point to an arbitrary array of known size of test data. This allows multiple tests to be run with different datasets. The array is stored as a void * but advanced by a known size on each iteration. The data for each invocation of the test is provided as a data argument, it is the responsibility of the test to cast it to something sensible. Also fixed single-test running to only run the tests specified --- tests/weston-test-runner.c | 123 - tests/weston-test-runner.h | 52 +-- 2 files changed, 113 insertions(+), 62 deletions(-) diff --git a/tests/weston-test-runner.c b/tests/weston-test-runner.c index ed5baf0..89eca40 100644 --- a/tests/weston-test-runner.c +++ b/tests/weston-test-runner.c @@ -47,9 +47,9 @@ find_test(const char *name) } static void -run_test(const struct weston_test *t) +run_test(const struct weston_test *t, void *data) { - t-run(); + t-run(data); exit(EXIT_SUCCESS); } @@ -63,12 +63,75 @@ list_tests(void) fprintf(stderr,%s\n, t-name); } +static int +exec_and_report_test(const struct weston_test *t, void *test_data, int iteration) +{ + int success = 0; + int hardfail = 0; + siginfo_t info; + + pid_t pid = fork(); + assert(pid = 0); + + if (pid == 0) + run_test(t, test_data); /* never returns */ + + if (waitid(P_ALL, 0, info, WEXITED)) { + fprintf(stderr, waitid failed: %m\n); + abort(); + } + + if (test_data) + fprintf(stderr, test \%s/%i\:\t, t-name, iteration); + else + fprintf(stderr, test \%s\:\t, t-name); + + switch (info.si_code) { + case CLD_EXITED: + fprintf(stderr, exit status %d, info.si_status); + if (info.si_status == EXIT_SUCCESS) + success = 1; + break; + case CLD_KILLED: + case CLD_DUMPED: + fprintf(stderr, signal %d, info.si_status); + if (info.si_status != SIGABRT) + hardfail = 1; + break; + } + + if (t-must_fail) + success = !success; + + if (success !hardfail) { + fprintf(stderr, , pass.\n); + return 1; + } else { + fprintf(stderr, , fail.\n); + return 0; + } +} + +/* Returns number of tests and number of pass / fail in param args */ +static int +iterate_test(const struct weston_test *t, int *passed) +{ + int i; + void *current_test_data = (void *) t-table_data; + for (i = 0; i t-n_elements; ++i, current_test_data += t-element_size) + { + if (exec_and_report_test(t, current_test_data, i)) + ++(*passed); + } + + return t-n_elements; +} + int main(int argc, char *argv[]) { const struct weston_test *t; - pid_t pid; - int total, pass; - siginfo_t info; + int total = 0; + int pass = 0; if (argc == 2) { const char *testname = argv[1]; @@ -86,51 +149,19 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } - run_test(t); + int number_passed_in_test = 0; + total += iterate_test(t, number_passed_in_test); + pass += number_passed_in_test; } - - pass = 0; - for (t = __start_test_section; t __stop_test_section; t++) { - int success = 0; - int hardfail = 0; - - pid = fork(); - assert(pid = 0); - - if (pid == 0) - run_test(t); /* never returns */ - - if (waitid(P_ALL, 0, info, WEXITED)) { - fprintf(stderr, waitid failed: %m\n); - abort(); + else + { + for (t = __start_test_section; t __stop_test_section; t++) { + int number_passed_in_test = 0; + total += iterate_test(t, number_passed_in_test); + pass += number_passed_in_test; } - - fprintf(stderr, test \%s\:\t, t-name); - switch (info.si_code) { - case CLD_EXITED: - fprintf(stderr, exit status %d, info.si_status); - if (info.si_status == EXIT_SUCCESS) - success = 1; - break; - case CLD_KILLED: - case CLD_DUMPED: - fprintf(stderr, signal %d, info.si_status); - if (info.si_status != SIGABRT) - hardfail = 1; - break; - } - - if (t-must_fail) - success =
[PATCH 3/4] Split vertex clipping code out into vertex-clipping.c in shared/
--- shared/Makefile.am | 4 +- shared/vertex-clipping.c | 317 +++ shared/vertex-clipping.h | 65 ++ src/gl-renderer.c| 292 +-- 4 files changed, 389 insertions(+), 289 deletions(-) create mode 100644 shared/vertex-clipping.c create mode 100644 shared/vertex-clipping.h diff --git a/shared/Makefile.am b/shared/Makefile.am index 2fcff7b..f1abc61 100644 --- a/shared/Makefile.am +++ b/shared/Makefile.am @@ -7,7 +7,9 @@ libshared_la_SOURCES = \ option-parser.c \ config-parser.h \ os-compatibility.c \ - os-compatibility.h + os-compatibility.h \ + vertex-clipping.c \ + vertex-clipping.h libshared_cairo_la_CFLAGS =\ $(GCC_CFLAGS) \ diff --git a/shared/vertex-clipping.c b/shared/vertex-clipping.c new file mode 100644 index 000..603ce6f --- /dev/null +++ b/shared/vertex-clipping.c @@ -0,0 +1,317 @@ +/* + * Copyright © 2012 Intel Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. The copyright holders make + * no representations about the suitability of this software for any + * purpose. It is provided as is without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +#include assert.h +#include float.h +#include math.h + +#include GLES2/gl2.h + +#include vertex-clipping.h + +GLfloat +float_difference(GLfloat a, GLfloat b) +{ + /* http://www.altdevblogaday.com/2012/02/22/comparing-floating-point-numbers-2012-edition/ */ + static const GLfloat max_diff = 4.0f * FLT_MIN; + static const GLfloat max_rel_diff = 4.0e-5; + GLfloat diff = a - b; + GLfloat adiff = fabsf(diff); + + if (adiff = max_diff) + return 0.0f; + + a = fabsf(a); + b = fabsf(b); + if (adiff = (a b ? a : b) * max_rel_diff) + return 0.0f; + + return diff; +} + +/* A line segment (p1x, p1y)-(p2x, p2y) intersects the line x = x_arg. + * Compute the y coordinate of the intersection. + */ +static GLfloat +clip_intersect_y(GLfloat p1x, GLfloat p1y, GLfloat p2x, GLfloat p2y, +GLfloat x_arg) +{ + GLfloat a; + GLfloat diff = float_difference(p1x, p2x); + + /* Practically vertical line segment, yet the end points have already +* been determined to be on different sides of the line. Therefore +* the line segment is part of the line and intersects everywhere. +* Return the end point, so we use the whole line segment. +*/ + if (diff == 0.0f) + return p2y; + + a = (x_arg - p2x) / diff; + return p2y + (p1y - p2y) * a; +} + +/* A line segment (p1x, p1y)-(p2x, p2y) intersects the line y = y_arg. + * Compute the x coordinate of the intersection. + */ +static GLfloat +clip_intersect_x(GLfloat p1x, GLfloat p1y, GLfloat p2x, GLfloat p2y, +GLfloat y_arg) +{ + GLfloat a; + GLfloat diff = float_difference(p1y, p2y); + + /* Practically horizontal line segment, yet the end points have already +* been determined to be on different sides of the line. Therefore +* the line segment is part of the line and intersects everywhere. +* Return the end point, so we use the whole line segment. +*/ + if (diff == 0.0f) + return p2x; + + a = (y_arg - p2y) / diff; + return p2x + (p1x - p2x) * a; +} + +enum path_transition { + PATH_TRANSITION_OUT_TO_OUT = 0, + PATH_TRANSITION_OUT_TO_IN = 1, + PATH_TRANSITION_IN_TO_OUT = 2, + PATH_TRANSITION_IN_TO_IN = 3, +}; + +static void +clip_append_vertex(struct clip_context *ctx, GLfloat x, GLfloat y) +{ + *ctx-vertices.x++ = x; + *ctx-vertices.y++ = y; +} + +static enum path_transition +path_transition_left_edge(struct clip_context *ctx, GLfloat x, GLfloat y) +{ +
[PATCH 4/4] Added tests for the vertex clipping code.
This tests (via the table-driven testing method) that the correct number of vertices and also the correct vertices themselves are generated for an clip box and polygon of up to eight vertices. Also add a libshared_test.a so that we don't have to build weston-test-runner all the time --- tests/Makefile.am| 36 +--- tests/vertex-clip-test.c | 219 +++ 2 files changed, 244 insertions(+), 11 deletions(-) create mode 100644 tests/vertex-clip-test.c diff --git a/tests/Makefile.am b/tests/Makefile.am index 3a36619..d2d2d8a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,7 +1,8 @@ TESTS = $(shared_tests) $(module_tests) $(weston_tests) shared_tests = \ - config-parser.test + config-parser.test \ + vertex-clip.test module_tests = \ surface-test.la \ @@ -48,13 +49,6 @@ AM_CPPFLAGS =\ -DUNIT_TEST \ $(COMPOSITOR_CFLAGS) - -config_parser_test_LDADD = \ - ../shared/libshared.la \ - $(COMPOSITOR_LIBS) -config_parser_test_SOURCES = \ - config-parser-test.c - surface_global_test_la_SOURCES = surface-global-test.c surface_global_test_la_LDFLAGS = -module -avoid-version -rpath $(libdir) surface_test_la_SOURCES = surface-test.c @@ -72,17 +66,37 @@ weston_test_la_SOURCES =\ weston_test_runner_src = \ weston-test-runner.c\ weston-test-runner.h + +check_LTLIBRARIES = libshared_test.la + +libshared_test_la_SOURCES =\ + $(weston_test_runner_src) +libshared_test_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS) + +config_parser_test_LDADD = \ + ../shared/libshared.la \ + libshared_test.la \ + $(COMPOSITOR_LIBS) +config_parser_test_SOURCES = \ + config-parser-test.c +vertex_clip_test_SOURCES = \ + vertex-clip-test.c +vertex_clip_test_LDADD = \ + ../shared/libshared.la \ + libshared_test.la \ + -lm -lrt + weston_test_client_src = \ weston-test-client-helper.c \ weston-test-client-helper.h \ wayland-test-protocol.c \ wayland-test-client-protocol.h \ subsurface-protocol.c \ - subsurface-client-protocol.h\ - $(weston_test_runner_src) + subsurface-client-protocol.h weston_test_client_libs = \ $(SIMPLE_CLIENT_LIBS) \ - ../shared/libshared.la + ../shared/libshared.la \ + libshared_test.la keyboard_weston_SOURCES = keyboard-test.c $(weston_test_client_src) keyboard_weston_LDADD = $(weston_test_client_libs) diff --git a/tests/vertex-clip-test.c b/tests/vertex-clip-test.c new file mode 100644 index 000..51188b2 --- /dev/null +++ b/tests/vertex-clip-test.c @@ -0,0 +1,219 @@ +/* + * Copyright © 2013 Sam Spilsbury smspil...@gmail.com + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. The copyright holders make + * no representations about the suitability of this software for any + * purpose. It is provided as is without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +#include assert.h +#include stdio.h +#include stdlib.h +#include string.h +#include math.h + +#include weston-test-runner.h + +#include ../shared/vertex-clipping.h + +#define BOUNDING_BOX_TOP_Y 100.0f +#define BOUNDING_BOX_LEFT_X 50.0f +#define BOUNDING_BOX_RIGHT_X 100.0f +#define BOUNDING_BOX_BOTTOM_Y 50.0f + +#define INSIDE_X1 (BOUNDING_BOX_LEFT_X + 1.0f) +#define INSIDE_X2 (BOUNDING_BOX_RIGHT_X - 1.0f) +#define INSIDE_Y1 (BOUNDING_BOX_BOTTOM_Y + 1.0f) +#define INSIDE_Y2 (BOUNDING_BOX_TOP_Y - 1.0f) + +#define OUTSIDE_X1 (BOUNDING_BOX_LEFT_X - 1.0f) +#define OUTSIDE_X2 (BOUNDING_BOX_RIGHT_X + 1.0f) +#define OUTSIDE_Y1 (BOUNDING_BOX_BOTTOM_Y - 1.0f) +#define OUTSIDE_Y2 (BOUNDING_BOX_TOP_Y + 1.0f) + +static void +populate_clip_context (struct clip_context *ctx) +{ + ctx-clip.x1 =
[PATCH v2] wayland: Add support for eglSwapInterval
I like Kristian's proposal to throttle the swap buffers to sync callbacks. It has the added benefit that we can stop the client from unnecessarily using 3 buffers by waiting for the sync event in get_back_bo. The previous patch would cause the client to use three buffers because it would only block when all three buffer slots are full. It also means if the compositor is doing something weird and keeping all three buffers then the render will fail instead of blocking forever, which I think makes more sense. Daniel, is there any situation where the compositor would keep hold of more than one before? If not, surely whenever you attach and commit a new buffer you will get the release event for the old buffer immediately? If that's the case then I don't think there'd be any need to periodically send sync requests to the compositor. It doesn't look like the old patch has landed in master yet, so here is a version 2 of the patch which implements Kristian's suggestion. Regards, - Neil -- 8 -- The Wayland EGL platform now respects the eglSwapInterval value. The value is clamped to either 0 or 1 because it is difficult (and probably not useful) to sync to more than 1 redraw. The main change is that if the swap interval is 0 then instead of installing a frame callback it will just call the display sync method and throttle itself to that. It needs to at least throttle itself to that so that it will still be sure to receive buffer release events. This also moves the vblank configuration defines from platform_x11.c to the common egl_dri2.h header so they can be shared by both platforms. --- src/egl/drivers/dri2/egl_dri2.h | 7 ++ src/egl/drivers/dri2/platform_wayland.c | 127 ++-- src/egl/drivers/dri2/platform_x11.c | 6 -- 3 files changed, 126 insertions(+), 14 deletions(-) diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index fba5f81..cc657ba 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -175,6 +175,7 @@ struct dri2_egl_surface intdx; intdy; struct wl_callback*frame_callback; + struct wl_callback*throttle_callback; int format; #endif @@ -221,6 +222,12 @@ struct dri2_egl_image __DRIimage *dri_image; }; +/* From xmlpool/options.h, user exposed so should be stable */ +#define DRI_CONF_VBLANK_NEVER 0 +#define DRI_CONF_VBLANK_DEF_INTERVAL_0 1 +#define DRI_CONF_VBLANK_DEF_INTERVAL_1 2 +#define DRI_CONF_VBLANK_ALWAYS_SYNC 3 + /* standard typecasts */ _EGL_DRIVER_STANDARD_TYPECASTS(dri2_egl) _EGL_DRIVER_TYPECAST(dri2_egl_image, _EGLImage, obj) diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index ffc5959..1cb92ac 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -180,8 +180,16 @@ dri2_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf, EGLNativeWindowType window, const EGLint *attrib_list) { - return dri2_create_surface(drv, disp, EGL_WINDOW_BIT, conf, + struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); + _EGLSurface *surf; + + surf = dri2_create_surface(drv, disp, EGL_WINDOW_BIT, conf, window, attrib_list); + + if (surf != NULL) + drv-API.SwapInterval(drv, disp, surf, dri2_dpy-default_swap_interval); + + return surf; } /** @@ -216,6 +224,8 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) if (dri2_surf-frame_callback) wl_callback_destroy(dri2_surf-frame_callback); + if (dri2_surf-throttle_callback) + wl_callback_destroy(dri2_surf-throttle_callback); if (dri2_surf-base.Type == EGL_WINDOW_BIT) { dri2_surf-wl_win-private = NULL; @@ -261,8 +271,20 @@ get_back_bo(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer) __DRIimage *image; int i, name, pitch; - /* There might be a buffer release already queued that wasn't processed */ - wl_display_dispatch_queue_pending(dri2_dpy-wl_dpy, dri2_dpy-wl_queue); + if (dri2_surf-throttle_callback == NULL) { + /* There might be a buffer release already queued that wasn't processed */ + wl_display_dispatch_queue_pending(dri2_dpy-wl_dpy, dri2_dpy-wl_queue); + } else { + /* If we aren't throttling to the frame callbacks then the compositor + * may have sent a release event after the last attach so we'll wait + * until the sync for the commit request completes in order to have the + * best chance of reusing a buffer */ + do { + if (wl_display_dispatch_queue(dri2_dpy-wl_dpy, + dri2_dpy-wl_queue) == -1) +return EGL_FALSE; + } while (dri2_surf-throttle_callback != NULL); + } if (dri2_surf-back == NULL) { for (i = 0; i
Re: Weston simple-egl on Raspberry PI
On Thu, Sep 12, 2013 at 12:40 AM, Peter Hanzel hanzelpe...@gmail.com wrote: Hello. I have been playing with Weston on Raspberry pi via rpi-backend. It run just fine (but slowly for example for smoke clients), but I am not able to run simple-egl. Smoke is a very CPU intensive application and runs fairly slowly even on fast desktop CPUs. Kristian I have just read that it requires wayland-egl library which is not available for Raspberry PI. So my question is: is there a way how we can run simple-egl on Raspberry Pi? Thanks. ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH xf86-video-intel] xwayland: shortcut Enter/ExitVT
On Wed, 11 Sep 2013 10:36:34 -0700, Kristian Høgsberg hoegsb...@gmail.com wrote: On Wed, Aug 21, 2013 at 10:02:43AM +0200, Giovanni Campagna wrote: Avoids a warning due to drmGetMaster and a crash with multimonitor, caused by not having an intel_mode. I finally applied this patch. The one thing I wasn't sure about is the call to xf86SetDesiredModes() in I830EnterVT, but I don't think we need it after all. Hi, This patch causes some issues for me with chromium's popup windows (like, when right clicking). They show up (incorrectly positioned) with a one pixel height, or not at all. I also get some warnings like this: [19758:19758:0912/130823:ERROR:browser_main_loop.cc(185)] Gtk: gtk_widget_size_allocate(): attempt to allocate widget with width 376 and height -100 So it looks like somehow the height is getting set to negative? I don't have any knowledge of X.org internals, so I'm not sure how this issue is connected to xf86SetDesiredModes, but reverting the commit makes things work again for me. Any ideas? -- Michael Forney mfor...@mforney.org ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH xf86-video-intel] xwayland: shortcut Enter/ExitVT
On Thu, Sep 12, 2013 at 1:52 PM, Michael Forney mfor...@mforney.org wrote: On Wed, 11 Sep 2013 10:36:34 -0700, Kristian Høgsberg hoegsb...@gmail.com wrote: On Wed, Aug 21, 2013 at 10:02:43AM +0200, Giovanni Campagna wrote: Avoids a warning due to drmGetMaster and a crash with multimonitor, caused by not having an intel_mode. I finally applied this patch. The one thing I wasn't sure about is the call to xf86SetDesiredModes() in I830EnterVT, but I don't think we need it after all. Hi, This patch causes some issues for me with chromium's popup windows (like, when right clicking). They show up (incorrectly positioned) with a one pixel height, or not at all. I also get some warnings like this: It may be that we need to call xf86SetDesiredModes() after all. [19758:19758:0912/130823:ERROR:browser_main_loop.cc(185)] Gtk: gtk_widget_size_allocate(): attempt to allocate widget with width 376 and height -100 So it looks like somehow the height is getting set to negative? I don't have any knowledge of X.org internals, so I'm not sure how this issue is connected to xf86SetDesiredModes, but reverting the commit makes things work again for me. Any ideas? -- Michael Forney mfor...@mforney.org ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH v2] Restoring alpha after the shell effects.
On Thu, Sep 12, 2013 at 11:32:54AM +0200, Axel Davy wrote: You are right, but if we use the slide effect, the target value has no meaning for alpha. The only time we use the fade effect with a target alpha value of 0 is the shell_fade effect with the FADE_IN parameter: at the end the surface is destroyed anyway. I think however the first patch was better, but I should add too to set surface-alpha to 1.0 for the shell_fade effect and the FADE_OUT parameter. Kristian, what do you like better? If we have to do it right, I think the fade animation should install its own done handler local to animation.c, which calls the user provided done function and then sets the alpha to animation-target. Alternatively, we may just be able to tweak the cut-off value in fade_frame(). The problem is that the animation stop before we get above that threshold. right now it rounds to 1 when alpha is above 0.999, but we never get there. We could lower that a bit, say 0.995, and/or tweak the threshold in weston_spring_done to be a little lower. Kristian Axel Davy Le 12/09/2013 10:27, Giulio Camuffo a écrit : Shouldn't this set the alpha to the target alpha instead of 1? What if i fade from 1 to 0, this will set it back to 1 when it's done. 2013/9/12 Axel Davy axel.d...@ens.fr mailto:axel.d...@ens.fr After the fade or zoom effects, alpha could not have been 1.0, preventing not redrawing behind opaque windows. Signed-off-by: Axel Davy axel.d...@ens.fr mailto:axel.d...@ens.fr --- src/animation.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/animation.c b/src/animation.c index 0b2fa95..9603115 100644 --- a/src/animation.c +++ b/src/animation.c @@ -134,6 +134,7 @@ weston_surface_animation_destroy(struct weston_surface_animation *animation) wl_list_remove(animation-animation.link); wl_list_remove(animation-listener.link); wl_list_remove(animation-transform.link); + animation-surface-alpha = 1.0; weston_surface_geometry_dirty(animation-surface); if (animation-done) animation-done(animation, animation-data); -- 1.8.1.2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org mailto:wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston v2] compositor: reset surface's resource field on resource destruction
On Wed, Sep 11, 2013 at 08:54:13PM +0200, Giulio Camuffo wrote: with the surface ref-count feature a surface may live on after its resource was destroyed. set it to NULL in that case, so that code like find_resource_for_surface() in input.c will act accordingly. --- src/compositor.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compositor.c b/src/compositor.c index 88df279..a79f911 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -1071,6 +1071,9 @@ destroy_surface(struct wl_resource *resource) struct weston_surface *surface = wl_resource_get_user_data(resource); weston_surface_destroy(surface); + /* the surface may live so make sure nothing thinks + it still has a resourc*e */ + surface-resource = NULL; This avoids the warning, but we might access freed memory here. And if we did something like checking for ref_count 1 before calling weston_surface_destroy() and then setting resource to NULL after if the ref_count was 1, we'll run into a problem when we later destroy the surface for real. We'll end up in weston_pointer_set_focus(), called from weston_surface_unmap() and there we'll send out the leave event with the NULL resource. So I think the right course of action is to not send out the leave event if pointer-focus is NULL. We discussed this back when we had the leave event warning and I wasn't too happy about doing that, but in the end I don't see a way around this. Kristian } static void -- 1.8.4 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 1/2] clients: de-duplicate demo clients list
--- clients/Makefile.am | 21 + 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/clients/Makefile.am b/clients/Makefile.am index 87b3a0e..24c6489 100644 --- a/clients/Makefile.am +++ b/clients/Makefile.am @@ -2,20 +2,17 @@ bin_PROGRAMS =\ weston-info \ $(terminal) +demo_clients = \ + $(clients_programs) \ + $(pango_programs) \ + $(poppler_programs) \ + $(simple_clients_programs) \ + $(simple_egl_clients_programs) + if ENABLE_DEMO_CLIENTS -bin_PROGRAMS +=\ - $(clients_programs) \ - $(pango_programs) \ - $(poppler_programs) \ - $(simple_clients_programs) \ - $(simple_egl_clients_programs) +bin_PROGRAMS += $(demo_clients) else -noinst_PROGRAMS = \ - $(clients_programs) \ - $(pango_programs) \ - $(poppler_programs) \ - $(simple_clients_programs) \ - $(simple_egl_clients_programs) +noinst_PROGRAMS = $(demo_clients) endif libexec_PROGRAMS = \ -- 1.8.3.1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 2/2] clients: remove superfluous call
--- clients/simple-touch.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/clients/simple-touch.c b/clients/simple-touch.c index 69e460c..b5a84d7 100644 --- a/clients/simple-touch.c +++ b/clients/simple-touch.c @@ -301,8 +301,6 @@ touch_create(int width, int height) exit(1); } - wl_display_get_fd(touch-display); - touch-width = width; touch-height = height; touch-surface = wl_compositor_create_surface(touch-compositor); -- 1.8.3.1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 0/4] Table driven tests for the vertex clipping code
This is the fourth series of patches for adding table driven tests for the vertex clipping code. From the last series I moved vertex-clipping into src/ and built each object twice. Its not my preferred way of doing it, but we should probably figure out how we're going to have the code split into libraries for testing purposes later. Also renamed libshared_test to libshared-test Sam Spilsbury (4): Remove AM_LDFLAGS usage Add support for table-driven testing. Split vertex clipping code out into vertex-clipping.c Added tests for the vertex clipping code. src/Makefile.am| 4 +- src/gl-renderer.c | 292 + src/vertex-clipping.c | 317 + src/vertex-clipping.h | 65 ++ tests/Makefile.am | 43 -- tests/vertex-clip-test.c | 219 +++ tests/weston-test-runner.c | 123 +++--- tests/weston-test-runner.h | 52 +--- 8 files changed, 752 insertions(+), 363 deletions(-) create mode 100644 src/vertex-clipping.c create mode 100644 src/vertex-clipping.h create mode 100644 tests/vertex-clip-test.c -- 1.8.3.2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 1/4] Remove AM_LDFLAGS usage
We are not building everything here as a module, only the test modules. --- tests/Makefile.am | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 398a275..3a36619 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -7,6 +7,8 @@ module_tests = \ surface-test.la \ surface-global-test.la +weston_test = weston-test.la + weston_tests = \ keyboard.weston \ event.weston\ @@ -45,7 +47,7 @@ AM_CPPFLAGS = \ -I$(top_builddir)/src \ -DUNIT_TEST \ $(COMPOSITOR_CFLAGS) -AM_LDFLAGS = -module -avoid-version -rpath $(libdir) + config_parser_test_LDADD = \ ../shared/libshared.la \ @@ -54,11 +56,13 @@ config_parser_test_SOURCES =\ config-parser-test.c surface_global_test_la_SOURCES = surface-global-test.c +surface_global_test_la_LDFLAGS = -module -avoid-version -rpath $(libdir) surface_test_la_SOURCES = surface-test.c +surface_test_la_LDFLAGS = -module -avoid-version -rpath $(libdir) -weston_test = weston-test.la weston_test_la_LIBADD = $(COMPOSITOR_LIBS) \ ../shared/libshared.la +weston_test_la_LDFLAGS = -module -avoid-version -rpath $(libdir) weston_test_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS) weston_test_la_SOURCES = \ weston-test.c \ -- 1.8.3.2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 2/4] Add support for table-driven testing.
The new TEST_P macro takes a function name and a data argument to point to an arbitrary array of known size of test data. This allows multiple tests to be run with different datasets. The array is stored as a void * but advanced by a known size on each iteration. The data for each invocation of the test is provided as a data argument, it is the responsibility of the test to cast it to something sensible. Also fixed single-test running to only run the tests specified --- tests/weston-test-runner.c | 123 - tests/weston-test-runner.h | 52 +-- 2 files changed, 113 insertions(+), 62 deletions(-) diff --git a/tests/weston-test-runner.c b/tests/weston-test-runner.c index ed5baf0..89eca40 100644 --- a/tests/weston-test-runner.c +++ b/tests/weston-test-runner.c @@ -47,9 +47,9 @@ find_test(const char *name) } static void -run_test(const struct weston_test *t) +run_test(const struct weston_test *t, void *data) { - t-run(); + t-run(data); exit(EXIT_SUCCESS); } @@ -63,12 +63,75 @@ list_tests(void) fprintf(stderr,%s\n, t-name); } +static int +exec_and_report_test(const struct weston_test *t, void *test_data, int iteration) +{ + int success = 0; + int hardfail = 0; + siginfo_t info; + + pid_t pid = fork(); + assert(pid = 0); + + if (pid == 0) + run_test(t, test_data); /* never returns */ + + if (waitid(P_ALL, 0, info, WEXITED)) { + fprintf(stderr, waitid failed: %m\n); + abort(); + } + + if (test_data) + fprintf(stderr, test \%s/%i\:\t, t-name, iteration); + else + fprintf(stderr, test \%s\:\t, t-name); + + switch (info.si_code) { + case CLD_EXITED: + fprintf(stderr, exit status %d, info.si_status); + if (info.si_status == EXIT_SUCCESS) + success = 1; + break; + case CLD_KILLED: + case CLD_DUMPED: + fprintf(stderr, signal %d, info.si_status); + if (info.si_status != SIGABRT) + hardfail = 1; + break; + } + + if (t-must_fail) + success = !success; + + if (success !hardfail) { + fprintf(stderr, , pass.\n); + return 1; + } else { + fprintf(stderr, , fail.\n); + return 0; + } +} + +/* Returns number of tests and number of pass / fail in param args */ +static int +iterate_test(const struct weston_test *t, int *passed) +{ + int i; + void *current_test_data = (void *) t-table_data; + for (i = 0; i t-n_elements; ++i, current_test_data += t-element_size) + { + if (exec_and_report_test(t, current_test_data, i)) + ++(*passed); + } + + return t-n_elements; +} + int main(int argc, char *argv[]) { const struct weston_test *t; - pid_t pid; - int total, pass; - siginfo_t info; + int total = 0; + int pass = 0; if (argc == 2) { const char *testname = argv[1]; @@ -86,51 +149,19 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } - run_test(t); + int number_passed_in_test = 0; + total += iterate_test(t, number_passed_in_test); + pass += number_passed_in_test; } - - pass = 0; - for (t = __start_test_section; t __stop_test_section; t++) { - int success = 0; - int hardfail = 0; - - pid = fork(); - assert(pid = 0); - - if (pid == 0) - run_test(t); /* never returns */ - - if (waitid(P_ALL, 0, info, WEXITED)) { - fprintf(stderr, waitid failed: %m\n); - abort(); + else + { + for (t = __start_test_section; t __stop_test_section; t++) { + int number_passed_in_test = 0; + total += iterate_test(t, number_passed_in_test); + pass += number_passed_in_test; } - - fprintf(stderr, test \%s\:\t, t-name); - switch (info.si_code) { - case CLD_EXITED: - fprintf(stderr, exit status %d, info.si_status); - if (info.si_status == EXIT_SUCCESS) - success = 1; - break; - case CLD_KILLED: - case CLD_DUMPED: - fprintf(stderr, signal %d, info.si_status); - if (info.si_status != SIGABRT) - hardfail = 1; - break; - } - - if (t-must_fail) - success =
[PATCH 3/4] Split vertex clipping code out into vertex-clipping.c
--- src/Makefile.am | 4 +- src/gl-renderer.c | 292 +- src/vertex-clipping.c | 317 ++ src/vertex-clipping.h | 65 +++ 4 files changed, 389 insertions(+), 289 deletions(-) create mode 100644 src/vertex-clipping.c create mode 100644 src/vertex-clipping.h diff --git a/src/Makefile.am b/src/Makefile.am index 3710be6..92426b0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -52,7 +52,9 @@ weston_SOURCES = \ if ENABLE_EGL weston_SOURCES += \ - gl-renderer.c + gl-renderer.c \ + vertex-clipping.c \ + vertex-clipping.h endif git-version.h : .FORCE diff --git a/src/gl-renderer.c b/src/gl-renderer.c index 4381a2e..6999121 100644 --- a/src/gl-renderer.c +++ b/src/gl-renderer.c @@ -33,6 +33,7 @@ #include linux/input.h #include gl-renderer.h +#include vertex-clipping.h #include EGL/eglext.h #include weston-egl-ext.h @@ -179,270 +180,8 @@ gl_renderer_print_egl_error_state(void) egl_error_string(code), (long)code); } -struct polygon8 { - GLfloat x[8]; - GLfloat y[8]; - int n; -}; - -struct clip_context { - struct { - GLfloat x; - GLfloat y; - } prev; - - struct { - GLfloat x1, y1; - GLfloat x2, y2; - } clip; - - struct { - GLfloat *x; - GLfloat *y; - } vertices; -}; - -static GLfloat -float_difference(GLfloat a, GLfloat b) -{ - /* http://www.altdevblogaday.com/2012/02/22/comparing-floating-point-numbers-2012-edition/ */ - static const GLfloat max_diff = 4.0f * FLT_MIN; - static const GLfloat max_rel_diff = 4.0e-5; - GLfloat diff = a - b; - GLfloat adiff = fabsf(diff); - - if (adiff = max_diff) - return 0.0f; - - a = fabsf(a); - b = fabsf(b); - if (adiff = (a b ? a : b) * max_rel_diff) - return 0.0f; - - return diff; -} - -/* A line segment (p1x, p1y)-(p2x, p2y) intersects the line x = x_arg. - * Compute the y coordinate of the intersection. - */ -static GLfloat -clip_intersect_y(GLfloat p1x, GLfloat p1y, GLfloat p2x, GLfloat p2y, -GLfloat x_arg) -{ - GLfloat a; - GLfloat diff = float_difference(p1x, p2x); - - /* Practically vertical line segment, yet the end points have already -* been determined to be on different sides of the line. Therefore -* the line segment is part of the line and intersects everywhere. -* Return the end point, so we use the whole line segment. -*/ - if (diff == 0.0f) - return p2y; - - a = (x_arg - p2x) / diff; - return p2y + (p1y - p2y) * a; -} - -/* A line segment (p1x, p1y)-(p2x, p2y) intersects the line y = y_arg. - * Compute the x coordinate of the intersection. - */ -static GLfloat -clip_intersect_x(GLfloat p1x, GLfloat p1y, GLfloat p2x, GLfloat p2y, -GLfloat y_arg) -{ - GLfloat a; - GLfloat diff = float_difference(p1y, p2y); - - /* Practically horizontal line segment, yet the end points have already -* been determined to be on different sides of the line. Therefore -* the line segment is part of the line and intersects everywhere. -* Return the end point, so we use the whole line segment. -*/ - if (diff == 0.0f) - return p2x; - - a = (y_arg - p2y) / diff; - return p2x + (p1x - p2x) * a; -} - -enum path_transition { - PATH_TRANSITION_OUT_TO_OUT = 0, - PATH_TRANSITION_OUT_TO_IN = 1, - PATH_TRANSITION_IN_TO_OUT = 2, - PATH_TRANSITION_IN_TO_IN = 3, -}; - -static void -clip_append_vertex(struct clip_context *ctx, GLfloat x, GLfloat y) -{ - *ctx-vertices.x++ = x; - *ctx-vertices.y++ = y; -} - -static enum path_transition -path_transition_left_edge(struct clip_context *ctx, GLfloat x, GLfloat y) -{ - return ((ctx-prev.x = ctx-clip.x1) 1) | (x = ctx-clip.x1); -} - -static enum path_transition -path_transition_right_edge(struct clip_context *ctx, GLfloat x, GLfloat y) -{ - return ((ctx-prev.x ctx-clip.x2) 1) | (x ctx-clip.x2); -} - -static enum path_transition -path_transition_top_edge(struct clip_context *ctx, GLfloat x, GLfloat y) -{ - return ((ctx-prev.y = ctx-clip.y1) 1) | (y = ctx-clip.y1); -} - -static enum path_transition -path_transition_bottom_edge(struct clip_context *ctx, GLfloat x, GLfloat y) -{ - return ((ctx-prev.y ctx-clip.y2) 1) | (y ctx-clip.y2); -} - -static void -clip_polygon_leftright(struct clip_context *ctx, - enum path_transition transition, - GLfloat x, GLfloat y, GLfloat clip_x) -{ - GLfloat yi; - - switch (transition) { - case
[PATCH 4/4] Added tests for the vertex clipping code.
This tests (via the table-driven testing method) that the correct number of vertices and also the correct vertices themselves are generated for an clip box and polygon of up to eight vertices. Also add a libshared-test.la so that we don't have to build weston-test-runner all the time --- tests/Makefile.am| 37 +--- tests/vertex-clip-test.c | 219 +++ 2 files changed, 245 insertions(+), 11 deletions(-) create mode 100644 tests/vertex-clip-test.c diff --git a/tests/Makefile.am b/tests/Makefile.am index 3a36619..5be52c6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,7 +1,8 @@ TESTS = $(shared_tests) $(module_tests) $(weston_tests) shared_tests = \ - config-parser.test + config-parser.test \ + vertex-clip.test module_tests = \ surface-test.la \ @@ -48,13 +49,6 @@ AM_CPPFLAGS =\ -DUNIT_TEST \ $(COMPOSITOR_CFLAGS) - -config_parser_test_LDADD = \ - ../shared/libshared.la \ - $(COMPOSITOR_LIBS) -config_parser_test_SOURCES = \ - config-parser-test.c - surface_global_test_la_SOURCES = surface-global-test.c surface_global_test_la_LDFLAGS = -module -avoid-version -rpath $(libdir) surface_test_la_SOURCES = surface-test.c @@ -72,17 +66,38 @@ weston_test_la_SOURCES =\ weston_test_runner_src = \ weston-test-runner.c\ weston-test-runner.h + +check_LTLIBRARIES = libshared-test.la + +libshared_test_la_SOURCES =\ + $(weston_test_runner_src) +libshared_test_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS) + +config_parser_test_LDADD = \ + ../shared/libshared.la \ + libshared-test.la \ + $(COMPOSITOR_LIBS) +config_parser_test_SOURCES = \ + config-parser-test.c +vertex_clip_test_SOURCES = \ + vertex-clip-test.c \ + ../src/vertex-clipping.c\ + ../src/vertex-clipping.h +vertex_clip_test_LDADD = \ + libshared-test.la \ + -lm -lrt + weston_test_client_src = \ weston-test-client-helper.c \ weston-test-client-helper.h \ wayland-test-protocol.c \ wayland-test-client-protocol.h \ subsurface-protocol.c \ - subsurface-client-protocol.h\ - $(weston_test_runner_src) + subsurface-client-protocol.h weston_test_client_libs = \ $(SIMPLE_CLIENT_LIBS) \ - ../shared/libshared.la + ../shared/libshared.la \ + libshared-test.la keyboard_weston_SOURCES = keyboard-test.c $(weston_test_client_src) keyboard_weston_LDADD = $(weston_test_client_libs) diff --git a/tests/vertex-clip-test.c b/tests/vertex-clip-test.c new file mode 100644 index 000..5b2e08c --- /dev/null +++ b/tests/vertex-clip-test.c @@ -0,0 +1,219 @@ +/* + * Copyright © 2013 Sam Spilsbury smspil...@gmail.com + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the copyright holders not be used in + * advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. The copyright holders make + * no representations about the suitability of this software for any + * purpose. It is provided as is without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +#include assert.h +#include stdio.h +#include stdlib.h +#include string.h +#include math.h + +#include weston-test-runner.h + +#include ../src/vertex-clipping.h + +#define BOUNDING_BOX_TOP_Y 100.0f +#define BOUNDING_BOX_LEFT_X 50.0f +#define BOUNDING_BOX_RIGHT_X 100.0f +#define BOUNDING_BOX_BOTTOM_Y 50.0f + +#define INSIDE_X1 (BOUNDING_BOX_LEFT_X + 1.0f) +#define INSIDE_X2 (BOUNDING_BOX_RIGHT_X - 1.0f) +#define INSIDE_Y1 (BOUNDING_BOX_BOTTOM_Y + 1.0f) +#define INSIDE_Y2 (BOUNDING_BOX_TOP_Y - 1.0f) + +#define OUTSIDE_X1 (BOUNDING_BOX_LEFT_X - 1.0f) +#define OUTSIDE_X2 (BOUNDING_BOX_RIGHT_X + 1.0f) +#define OUTSIDE_Y1 (BOUNDING_BOX_BOTTOM_Y - 1.0f) +#define OUTSIDE_Y2 (BOUNDING_BOX_TOP_Y + 1.0f) + +static void +populate_clip_context
[PATCH] wayland: use wl_log instead of printf
use wl_log instead of printf and fprintf in core library --- I'm pretty sure these printf usages should be avoided since libraries should not print to stdout. But I'm not sure if there is any reason for favoring a fprintf to stderr over wl_log. Please enlighten me if there is any. src/connection.c | 36 ++-- src/event-loop.c | 8 src/wayland-client.c | 14 ++ 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/src/connection.c b/src/connection.c index 451b93e..40b7fbd 100644 --- a/src/connection.c +++ b/src/connection.c @@ -512,7 +512,7 @@ wl_closure_marshal(struct wl_object *sender, uint32_t opcode, count = arg_count_for_signature(message-signature); if (count WL_CLOSURE_MAX_ARGS) { - printf(too many args (%d)\n, count); + wl_log(too many args (%d)\n, count); errno = EINVAL; return NULL; } @@ -557,14 +557,14 @@ wl_closure_marshal(struct wl_object *sender, uint32_t opcode, fd = args[i].h; dup_fd = wl_os_dupfd_cloexec(fd, 0); if (dup_fd 0) { - fprintf(stderr, dup failed: %m); + wl_log(dup failed: %m); abort(); } closure-args[i].h = dup_fd; break; default: - fprintf(stderr, unhandled format code: '%c'\n, - arg.type); + wl_log(unhandled format code: '%c'\n, + arg.type); assert(0); break; } @@ -615,7 +615,7 @@ wl_connection_demarshal(struct wl_connection *connection, count = arg_count_for_signature(message-signature); if (count WL_CLOSURE_MAX_ARGS) { - printf(too many args (%d)\n, count); + wl_log(too many args (%d)\n, count); errno = EINVAL; wl_connection_consume(connection, size); return NULL; @@ -642,7 +642,7 @@ wl_connection_demarshal(struct wl_connection *connection, signature = get_next_argument(signature, arg); if (arg.type != 'h' p + 1 end) { - printf(message too short, + wl_log(message too short, object (%d), message %s(%s)\n, *p, message-name, message-signature); errno = EINVAL; @@ -669,7 +669,7 @@ wl_connection_demarshal(struct wl_connection *connection, next = p + DIV_ROUNDUP(length, sizeof *p); if (next end) { - printf(message too short, + wl_log(message too short, object (%d), message %s(%s)\n, closure-sender_id, message-name, message-signature); @@ -680,7 +680,7 @@ wl_connection_demarshal(struct wl_connection *connection, s = (char *) p; if (length 0 s[length - 1] != '\0') { - printf(string not nul-terminated, + wl_log(string not nul-terminated, message %s(%s)\n, message-name, message-signature); errno = EINVAL; @@ -695,7 +695,7 @@ wl_connection_demarshal(struct wl_connection *connection, closure-args[i].n = id; if (id == 0 !arg.nullable) { - printf(NULL object received on non-nullable + wl_log(NULL object received on non-nullable type, message %s(%s)\n, message-name, message-signature); errno = EINVAL; @@ -707,7 +707,7 @@ wl_connection_demarshal(struct wl_connection *connection, closure-args[i].n = id; if (id == 0 !arg.nullable) { - printf(NULL new ID received on non-nullable + wl_log(NULL new ID received on non-nullable type, message %s(%s)\n, message-name, message-signature); errno = EINVAL; @@ -715,7 +715,7 @@ wl_connection_demarshal(struct wl_connection *connection, } if (wl_map_reserve_new(objects, id) 0) { - printf(not a valid new object id (%d), + wl_log(not a
Re: [PATCH xwayland] xwayland: Probe outputs on preinit
Actually, never mind. Not sure what the problem was, but I updated everything just now, and xwayland works! On Sat, Sep 7, 2013 at 1:51 AM, Jonas Ådahl jad...@gmail.com wrote: On Thu, Sep 05, 2013 at 09:00:51PM -0700, Dima Ryazanov wrote: Hi, This actually made xwayland work for me when running weston using the X11 backend. If I run it using the drm backend, though, it still fails: Odd, because with the patch, xwayland works also using the drm backend of weston on my machine, also using the intel X driver. [102316.702] (==) intel(0): Backing store disabled [102316.702] (==) intel(0): Silken mouse enabled [102316.702] (II) intel(0): Initializing HW Cursor [102316.702] (II) intel(0): RandR 1.2 enabled, ignore the following RandR disabled message. [102316.702] (==) intel(0): DPMS enabled [102316.702] (II) intel(0): Set up textured video [102316.703] (II) intel(0): direct rendering: DRI2 Enabled [102316.703] (==) intel(0): hotplug detection: enabled [102316.703] (WW) intel(0): drmSetMaster failed: Permission denied [102316.703] (EE) Fatal server error: [102316.703] (EE) AddScreen/ScreenInit failed for driver 0 [102316.703] (EE [102316.704] (EE) Please consult the The X.Org Foundation support at http://wiki.x.org for help. [102316.704] (EE) Please also check the log file at /home/dima/install/var/log/Xorg.1.log for additional information. [102316.704] (EE) (I'm assuming that's the bug you were trying to fix?) Yes, these are the same errors I got. Jonas ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel