[Libva] [PATCH Intel-driver 2/9] Add a new intel_device_info structure

Xiang, Haihao haihao.xiang at intel.com
Fri Apr 18 09:21:18 PDT 2014


From: "Xiang, Haihao" <haihao.xiang at intel.com>

To store statically known device information

Signed-off-by: Xiang, Haihao <haihao.xiang at intel.com>
---
 src/i965_device_info.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++
 src/intel_driver.c     |   7 ++++
 src/intel_driver.h     |  16 +++++++
 3 files changed, 135 insertions(+)

diff --git a/src/i965_device_info.c b/src/i965_device_info.c
index 810e42b..6d7a87e 100644
--- a/src/i965_device_info.c
+++ b/src/i965_device_info.c
@@ -195,3 +195,115 @@ i965_get_codec_info(int devid)
         return NULL;
     }
 }
+
+static const struct intel_device_info g4x_device_info = {
+    .gen = 4,
+
+    .urb_size = 384,
+    .max_wm_threads = 50,       /* 10 * 5 */
+
+    .is_g4x = 1,
+};
+
+static const struct intel_device_info ilk_device_info = {
+    .gen = 5,
+
+    .urb_size = 1024,
+    .max_wm_threads = 72,       /* 12 * 6 */
+};
+
+static const struct intel_device_info snb_gt1_device_info = {
+    .gen = 6,
+    .gt = 1,
+
+    .urb_size = 1024,
+    .max_wm_threads = 40,
+};
+
+static const struct intel_device_info snb_gt2_device_info = {
+    .gen = 6,
+    .gt = 2,
+
+    .urb_size = 1024,
+    .max_wm_threads = 80,
+};
+
+static const struct intel_device_info ivb_gt1_device_info = {
+    .gen = 7,
+    .gt = 1,
+
+    .urb_size = 4096,
+    .max_wm_threads = 48,
+
+    .is_ivybridge = 1,
+};
+
+static const struct intel_device_info ivb_gt2_device_info = {
+    .gen = 7,
+    .gt = 2,
+
+    .urb_size = 4096,
+    .max_wm_threads = 172,
+
+    .is_ivybridge = 1,
+};
+
+static const struct intel_device_info byt_device_info = {
+    .gen = 7,
+    .gt = 1,
+
+    .urb_size = 4096,
+    .max_wm_threads = 48,
+
+    .is_ivybridge = 1,
+    .is_baytrail = 1,
+};
+
+static const struct intel_device_info hsw_gt1_device_info = {
+    .gen = 7,
+    .gt = 1,
+
+    .urb_size = 4096,
+    .max_wm_threads = 102,
+
+    .is_haswell = 1,
+};
+
+static const struct intel_device_info hsw_gt2_device_info = {
+    .gen = 7,
+    .gt = 2,
+
+    .urb_size = 4096,
+    .max_wm_threads = 204,
+
+    .is_haswell = 1,
+};
+
+static const struct intel_device_info hsw_gt3_device_info = {
+    .gen = 7,
+    .gt = 3,
+
+    .urb_size = 4096,
+    .max_wm_threads = 408,
+
+    .is_haswell = 1,
+};
+
+static const struct intel_device_info bdw_device_info = {
+    .gen = 8,
+
+    .urb_size = 4096,
+    .max_wm_threads = 64,       /* per PSD */
+};
+
+const struct intel_device_info *
+i965_get_device_info(int devid)
+{
+    switch (devid) {
+#undef CHIPSET
+#define CHIPSET(id, family, dev, str) case id: return &dev##_device_info;
+#include "i965_pciids.h"
+    default:
+        return NULL;
+    }
+}
diff --git a/src/intel_driver.c b/src/intel_driver.c
index 8650dba..e3e082d 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -67,6 +67,8 @@ static void intel_driver_get_revid(struct intel_driver_data *intel, int *value)
 	return;
 }
 
+extern const struct intel_device_info *i965_get_device_info(int devid);
+
 bool 
 intel_driver_init(VADriverContextP ctx)
 {
@@ -91,6 +93,11 @@ intel_driver_init(VADriverContextP ctx)
     pthread_mutex_init(&intel->ctxmutex, NULL);
 
     intel_driver_get_param(intel, I915_PARAM_CHIPSET_ID, &intel->device_id);
+    intel->device_info = i965_get_device_info(intel->device_id);
+
+    if (!intel->device_info)
+        return false;
+
     if (intel_driver_get_param(intel, I915_PARAM_HAS_EXECBUF2, &has_exec2))
         intel->has_exec2 = has_exec2;
     if (intel_driver_get_param(intel, I915_PARAM_HAS_BSD, &has_bsd))
diff --git a/src/intel_driver.h b/src/intel_driver.h
index a1764b2..73088bc 100644
--- a/src/intel_driver.h
+++ b/src/intel_driver.h
@@ -116,6 +116,20 @@ struct intel_batchbuffer;
         }                                       \
     } while (0)
 
+struct intel_device_info
+{
+    int gen;
+    int gt;
+
+    unsigned int urb_size;
+    unsigned int max_wm_threads;
+
+    unsigned int is_g4x         : 1; /* gen4 */
+    unsigned int is_ivybridge   : 1; /* gen7 */
+    unsigned int is_baytrail    : 1; /* gen7 */
+    unsigned int is_haswell     : 1; /* gen7 */
+};
+
 struct intel_driver_data 
 {
     int fd;
@@ -134,6 +148,8 @@ struct intel_driver_data
     unsigned int has_bsd    : 1; /* Flag: has bitstream decoder for H.264? */
     unsigned int has_blt    : 1; /* Flag: has BLT unit? */
     unsigned int has_vebox  : 1; /* Flag: has VEBOX unit */
+
+    const struct intel_device_info *device_info;
 };
 
 bool intel_driver_init(VADriverContextP ctx);
-- 
1.8.3.2



More information about the Libva mailing list