summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott <[email protected]>2017-01-15 14:25:55 +0000
committerGitHub <[email protected]>2017-01-15 14:25:55 +0000
commitc72b80dcb7cb063b40c43a47761ba2919ef85c46 (patch)
tree35058affc3a5c7bc2eedf7506eede32db5dd2f9b
parent7545b0a6c242815fc31da306ff93d156bdee7ef4 (diff)
opencl: Workaround broken drivers that crash when you call clGetPlatformIDs with valid inputs. #496
-rw-r--r--libhb/hb.c21
-rw-r--r--libhb/hb.h3
-rw-r--r--libhb/scan.c8
3 files changed, 28 insertions, 4 deletions
diff --git a/libhb/hb.c b/libhb/hb.c
index 500af764e..562f0dc70 100644
--- a/libhb/hb.c
+++ b/libhb/hb.c
@@ -65,6 +65,8 @@ struct hb_handle_s
// power management opaque pointer
void * system_sleep_opaque;
+
+ int enable_opencl;
};
hb_work_object_t * hb_objects = NULL;
@@ -141,6 +143,11 @@ int hb_avcodec_open(AVCodecContext *avctx, AVCodec *codec,
return ret;
}
+int hb_get_opencl_enabled(hb_handle_t *h)
+{
+ return h->enable_opencl;
+}
+
int hb_avcodec_close(AVCodecContext *avctx)
{
int ret;
@@ -409,10 +416,17 @@ void hb_log_level_set(hb_handle_t *h, int level)
global_verbosity_level = level;
}
+/*
+ * Enable or disable support for OpenCL detection.
+ */
+void hb_opencl_set_enable(hb_handle_t *h, int enable_opencl)
+{
+ h->enable_opencl = enable_opencl;
+}
+
/**
* libhb initialization routine.
* @param verbose HB_DEBUG_NONE or HB_DEBUG_ALL.
- * @param update_check signals libhb to check for updated version from HandBrake website.
* @return Handle to hb_handle_t for use on all subsequent calls to libhb.
*/
hb_handle_t * hb_init( int verbose )
@@ -629,7 +643,10 @@ void hb_scan( hb_handle_t * h, const char * path, int title_index,
hb_log(" - logical processor count: %d", hb_get_cpu_count());
/* Print OpenCL info here so that it's in all scan and encode logs */
- hb_opencl_info_print();
+ if (hb_get_opencl_enabled(h))
+ {
+ hb_opencl_info_print();
+ }
#ifdef USE_QSV
/* Print QSV info here so that it's in all scan and encode logs */
diff --git a/libhb/hb.h b/libhb/hb.h
index 3ad138e1e..86fed9bc0 100644
--- a/libhb/hb.h
+++ b/libhb/hb.h
@@ -32,6 +32,7 @@ void hb_register( hb_work_object_t * );
void hb_register_logger( void (*log_cb)(const char* message) );
hb_handle_t * hb_init( int verbose );
void hb_log_level_set(hb_handle_t *h, int level);
+void hb_opencl_set_enable(hb_handle_t *h, int enable_opencl);
/* hb_get_version() */
const char * hb_get_full_description();
@@ -48,6 +49,8 @@ int hb_check_update( hb_handle_t * h, char ** version );
char * hb_dvd_name( char * path );
void hb_dvd_set_dvdnav( int enable );
+int hb_get_opencl_enabled(hb_handle_t *h);
+
/* hb_scan()
Scan the specified path. Can be a DVD device, a VIDEO_TS folder or
a VOB file. If title_index is 0, scan all titles. */
diff --git a/libhb/scan.c b/libhb/scan.c
index e612f2a98..da7379c0f 100644
--- a/libhb/scan.c
+++ b/libhb/scan.c
@@ -1021,8 +1021,12 @@ skip_preview:
title->video_decode_support = vid_info.video_decode_support;
// TODO: check video dimensions
- title->opencl_support = !!hb_opencl_available();
-
+ hb_handle_t *hb_handle = (hb_handle_t *)data->h;
+ if (hb_get_opencl_enabled(hb_handle))
+ {
+ title->opencl_support = !!hb_opencl_available();
+ }
+
// compute the aspect ratio based on the storage dimensions and PAR.
hb_reduce(&title->dar.num, &title->dar.den,
title->geometry.par.num * title->geometry.width,