• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2020 Collabora, Ltd.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the
13  * next paragraph) shall be included in all copies or substantial
14  * portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23  * SOFTWARE.
24  */
25 
26 #include "config.h"
27 
28 #include "weston-test-client-helper.h"
29 #include "weston-test-fixture-compositor.h"
30 
31 static enum test_result_code
fixture_setup(struct weston_test_harness * harness)32 fixture_setup(struct weston_test_harness *harness)
33 {
34 	struct compositor_setup setup;
35 
36 	compositor_setup_defaults(&setup);
37 	setup.shell = SHELL_TEST_DESKTOP;
38 	setup.backend = WESTON_BACKEND_DRM;
39 	setup.renderer = RENDERER_PIXMAN;
40 
41 	return weston_test_harness_execute_as_client(harness, &setup);
42 }
43 DECLARE_FIXTURE_SETUP(fixture_setup);
44 
TEST(drm_smoke)45 TEST(drm_smoke) {
46 
47 	struct client *client;
48 	struct buffer *buffer;
49 	struct wl_surface *surface;
50 	pixman_color_t red;
51 	int i, frame;
52 
53 	color_rgb888(&red, 255, 0, 0);
54 
55 	client = create_client_and_test_surface(0, 0, 200, 200);
56 	assert(client);
57 
58 	surface = client->surface->wl_surface;
59 	buffer = create_shm_buffer_a8r8g8b8(client, 200, 200);
60 
61 	fill_image_with_color(buffer->image, &red);
62 
63 	for (i = 0; i < 5; i++) {
64 		wl_surface_attach(surface, buffer->proxy, 0, 0);
65 		wl_surface_damage(surface, 0, 0, 200, 200);
66 		frame_callback_set(surface, &frame);
67 		wl_surface_commit(surface);
68 		frame_callback_wait(client, &frame);
69 	}
70 
71 	client_destroy(client);
72 }
73