vkr: split out vkr_query_pool.c

No functional change.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
macos/master
Chia-I Wu 3 years ago
parent 243cacf2bb
commit ccf9552e92
  1. 1
      src/meson.build
  2. 69
      src/venus/vkr_query_pool.c
  3. 3
      src/venus/vkr_query_pool.h
  4. 52
      src/venus/vkr_renderer.c

@ -91,6 +91,7 @@ venus_sources = [
'venus/vkr_image.h',
'venus/vkr_pipeline.c',
'venus/vkr_pipeline.h',
'venus/vkr_query_pool.c',
'venus/vkr_query_pool.h',
'venus/vkr_queue.h',
'venus/vkr_render_pass.h',

@ -0,0 +1,69 @@
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#include "vkr_query_pool.h"
#include "venus-protocol/vn_protocol_renderer_query_pool.h"
#include "vkr_context.h"
#include "vkr_device.h"
static void
vkr_dispatch_vkCreateQueryPool(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateQueryPool *args)
{
struct vkr_context *ctx = dispatch->data;
CREATE_OBJECT(pool, query_pool, QUERY_POOL, vkCreateQueryPool, pQueryPool);
util_hash_table_set_u64(ctx->object_table, pool->base.id, pool);
}
static void
vkr_dispatch_vkDestroyQueryPool(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyQueryPool *args)
{
struct vkr_context *ctx = dispatch->data;
DESTROY_OBJECT(pool, query_pool, QUERY_POOL, vkDestroyQueryPool, queryPool);
util_hash_table_remove_u64(ctx->object_table, pool->base.id);
}
static void
vkr_dispatch_vkGetQueryPoolResults(UNUSED struct vn_dispatch_context *dispatch,
struct vn_command_vkGetQueryPoolResults *args)
{
vn_replace_vkGetQueryPoolResults_args_handle(args);
args->ret = vkGetQueryPoolResults(args->device, args->queryPool, args->firstQuery,
args->queryCount, args->dataSize, args->pData,
args->stride, args->flags);
}
static void
vkr_dispatch_vkResetQueryPool(struct vn_dispatch_context *dispatch,
struct vn_command_vkResetQueryPool *args)
{
struct vkr_context *ctx = dispatch->data;
struct vkr_device *dev = (struct vkr_device *)args->device;
if (!dev || dev->base.type != VK_OBJECT_TYPE_DEVICE) {
vkr_cs_decoder_set_fatal(&ctx->decoder);
return;
}
vn_replace_vkResetQueryPool_args_handle(args);
dev->ResetQueryPool(args->device, args->queryPool, args->firstQuery, args->queryCount);
}
void
vkr_context_init_query_pool_dispatch(struct vkr_context *ctx)
{
struct vn_dispatch_context *dispatch = &ctx->dispatch;
dispatch->dispatch_vkCreateQueryPool = vkr_dispatch_vkCreateQueryPool;
dispatch->dispatch_vkDestroyQueryPool = vkr_dispatch_vkDestroyQueryPool;
dispatch->dispatch_vkGetQueryPoolResults = vkr_dispatch_vkGetQueryPoolResults;
dispatch->dispatch_vkResetQueryPool = vkr_dispatch_vkResetQueryPool;
}

@ -12,4 +12,7 @@ struct vkr_query_pool {
struct vkr_object base;
};
void
vkr_context_init_query_pool_dispatch(struct vkr_context *ctx);
#endif /* VKR_QUERY_POOL_H */

@ -2728,53 +2728,6 @@ vkr_dispatch_vkResetEvent(UNUSED struct vn_dispatch_context *dispatch,
args->ret = vkResetEvent(args->device, args->event);
}
static void
vkr_dispatch_vkCreateQueryPool(struct vn_dispatch_context *dispatch,
struct vn_command_vkCreateQueryPool *args)
{
struct vkr_context *ctx = dispatch->data;
CREATE_OBJECT(pool, query_pool, QUERY_POOL, vkCreateQueryPool, pQueryPool);
util_hash_table_set_u64(ctx->object_table, pool->base.id, pool);
}
static void
vkr_dispatch_vkDestroyQueryPool(struct vn_dispatch_context *dispatch,
struct vn_command_vkDestroyQueryPool *args)
{
struct vkr_context *ctx = dispatch->data;
DESTROY_OBJECT(pool, query_pool, QUERY_POOL, vkDestroyQueryPool, queryPool);
util_hash_table_remove_u64(ctx->object_table, pool->base.id);
}
static void
vkr_dispatch_vkGetQueryPoolResults(UNUSED struct vn_dispatch_context *dispatch,
struct vn_command_vkGetQueryPoolResults *args)
{
vn_replace_vkGetQueryPoolResults_args_handle(args);
args->ret = vkGetQueryPoolResults(args->device, args->queryPool, args->firstQuery,
args->queryCount, args->dataSize, args->pData,
args->stride, args->flags);
}
static void
vkr_dispatch_vkResetQueryPool(struct vn_dispatch_context *dispatch,
struct vn_command_vkResetQueryPool *args)
{
struct vkr_context *ctx = dispatch->data;
struct vkr_device *dev = (struct vkr_device *)args->device;
if (!dev || dev->base.type != VK_OBJECT_TYPE_DEVICE) {
vkr_cs_decoder_set_fatal(&ctx->decoder);
return;
}
vn_replace_vkResetQueryPool_args_handle(args);
dev->ResetQueryPool(args->device, args->queryPool, args->firstQuery, args->queryCount);
}
static void
vkr_dispatch_vkGetImageDrmFormatModifierPropertiesEXT(
struct vn_dispatch_context *dispatch,
@ -3069,10 +3022,7 @@ vkr_context_init_dispatch(struct vkr_context *ctx)
dispatch->dispatch_vkSetEvent = vkr_dispatch_vkSetEvent;
dispatch->dispatch_vkResetEvent = vkr_dispatch_vkResetEvent;
dispatch->dispatch_vkCreateQueryPool = vkr_dispatch_vkCreateQueryPool;
dispatch->dispatch_vkDestroyQueryPool = vkr_dispatch_vkDestroyQueryPool;
dispatch->dispatch_vkGetQueryPoolResults = vkr_dispatch_vkGetQueryPoolResults;
dispatch->dispatch_vkResetQueryPool = vkr_dispatch_vkResetQueryPool;
vkr_context_init_query_pool_dispatch(ctx);
vkr_context_init_shader_module_dispatch(ctx);
vkr_context_init_pipeline_layout_dispatch(ctx);

Loading…
Cancel
Save