ilo: PIPE_CAP_QUERY_TIMESTAMP may not be supported
authorChia-I Wu <olvaffe@gmail.com>
Sat, 8 Mar 2014 18:00:46 +0000 (02:00 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Mon, 10 Mar 2014 08:42:42 +0000 (16:42 +0800)
Reading TIMESTAMP register may fail, depending on both kernel and hardware.

src/gallium/drivers/ilo/ilo_common.h
src/gallium/drivers/ilo/ilo_screen.c
src/gallium/winsys/intel/drm/intel_drm_winsys.c
src/gallium/winsys/intel/intel_winsys.h

index 9145d3235bd694fbab875127649751c1bedf5b2d..cc17f76e24356eca1e1f47fcc72a11981e96c590 100644 (file)
@@ -71,6 +71,7 @@ struct ilo_dev_info {
    bool has_llc;
    bool has_gen7_sol_reset;
    bool has_address_swizzling;
+   bool has_timestamp;
 
    int gen;
    int gt;
index 5d1243d1da3b896adf8fb6404ac1cc5c42fe2b44..55bbb3abaf0aff3d4bf27ccd1fbe938f6d8d7dac 100644 (file)
@@ -404,8 +404,9 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
       /* imposed by OWord (Dual) Block Read */
       return 16;
    case PIPE_CAP_START_INSTANCE:
-   case PIPE_CAP_QUERY_TIMESTAMP:
       return true;
+   case PIPE_CAP_QUERY_TIMESTAMP:
+      return is->dev.has_timestamp;
    case PIPE_CAP_TEXTURE_MULTISAMPLE:
       return false; /* TODO */
    case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
@@ -650,6 +651,7 @@ init_dev(struct ilo_dev_info *dev, const struct intel_winsys_info *info)
    dev->has_llc = info->has_llc;
    dev->has_gen7_sol_reset = info->has_gen7_sol_reset;
    dev->has_address_swizzling = info->has_address_swizzling;
+   dev->has_timestamp = info->has_timestamp;
 
    /*
     * From the Sandy Bridge PRM, volume 4 part 2, page 18:
index 12ed2e4335584d4685158fe8fc084a8625442bd0..bd805fdb78657dcd83ce3e172ee66ee13cd89af0 100644 (file)
@@ -99,6 +99,14 @@ test_address_swizzling(struct intel_winsys *winsys)
    return (swizzle != I915_BIT_6_SWIZZLE_NONE);
 }
 
+static bool
+test_reg_read(struct intel_winsys *winsys, uint32_t reg)
+{
+   uint64_t dummy;
+
+   return !drm_intel_reg_read(winsys->bufmgr, reg, &dummy);
+}
+
 static bool
 init_info(struct intel_winsys *winsys)
 {
@@ -130,6 +138,9 @@ init_info(struct intel_winsys *winsys)
    get_param(winsys, I915_PARAM_HAS_LLC, &val);
    info->has_llc = val;
 
+   /* test TIMESTAMP read */
+   info->has_timestamp = test_reg_read(winsys, 0x2358);
+
    get_param(winsys, I915_PARAM_HAS_GEN7_SOL_RESET, &val);
    info->has_gen7_sol_reset = val;
 
index e84c9600c35b5962bea0715796c19c3c5c58c9f2..15f1aec1093532d523b6f95339581e1dee80fdbd 100644 (file)
@@ -69,9 +69,13 @@ struct intel_bo;
 
 struct intel_winsys_info {
    int devid;
+
    bool has_llc;
    bool has_gen7_sol_reset;
    bool has_address_swizzling;
+
+   /* valid registers for intel_winsys_read_reg() */
+   bool has_timestamp;
 };
 
 struct intel_winsys *