Commit 92053299 authored by Deepak Rawat's avatar Deepak Rawat Committed by Daniel Vetter

drm/selftest: Refactor drm mode setting selftests

With this patch split the kernel module specific code from actual
selftest code. This is done to allow adding more selftests as separate
file. Also added kernel module exit stub with this patch.

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: alexandru-cosmin.gheorghe@arm.com
Signed-off-by: default avatarDeepak Rawat <drawat@vmware.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181016204609.1555-1-drawat@vmware.com
parent a3780509
obj-$(CONFIG_DRM_DEBUG_SELFTEST) += test-drm_mm.o test-drm-helper.o test-drm_modeset-y := test-drm_modeset_common.o test-drm_plane_helper.o
obj-$(CONFIG_DRM_DEBUG_SELFTEST) += test-drm_mm.o test-drm_modeset.o
// SPDX-License-Identifier: GPL-2.0
/*
* Common file for modeset selftests.
*/
#include <linux/module.h>
#include "test-drm_modeset_common.h"
static int __init test_drm_modeset_init(void)
{
return test_drm_plane_helper();
}
static void __exit test_drm_modeset_exit(void)
{
}
module_init(test_drm_modeset_init);
module_exit(test_drm_modeset_exit);
MODULE_AUTHOR("Intel Corporation");
MODULE_LICENSE("GPL");
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __TEST_DRM_MODESET_COMMON_H__
#define __TEST_DRM_MODESET_COMMON_H__
#define FAIL(test, msg, ...) \
do { \
if (test) { \
pr_err("%s/%u: " msg, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
return -EINVAL; \
} \
} while (0)
#define FAIL_ON(x) FAIL((x), "%s", "FAIL_ON(" __stringify(x) ")\n")
int test_drm_plane_helper(void);
#endif
// SPDX-License-Identifier: GPL-2.0
/* /*
* Test cases for the drm_kms_helper functions * Test cases for the drm_plane_helper functions
*/ */
#define pr_fmt(fmt) "drm_kms_helper: " fmt #define pr_fmt(fmt) "drm_plane_helper: " fmt
#include <linux/module.h>
#include <drm/drm_atomic_helper.h> #include <drm/drm_atomic_helper.h>
#include <drm/drm_plane_helper.h> #include <drm/drm_plane_helper.h>
#include <drm/drm_modes.h> #include <drm/drm_modes.h>
#define TESTS "drm_helper_selftests.h" #include "test-drm_modeset_common.h"
#include "drm_selftest.h"
#define FAIL(test, msg, ...) \
do { \
if (test) { \
pr_err("%s/%u: " msg, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
return -EINVAL; \
} \
} while (0)
#define FAIL_ON(x) FAIL((x), "%s", "FAIL_ON(" __stringify(x) ")\n") #define TESTS "drm_plane_helper_selftests.h"
#include "drm_selftest.h"
static void set_src(struct drm_plane_state *plane_state, static void set_src(struct drm_plane_state *plane_state,
unsigned src_x, unsigned src_y, unsigned src_x, unsigned src_y,
...@@ -232,7 +223,10 @@ static int igt_check_plane_state(void *ignored) ...@@ -232,7 +223,10 @@ static int igt_check_plane_state(void *ignored)
#include "drm_selftest.c" #include "drm_selftest.c"
static int __init test_drm_helper_init(void) /**
* test_drm_plane_helper - Run drm plane helper selftests.
*/
int test_drm_plane_helper(void)
{ {
int err; int err;
...@@ -240,8 +234,3 @@ static int __init test_drm_helper_init(void) ...@@ -240,8 +234,3 @@ static int __init test_drm_helper_init(void)
return err > 0 ? 0 : err; return err > 0 ? 0 : err;
} }
module_init(test_drm_helper_init);
MODULE_AUTHOR("Intel Corporation");
MODULE_LICENSE("GPL");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment