コード例 #1
0
ファイル: output.c プロジェクト: GStreamer/gstreamer-vaapi
gboolean
video_output_init (int *argc, char *argv[], GOptionEntry * options)
{
  GOptionContext *ctx;
  gboolean success;

#if !GLIB_CHECK_VERSION(2,31,0)
  if (!g_thread_supported ())
    g_thread_init (NULL);
#endif

  ctx = g_option_context_new ("- test options");
  if (!ctx)
    return FALSE;

  g_option_context_add_group (ctx, gst_init_get_option_group ());
  g_option_context_add_main_entries (ctx, g_options, NULL);
  if (options)
    g_option_context_add_main_entries (ctx, options, NULL);
  success = g_option_context_parse (ctx, argc, &argv, NULL);
  g_option_context_free (ctx);

  if (g_list_outputs) {
    list_outputs ();
    exit (0);
  }
  return success;
}
コード例 #2
0
ファイル: test_output.c プロジェクト: larsks/kmscon
int main(int argc, char **argv)
{
	struct uterm_video *video;
	int ret;
	const char *node;
	const struct uterm_video_module *mode;
	size_t onum;

	onum = sizeof(options) / sizeof(*options);
	ret = test_prepare(options, onum, argc, argv, &eloop);
	if (ret)
		goto err_fail;

	if (output_conf.fbdev) {
		mode = UTERM_VIDEO_FBDEV;
		node = "/dev/fb0";
	} else {
		mode = UTERM_VIDEO_DRM3D;
		node = "/dev/dri/card0";
	}

	if (output_conf.dev)
		node = output_conf.dev;

	log_notice("Creating video object using %s...", node);

	ret = uterm_video_new(&video, eloop, node, mode);
	if (ret) {
		if (mode == UTERM_VIDEO_DRM3D) {
			log_notice("cannot create drm device; trying drm2d mode");
			ret = uterm_video_new(&video, eloop, node,
					      UTERM_VIDEO_DRM2D);
			if (ret)
				goto err_exit;
		} else {
			goto err_exit;
		}
	}

	log_notice("Wakeing up video object...");
	ret = uterm_video_wake_up(video);
	if (ret < 0)
		goto err_unref;

	if (!output_conf.test) {
		ret = list_outputs(video);
		if (ret) {
			log_err("Cannot list outputs: %d", ret);
			goto err_unref;
		}
	} else {
		ret = blit_outputs(video);
		if (ret) {
			log_err("Cannot set outputs: %d", ret);
			goto err_unref;
		}
	}

err_unref:
	uterm_video_unref(video);
err_exit:
	test_exit(options, onum, eloop);
err_fail:
	if (ret != -ECANCELED)
		test_fail(ret);
	return abs(ret);
}
コード例 #3
0
ファイル: test_output.c プロジェクト: myra/kmscon
int main(int argc, char **argv)
{
	struct uterm_video *video;
	int ret;
	unsigned int mode;
	const char *node;

	ret = test_prepare(argc, argv, &eloop);
	if (ret)
		goto err_fail;

	if (conf_global.use_fbdev) {
		mode = UTERM_VIDEO_FBDEV;
		node = "/dev/fb0";
	} else {
		mode = UTERM_VIDEO_DRM;
		node = "/dev/dri/card0";
	}

	log_notice("Creating video object using %s...", node);

	ret = uterm_video_new(&video, eloop, mode, node);
	if (ret) {
		if (mode == UTERM_VIDEO_DRM) {
			log_notice("cannot create drm device; trying dumb drm mode");
			ret = uterm_video_new(&video, eloop,
					      UTERM_VIDEO_DUMB, node);
			if (ret)
				goto err_exit;
		} else {
			goto err_exit;
		}
	}

	log_notice("Wakeing up video object...");
	ret = uterm_video_wake_up(video);
	if (ret < 0)
		goto err_unref;

	if (argc < 2) {
		ret = list_outputs(video);
		if (ret) {
			log_err("Cannot list outputs: %d", ret);
			goto err_unref;
		}
	} else {
		ret = uterm_video_use(video);
		if (ret)
			ret = blit_outputs(video);
		else
			ret = set_outputs(video);

		if (ret) {
			log_err("Cannot set outputs: %d", ret);
			goto err_unref;
		}
	}

err_unref:
	uterm_video_unref(video);
err_exit:
	test_exit(eloop);
err_fail:
	test_fail(ret);
	return abs(ret);
}