libweston: add required_capabilities test suite quirk
This allows tests to skip when required capabilities are not present. The output damage test for the shadow buffer case needs this. required_capabilities is added to struct weston_testsuite_quirks which is libweston public API just because there is no better place currently. This is a little weird because the code to check it is in compositor, not libweston. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
@@ -816,6 +816,33 @@ weston_compositor_log_capabilities(struct weston_compositor *compositor)
|
|||||||
"presentation clock resolution: N/A\n");
|
"presentation clock resolution: N/A\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
check_compositor_capabilities(struct weston_compositor *compositor,
|
||||||
|
uint32_t mask)
|
||||||
|
{
|
||||||
|
uint32_t missing = mask & ~compositor->capabilities;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
if (missing == 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
weston_log("Quirk error, missing capabilities:\n");
|
||||||
|
for (i = 0; i < ARRAY_LENGTH(capability_strings); i++) {
|
||||||
|
if (!(missing & capability_strings[i].bit))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
weston_log_continue(STAMP_SPACE "- %s\n",
|
||||||
|
capability_strings[i].desc);
|
||||||
|
missing &= ~capability_strings[i].bit;
|
||||||
|
}
|
||||||
|
if (missing) {
|
||||||
|
weston_log_continue(STAMP_SPACE "- unlisted bits 0x%x\n",
|
||||||
|
missing);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_primary_client_destroyed(struct wl_listener *listener, void *data)
|
handle_primary_client_destroyed(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
@@ -3355,6 +3382,12 @@ wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_data)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!check_compositor_capabilities(wet.compositor,
|
||||||
|
test_data->test_quirks.required_capabilities)) {
|
||||||
|
ret = WET_MAIN_RET_MISSING_CAPS;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
weston_compositor_flush_heads_changed(wet.compositor);
|
weston_compositor_flush_heads_changed(wet.compositor);
|
||||||
if (wet.init_failed)
|
if (wet.init_failed)
|
||||||
goto out;
|
goto out;
|
||||||
|
|||||||
@@ -95,6 +95,12 @@ text_backend_init(struct weston_compositor *ec);
|
|||||||
void
|
void
|
||||||
text_backend_destroy(struct text_backend *text_backend);
|
text_backend_destroy(struct text_backend *text_backend);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return value from wet_main() when
|
||||||
|
* weston_testsuite_quirks::required_capabilities are not met.
|
||||||
|
*/
|
||||||
|
#define WET_MAIN_RET_MISSING_CAPS 77
|
||||||
|
|
||||||
int
|
int
|
||||||
wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_data);
|
wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_data);
|
||||||
|
|
||||||
|
|||||||
@@ -198,6 +198,8 @@ struct weston_testsuite_quirks {
|
|||||||
bool gl_force_full_upload;
|
bool gl_force_full_upload;
|
||||||
/** Ensure GL shadow fb is used, and always repaint it fully. */
|
/** Ensure GL shadow fb is used, and always repaint it fully. */
|
||||||
bool gl_force_full_redraw_of_shadow_fb;
|
bool gl_force_full_redraw_of_shadow_fb;
|
||||||
|
/** Required enum weston_capability bit mask, otherwise skip run. */
|
||||||
|
uint32_t required_capabilities;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Weston test suite data that is given to compositor
|
/** Weston test suite data that is given to compositor
|
||||||
|
|||||||
@@ -42,6 +42,9 @@
|
|||||||
#include "weston.h"
|
#include "weston.h"
|
||||||
#include "test-config.h"
|
#include "test-config.h"
|
||||||
|
|
||||||
|
static_assert(WET_MAIN_RET_MISSING_CAPS == RESULT_SKIP,
|
||||||
|
"wet_main() return value for skip is wrong");
|
||||||
|
|
||||||
struct prog_args {
|
struct prog_args {
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
|
|||||||
Reference in New Issue
Block a user