gallium: add QUERY_TIMESTAMP cap and get_timestamp screen function
authorMarek Olšák <maraeo@gmail.com>
Thu, 5 Jul 2012 18:04:02 +0000 (20:04 +0200)
committerMarek Olšák <maraeo@gmail.com>
Tue, 10 Jul 2012 17:04:12 +0000 (19:04 +0200)
src/gallium/drivers/i915/i915_screen.c
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/nv30/nv30_screen.c
src/gallium/drivers/nv50/nv50_screen.c
src/gallium/drivers/nvc0/nvc0_screen.c
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/drivers/svga/svga_screen.c
src/gallium/include/pipe/p_defines.h
src/gallium/include/pipe/p_screen.h

index ff352035fb0e43a22ab617d9ea9ae3e810c18cf1..88c826085c198c1ab05193022dab9968f2a43e0a 100644 (file)
@@ -209,6 +209,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
    case PIPE_CAP_VERTEX_COLOR_UNCLAMPED:
    case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
    case PIPE_CAP_START_INSTANCE:
+   case PIPE_CAP_QUERY_TIMESTAMP:
       return 0;
 
    case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
index 33fa24133947660c90e45256fedefecf9d28dc34..930a9ee16af0353437abd2fed66f1a409b46a496 100644 (file)
@@ -207,6 +207,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
       return 16;
    case PIPE_CAP_START_INSTANCE:
+   case PIPE_CAP_QUERY_TIMESTAMP:
       return 0;
    }
    /* should only get here on unhandled cases */
index ffb49c9da7655ca8a2747a767fdc77410464b3ca..88e428b6809e233a7d892faa6a5a7958dbabfdfe 100644 (file)
@@ -116,6 +116,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
    case PIPE_CAP_MIXED_COLORBUFFER_FORMATS:
    case PIPE_CAP_START_INSTANCE:
+   case PIPE_CAP_QUERY_TIMESTAMP:
       return 0;
    case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
    case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
index 8c30c96aa739148b8ed9ec3be39b3c458daf1833..c7344a1a382d21dfc59c64adf69ad100a0be0e4f 100644 (file)
@@ -172,6 +172,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
    case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
    case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
+   case PIPE_CAP_QUERY_TIMESTAMP:
       return 0;
    default:
       NOUVEAU_ERR("unknown PIPE_CAP %d\n", param);
index 0ed3a560194919cc525d12aaf7ce9d0bf5a45a23..02a408ecb2536f7e46412f96b17bf3ac4c15c795 100644 (file)
@@ -150,6 +150,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
    case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
    case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
+   case PIPE_CAP_QUERY_TIMESTAMP:
       return 0;
    default:
       NOUVEAU_ERR("unknown PIPE_CAP %d\n", param);
index 749c8509b185a091b5471de56e5f6e207dd6f81a..863dedd9c1ea286f8e94d3e3cc96c7f68df5ddc0 100644 (file)
@@ -148,6 +148,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
         case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
         case PIPE_CAP_COMPUTE:
         case PIPE_CAP_START_INSTANCE:
+        case PIPE_CAP_QUERY_TIMESTAMP:
             return 0;
 
         /* SWTCL-only features. */
index b354baecf65c38b6c9d8fe085b4d97645af974b7..a0a8a58cd9c2ccf642fe4da61711cc2b36ced0d1 100644 (file)
@@ -412,6 +412,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_FRAGMENT_COLOR_CLAMPED:
        case PIPE_CAP_VERTEX_COLOR_CLAMPED:
        case PIPE_CAP_USER_VERTEX_BUFFERS:
+       case PIPE_CAP_QUERY_TIMESTAMP:
                return 0;
 
        /* Stream output. */
index ade97a7a08c63f292067a72fb810c4a0f33b7c02..5164930496c35531b67b5210166d1027d3b4920d 100644 (file)
@@ -164,6 +164,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
    case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
    case PIPE_CAP_START_INSTANCE:
+   case PIPE_CAP_QUERY_TIMESTAMP:
       return 0;
    }
    /* should only get here on unhandled cases */
index 70a2530bcac421e689a6e649ce7a3b7ceb184da1..833defbaef8ed657ebb34a54f3eea62c905c2ebc 100644 (file)
@@ -254,6 +254,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
    case PIPE_CAP_COMPUTE:
    case PIPE_CAP_START_INSTANCE:
+   case PIPE_CAP_QUERY_TIMESTAMP:
       return 0;
    case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
       return 1;
index 479b26e151707f0cb494c70e425b2c71aa95a7fd..8d787ec79e2350dbbdfce2b9891810d220d7da28 100644 (file)
@@ -485,7 +485,8 @@ enum pipe_cap {
    PIPE_CAP_USER_INDEX_BUFFERS = 69,
    PIPE_CAP_USER_CONSTANT_BUFFERS = 70,
    PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT = 71,
-   PIPE_CAP_START_INSTANCE = 72
+   PIPE_CAP_START_INSTANCE = 72,
+   PIPE_CAP_QUERY_TIMESTAMP = 73
 };
 
 /**
index 164e54d3205796e210a8cb0ba6098b03941c3b4a..fdf6fa2d3f956a6114c522cb6fe58120ec211c57 100644 (file)
@@ -108,6 +108,13 @@ struct pipe_screen {
                            enum pipe_compute_cap param,
                            void *ret);
 
+   /**
+    * Query a timestamp in nanoseconds. The returned value should match
+    * PIPE_QUERY_TIMESTAMP. This function returns immediately and doesn't
+    * wait for rendering to complete (which cannot be achieved with queries).
+    */
+   uint64_t (*get_timestamp)(struct pipe_screen *);
+
    struct pipe_context * (*context_create)( struct pipe_screen *,
                                            void *priv );