From: Marek Olšák Date: Sun, 3 Mar 2013 13:33:00 +0000 (+0100) Subject: r600g: remove r600.h, move the stuff elsewhere (mostly to r600_pipe.h) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2c339f801516d4f6201e8bd4cd0fe0033f36046a;p=mesa.git r600g: remove r600.h, move the stuff elsewhere (mostly to r600_pipe.h) Reviewed-by: Jerome Glisse --- diff --git a/src/gallium/drivers/r600/compute_memory_pool.c b/src/gallium/drivers/r600/compute_memory_pool.c index ee1954e0818..454af900bc6 100644 --- a/src/gallium/drivers/r600/compute_memory_pool.c +++ b/src/gallium/drivers/r600/compute_memory_pool.c @@ -33,7 +33,6 @@ #include "util/u_memory.h" #include "util/u_inlines.h" #include "util/u_framebuffer.h" -#include "r600.h" #include "r600_resource.h" #include "r600_shader.h" #include "r600_pipe.h" diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c index 785d5e749e0..80ce739e021 100644 --- a/src/gallium/drivers/r600/evergreen_compute.c +++ b/src/gallium/drivers/r600/evergreen_compute.c @@ -38,7 +38,6 @@ #include "util/u_inlines.h" #include "util/u_framebuffer.h" #include "pipebuffer/pb_buffer.h" -#include "r600.h" #include "evergreend.h" #include "r600_resource.h" #include "r600_shader.h" diff --git a/src/gallium/drivers/r600/evergreen_compute.h b/src/gallium/drivers/r600/evergreen_compute.h index 69e41cc82aa..f593432ec7d 100644 --- a/src/gallium/drivers/r600/evergreen_compute.h +++ b/src/gallium/drivers/r600/evergreen_compute.h @@ -26,7 +26,6 @@ #ifndef EVERGREEN_COMPUTE_H #define EVERGREEN_COMPUTE_H -#include "r600.h" #include "r600_pipe.h" struct r600_atom; diff --git a/src/gallium/drivers/r600/evergreen_compute_internal.c b/src/gallium/drivers/r600/evergreen_compute_internal.c index 89f83809f6b..66a5f391817 100644 --- a/src/gallium/drivers/r600/evergreen_compute_internal.c +++ b/src/gallium/drivers/r600/evergreen_compute_internal.c @@ -36,7 +36,6 @@ #include "util/u_memory.h" #include "util/u_inlines.h" #include "util/u_framebuffer.h" -#include "r600.h" #include "r600_resource.h" #include "r600_shader.h" #include "r600_pipe.h" diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h deleted file mode 100644 index a71e152e19a..00000000000 --- a/src/gallium/drivers/r600/r600.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright 2010 Jerome Glisse - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: - * Jerome Glisse - */ -#ifndef R600_H -#define R600_H - -#include "../../winsys/radeon/drm/radeon_winsys.h" -#include "util/u_double_list.h" -#include "util/u_range.h" -#include "util/u_transfer.h" - -#define R600_ERR(fmt, args...) \ - fprintf(stderr, "EE %s:%d %s - "fmt, __FILE__, __LINE__, __func__, ##args) - -struct winsys_handle; - -struct r600_tiling_info { - unsigned num_channels; - unsigned num_banks; - unsigned group_bytes; -}; - -struct r600_resource { - struct u_resource b; - - /* Winsys objects. */ - struct pb_buffer *buf; - struct radeon_winsys_cs_handle *cs_buf; - - /* Resource state. */ - unsigned domains; - - /* The buffer range which is initialized (with a write transfer, - * streamout, DMA, or as a random access target). The rest of - * the buffer is considered invalid and can be mapped unsynchronized. - * - * This allows unsychronized mapping of a buffer range which hasn't - * been used yet. It's for applications which forget to use - * the unsynchronized map flag and expect the driver to figure it out. - */ - struct util_range valid_buffer_range; -}; - -struct r600_query_buffer { - /* The buffer where query results are stored. */ - struct r600_resource *buf; - /* Offset of the next free result after current query data */ - unsigned results_end; - /* If a query buffer is full, a new buffer is created and the old one - * is put in here. When we calculate the result, we sum up the samples - * from all buffers. */ - struct r600_query_buffer *previous; -}; - -struct r600_query { - /* The query buffer and how many results are in it. */ - struct r600_query_buffer buffer; - /* The type of query */ - unsigned type; - /* Size of the result in memory for both begin_query and end_query, - * this can be one or two numbers, or it could even be a size of a structure. */ - unsigned result_size; - /* The number of dwords for begin_query or end_query. */ - unsigned num_cs_dw; - /* linked list of queries */ - struct list_head list; -}; - -struct r600_so_target { - struct pipe_stream_output_target b; - - /* The buffer where BUFFER_FILLED_SIZE is stored. */ - struct r600_resource *buf_filled_size; - unsigned buf_filled_size_offset; - - unsigned stride_in_dw; - unsigned so_index; -}; - -#define R600_CONTEXT_INVAL_READ_CACHES (1 << 0) -#define R600_CONTEXT_STREAMOUT_FLUSH (1 << 1) -#define R600_CONTEXT_WAIT_3D_IDLE (1 << 2) -#define R600_CONTEXT_WAIT_CP_DMA_IDLE (1 << 3) -#define R600_CONTEXT_FLUSH_AND_INV (1 << 4) -#define R600_CONTEXT_FLUSH_AND_INV_CB_META (1 << 5) -#define R600_CONTEXT_PS_PARTIAL_FLUSH (1 << 6) -#define R600_CONTEXT_FLUSH_AND_INV_DB_META (1 << 7) - -struct r600_context; -struct r600_screen; - -void r600_get_backend_mask(struct r600_context *ctx); -void r600_context_flush(struct r600_context *ctx, unsigned flags); -void r600_begin_new_cs(struct r600_context *ctx); - -void r600_context_emit_fence(struct r600_context *ctx, struct r600_resource *fence, - unsigned offset, unsigned value); -void r600_flush_emit(struct r600_context *ctx); - -void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw, boolean count_draw_in); -void r600_need_dma_space(struct r600_context *ctx, unsigned num_dw); -void r600_dma_copy(struct r600_context *rctx, - struct pipe_resource *dst, - struct pipe_resource *src, - uint64_t dst_offset, - uint64_t src_offset, - uint64_t size); -boolean r600_dma_blit(struct pipe_context *ctx, - struct pipe_resource *dst, - unsigned dst_level, - unsigned dst_x, unsigned dst_y, unsigned dst_z, - struct pipe_resource *src, - unsigned src_level, - const struct pipe_box *src_box); -void evergreen_dma_copy(struct r600_context *rctx, - struct pipe_resource *dst, - struct pipe_resource *src, - uint64_t dst_offset, - uint64_t src_offset, - uint64_t size); -boolean evergreen_dma_blit(struct pipe_context *ctx, - struct pipe_resource *dst, - unsigned dst_level, - unsigned dst_x, unsigned dst_y, unsigned dst_z, - struct pipe_resource *src, - unsigned src_level, - const struct pipe_box *src_box); -void r600_cp_dma_copy_buffer(struct r600_context *rctx, - struct pipe_resource *dst, uint64_t dst_offset, - struct pipe_resource *src, uint64_t src_offset, - unsigned size); - -#endif diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c index c7aa45f4e67..0fa6ab17fe6 100644 --- a/src/gallium/drivers/r600/r600_llvm.c +++ b/src/gallium/drivers/r600/r600_llvm.c @@ -7,7 +7,6 @@ #include "util/u_double_list.h" #include "util/u_memory.h" -#include "r600.h" #include "r600_asm.h" #include "r600_sq.h" #include "r600_opcodes.h" diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index dd92a01e103..7e0f242051d 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -29,7 +29,8 @@ #include "util/u_blitter.h" #include "util/u_slab.h" #include "util/u_suballoc.h" -#include "r600.h" +#include "util/u_double_list.h" +#include "util/u_transfer.h" #include "r600_llvm.h" #include "r600_public.h" #include "r600_resource.h" @@ -62,6 +63,19 @@ #define R600_MAP_BUFFER_ALIGNMENT 64 +#define R600_ERR(fmt, args...) \ + fprintf(stderr, "EE %s:%d %s - "fmt, __FILE__, __LINE__, __func__, ##args) + +#define R600_CONTEXT_INVAL_READ_CACHES (1 << 0) +#define R600_CONTEXT_STREAMOUT_FLUSH (1 << 1) +#define R600_CONTEXT_WAIT_3D_IDLE (1 << 2) +#define R600_CONTEXT_WAIT_CP_DMA_IDLE (1 << 3) +#define R600_CONTEXT_FLUSH_AND_INV (1 << 4) +#define R600_CONTEXT_FLUSH_AND_INV_CB_META (1 << 5) +#define R600_CONTEXT_PS_PARTIAL_FLUSH (1 << 6) +#define R600_CONTEXT_FLUSH_AND_INV_DB_META (1 << 7) + +struct r600_context; struct r600_bytecode; struct r600_shader_key; @@ -188,11 +202,6 @@ struct r600_viewport_state { struct pipe_viewport_state state; }; -struct compute_memory_pool; -void compute_memory_pool_delete(struct compute_memory_pool* pool); -struct compute_memory_pool* compute_memory_pool_new( - struct r600_screen *rscreen); - struct r600_pipe_fences { struct r600_resource *bo; unsigned *data; @@ -241,6 +250,12 @@ typedef boolean (*r600g_dma_blit_t)(struct pipe_context *ctx, #define DBG_NO_HYPERZ (1 << 16) #define DBG_NO_LLVM (1 << 17) +struct r600_tiling_info { + unsigned num_channels; + unsigned num_banks; + unsigned group_bytes; +}; + struct r600_screen { struct pipe_screen screen; struct radeon_winsys *ws; @@ -435,6 +450,42 @@ struct r600_shader_state { struct r600_pipe_shader_selector *shader; }; +struct r600_query_buffer { + /* The buffer where query results are stored. */ + struct r600_resource *buf; + /* Offset of the next free result after current query data */ + unsigned results_end; + /* If a query buffer is full, a new buffer is created and the old one + * is put in here. When we calculate the result, we sum up the samples + * from all buffers. */ + struct r600_query_buffer *previous; +}; + +struct r600_query { + /* The query buffer and how many results are in it. */ + struct r600_query_buffer buffer; + /* The type of query */ + unsigned type; + /* Size of the result in memory for both begin_query and end_query, + * this can be one or two numbers, or it could even be a size of a structure. */ + unsigned result_size; + /* The number of dwords for begin_query or end_query. */ + unsigned num_cs_dw; + /* linked list of queries */ + struct list_head list; +}; + +struct r600_so_target { + struct pipe_stream_output_target b; + + /* The buffer where BUFFER_FILLED_SIZE is stored. */ + struct r600_resource *buf_filled_size; + unsigned buf_filled_size_offset; + + unsigned stride_in_dw; + unsigned so_index; +}; + struct r600_streamout { struct r600_atom begin_atom; bool begin_emitted; @@ -613,6 +664,12 @@ static INLINE void r600_set_cso_state_with_cb(struct r600_cso_state *state, void r600_set_cso_state(state, cso); } +/* compute_memory_pool.c */ +struct compute_memory_pool; +void compute_memory_pool_delete(struct compute_memory_pool* pool); +struct compute_memory_pool* compute_memory_pool_new( + struct r600_screen *rscreen); + /* evergreen_state.c */ struct pipe_sampler_view * evergreen_create_sampler_view_custom(struct pipe_context *ctx, @@ -737,6 +794,31 @@ unsigned r600_get_swizzle_combined(const unsigned char *swizzle_format, boolean vtx); /* r600_hw_context.c */ +void r600_get_backend_mask(struct r600_context *ctx); +void r600_context_flush(struct r600_context *ctx, unsigned flags); +void r600_begin_new_cs(struct r600_context *ctx); +void r600_context_emit_fence(struct r600_context *ctx, struct r600_resource *fence, + unsigned offset, unsigned value); +void r600_flush_emit(struct r600_context *ctx); +void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw, boolean count_draw_in); +void r600_need_dma_space(struct r600_context *ctx, unsigned num_dw); +void r600_cp_dma_copy_buffer(struct r600_context *rctx, + struct pipe_resource *dst, uint64_t dst_offset, + struct pipe_resource *src, uint64_t src_offset, + unsigned size); +void r600_dma_copy(struct r600_context *rctx, + struct pipe_resource *dst, + struct pipe_resource *src, + uint64_t dst_offset, + uint64_t src_offset, + uint64_t size); +boolean r600_dma_blit(struct pipe_context *ctx, + struct pipe_resource *dst, + unsigned dst_level, + unsigned dst_x, unsigned dst_y, unsigned dst_z, + struct pipe_resource *src, + unsigned src_level, + const struct pipe_box *src_box); void r600_emit_streamout_begin(struct r600_context *ctx, struct r600_atom *atom); void r600_emit_streamout_end(struct r600_context *ctx); @@ -745,6 +827,19 @@ void r600_emit_streamout_end(struct r600_context *ctx); */ void evergreen_flush_vgt_streamout(struct r600_context *ctx); void evergreen_set_streamout_enable(struct r600_context *ctx, unsigned buffer_enable_bit); +void evergreen_dma_copy(struct r600_context *rctx, + struct pipe_resource *dst, + struct pipe_resource *src, + uint64_t dst_offset, + uint64_t src_offset, + uint64_t size); +boolean evergreen_dma_blit(struct pipe_context *ctx, + struct pipe_resource *dst, + unsigned dst_level, + unsigned dst_x, unsigned dst_y, unsigned dst_z, + struct pipe_resource *src, + unsigned src_level, + const struct pipe_box *src_box); /* r600_state_common.c */ void r600_init_common_state_functions(struct r600_context *rctx); diff --git a/src/gallium/drivers/r600/r600_resource.h b/src/gallium/drivers/r600/r600_resource.h index 25d0be4cac9..d07ff9e1e04 100644 --- a/src/gallium/drivers/r600/r600_resource.h +++ b/src/gallium/drivers/r600/r600_resource.h @@ -23,13 +23,37 @@ #ifndef R600_RESOURCE_H #define R600_RESOURCE_H -#include "r600.h" +#include "../../winsys/radeon/drm/radeon_winsys.h" +#include "util/u_range.h" + +struct r600_screen; /* flag to indicate a resource is to be used as a transfer so should not be tiled */ #define R600_RESOURCE_FLAG_TRANSFER PIPE_RESOURCE_FLAG_DRV_PRIV #define R600_RESOURCE_FLAG_FLUSHED_DEPTH (PIPE_RESOURCE_FLAG_DRV_PRIV << 1) #define R600_RESOURCE_FLAG_FORCE_TILING (PIPE_RESOURCE_FLAG_DRV_PRIV << 2) +struct r600_resource { + struct u_resource b; + + /* Winsys objects. */ + struct pb_buffer *buf; + struct radeon_winsys_cs_handle *cs_buf; + + /* Resource state. */ + unsigned domains; + + /* The buffer range which is initialized (with a write transfer, + * streamout, DMA, or as a random access target). The rest of + * the buffer is considered invalid and can be mapped unsynchronized. + * + * This allows unsychronized mapping of a buffer range which hasn't + * been used yet. It's for applications which forget to use + * the unsynchronized map flag and expect the driver to figure it out. + */ + struct util_range valid_buffer_range; +}; + struct r600_transfer { struct pipe_transfer transfer; struct r600_resource *staging;