Mesa (master): softpipe: implement get_timestamp and expose ARB_timer_query

Marek Olšák mareko at kemper.freedesktop.org
Tue Jul 10 17:08:34 UTC 2012


Module: Mesa
Branch: master
Commit: 5ddcda060ce19d0e63b18142bffa49709e103cc8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5ddcda060ce19d0e63b18142bffa49709e103cc8

Author: Marek Olšák <maraeo at gmail.com>
Date:   Thu Jul  5 23:20:21 2012 +0200

softpipe: implement get_timestamp and expose ARB_timer_query

PIPE_QUERY_TIMESTAMP is already implemented and working.

---

 src/gallium/drivers/softpipe/sp_screen.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index 5164930..684f035 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -30,6 +30,7 @@
 #include "util/u_format.h"
 #include "util/u_format_s3tc.h"
 #include "util/u_video.h"
+#include "os/os_time.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_screen.h"
 #include "draw/draw_context.h"
@@ -164,8 +165,9 @@ 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;
+   case PIPE_CAP_QUERY_TIMESTAMP:
+      return 1;
    }
    /* should only get here on unhandled cases */
    debug_printf("Unexpected PIPE_CAP %d query\n", param);
@@ -361,6 +363,12 @@ softpipe_flush_frontbuffer(struct pipe_screen *_screen,
       winsys->displaytarget_display(winsys, texture->dt, context_private);
 }
 
+static uint64_t
+softpipe_get_timestamp(struct pipe_screen *_screen)
+{
+   return os_time_get()*1000;
+}
+
 /**
  * Create a new pipe_screen object
  * Note: we're not presently subclassing pipe_screen (no softpipe_screen).
@@ -383,6 +391,7 @@ softpipe_create_screen(struct sw_winsys *winsys)
    screen->base.get_shader_param = softpipe_get_shader_param;
    screen->base.get_paramf = softpipe_get_paramf;
    screen->base.get_video_param = softpipe_get_video_param;
+   screen->base.get_timestamp = softpipe_get_timestamp;
    screen->base.is_format_supported = softpipe_is_format_supported;
    screen->base.is_video_format_supported = vl_video_buffer_is_format_supported;
    screen->base.context_create = softpipe_create_context;




More information about the mesa-commit mailing list