[Mesa-dev] [PATCH 1/2] nvc0: add a header file for nvc0_query

Tobias Klausmann tobias.johannes.klausmann at mni.thm.de
Sun May 17 09:46:25 PDT 2015


Reviewed-by: Tobias Klausmann <tobias.johannes.klausmann at mni.thm.de>

On 17.05.2015 18:21, Samuel Pitoiset wrote:
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>   src/gallium/drivers/nouveau/Makefile.sources    |  1 +
>   src/gallium/drivers/nouveau/nvc0/nvc0_context.h | 12 +------
>   src/gallium/drivers/nouveau/nvc0/nvc0_query.c   | 28 ++-------------
>   src/gallium/drivers/nouveau/nvc0/nvc0_query.h   | 47 +++++++++++++++++++++++++
>   4 files changed, 51 insertions(+), 37 deletions(-)
>   create mode 100644 src/gallium/drivers/nouveau/nvc0/nvc0_query.h
>
> diff --git a/src/gallium/drivers/nouveau/Makefile.sources b/src/gallium/drivers/nouveau/Makefile.sources
> index 3fae3bc..d76ee90 100644
> --- a/src/gallium/drivers/nouveau/Makefile.sources
> +++ b/src/gallium/drivers/nouveau/Makefile.sources
> @@ -150,6 +150,7 @@ NVC0_C_SOURCES := \
>   	nvc0/nvc0_program.c \
>   	nvc0/nvc0_program.h \
>   	nvc0/nvc0_query.c \
> +	nvc0/nvc0_query.h \
>   	nvc0/nvc0_resource.c \
>   	nvc0/nvc0_resource.h \
>   	nvc0/nvc0_screen.c \
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
> index a8d7593..0f40267 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
> @@ -15,6 +15,7 @@
>   #include "nvc0/nvc0_screen.h"
>   #include "nvc0/nvc0_program.h"
>   #include "nvc0/nvc0_resource.h"
> +#include "nvc0/nvc0_query.h"
>   
>   #include "nv50/nv50_transfer.h"
>   
> @@ -224,17 +225,6 @@ void nvc0_program_library_upload(struct nvc0_context *);
>   uint32_t nvc0_program_symbol_offset(const struct nvc0_program *,
>                                       uint32_t label);
>   
> -/* nvc0_query.c */
> -void nvc0_init_query_functions(struct nvc0_context *);
> -void nvc0_query_pushbuf_submit(struct nouveau_pushbuf *,
> -                               struct pipe_query *, unsigned result_offset);
> -void nvc0_query_fifo_wait(struct nouveau_pushbuf *, struct pipe_query *);
> -void nvc0_so_target_save_offset(struct pipe_context *,
> -                                struct pipe_stream_output_target *, unsigned i,
> -                                boolean *serialize);
> -
> -#define NVC0_QUERY_TFB_BUFFER_OFFSET (PIPE_QUERY_TYPES + 0)
> -
>   /* nvc0_shader_state.c */
>   void nvc0_vertprog_validate(struct nvc0_context *);
>   void nvc0_tctlprog_validate(struct nvc0_context *);
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
> index 74f210c..12837cf 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
> @@ -25,6 +25,8 @@
>   #define NVC0_PUSH_EXPLICIT_SPACE_CHECKING
>   
>   #include "nvc0/nvc0_context.h"
> +#include "nvc0/nvc0_query.h"
> +
>   #include "nv_object.xml.h"
>   #include "nvc0/nve4_compute.xml.h"
>   #include "nvc0/nvc0_compute.xml.h"
> @@ -34,26 +36,6 @@
>   #define NVC0_QUERY_STATE_ENDED   2
>   #define NVC0_QUERY_STATE_FLUSHED 3
>   
> -struct nvc0_query {
> -   uint32_t *data;
> -   uint16_t type;
> -   uint16_t index;
> -   int8_t ctr[4];
> -   uint32_t sequence;
> -   struct nouveau_bo *bo;
> -   uint32_t base;
> -   uint32_t offset; /* base + i * rotate */
> -   uint8_t state;
> -   boolean is64bit;
> -   uint8_t rotate;
> -   int nesting; /* only used for occlusion queries */
> -   union {
> -      struct nouveau_mm_allocation *mm;
> -      uint64_t value;
> -   } u;
> -   struct nouveau_fence *fence;
> -};
> -
>   #define NVC0_QUERY_ALLOC_SPACE 256
>   
>   static boolean nvc0_mp_pm_query_begin(struct nvc0_context *,
> @@ -62,12 +44,6 @@ static void nvc0_mp_pm_query_end(struct nvc0_context *, struct nvc0_query *);
>   static boolean nvc0_mp_pm_query_result(struct nvc0_context *,
>                                          struct nvc0_query *, void *, boolean);
>   
> -static INLINE struct nvc0_query *
> -nvc0_query(struct pipe_query *pipe)
> -{
> -   return (struct nvc0_query *)pipe;
> -}
> -
>   static boolean
>   nvc0_query_allocate(struct nvc0_context *nvc0, struct nvc0_query *q, int size)
>   {
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.h b/src/gallium/drivers/nouveau/nvc0/nvc0_query.h
> new file mode 100644
> index 0000000..2d9105f
> --- /dev/null
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.h
> @@ -0,0 +1,47 @@
> +#ifndef __NVC0_QUERY_H__
> +#define __NVC0_QUERY_H__
> +
> +#include "pipe/p_context.h"
> +
> +#include "nouveau_context.h"
> +#include "nouveau_mm.h"
> +
> +#define NVC0_QUERY_TFB_BUFFER_OFFSET (PIPE_QUERY_TYPES + 0)
> +
> +struct nvc0_context;
> +
> +struct nvc0_query {
> +   uint32_t *data;
> +   uint16_t type;
> +   uint16_t index;
> +   int8_t ctr[4];
> +   uint32_t sequence;
> +   struct nouveau_bo *bo;
> +   uint32_t base;
> +   uint32_t offset; /* base + i * rotate */
> +   uint8_t state;
> +   boolean is64bit;
> +   uint8_t rotate;
> +   int nesting; /* only used for occlusion queries */
> +   union {
> +      struct nouveau_mm_allocation *mm;
> +      uint64_t value;
> +   } u;
> +   struct nouveau_fence *fence;
> +};
> +
> +static INLINE struct nvc0_query *
> +nvc0_query(struct pipe_query *pipe)
> +{
> +   return (struct nvc0_query *)pipe;
> +}
> +
> +void nvc0_init_query_functions(struct nvc0_context *);
> +void nvc0_query_pushbuf_submit(struct nouveau_pushbuf *,
> +                               struct pipe_query *, unsigned result_offset);
> +void nvc0_query_fifo_wait(struct nouveau_pushbuf *, struct pipe_query *);
> +void nvc0_so_target_save_offset(struct pipe_context *,
> +                                struct pipe_stream_output_target *, unsigned i,
> +                                boolean *serialize);
> +
> +#endif /* NVC0_QUERY_H */



More information about the mesa-dev mailing list