]> granicus.if.org Git - handbrake/commitdiff
scan: print CPU info, GPU info, then QSV info.
authorRodeo <tdskywalker@gmail.com>
Fri, 11 Oct 2013 12:00:04 +0000 (12:00 +0000)
committerRodeo <tdskywalker@gmail.com>
Fri, 11 Oct 2013 12:00:04 +0000 (12:00 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5830 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/hb.c
libhb/openclwrapper.c
libhb/openclwrapper.h

index 18859de95543741e0a962e06ac6ef97dfb3338af..4186fa65a89dd06e91fe290e105cb566d894c418 100644 (file)
@@ -620,11 +620,6 @@ void hb_scan( hb_handle_t * h, const char * path, int title_index,
         hb_title_close( &title );
     }
 
-#ifdef USE_QSV
-    /* Print QSV info here so that it's in all scan and encode logs */
-    hb_qsv_info_print();
-#endif
-
     /* Print CPU info here so that it's in all scan and encode logs */
     const char *cpu_name = hb_get_cpu_name();
     const char *cpu_type = hb_get_cpu_platform_name();
@@ -635,6 +630,16 @@ void hb_scan( hb_handle_t * h, const char * path, int title_index,
     }
     hb_log(" - logical processor count: %d", hb_get_cpu_count());
 
+#ifdef USE_OPENCL
+    /* Print OpenCL info here so that it's in all scan and encode logs */
+    hb_opencl_info_print();
+#endif
+
+#ifdef USE_QSV
+    /* Print QSV info here so that it's in all scan and encode logs */
+    hb_qsv_info_print();
+#endif
+
     hb_log( "hb_scan: path=%s, title_index=%d", path, title_index );
     h->scan_thread = hb_scan_init( h, &h->scan_die, path, title_index, 
                                    &h->title_set, preview_count, 
index 43da091e1588e955066a6482f152db759619b079..9c45ea14514df6631830e93713ee9ca316865364 100644 (file)
@@ -1103,23 +1103,6 @@ int hb_get_opencl_env()
                                devices,
                                NULL );
 
-    for (i = 0; i < numDevices; i++)
-    {
-        if (devices[i] != NULL)
-        {
-            char deviceVendor[100], deviceName[1024], driverVersion[1024];
-            clGetDeviceInfo(devices[i], CL_DEVICE_VENDOR, sizeof(deviceVendor),
-                            deviceVendor, NULL);
-            clGetDeviceInfo(devices[i], CL_DEVICE_NAME, sizeof(deviceName),
-                            deviceName, NULL);
-            clGetDeviceInfo(devices[i], CL_DRIVER_VERSION, sizeof(driverVersion),
-                            driverVersion, NULL);
-            hb_log("hb_get_opencl_env: GPU #%d, Device Vendor:  %s", i + 1, deviceVendor);
-            hb_log("hb_get_opencl_env: GPU #%d, Device Name:    %s", i + 1, deviceName);
-            hb_log("hb_get_opencl_env: GPU #%d, Driver Version: %s", i + 1, driverVersion);
-        }
-    }
-
     if( devices != NULL )
     {
         free( devices );
@@ -1199,6 +1182,54 @@ void hb_opencl_init()
     hb_get_opencl_env();
 }
 
+void hb_opencl_info_print()
+{
+    cl_uint i, numDevices;
+    cl_device_id *devices;
+    
+    if (hb_init_opencl_env(&gpu_env))
+    {
+        return;
+    }
+
+    if (clGetContextInfo(gpu_env.context, CL_CONTEXT_NUM_DEVICES,
+                         sizeof(numDevices), &numDevices, NULL) != CL_SUCCESS)
+    {
+        return;
+    }
+    
+    if ((devices = malloc(sizeof(cl_device_id) * numDevices)) == NULL)
+    {
+        return;
+    }
+    
+    if (clGetContextInfo(gpu_env.context, CL_CONTEXT_DEVICES,
+                         sizeof(cl_device_id) * numDevices, devices, NULL) != CL_SUCCESS)
+    {
+        return;
+    }
+
+    for (i = 0; i < numDevices; i++)
+    {
+        if (devices[i] != NULL)
+        {
+            char vendor[100], name[1024], version[1024];
+
+            clGetDeviceInfo(devices[i], CL_DEVICE_VENDOR,  sizeof(vendor),
+                            vendor,  NULL);
+            clGetDeviceInfo(devices[i], CL_DEVICE_NAME,    sizeof(name),
+                            name,    NULL);
+            clGetDeviceInfo(devices[i], CL_DRIVER_VERSION, sizeof(version),
+                            version, NULL);
+
+            hb_log("GPU #%d: %s %s", i + 1, vendor, name);
+            hb_log(" - OpenCL driver version: %s", version);
+        }
+    }
+
+    free(devices);
+}
+
 int hb_use_buffers()
 {
     return useBuffers;
index c7606afc0014ec544022421441904ea66908f529..1ee081da96bf83d17fad56907794b1f0c6d0b9e3 100644 (file)
@@ -71,6 +71,7 @@ int hb_create_kernel( char * kernelname, KernelEnv * env );
 int hb_release_kernel( KernelEnv * env );
 
 void hb_opencl_init();
+void hb_opencl_info_print();
 
 int hb_get_opencl_env();