Example #1
0
int
main(int argc, char **argv)
{
	uint16_t devid;
	struct drm_intel_decode *ctx;

	if (argc < 2)
		usage();


	devid = infer_devid(argv[1]);

	ctx = drm_intel_decode_context_alloc(devid);

	if (argc == 3) {
		if (strcmp(argv[2], "-dump") == 0)
			dump_batch(ctx, argv[1]);
		else
			usage();
	} else {
		compare_batch(ctx, argv[1]);
	}

	drm_intel_decode_context_free(ctx);

	return 0;
}
Example #2
0
static void
do_batch_dump(struct intel_context *intel)
{
   struct drm_intel_decode *decode;
   struct intel_batchbuffer *batch = &intel->batch;
   int ret;

   decode = drm_intel_decode_context_alloc(intel->intelScreen->deviceID);
   if (!decode)
      return;

   ret = drm_intel_bo_map(batch->bo, false);
   if (ret == 0) {
      drm_intel_decode_set_batch_pointer(decode,
					 batch->bo->virtual,
					 batch->bo->offset,
					 batch->used);
   } else {
Example #3
0
void
intel_winsys_decode_bo(struct intel_winsys *winsys,
                       struct intel_bo *bo, int used)
{
   void *ptr;

   ptr = intel_bo_map(bo, false);
   if (!ptr) {
      debug_printf("failed to map buffer for decoding\n");
      return;
   }

   pipe_mutex_lock(winsys->mutex);

   if (!winsys->decode) {
      winsys->decode = drm_intel_decode_context_alloc(winsys->info.devid);
      if (!winsys->decode) {
         pipe_mutex_unlock(winsys->mutex);
         intel_bo_unmap(bo);
         return;
      }

      /* debug_printf()/debug_error() uses stderr by default */
      drm_intel_decode_set_output_file(winsys->decode, stderr);
   }

   /* in dwords */
   used /= 4;

   drm_intel_decode_set_batch_pointer(winsys->decode,
         ptr, gem_bo(bo)->offset64, used);

   drm_intel_decode(winsys->decode);

   pipe_mutex_unlock(winsys->mutex);

   intel_bo_unmap(bo);
}
int
main (int argc, char *argv[])
{
	uint32_t devid = 0xa011;
	char *devid_str = NULL;
	int i, c;
	int option_index = 0;
	int binary = -1;

	static struct option long_options[] = {
		{"devid", 1, 0, 'd'},
		{"ascii", 0, 0, 'a'},
		{"binary", 0, 0, 'b'},
		{ 0 }
	};

	devid_str = getenv("INTEL_DEVID_OVERRIDE");

	while((c = getopt_long(argc, argv, "ad:b",
			       long_options, &option_index)) != -1) {
		switch(c) {
		case 'd':
			devid_str = optarg;
			break;
		case 'b':
			binary = 1;
			break;
		case 'a':
			binary = 0;
			break;
		default:
			printf("unkown command options\n");
			break;
		}
	}

	if (devid_str)
		devid = strtoul(devid_str, NULL, 0);

	ctx = drm_intel_decode_context_alloc(devid);

	if (optind == argc) {
		fprintf(stderr, "no input file given\n");
		exit(-1);
	}

	for (i = optind; i < argc; i++) {
		/* For stdin input, let's read as data file */
		if (!strcmp(argv[i], "-")) {
			read_data_file(argv[i]);
			continue;
		}
		if (binary == 1)
			read_bin_file(argv[i]);
		else if (binary == 0)
			read_data_file(argv[i]);
		else
			read_autodetect_file(argv[i]);
	}

	return 0;
}