• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/minidlna/ffmpeg-2.3.4/libavutil/

Lines Matching defs:opencl_ctx

104 static OpenclContext opencl_ctx = {&openclutils_class};
212 av_log(&opencl_ctx, AV_LOG_ERROR,
221 av_log(&opencl_ctx, AV_LOG_ERROR,
267 av_log(&opencl_ctx, AV_LOG_WARNING,
286 av_log(&opencl_ctx, AV_LOG_WARNING,
310 av_log(&opencl_ctx, AV_LOG_ERROR, "Could not allocate opencl device list\n");
315 av_log(&opencl_ctx, AV_LOG_ERROR, "Could not get device list from environment\n");
356 if (!opencl_ctx.opt_init_flag) {
357 av_opt_set_defaults(&opencl_ctx);
358 opencl_ctx.opt_init_flag = 1;
360 ret = av_opt_set(&opencl_ctx, key, val, 0);
369 ret = av_opt_get(&opencl_ctx, key, 0, out_val);
378 av_opt_free(&opencl_ctx);
386 av_log(&opencl_ctx, AV_LOG_ERROR,
403 if (opencl_ctx.kernel_code_count >= MAX_KERNEL_CODE_NUM) {
404 av_log(&opencl_ctx, AV_LOG_ERROR,
410 for (i = 0; i < opencl_ctx.kernel_code_count; i++) {
411 if (opencl_ctx.kernel_code[i].kernel_string == kernel_code) {
412 av_log(&opencl_ctx, AV_LOG_WARNING, "Same kernel code has been registered\n");
416 opencl_ctx.kernel_code[opencl_ctx.kernel_code_count].kernel_string = kernel_code;
417 opencl_ctx.kernel_code[opencl_ctx.kernel_code_count].is_compiled = 0;
418 opencl_ctx.kernel_code_count++;
435 for (i = 0; i < opencl_ctx.kernel_code_count; i++) {
437 ptr = av_stristr(opencl_ctx.kernel_code[i].kernel_string, program_name);
438 if (ptr && !opencl_ctx.kernel_code[i].is_compiled) {
439 kernel_source = opencl_ctx.kernel_code[i].kernel_string;
440 kernel_code_len = strlen(opencl_ctx.kernel_code[i].kernel_string);
446 av_log(&opencl_ctx, AV_LOG_ERROR,
452 program = clCreateProgramWithSource(opencl_ctx.context, 1, &kernel_source, &kernel_code_len, &status);
454 av_log(&opencl_ctx, AV_LOG_ERROR,
459 status = clBuildProgram(program, 1, &(opencl_ctx.device_id), build_opts, NULL, NULL);
461 av_log(&opencl_ctx, AV_LOG_ERROR,
467 opencl_ctx.kernel_code[kernel_code_idx].is_compiled = 1;
475 return opencl_ctx.command_queue;
481 av_log(&opencl_ctx, AV_LOG_ERROR, "Could not create OpenCL kernel %s, please update libavfilter.\n", kernel_name);
487 av_log(&opencl_ctx, AV_LOG_ERROR, "Could not release OpenCL kernel, please update libavfilter.\n");
491 static int init_opencl_env(OpenclContext *opencl_ctx, AVOpenCLExternalEnv *ext_opencl_env)
499 if (opencl_ctx->is_user_created)
501 opencl_ctx->platform_id = ext_opencl_env->platform_id;
502 opencl_ctx->is_user_created = 1;
503 opencl_ctx->command_queue = ext_opencl_env->command_queue;
504 opencl_ctx->context = ext_opencl_env->context;
505 opencl_ctx->device_id = ext_opencl_env->device_id;
506 opencl_ctx->device_type = ext_opencl_env->device_type;
508 if (!opencl_ctx->is_user_created) {
509 if (!opencl_ctx->device_list.platform_num) {
510 ret = get_device_list(&opencl_ctx->device_list);
515 if (opencl_ctx->platform_idx >= 0) {
516 if (opencl_ctx->device_list.platform_num < opencl_ctx->platform_idx + 1) {
517 av_log(opencl_ctx, AV_LOG_ERROR, "User set platform index not exist\n");
520 if (!opencl_ctx->device_list.platform_node[opencl_ctx->platform_idx]->device_num) {
521 av_log(opencl_ctx, AV_LOG_ERROR, "No devices in user specific platform with index %d\n",
522 opencl_ctx->platform_idx);
525 opencl_ctx->platform_id = opencl_ctx->device_list.platform_node[opencl_ctx->platform_idx]->platform_id;
528 for (i = 0; i < opencl_ctx->device_list.platform_num; i++) {
529 if (opencl_ctx->device_list.platform_node[i]->device_num) {
530 opencl_ctx->platform_id = opencl_ctx->device_list.platform_node[i]->platform_id;
531 opencl_ctx->platform_idx = i;
536 if (!opencl_ctx->platform_id) {
537 av_log(opencl_ctx, AV_LOG_ERROR, "Could not get OpenCL platforms\n");
541 if (opencl_ctx->device_idx >= 0) {
542 if (opencl_ctx->device_list.platform_node[opencl_ctx->platform_idx]->device_num < opencl_ctx->device_idx + 1) {
543 av_log(opencl_ctx, AV_LOG_ERROR,
544 "Could not get OpenCL device idx %d in the user set platform\n", opencl_ctx->platform_idx);
548 opencl_ctx->device_idx = 0;
551 device_node = opencl_ctx->device_list.platform_node[opencl_ctx->platform_idx]->device_node[opencl_ctx->device_idx];
552 opencl_ctx->device_id = device_node->device_id;
553 opencl_ctx->device_type = device_node->device_type;
558 av_log(opencl_ctx, AV_LOG_VERBOSE, "Platform Name: %s, Device Name: %s\n",
559 opencl_ctx->device_list.platform_node[opencl_ctx->platform_idx]->platform_name,
562 cps[1] = (cl_context_properties)opencl_ctx->platform_id;
565 opencl_ctx->context = clCreateContextFromType(cps, opencl_ctx->device_type,
568 av_log(opencl_ctx, AV_LOG_ERROR,
572 opencl_ctx->command_queue = clCreateCommandQueue(opencl_ctx->context, opencl_ctx->device_id,
575 av_log(opencl_ctx, AV_LOG_ERROR,
590 if (!opencl_ctx.init_count) {
591 if (!opencl_ctx.opt_init_flag) {
592 av_opt_set_defaults(&opencl_ctx);
593 opencl_ctx.opt_init_flag = 1;
595 ret = init_opencl_env(&opencl_ctx, ext_opencl_env);
598 if (opencl_ctx.kernel_code_count <= 0) {
599 av_log(&opencl_ctx, AV_LOG_ERROR,
605 opencl_ctx.init_count++;
615 opencl_ctx.init_count--;
616 if (opencl_ctx.is_user_created)
618 if (opencl_ctx.init_count > 0)
620 if (opencl_ctx.command_queue) {
621 status = clReleaseCommandQueue(opencl_ctx.command_queue);
623 av_log(&opencl_ctx, AV_LOG_ERROR,
626 opencl_ctx.command_queue = NULL;
628 if (opencl_ctx.context) {
629 status = clReleaseContext(opencl_ctx.context);
631 av_log(&opencl_ctx, AV_LOG_ERROR,
634 opencl_ctx.context = NULL;
636 free_device_list(&opencl_ctx.device_list);
638 if (opencl_ctx.init_count <= 0)
639 av_opt_free(&opencl_ctx); //FIXME: free openclutils context
646 *cl_buf = clCreateBuffer(opencl_ctx.context, flags, cl_buf_size, host_ptr, &status);
648 av_log(&opencl_ctx, AV_LOG_ERROR, "Could not create OpenCL buffer: %s\n", av_opencl_errstr(status));
661 av_log(&opencl_ctx, AV_LOG_ERROR,
670 void *mapped = clEnqueueMapBuffer(opencl_ctx.command_queue, dst_cl_buf,
675 av_log(&opencl_ctx, AV_LOG_ERROR,
681 status = clEnqueueUnmapMemObject(opencl_ctx.command_queue, dst_cl_buf, mapped, 0, NULL, NULL);
683 av_log(&opencl_ctx, AV_LOG_ERROR,
693 void *mapped = clEnqueueMapBuffer(opencl_ctx.command_queue, src_cl_buf,
698 av_log(&opencl_ctx, AV_LOG_ERROR,
704 status = clEnqueueUnmapMemObject(opencl_ctx.command_queue, src_cl_buf, mapped, 0, NULL, NULL);
706 av_log(&opencl_ctx, AV_LOG_ERROR,
727 av_log(&opencl_ctx, AV_LOG_ERROR,
731 mapped = clEnqueueMapBuffer(opencl_ctx.command_queue, dst_cl_buf,
735 av_log(&opencl_ctx, AV_LOG_ERROR,
745 status = clEnqueueUnmapMemObject(opencl_ctx.command_queue, dst_cl_buf, mapped, 0, NULL, NULL);
747 av_log(&opencl_ctx, AV_LOG_ERROR,
768 av_log(&opencl_ctx, AV_LOG_ERROR,
772 mapped = clEnqueueMapBuffer(opencl_ctx.command_queue, src_cl_buf,
777 av_log(&opencl_ctx, AV_LOG_ERROR,
788 status = clEnqueueUnmapMemObject(opencl_ctx.command_queue, src_cl_buf, mapped, 0, NULL, NULL);
790 av_log(&opencl_ctx, AV_LOG_ERROR,
808 av_log(&opencl_ctx, AV_LOG_VERBOSE, "Performing test on OpenCL device %s\n",
828 av_log(&opencl_ctx, AV_LOG_ERROR, "Benchmark failed with OpenCL device %s\n",