[Intel-gfx] [PATCH i-g-t 2/2] kms_plane_scaling: Find the image regardless how the test is run
Tvrtko Ursulin
tvrtko.ursulin at linux.intel.com
Thu Apr 30 04:27:55 PDT 2015
From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
As it stands running the test like "sudo tests/kms_plane_scaling"
does not work.
Fix it by using the same method igt_paint_image uses.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Cc: chandra konduru <chandra.konduru at intel.com>
---
tests/kms_plane_scaling.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 00db5cb..8ff154f 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -202,6 +202,15 @@ static void iterate_plane_scaling(data_t *d, drmModeModeInfo *mode)
}
}
+static cairo_status_t
+stdio_read_func(void *closure, unsigned char* data, unsigned int size)
+{
+ if (fread(data, 1, size, (FILE*)closure) != size)
+ return CAIRO_STATUS_READ_ERROR;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
static void test_plane_scaling(data_t *d)
{
igt_display_t *display = &d->display;
@@ -210,6 +219,7 @@ static void test_plane_scaling(data_t *d)
enum pipe pipe;
int valid_tests = 0;
int primary_plane_scaling = 0; /* For now */
+ FILE* f;
igt_require(d->display.has_universal_planes);
igt_require(d->num_scalers);
@@ -223,11 +233,15 @@ static void test_plane_scaling(data_t *d)
mode = igt_output_get_mode(output);
/* allocate fb2 with image size */
- image = cairo_image_surface_create_from_png(FILE_NAME);
+
+ f = igt_fopen_data(FILE_NAME);
+ image = cairo_image_surface_create_from_png_stream(
+ &stdio_read_func, f);
igt_assert(cairo_surface_status(image) == CAIRO_STATUS_SUCCESS);
d->image_w = cairo_image_surface_get_width(image);
d->image_h = cairo_image_surface_get_height(image);
cairo_surface_destroy(image);
+ fclose(f);
d->fb_id2 = igt_create_fb(d->drm_fd,
d->image_w, d->image_h,
@@ -355,7 +369,6 @@ igt_simple_main
igt_skip_on_simulation();
-
data.drm_fd = drm_open_any();
igt_require_pipe_crc();
igt_display_init(&data.display, data.drm_fd);
--
2.3.5
More information about the Intel-gfx
mailing list