Пример #1
0
static Bool probe_hw_pci(const char *dev, struct pci_device *pdev)
{
    int ret = FALSE, fd = open_hw(dev);
    char *id, *devid;
    drmSetVersion sv;

    if (fd == -1)
	return FALSE;

    sv.drm_di_major = 1;
    sv.drm_di_minor = 2;
    sv.drm_dd_major = -1;
    sv.drm_dd_minor = -1;
    if (drmSetInterfaceVersion(fd, &sv)) {
        close(fd);
        return FALSE;
    }


    id = drmGetBusid(fd);
    devid = ms_DRICreatePCIBusID(pdev);

    if (id && devid && !strcmp(id, devid))
        ret = check_outputs(fd);

    close(fd);
    free(id);
    free(devid);
    return ret;
}
Пример #2
0
static Bool probe_hw(const char *dev, struct xf86_platform_device *platform_dev)
{
    int fd;

#if XF86_PDEV_SERVER_FD
    if (platform_dev && (platform_dev->flags & XF86_PDEV_SERVER_FD)) {
        fd = xf86_get_platform_device_int_attrib(platform_dev, ODEV_ATTRIB_FD, -1);
        if (fd == -1)
            return FALSE;
        return check_outputs(fd);
    }
#endif

    fd = open_hw(dev);
    if (fd != -1) {
        int ret = check_outputs(fd);
        close(fd);
        return ret;
    }
    return FALSE;
}
Пример #3
0
/**
 * Render using the program and verify that it outputs the proper data
 * to the transform feedback buffer.
 *
 * The program should already be linked and stored in the global \c
 * prog.
 */
static enum piglit_result
test_xfb(bool use_rasterizer_discard)
{
	GLuint buf;
	void *initial_data;
	const void *readback;
	unsigned expected_num_outputs = count_outputs();
	unsigned buf_size
		= expected_num_outputs * NUM_VERTICES * sizeof(float);
	bool pass = true;

	/* Create transform feedback buffer and pre-load it with
	 * garbage.
	 */
	glGenBuffers(1, &buf);
	initial_data = malloc(buf_size);
	memset(initial_data, 0xcc, buf_size);
	glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
	glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, buf_size, initial_data,
		     GL_STREAM_READ);
	free(initial_data);

	/* Draw a quad filling the window, with transform feedback
	 * enabled.
	 */
	glUseProgram(prog);
	glBeginTransformFeedback(GL_TRIANGLES);
	if (use_rasterizer_discard)
		glEnable(GL_RASTERIZER_DISCARD);
	draw_rect(-1, -1, 2, 2);
	if (use_rasterizer_discard)
		glDisable(GL_RASTERIZER_DISCARD);
	glEndTransformFeedback();
	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;

	/* Inspect transform feedback output. */
	readback = glMapBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf_size,
				    GL_MAP_READ_BIT);
	pass = check_outputs(readback) && pass;
	glUnmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER);

	glDeleteBuffers(1, &buf);

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}