Mesa (main): zink: move get_timestamp to screen
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue May 17 03:56:33 UTC 2022
Module: Mesa
Branch: main
Commit: fffafa363543c89846291e40e521b48197a061f6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fffafa363543c89846291e40e521b48197a061f6
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Mon May 16 09:02:07 2022 -0400
zink: move get_timestamp to screen
this doesn't need to use a particular context
Reviewed-by: Adam Jackson <ajax at redhat.com>
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16529>
---
src/gallium/drivers/zink/zink_query.c | 9 ++++-----
src/gallium/drivers/zink/zink_query.h | 4 ++++
src/gallium/drivers/zink/zink_screen.c | 2 ++
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_query.c b/src/gallium/drivers/zink/zink_query.c
index 7e2a1dbf91b..9d955c2dd1c 100644
--- a/src/gallium/drivers/zink/zink_query.c
+++ b/src/gallium/drivers/zink/zink_query.c
@@ -1293,10 +1293,10 @@ zink_get_query_result_resource(struct pipe_context *pctx,
force_cpu_read(ctx, pquery, result_type, pres, offset);
}
-static uint64_t
-zink_get_timestamp(struct pipe_context *pctx)
+uint64_t
+zink_get_timestamp(struct pipe_screen *pscreen)
{
- struct zink_screen *screen = zink_screen(pctx->screen);
+ struct zink_screen *screen = zink_screen(pscreen);
uint64_t timestamp, deviation;
if (screen->info.have_EXT_calibrated_timestamps) {
VkCalibratedTimestampInfoEXT cti = {0};
@@ -1306,7 +1306,7 @@ zink_get_timestamp(struct pipe_context *pctx)
mesa_loge("ZINK: vkGetCalibratedTimestampsEXT failed");
}
} else {
- pctx = &screen->copy_context->base;
+ struct pipe_context *pctx = &screen->copy_context->base;
struct pipe_query *pquery = pctx->create_query(pctx, PIPE_QUERY_TIMESTAMP, 0);
if (!pquery)
return 0;
@@ -1336,5 +1336,4 @@ zink_context_query_init(struct pipe_context *pctx)
pctx->get_query_result_resource = zink_get_query_result_resource;
pctx->set_active_query_state = zink_set_active_query_state;
pctx->render_condition = zink_render_condition;
- pctx->get_timestamp = zink_get_timestamp;
}
diff --git a/src/gallium/drivers/zink/zink_query.h b/src/gallium/drivers/zink/zink_query.h
index 7bb73e8f02a..1465ce5b248 100644
--- a/src/gallium/drivers/zink/zink_query.h
+++ b/src/gallium/drivers/zink/zink_query.h
@@ -25,6 +25,7 @@
#define ZINK_QUERY_H
#include <stdbool.h>
+#include <inttypes.h>
struct zink_batch;
struct zink_batch_state;
@@ -32,6 +33,7 @@ struct zink_context;
struct zink_fence;
struct zink_query;
struct zink_screen;
+struct pipe_screen;
#ifdef __cplusplus
extern "C" {
#endif
@@ -59,6 +61,8 @@ zink_check_conditional_render(struct zink_context *ctx);
void
zink_context_destroy_query_pools(struct zink_context *ctx);
+uint64_t
+zink_get_timestamp(struct pipe_screen *pscreen);
#ifdef __cplusplus
}
#endif
diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index 248abc7bd13..35a8f7ea27d 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -34,6 +34,7 @@
#include "zink_instance.h"
#include "zink_program.h"
#include "zink_public.h"
+#include "zink_query.h"
#include "zink_resource.h"
#include "nir_to_spirv/nir_to_spirv.h" // for SPIRV_VERSION
@@ -2195,6 +2196,7 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
screen->base.get_vendor = zink_get_vendor;
screen->base.get_device_vendor = zink_get_device_vendor;
screen->base.get_compute_param = zink_get_compute_param;
+ screen->base.get_timestamp = zink_get_timestamp;
screen->base.query_memory_info = zink_query_memory_info;
screen->base.get_param = zink_get_param;
screen->base.get_paramf = zink_get_paramf;
More information about the mesa-commit
mailing list