[PATCH weston 1/6] test: Add a compositor test-mode
Bryce Harrington
bryce at osg.samsung.com
Fri Dec 19 12:25:12 PST 2014
On Fri, Dec 19, 2014 at 12:45:45PM -0600, Derek Foreman wrote:
> For now, the intention of test-mode is to have a way to allow a client
> to control the presentation clock to allow capturing deterministic
> screenshots during testing.
>
> Once in test-mode you're trapped in test-mode forever.
>
> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
> ---
> protocol/wayland-test.xml | 4 +++-
> src/compositor.c | 15 +++++++++++++++
> src/compositor.h | 6 ++++++
> tests/weston-test.c | 9 +++++++++
> 4 files changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/protocol/wayland-test.xml b/protocol/wayland-test.xml
> index 18b6625..7174907 100644
> --- a/protocol/wayland-test.xml
> +++ b/protocol/wayland-test.xml
> @@ -26,7 +26,7 @@
> THIS SOFTWARE.
> </copyright>
>
> - <interface name="wl_test" version="1">
> + <interface name="wl_test" version="2">
> <request name="move_surface">
> <arg name="surface" type="object" interface="wl_surface"/>
> <arg name="x" type="int"/>
> @@ -58,5 +58,7 @@
> <event name="n_egl_buffers">
> <arg name="n" type="uint"/>
> </event>
> + <!-- interface version 2 -->
> + <request name="enable_test_mode"/>
Needs a documentation section added. So like:
<request name="enable_test_mode">
<description summary="enables test mode">
Allows a client to control the presentation clock to allow
capturing deterministic screenshots during testing.
Once in test-mode you're trapped in test-mode forever.
</description>
</request>
I just cribbed your commit message, maybe something better could be
made.
> </interface>
> </protocol>
> diff --git a/src/compositor.c b/src/compositor.c
> index b84658a..833cf51 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -4750,6 +4750,21 @@ weston_transform_to_string(uint32_t output_transform)
> return "<illegal value>";
> }
>
> +WL_EXPORT void
In one of the other threads we had discussed making docs required for
all WL_EXPORT functions. Are the protocol docs in the .xml sufficient
for this or do we also need doxygen style comments added in the source?
> +weston_compositor_test_mode_enable(struct weston_compositor *compositor)
> +{
> + weston_log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
> + weston_log("Entering compositor test mode.\n");
> + weston_log("This should never be seen in normal operation.\n");
> + weston_log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
> +
> + /* set the test_mode flag first in case the callback follows
> + * code paths that test it...
> + */
> + compositor->test_mode = true;
> + if (compositor->enable_test_mode)
> + compositor->enable_test_mode(compositor);
> +}
>
> int main(int argc, char *argv[])
> {
> diff --git a/src/compositor.h b/src/compositor.h
> index 3f7ed4a..2b99225 100644
> --- a/src/compositor.h
> +++ b/src/compositor.h
> @@ -650,6 +650,7 @@ struct weston_compositor {
> void (*destroy)(struct weston_compositor *ec);
> void (*restore)(struct weston_compositor *ec);
> int (*authenticate)(struct weston_compositor *c, uint32_t id);
> + void (*enable_test_mode)(struct weston_compositor *c);
>
> struct weston_launcher *launcher;
>
> @@ -668,6 +669,8 @@ struct weston_compositor {
> clockid_t presentation_clock;
>
> int exit_code;
> +
> + bool test_mode;
> };
>
> struct weston_buffer {
> @@ -1490,6 +1493,9 @@ weston_parse_transform(const char *transform, uint32_t *out);
> const char *
> weston_transform_to_string(uint32_t output_transform);
>
> +void
> +weston_compositor_test_mode_enable(struct weston_compositor *compositor);
> +
> #ifdef __cplusplus
> }
> #endif
> diff --git a/tests/weston-test.c b/tests/weston-test.c
> index 77eaa23..0a213b2 100644
> --- a/tests/weston-test.c
> +++ b/tests/weston-test.c
> @@ -235,6 +235,14 @@ get_n_buffers(struct wl_client *client, struct wl_resource *resource)
> wl_test_send_n_egl_buffers(resource, n_buffers);
> }
>
> +static void
> +enable_test_mode(struct wl_client *client, struct wl_resource *resource)
> +{
> + struct weston_test *test = wl_resource_get_user_data(resource);
> +
> + weston_compositor_test_mode_enable(test->compositor);
> +}
> +
> static const struct wl_test_interface test_implementation = {
> move_surface,
> move_pointer,
> @@ -242,6 +250,7 @@ static const struct wl_test_interface test_implementation = {
> activate_surface,
> send_key,
> get_n_buffers,
> + enable_test_mode,
> };
Rest looks good.
Bryce
More information about the wayland-devel
mailing list