Beispiel #1
0
static void draw_rect_render(int fd, struct cmd_data *cmd_data,
			     struct buf_data *buf, struct rect *rect,
			     uint32_t color)
{
	drm_intel_bo *src, *dst;
	uint32_t devid = intel_get_drm_devid(fd);
	igt_render_copyfunc_t rendercopy = igt_get_render_copyfunc(devid);
	struct igt_buf src_buf, dst_buf;
	struct intel_batchbuffer *batch;
	uint32_t tiling, swizzle;
	struct buf_data tmp;
	int pixel_size = buf->bpp / 8;
	unsigned adjusted_w, adjusted_dst_x;

	igt_skip_on(!rendercopy);

	/* Rendercopy works at 32bpp, so if you try to do copies on buffers with
	 * smaller bpps you won't succeeed if you need to copy "half" of a 32bpp
	 * pixel or something similar. */
	igt_skip_on(rect->x % (32 / buf->bpp) != 0 ||
		    rect->y % (32 / buf->bpp) != 0 ||
		    rect->w % (32 / buf->bpp) != 0 ||
		    rect->h % (32 / buf->bpp) != 0);

	gem_get_tiling(fd, buf->handle, &tiling, &swizzle);

	/* We create a temporary buffer and copy from it using rendercopy. */
	tmp.size = rect->w * rect->h * pixel_size;
	tmp.handle = gem_create(fd, tmp.size);
	tmp.stride = rect->w * pixel_size;
	tmp.bpp = buf->bpp;
	draw_rect_mmap_cpu(fd, &tmp, &(struct rect){0, 0, rect->w, rect->h},
static char *dmabuf_mmap_framebuffer(int drm_fd, struct igt_fb *fb)
{
	char *ptr = NULL;

	dma_buf_fd = prime_handle_to_fd_for_mmap(drm_fd, fb->gem_handle);
	igt_skip_on(dma_buf_fd == -1 && errno == EINVAL);

	ptr = mmap(NULL, fb->size, PROT_READ | PROT_WRITE, MAP_SHARED, dma_buf_fd, 0);
	igt_assert(ptr != MAP_FAILED);

	return ptr;
}
static void test_read_crc(data_t *data, int pipe, unsigned flags)
{
	igt_display_t *display = &data->display;
	int valid_connectors = 0;
	igt_output_t *output;

	igt_skip_on(pipe >= data->display.n_pipes);

	for_each_connected_output(display, output) {

		igt_info("%s: Testing connector %s using pipe %s\n",
			 igt_subtest_name(), igt_output_name(output),
			 kmstest_pipe_name(pipe));

		valid_connectors += test_read_crc_for_output(data, pipe, output, flags);
	}
Beispiel #4
0
static void test_fade(int max)
{
    int i;
    static const struct timespec ts = { .tv_sec = 0, .tv_nsec = FADESPEED*1000000 };

    /* Fade out, then in */
    for (i = max; i > 0; i -= max / FADESTEPS) {
        test_and_verify(i);
        nanosleep(&ts, NULL);
    }
    for (i = 0; i <= max; i += max / FADESTEPS) {
        test_and_verify(i);
        nanosleep(&ts, NULL);
    }
}

igt_main
{
    int max, old;

    igt_skip_on_simulation();

    igt_fixture {
        /* Get the max value and skip the whole test if sysfs interface not available */
        igt_skip_on(backlight_read(&old, "brightness"));
        igt_assert(backlight_read(&max, "max_brightness") > -1);
    }

    igt_subtest("basic-brightness")
    test_brightness(max);
    igt_subtest("bad-brightness")
    test_bad_brightness(max);
    igt_subtest("fade")
    test_fade(max);

    igt_fixture {
        /* Restore old brightness */
        backlight_write(old, "brightness");
    }
}