[Intel-gfx] [PATCH 07/12] lib/igt_fb: switch to igt_ prefix from kmstest_
Daniel Vetter
daniel.vetter at ffwll.ch
Wed Mar 26 17:15:50 CET 2014
Shorter and more in line with our general igt_ prefix for everything
which isn't somehow intel or i915-gem or otherwise hw specific - these
helpers here are all fully generic framebuffer handling functions
based on kms + cairo.
Well, the actual buffer alloc is done with i915 gem, but meh ;-)
Two special cases:
- bpp_depth_to_drm_format and drm_format_to_bpp completely lacked
prefixes, so just add igt_.
- write_fb was a bit misleading given that we have gem_write for
uploading to buffers. Rename that to write_fb_to_png to make it
crystal clear what this thing does even without looking at docs.
Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
lib/igt_fb.c | 58 +++++++++++++++++++++++-----------------------
lib/igt_fb.h | 40 +++++++++++++++++---------------
lib/igt_kms.c | 2 +-
lib/igt_kms.h | 4 ++--
tests/kms_cursor_crc.c | 14 +++++------
tests/kms_fbc_crc.c | 10 ++++----
tests/kms_flip.c | 36 ++++++++++++++--------------
tests/kms_pipe_crc_basic.c | 6 ++---
tests/kms_plane.c | 20 ++++++++--------
tests/kms_render.c | 36 ++++++++++++++--------------
tests/kms_setmode.c | 20 ++++++++--------
tests/pm_lpsp.c | 8 +++----
tests/pm_pc8.c | 8 +++----
tests/testdisplay.c | 42 ++++++++++++++++-----------------
14 files changed, 153 insertions(+), 151 deletions(-)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 6ae87a09903b..9cbfe6465ecd 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -100,7 +100,7 @@ static int create_bo_for_fb(int fd, int width, int height, int bpp,
return 0;
}
-void kmstest_paint_color(cairo_t *cr, int x, int y, int w, int h,
+void igt_paint_color(cairo_t *cr, int x, int y, int w, int h,
double r, double g, double b)
{
cairo_rectangle(cr, x, y, w, h);
@@ -108,7 +108,7 @@ void kmstest_paint_color(cairo_t *cr, int x, int y, int w, int h,
cairo_fill(cr);
}
-void kmstest_paint_color_alpha(cairo_t *cr, int x, int y, int w, int h,
+void igt_paint_color_alpha(cairo_t *cr, int x, int y, int w, int h,
double r, double g, double b, double a)
{
cairo_rectangle(cr, x, y, w, h);
@@ -117,7 +117,7 @@ void kmstest_paint_color_alpha(cairo_t *cr, int x, int y, int w, int h,
}
void
-kmstest_paint_color_gradient(cairo_t *cr, int x, int y, int w, int h,
+igt_paint_color_gradient(cairo_t *cr, int x, int y, int w, int h,
int r, int g, int b)
{
cairo_pattern_t *pat;
@@ -143,19 +143,19 @@ paint_test_patterns(cairo_t *cr, int width, int height)
gr_height = height * 0.08;
x = (width / 2) - (gr_width / 2);
- kmstest_paint_color_gradient(cr, x, y, gr_width, gr_height, 1, 0, 0);
+ igt_paint_color_gradient(cr, x, y, gr_width, gr_height, 1, 0, 0);
y += gr_height;
- kmstest_paint_color_gradient(cr, x, y, gr_width, gr_height, 0, 1, 0);
+ igt_paint_color_gradient(cr, x, y, gr_width, gr_height, 0, 1, 0);
y += gr_height;
- kmstest_paint_color_gradient(cr, x, y, gr_width, gr_height, 0, 0, 1);
+ igt_paint_color_gradient(cr, x, y, gr_width, gr_height, 0, 0, 1);
y += gr_height;
- kmstest_paint_color_gradient(cr, x, y, gr_width, gr_height, 1, 1, 1);
+ igt_paint_color_gradient(cr, x, y, gr_width, gr_height, 1, 1, 1);
}
-int kmstest_cairo_printf_line(cairo_t *cr, enum kmstest_text_align align,
+int igt_cairo_printf_line(cairo_t *cr, enum igt_text_align align,
double yspacing, const char *fmt, ...)
{
double x, y, xofs, yofs;
@@ -202,7 +202,7 @@ int kmstest_cairo_printf_line(cairo_t *cr, enum kmstest_text_align align,
static void
paint_marker(cairo_t *cr, int x, int y)
{
- enum kmstest_text_align align;
+ enum igt_text_align align;
int xoff, yoff;
cairo_move_to(cr, x, y - 20);
@@ -226,10 +226,10 @@ paint_marker(cairo_t *cr, int x, int y)
cairo_move_to(cr, x + xoff, y + yoff);
cairo_set_font_size(cr, 18);
- kmstest_cairo_printf_line(cr, align, 0, "(%d, %d)", x, y);
+ igt_cairo_printf_line(cr, align, 0, "(%d, %d)", x, y);
}
-void kmstest_paint_test_pattern(cairo_t *cr, int width, int height)
+void igt_paint_test_pattern(cairo_t *cr, int width, int height)
{
paint_test_patterns(cr, width, height);
@@ -244,7 +244,7 @@ void kmstest_paint_test_pattern(cairo_t *cr, int width, int height)
igt_assert(!cairo_status(cr));
}
-void kmstest_paint_image(cairo_t *cr, const char *filename,
+void igt_paint_image(cairo_t *cr, const char *filename,
int dst_x, int dst_y, int dst_width, int dst_height)
{
cairo_surface_t *image;
@@ -272,8 +272,8 @@ void kmstest_paint_image(cairo_t *cr, const char *filename,
cairo_restore(cr);
}
-unsigned int kmstest_create_fb(int fd, int width, int height, uint32_t format,
- bool tiled, struct kmstest_fb *fb)
+unsigned int igt_create_fb(int fd, int width, int height, uint32_t format,
+ bool tiled, struct igt_fb *fb)
{
uint32_t handles[4];
uint32_t pitches[4];
@@ -284,7 +284,7 @@ unsigned int kmstest_create_fb(int fd, int width, int height, uint32_t format,
memset(fb, 0, sizeof(*fb));
- bpp = drm_format_to_bpp(format);
+ bpp = igt_drm_format_to_bpp(format);
ret = create_bo_for_fb(fd, width, height, bpp, tiled, &fb->gem_handle,
&fb->size, &fb->stride);
if (ret < 0)
@@ -311,19 +311,19 @@ unsigned int kmstest_create_fb(int fd, int width, int height, uint32_t format,
return fb_id;
}
-unsigned int kmstest_create_color_fb(int fd, int width, int height,
+unsigned int igt_create_color_fb(int fd, int width, int height,
uint32_t format, bool tiled,
double r, double g, double b,
- struct kmstest_fb *fb /* out */)
+ struct igt_fb *fb /* out */)
{
unsigned int fb_id;
cairo_t *cr;
- fb_id = kmstest_create_fb(fd, width, height, format, tiled, fb);
+ fb_id = igt_create_fb(fd, width, height, format, tiled, fb);
igt_assert(fb_id);
- cr = kmstest_get_cairo_ctx(fd, fb);
- kmstest_paint_color(cr, 0, 0, width, height, r, g, b);
+ cr = igt_get_cairo_ctx(fd, fb);
+ igt_paint_color(cr, 0, 0, width, height, r, g, b);
igt_assert(cairo_status(cr) == 0);
cairo_destroy(cr);
@@ -343,11 +343,11 @@ static cairo_format_t drm_format_to_cairo(uint32_t drm_format)
static void __kmstest_destroy_cairo_surface(void *arg)
{
- struct kmstest_fb *fb = arg;
+ struct igt_fb *fb = arg;
munmap(cairo_image_surface_get_data(fb->cairo_surface), fb->size);
}
-static cairo_surface_t *kmstest_get_cairo_surface(int fd, struct kmstest_fb *fb)
+static cairo_surface_t *kmstest_get_cairo_surface(int fd, struct igt_fb *fb)
{
if (fb->cairo_surface == NULL) {
fb->cairo_surface =
@@ -367,7 +367,7 @@ static cairo_surface_t *kmstest_get_cairo_surface(int fd, struct kmstest_fb *fb)
return cairo_surface_reference(fb->cairo_surface);
}
-cairo_t *kmstest_get_cairo_ctx(int fd, struct kmstest_fb *fb)
+cairo_t *igt_get_cairo_ctx(int fd, struct igt_fb *fb)
{
cairo_surface_t *surface;
cairo_t *cr;
@@ -381,7 +381,7 @@ cairo_t *kmstest_get_cairo_ctx(int fd, struct kmstest_fb *fb)
return cr;
}
-void kmstest_write_fb(int fd, struct kmstest_fb *fb, const char *filename)
+void igt_write_fb_to_png(int fd, struct igt_fb *fb, const char *filename)
{
cairo_surface_t *surface;
cairo_status_t status;
@@ -393,7 +393,7 @@ void kmstest_write_fb(int fd, struct kmstest_fb *fb, const char *filename)
igt_assert(status == CAIRO_STATUS_SUCCESS);
}
-void kmstest_remove_fb(int fd, struct kmstest_fb *fb)
+void igt_remove_fb(int fd, struct igt_fb *fb)
{
cairo_surface_destroy(fb->cairo_surface);
do_or_die(drmModeRmFB(fd, fb->fb_id));
@@ -401,7 +401,7 @@ void kmstest_remove_fb(int fd, struct kmstest_fb *fb)
}
/* helpers to handle drm fourcc codes */
-uint32_t bpp_depth_to_drm_format(int bpp, int depth)
+uint32_t igt_bpp_depth_to_drm_format(int bpp, int depth)
{
struct format_desc_struct *f;
@@ -413,7 +413,7 @@ uint32_t bpp_depth_to_drm_format(int bpp, int depth)
}
/* Return fb_id on success, 0 on error */
-uint32_t drm_format_to_bpp(uint32_t drm_format)
+uint32_t igt_drm_format_to_bpp(uint32_t drm_format)
{
struct format_desc_struct *f;
@@ -424,7 +424,7 @@ uint32_t drm_format_to_bpp(uint32_t drm_format)
abort();
}
-const char *kmstest_format_str(uint32_t drm_format)
+const char *igt_format_str(uint32_t drm_format)
{
struct format_desc_struct *f;
@@ -435,7 +435,7 @@ const char *kmstest_format_str(uint32_t drm_format)
return "invalid";
}
-void kmstest_get_all_formats(const uint32_t **formats, int *format_count)
+void igt_get_all_formats(const uint32_t **formats, int *format_count)
{
static uint32_t *drm_formats;
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index efa54989a508..d5e728cca626 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -34,7 +34,7 @@
#include <xf86drmMode.h>
/* helpers to create nice-looking framebuffers */
-struct kmstest_fb {
+struct igt_fb {
uint32_t fb_id;
uint32_t gem_handle;
uint32_t drm_format;
@@ -47,7 +47,7 @@ struct kmstest_fb {
cairo_surface_t *cairo_surface;
};
-enum kmstest_text_align {
+enum igt_text_align {
align_left,
align_bottom = align_left,
align_right = 0x01,
@@ -56,34 +56,36 @@ enum kmstest_text_align {
align_hcenter = 0x08,
};
-int kmstest_cairo_printf_line(cairo_t *cr, enum kmstest_text_align align,
+int igt_cairo_printf_line(cairo_t *cr, enum igt_text_align align,
double yspacing, const char *fmt, ...)
__attribute__((format (printf, 4, 5)));
-unsigned int kmstest_create_fb(int fd, int width, int height, uint32_t format,
- bool tiled, struct kmstest_fb *fb);
-unsigned int kmstest_create_color_fb(int fd, int width, int height,
+unsigned int igt_create_fb(int fd, int width, int height, uint32_t format,
+ bool tiled, struct igt_fb *fb);
+unsigned int igt_create_color_fb(int fd, int width, int height,
uint32_t format, bool tiled,
double r, double g, double b,
- struct kmstest_fb *fb /* out */);
-void kmstest_remove_fb(int fd, struct kmstest_fb *fb_info);
-cairo_t *kmstest_get_cairo_ctx(int fd, struct kmstest_fb *fb);
-void kmstest_paint_color(cairo_t *cr, int x, int y, int w, int h,
+ struct igt_fb *fb /* out */);
+void igt_remove_fb(int fd, struct igt_fb *fb_info);
+
+/* cairo-based painting */
+cairo_t *igt_get_cairo_ctx(int fd, struct igt_fb *fb);
+void igt_paint_color(cairo_t *cr, int x, int y, int w, int h,
double r, double g, double b);
-void kmstest_paint_color_alpha(cairo_t *cr, int x, int y, int w, int h,
+void igt_paint_color_alpha(cairo_t *cr, int x, int y, int w, int h,
double r, double g, double b, double a);
-void kmstest_paint_color_gradient(cairo_t *cr, int x, int y, int w, int h,
+void igt_paint_color_gradient(cairo_t *cr, int x, int y, int w, int h,
int r, int g, int b);
-void kmstest_paint_test_pattern(cairo_t *cr, int width, int height);
-void kmstest_paint_image(cairo_t *cr, const char *filename,
+void igt_paint_test_pattern(cairo_t *cr, int width, int height);
+void igt_paint_image(cairo_t *cr, const char *filename,
int dst_x, int dst_y, int dst_width, int dst_height);
-void kmstest_write_fb(int fd, struct kmstest_fb *fb, const char *filename);
+void igt_write_fb_to_png(int fd, struct igt_fb *fb, const char *filename);
/* helpers to handle drm fourcc codes */
-uint32_t bpp_depth_to_drm_format(int bpp, int depth);
-uint32_t drm_format_to_bpp(uint32_t drm_format);
-const char *kmstest_format_str(uint32_t drm_format);
-void kmstest_get_all_formats(const uint32_t **formats, int *format_count);
+uint32_t igt_bpp_depth_to_drm_format(int bpp, int depth);
+uint32_t igt_drm_format_to_bpp(uint32_t drm_format);
+const char *igt_format_str(uint32_t drm_format);
+void igt_get_all_formats(const uint32_t **formats, int *format_count);
#endif /* __IGT_FB_H__ */
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 0793acf5c807..1d4bad4535c7 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -956,7 +956,7 @@ igt_plane_t *igt_output_get_plane(igt_output_t *output, enum igt_plane plane)
return igt_pipe_get_plane(pipe, plane);
}
-void igt_plane_set_fb(igt_plane_t *plane, struct kmstest_fb *fb)
+void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
{
igt_pipe_t *pipe = plane->pipe;
igt_display_t *display = pipe->display;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 775af78537a8..1ba7d9bc7021 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -79,7 +79,7 @@ typedef struct {
* using the atomic modeset API)
*/
drmModePlane *drm_plane;
- struct kmstest_fb *fb;
+ struct igt_fb *fb;
/* position within pipe_src_w x pipe_src_h */
int crtc_x, crtc_y;
} igt_plane_t;
@@ -127,7 +127,7 @@ drmModeModeInfo *igt_output_get_mode(igt_output_t *output);
void igt_output_set_pipe(igt_output_t *output, enum pipe pipe);
igt_plane_t *igt_output_get_plane(igt_output_t *output, enum igt_plane plane);
-void igt_plane_set_fb(igt_plane_t *plane, struct kmstest_fb *fb);
+void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb);
void igt_plane_set_position(igt_plane_t *plane, int x, int y);
#define for_each_connected_output(display, output) \
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index dd4c727a20cc..fbb5d8874763 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -50,8 +50,8 @@ enum cursor_type {
typedef struct {
int drm_fd;
igt_display_t display;
- struct kmstest_fb primary_fb;
- struct kmstest_fb fb[NUM_CURSOR_TYPES];
+ struct igt_fb primary_fb;
+ struct igt_fb fb[NUM_CURSOR_TYPES];
igt_pipe_crc_t **pipe_crc;
} data_t;
@@ -199,7 +199,7 @@ static bool prepare_crtc(test_data_t *test_data, igt_output_t *output,
/* create and set the primary plane fb */
mode = igt_output_get_mode(output);
- kmstest_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+ igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
DRM_FORMAT_XRGB8888,
false, /* tiled */
0.0, 0.0, 0.0,
@@ -247,7 +247,7 @@ static void cleanup_crtc(test_data_t *test_data, igt_output_t *output)
igt_pipe_crc_free(data->pipe_crc[test_data->pipe]);
data->pipe_crc[test_data->pipe] = NULL;
- kmstest_remove_fb(data->drm_fd, &data->primary_fb);
+ igt_remove_fb(data->drm_fd, &data->primary_fb);
primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
igt_plane_set_fb(primary, NULL);
@@ -302,14 +302,14 @@ static void create_cursor_fb(data_t *data,
cairo_t *cr;
uint32_t fb_id[NUM_CURSOR_TYPES];
- fb_id[cursor_type] = kmstest_create_fb(data->drm_fd, cur_w, cur_h,
+ fb_id[cursor_type] = igt_create_fb(data->drm_fd, cur_w, cur_h,
DRM_FORMAT_ARGB8888, false,
&data->fb[cursor_type]);
igt_assert(fb_id[cursor_type]);
- cr = kmstest_get_cairo_ctx(data->drm_fd,
+ cr = igt_get_cairo_ctx(data->drm_fd,
&data->fb[cursor_type]);
- kmstest_paint_color_alpha(cr, 0, 0, cur_w, cur_h, r, g, b, a);
+ igt_paint_color_alpha(cr, 0, 0, cur_w, cur_h, r, g, b, a);
igt_assert(cairo_status(cr) == 0);
}
diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c
index d60aaaae9ca9..4f56d630692f 100644
--- a/tests/kms_fbc_crc.c
+++ b/tests/kms_fbc_crc.c
@@ -51,7 +51,7 @@ enum test_mode {
typedef struct {
struct kmstest_connector_config config;
drmModeModeInfo mode;
- struct kmstest_fb fb[2];
+ struct igt_fb fb[2];
} connector_t;
typedef struct {
@@ -90,17 +90,17 @@ static const char *test_mode_str(enum test_mode mode)
static uint32_t create_fb(data_t *data,
int w, int h,
double r, double g, double b,
- struct kmstest_fb *fb)
+ struct igt_fb *fb)
{
uint32_t fb_id;
cairo_t *cr;
- fb_id = kmstest_create_fb(data->drm_fd, w, h,
+ fb_id = igt_create_fb(data->drm_fd, w, h,
DRM_FORMAT_XRGB8888, true, fb);
igt_assert(fb_id);
- cr = kmstest_get_cairo_ctx(data->drm_fd, fb);
- kmstest_paint_color(cr, 0, 0, w, h, r, g, b);
+ cr = igt_get_cairo_ctx(data->drm_fd, fb);
+ igt_paint_color(cr, 0, 0, w, h, r, g, b);
igt_assert(cairo_status(cr) == 0);
cairo_destroy(cr);
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index c31a1e3860e4..a3a7be2e28c1 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -138,7 +138,7 @@ struct test_output {
unsigned int fb_height;
unsigned int fb_ids[3];
int bpp, depth;
- struct kmstest_fb fb_info[3];
+ struct igt_fb fb_info[3];
struct event_state flip_state;
struct event_state vblank_state;
@@ -162,7 +162,7 @@ static void emit_dummy_load__bcs(struct test_output *o)
{
int i, limit;
drm_intel_bo *dummy_bo, *target_bo, *tmp_bo;
- struct kmstest_fb *fb_info = &o->fb_info[o->current_fb_id];
+ struct igt_fb *fb_info = &o->fb_info[o->current_fb_id];
unsigned pitch = fb_info->stride;
limit = intel_gen(devid) < 6 ? 500 : 5000;
@@ -208,7 +208,7 @@ static void emit_dummy_load__bcs(struct test_output *o)
static void emit_fence_stress(struct test_output *o)
{
const int num_fences = gem_available_fences(drm_fd);
- struct kmstest_fb *fb_info = &o->fb_info[o->current_fb_id];
+ struct igt_fb *fb_info = &o->fb_info[o->current_fb_id];
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 *exec;
uint32_t buf[2] = { MI_BATCH_BUFFER_END, 0 };
@@ -249,7 +249,7 @@ static void emit_fence_stress(struct test_output *o)
static void emit_dummy_load__rcs(struct test_output *o)
{
- const struct kmstest_fb *fb_info = &o->fb_info[o->current_fb_id];
+ const struct igt_fb *fb_info = &o->fb_info[o->current_fb_id];
igt_render_copyfunc_t copyfunc;
struct igt_buf sb[2], *src, *dst;
int i, limit;
@@ -657,7 +657,7 @@ static void check_all_state(struct test_output *o,
static void recreate_fb(struct test_output *o)
{
drmModeFBPtr r;
- struct kmstest_fb *fb_info = &o->fb_info[o->current_fb_id];
+ struct igt_fb *fb_info = &o->fb_info[o->current_fb_id];
uint32_t new_fb_id;
/* Call rmfb/getfb/addfb to ensure those don't introduce stalls */
@@ -679,7 +679,7 @@ static void recreate_fb(struct test_output *o)
static void set_y_tiling(struct test_output *o, int fb_idx)
{
drmModeFBPtr r;
- struct kmstest_fb *fb_info = &o->fb_info[fb_idx];
+ struct igt_fb *fb_info = &o->fb_info[fb_idx];
/* Call rmfb/getfb/addfb to ensure those don't introduce stalls */
r = drmModeGetFB(drm_fd, fb_info->fb_id);
@@ -1104,13 +1104,13 @@ found:
drmModeFreeCrtc(config[1].crtc);
}
-static void paint_flip_mode(struct kmstest_fb *fb, bool odd_frame)
+static void paint_flip_mode(struct igt_fb *fb, bool odd_frame)
{
- cairo_t *cr = kmstest_get_cairo_ctx(drm_fd, fb);
+ cairo_t *cr = igt_get_cairo_ctx(drm_fd, fb);
int width = fb->width;
int height = fb->height;
- kmstest_paint_test_pattern(cr, width, height);
+ igt_paint_test_pattern(cr, width, height);
if (odd_frame)
cairo_rectangle(cr, width/4, height/2, width/4, height/8);
@@ -1290,14 +1290,14 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
if (o->flags & TEST_FENCE_STRESS)
tiled = true;
- o->fb_ids[0] = kmstest_create_fb(drm_fd, o->fb_width, o->fb_height,
- bpp_depth_to_drm_format(o->bpp, o->depth),
+ o->fb_ids[0] = igt_create_fb(drm_fd, o->fb_width, o->fb_height,
+ igt_bpp_depth_to_drm_format(o->bpp, o->depth),
tiled, &o->fb_info[0]);
- o->fb_ids[1] = kmstest_create_fb(drm_fd, o->fb_width, o->fb_height,
- bpp_depth_to_drm_format(o->bpp, o->depth),
+ o->fb_ids[1] = igt_create_fb(drm_fd, o->fb_width, o->fb_height,
+ igt_bpp_depth_to_drm_format(o->bpp, o->depth),
tiled, &o->fb_info[1]);
- o->fb_ids[2] = kmstest_create_fb(drm_fd, o->fb_width, o->fb_height,
- bpp_depth_to_drm_format(o->bpp, o->depth),
+ o->fb_ids[2] = igt_create_fb(drm_fd, o->fb_width, o->fb_height,
+ igt_bpp_depth_to_drm_format(o->bpp, o->depth),
true, &o->fb_info[2]);
igt_assert(o->fb_ids[0]);
igt_assert(o->fb_ids[1]);
@@ -1353,9 +1353,9 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
igt_info("\n%s: PASSED\n\n", test_name);
out:
- kmstest_remove_fb(drm_fd, &o->fb_info[2]);
- kmstest_remove_fb(drm_fd, &o->fb_info[1]);
- kmstest_remove_fb(drm_fd, &o->fb_info[0]);
+ igt_remove_fb(drm_fd, &o->fb_info[2]);
+ igt_remove_fb(drm_fd, &o->fb_info[1]);
+ igt_remove_fb(drm_fd, &o->fb_info[0]);
last_connector = NULL;
diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
index 75217df4f5e1..bef7a42118e6 100644
--- a/tests/kms_pipe_crc_basic.c
+++ b/tests/kms_pipe_crc_basic.c
@@ -34,7 +34,7 @@
typedef struct {
int drm_fd;
igt_display_t display;
- struct kmstest_fb fb;
+ struct igt_fb fb;
} data_t;
static void test_bad_command(data_t *data, const char *cmd)
@@ -75,7 +75,7 @@ static void test_read_crc(data_t *data, int pipe, unsigned flags)
pipe_name(pipe));
mode = igt_output_get_mode(output);
- kmstest_create_color_fb(data->drm_fd,
+ igt_create_color_fb(data->drm_fd,
mode->hdisplay, mode->vdisplay,
DRM_FORMAT_XRGB8888,
false, /* tiled */
@@ -116,7 +116,7 @@ static void test_read_crc(data_t *data, int pipe, unsigned flags)
free(crcs);
igt_pipe_crc_free(pipe_crc);
- kmstest_remove_fb(data->drm_fd, &data->fb);
+ igt_remove_fb(data->drm_fd, &data->fb);
igt_plane_set_fb(primary, NULL);
igt_output_set_pipe(output, PIPE_ANY);
diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index b24a1b771c2b..6bdbca32ff5c 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -63,22 +63,22 @@ static void
create_fb_for_mode__position(data_t *data, drmModeModeInfo *mode,
double rect_x, double rect_y,
double rect_w, double rect_h,
- struct kmstest_fb *fb /* out */)
+ struct igt_fb *fb /* out */)
{
unsigned int fb_id;
cairo_t *cr;
- fb_id = kmstest_create_fb(data->drm_fd,
+ fb_id = igt_create_fb(data->drm_fd,
mode->hdisplay, mode->vdisplay,
DRM_FORMAT_XRGB8888,
false /* tiling */,
fb);
igt_assert(fb_id);
- cr = kmstest_get_cairo_ctx(data->drm_fd, fb);
- kmstest_paint_color(cr, 0, 0, mode->hdisplay, mode->vdisplay,
+ cr = igt_get_cairo_ctx(data->drm_fd, fb);
+ igt_paint_color(cr, 0, 0, mode->hdisplay, mode->vdisplay,
0.0, 1.0, 0.0);
- kmstest_paint_color(cr, rect_x, rect_y, rect_w, rect_h, 0.0, 0.0, 0.0);
+ igt_paint_color(cr, rect_x, rect_y, rect_w, rect_h, 0.0, 0.0, 0.0);
igt_assert(cairo_status(cr) == 0);
cairo_destroy(cr);
}
@@ -87,7 +87,7 @@ static void
test_position_init(test_position_t *test, igt_output_t *output, enum pipe pipe)
{
data_t *data = test->data;
- struct kmstest_fb green_fb;
+ struct igt_fb green_fb;
drmModeModeInfo *mode;
igt_plane_t *primary;
@@ -97,7 +97,7 @@ test_position_init(test_position_t *test, igt_output_t *output, enum pipe pipe)
primary = igt_output_get_plane(output, 0);
mode = igt_output_get_mode(output);
- kmstest_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+ igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
DRM_FORMAT_XRGB8888,
false, /* tiled */
0.0, 1.0, 0.0,
@@ -111,7 +111,7 @@ test_position_init(test_position_t *test, igt_output_t *output, enum pipe pipe)
igt_plane_set_fb(primary, NULL);
igt_display_commit(&data->display);
- kmstest_remove_fb(data->drm_fd, &green_fb);
+ igt_remove_fb(data->drm_fd, &green_fb);
}
static void
@@ -136,7 +136,7 @@ test_plane_position_with_output(data_t *data,
{
test_position_t test = { .data = data };
igt_plane_t *primary, *sprite;
- struct kmstest_fb primary_fb, sprite_fb;
+ struct igt_fb primary_fb, sprite_fb;
drmModeModeInfo *mode;
igt_crc_t crc;
@@ -153,7 +153,7 @@ test_plane_position_with_output(data_t *data,
&primary_fb);
igt_plane_set_fb(primary, &primary_fb);
- kmstest_create_color_fb(data->drm_fd,
+ igt_create_color_fb(data->drm_fd,
64, 64, /* width, height */
DRM_FORMAT_XRGB8888,
false, /* tiled */
diff --git a/tests/kms_render.c b/tests/kms_render.c
index 493bb5e0c74f..d39281474ec4 100644
--- a/tests/kms_render.c
+++ b/tests/kms_render.c
@@ -50,30 +50,30 @@ enum test_flags {
TEST_GPU_BLIT = 0x02,
};
-static int paint_fb(struct kmstest_fb *fb, const char *test_name,
+static int paint_fb(struct igt_fb *fb, const char *test_name,
const char *mode_format_str, const char *cconf_str)
{
cairo_t *cr;
- cr = kmstest_get_cairo_ctx(drm_fd, fb);
+ cr = igt_get_cairo_ctx(drm_fd, fb);
- kmstest_paint_color_gradient(cr, 0, 0, fb->width, fb->height, 1, 1, 1);
- kmstest_paint_test_pattern(cr, fb->width, fb->height);
+ igt_paint_color_gradient(cr, 0, 0, fb->width, fb->height, 1, 1, 1);
+ igt_paint_test_pattern(cr, fb->width, fb->height);
cairo_select_font_face(cr, "Helvetica", CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
cairo_move_to(cr, fb->width / 2, fb->height / 2);
cairo_set_font_size(cr, 36);
- kmstest_cairo_printf_line(cr, align_hcenter, 10, "%s", test_name);
- kmstest_cairo_printf_line(cr, align_hcenter, 10, "%s", mode_format_str);
- kmstest_cairo_printf_line(cr, align_hcenter, 10, "%s", cconf_str);
+ igt_cairo_printf_line(cr, align_hcenter, 10, "%s", test_name);
+ igt_cairo_printf_line(cr, align_hcenter, 10, "%s", mode_format_str);
+ igt_cairo_printf_line(cr, align_hcenter, 10, "%s", cconf_str);
cairo_destroy(cr);
return 0;
}
-static void gpu_blit(struct kmstest_fb *dst_fb, struct kmstest_fb *src_fb)
+static void gpu_blit(struct igt_fb *dst_fb, struct igt_fb *src_fb)
{
drm_intel_bo *dst_bo;
drm_intel_bo *src_bo;
@@ -81,8 +81,8 @@ static void gpu_blit(struct kmstest_fb *dst_fb, struct kmstest_fb *src_fb)
igt_assert(dst_fb->drm_format == src_fb->drm_format);
igt_assert(src_fb->drm_format == DRM_FORMAT_RGB565 ||
- drm_format_to_bpp(src_fb->drm_format) != 16);
- bpp = drm_format_to_bpp(src_fb->drm_format);
+ igt_drm_format_to_bpp(src_fb->drm_format) != 16);
+ bpp = igt_drm_format_to_bpp(src_fb->drm_format);
dst_bo = gem_handle_to_libdrm_bo(bufmgr, drm_fd, "destination",
dst_fb->gem_handle);
igt_assert(dst_bo);
@@ -108,13 +108,13 @@ static int test_format(const char *test_name,
{
int width;
int height;
- struct kmstest_fb fb[2];
+ struct igt_fb fb[2];
char *mode_format_str;
char *cconf_str;
int ret;
ret = asprintf(&mode_format_str, "%s @ %dHz / %s",
- mode->name, mode->vrefresh, kmstest_format_str(format));
+ mode->name, mode->vrefresh, igt_format_str(format));
igt_assert(ret > 0);
ret = asprintf(&cconf_str, "pipe %s, encoder %s, connector %s",
kmstest_pipe_str(cconf->pipe),
@@ -128,10 +128,10 @@ static int test_format(const char *test_name,
width = mode->hdisplay;
height = mode->vdisplay;
- if (!kmstest_create_fb(drm_fd, width, height, format, false, &fb[0]))
+ if (!igt_create_fb(drm_fd, width, height, format, false, &fb[0]))
goto err1;
- if (!kmstest_create_fb(drm_fd, width, height, format, false, &fb[1]))
+ if (!igt_create_fb(drm_fd, width, height, format, false, &fb[1]))
goto err2;
if (drmModeSetCrtc(drm_fd, cconf->crtc->crtc_id, fb[0].fb_id,
@@ -155,13 +155,13 @@ static int test_format(const char *test_name,
free(mode_format_str);
free(cconf_str);
- kmstest_remove_fb(drm_fd, &fb[1]);
- kmstest_remove_fb(drm_fd, &fb[0]);
+ igt_remove_fb(drm_fd, &fb[1]);
+ igt_remove_fb(drm_fd, &fb[0]);
return 0;
err2:
- kmstest_remove_fb(drm_fd, &fb[0]);
+ igt_remove_fb(drm_fd, &fb[0]);
err1:
printf("Test %s with %s on %s: SKIPPED\n",
test_name, mode_format_str, cconf_str);
@@ -179,7 +179,7 @@ static void test_connector(const char *test_name,
int format_count;
int i;
- kmstest_get_all_formats(&formats, &format_count);
+ igt_get_all_formats(&formats, &format_count);
for (i = 0; i < cconf->connector->count_modes; i++) {
int j;
diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index e873fb251e79..802876a6d728 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -95,7 +95,7 @@ struct crtc_config {
int pipe_id;
int connector_count;
struct connector_config *cconfs;
- struct kmstest_fb fb_info;
+ struct igt_fb fb_info;
drmModeModeInfo mode;
};
@@ -141,22 +141,22 @@ static bool crtc_supports_mode(struct crtc_config *crtc, drmModeModeInfo *mode)
return true;
}
-static int paint_fb(struct kmstest_fb *fb, const char *test_name,
+static int paint_fb(struct igt_fb *fb, const char *test_name,
const char **crtc_str, int crtc_count, int current_crtc_idx)
{
double x, y;
cairo_t *cr;
int i;
- cr = kmstest_get_cairo_ctx(drm_fd, fb);
+ cr = igt_get_cairo_ctx(drm_fd, fb);
- kmstest_paint_test_pattern(cr, fb->width, fb->height);
+ igt_paint_test_pattern(cr, fb->width, fb->height);
cairo_select_font_face(cr, "Helvetica", CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
cairo_move_to(cr, fb->width / 2, fb->height / 2);
cairo_set_font_size(cr, 24);
- kmstest_cairo_printf_line(cr, align_hcenter, 40, "%s", test_name);
+ igt_cairo_printf_line(cr, align_hcenter, 40, "%s", test_name);
cairo_get_current_point(cr, &x, &y);
cairo_move_to(cr, 60, y);
@@ -165,10 +165,10 @@ static int paint_fb(struct kmstest_fb *fb, const char *test_name,
if (i == current_crtc_idx) {
cairo_get_current_point(cr, &x, &y);
cairo_move_to(cr, x - 20, y);
- kmstest_cairo_printf_line(cr, align_right, 20, "X");
+ igt_cairo_printf_line(cr, align_right, 20, "X");
cairo_move_to(cr, x, y);
}
- kmstest_cairo_printf_line(cr, align_left, 20, "%s",
+ igt_cairo_printf_line(cr, align_left, 20, "%s",
crtc_str[i]);
}
@@ -178,7 +178,7 @@ static int paint_fb(struct kmstest_fb *fb, const char *test_name,
}
static void create_fb_for_crtc(struct crtc_config *crtc,
- struct kmstest_fb *fb_info)
+ struct igt_fb *fb_info)
{
int bpp;
int depth;
@@ -188,9 +188,9 @@ static void create_fb_for_crtc(struct crtc_config *crtc,
bpp = 32;
depth = 24;
enable_tiling = false;
- fb_id = kmstest_create_fb(drm_fd, crtc->mode.hdisplay,
+ fb_id = igt_create_fb(drm_fd, crtc->mode.hdisplay,
crtc->mode.vdisplay,
- bpp_depth_to_drm_format(bpp, depth),
+ igt_bpp_depth_to_drm_format(bpp, depth),
enable_tiling, fb_info);
igt_assert(fb_id > 0);
}
diff --git a/tests/pm_lpsp.c b/tests/pm_lpsp.c
index e8033cf330c5..9d3884c00302 100644
--- a/tests/pm_lpsp.c
+++ b/tests/pm_lpsp.c
@@ -91,15 +91,15 @@ static void screens_disabled_subtest(int drm_fd, drmModeResPtr drm_res)
static uint32_t create_fb(int drm_fd, int width, int height)
{
- struct kmstest_fb fb;
+ struct igt_fb fb;
cairo_t *cr;
uint32_t buffer_id;
- buffer_id = kmstest_create_fb(drm_fd, width, height,
+ buffer_id = igt_create_fb(drm_fd, width, height,
DRM_FORMAT_XRGB8888,
false, &fb);
- cr = kmstest_get_cairo_ctx(drm_fd, &fb);
- kmstest_paint_test_pattern(cr, width, height);
+ cr = igt_get_cairo_ctx(drm_fd, &fb);
+ igt_paint_test_pattern(cr, width, height);
cairo_destroy(cr);
return buffer_id;
diff --git a/tests/pm_pc8.c b/tests/pm_pc8.c
index bed69c570c42..0d04323c4fd5 100644
--- a/tests/pm_pc8.c
+++ b/tests/pm_pc8.c
@@ -269,21 +269,21 @@ static struct scanout_fb *create_fb(struct mode_set_data *data, int width,
int height)
{
struct scanout_fb *fb_info;
- struct kmstest_fb fb;
+ struct igt_fb fb;
cairo_t *cr;
fb_info = malloc(sizeof(struct scanout_fb));
igt_assert(fb_info);
- fb_info->handle = kmstest_create_fb(drm_fd, width, height,
+ fb_info->handle = igt_create_fb(drm_fd, width, height,
DRM_FORMAT_XRGB8888,
false, &fb);
fb_info->width = width;
fb_info->height = height;
fb_info->next = NULL;
- cr = kmstest_get_cairo_ctx(drm_fd, &fb);
- kmstest_paint_test_pattern(cr, width, height);
+ cr = igt_get_cairo_ctx(drm_fd, &fb);
+ igt_paint_test_pattern(cr, width, height);
cairo_destroy(cr);
return fb_info;
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 13197311e444..c320a9c1e18b 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -221,7 +221,7 @@ static void connector_find_preferred_mode(uint32_t connector_id,
}
static void
-paint_color_key(struct kmstest_fb *fb_info)
+paint_color_key(struct igt_fb *fb_info)
{
int i, j;
uint32_t *fb_ptr;
@@ -272,9 +272,9 @@ static void paint_image(cairo_t *cr, const char *file)
cairo_surface_destroy(image);
}
-static void paint_output_info(struct connector *c, struct kmstest_fb *fb)
+static void paint_output_info(struct connector *c, struct igt_fb *fb)
{
- cairo_t *cr = kmstest_get_cairo_ctx(drm_fd, fb);
+ cairo_t *cr = igt_get_cairo_ctx(drm_fd, fb);
int l_width = fb->width;
int l_height = fb->height;
double str_width;
@@ -282,7 +282,7 @@ static void paint_output_info(struct connector *c, struct kmstest_fb *fb)
double max_width;
int i;
- kmstest_paint_test_pattern(cr, l_width, l_height);
+ igt_paint_test_pattern(cr, l_width, l_height);
cairo_select_font_face(cr, "Helvetica",
CAIRO_FONT_SLANT_NORMAL,
@@ -291,11 +291,11 @@ static void paint_output_info(struct connector *c, struct kmstest_fb *fb)
/* Print connector and mode name */
cairo_set_font_size(cr, 48);
- kmstest_cairo_printf_line(cr, align_hcenter, 10, "%s",
+ igt_cairo_printf_line(cr, align_hcenter, 10, "%s",
kmstest_connector_type_str(c->connector->connector_type));
cairo_set_font_size(cr, 36);
- str_width = kmstest_cairo_printf_line(cr, align_hcenter, 10,
+ str_width = igt_cairo_printf_line(cr, align_hcenter, 10,
"%s @ %dHz on %s encoder", c->mode.name, c->mode.vrefresh,
kmstest_encoder_type_str(c->encoder->encoder_type));
@@ -303,7 +303,7 @@ static void paint_output_info(struct connector *c, struct kmstest_fb *fb)
/* List available modes */
cairo_set_font_size(cr, 18);
- str_width = kmstest_cairo_printf_line(cr, align_left, 10,
+ str_width = igt_cairo_printf_line(cr, align_left, 10,
"Available modes:");
cairo_rel_move_to(cr, str_width, 0);
cairo_get_current_point(cr, &x, &top_y);
@@ -316,7 +316,7 @@ static void paint_output_info(struct connector *c, struct kmstest_fb *fb)
max_width = 0;
cairo_move_to(cr, x, top_y);
}
- str_width = kmstest_cairo_printf_line(cr, align_right, 10,
+ str_width = igt_cairo_printf_line(cr, align_right, 10,
"%s @ %dHz", c->connector->modes[i].name,
c->connector->modes[i].vrefresh);
if (str_width > max_width)
@@ -378,7 +378,7 @@ static void
set_mode(struct connector *c)
{
unsigned int fb_id = 0;
- struct kmstest_fb fb_info[2] = { };
+ struct igt_fb fb_info[2] = { };
int j, test_mode_num, current_fb = 0, old_fb = -1;
test_mode_num = 1;
@@ -405,8 +405,8 @@ set_mode(struct connector *c)
width = c->mode.hdisplay;
height = c->mode.vdisplay;
- fb_id = kmstest_create_fb(drm_fd, width, height,
- bpp_depth_to_drm_format(bpp, depth),
+ fb_id = igt_create_fb(drm_fd, width, height,
+ igt_bpp_depth_to_drm_format(bpp, depth),
enable_tiling, &fb_info[current_fb]);
paint_output_info(c, &fb_info[current_fb]);
paint_color_key(&fb_info[current_fb]);
@@ -422,7 +422,7 @@ set_mode(struct connector *c)
}
if (old_fb != -1)
- kmstest_remove_fb(drm_fd, &fb_info[old_fb]);
+ igt_remove_fb(drm_fd, &fb_info[old_fb]);
old_fb = current_fb;
current_fb = 1 - current_fb;
@@ -442,7 +442,7 @@ set_mode(struct connector *c)
}
if (test_all_modes)
- kmstest_remove_fb(drm_fd, &fb_info[old_fb]);
+ igt_remove_fb(drm_fd, &fb_info[old_fb]);
drmModeFreeEncoder(c->encoder);
drmModeFreeConnector(c->connector);
@@ -525,22 +525,22 @@ static const char *stereo_mode_str(drmModeModeInfo *mode)
}
}
-static uint32_t create_stereo_fb(drmModeModeInfo *mode, struct kmstest_fb *fb)
+static uint32_t create_stereo_fb(drmModeModeInfo *mode, struct igt_fb *fb)
{
struct stereo_fb_layout layout;
cairo_t *cr;
uint32_t fb_id;
stereo_fb_layout_from_mode(&layout, mode);
- fb_id = kmstest_create_fb(drm_fd, layout.fb_width, layout.fb_height,
- bpp_depth_to_drm_format(bpp, depth),
+ fb_id = igt_create_fb(drm_fd, layout.fb_width, layout.fb_height,
+ igt_bpp_depth_to_drm_format(bpp, depth),
enable_tiling, fb);
- cr = kmstest_get_cairo_ctx(drm_fd, fb);
+ cr = igt_get_cairo_ctx(drm_fd, fb);
- kmstest_paint_image(cr, IGT_DATADIR"/1080p-left.png",
+ igt_paint_image(cr, IGT_DATADIR"/1080p-left.png",
layout.left.x, layout.left.y,
layout.left.width, layout.left.height);
- kmstest_paint_image(cr, IGT_DATADIR"/1080p-right.png",
+ igt_paint_image(cr, IGT_DATADIR"/1080p-right.png",
layout.right.x, layout.right.y,
layout.right.width, layout.right.height);
@@ -555,7 +555,7 @@ static uint32_t create_stereo_fb(drmModeModeInfo *mode, struct kmstest_fb *fb)
mode->vrefresh,
stereo_mode_str(mode));
- kmstest_write_fb(drm_fd, fb, buffer);
+ igt_write_fb_to_png(drm_fd, fb, buffer);
}
return fb_id;
@@ -564,7 +564,7 @@ static uint32_t create_stereo_fb(drmModeModeInfo *mode, struct kmstest_fb *fb)
static void do_set_stereo_mode(struct connector *c)
{
uint32_t fb_id;
- struct kmstest_fb fb_info;
+ struct igt_fb fb_info;
fb_id = create_stereo_fb(&c->mode, &fb_info);
--
1.8.5.2
More information about the Intel-gfx
mailing list