From 493e410d552e97572ca9a492d23648f6a236e4a4 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Thu, 29 Oct 2015 10:17:04 +0000 Subject: [PATCH] virgl: unwrap the includes Include what you want, rather than relying on a header foo.h N levels down the include chain, to provide something that you need. Signed-off-by: Emil Velikov Reviewed-by: Dave Airlie --- src/gallium/drivers/virgl/virgl_buffer.c | 2 ++ src/gallium/drivers/virgl/virgl_context.c | 7 ++----- src/gallium/drivers/virgl/virgl_context.h | 10 ++++----- src/gallium/drivers/virgl/virgl_encode.c | 8 +++++-- src/gallium/drivers/virgl/virgl_encode.h | 12 ++++++++++- src/gallium/drivers/virgl/virgl_query.c | 3 ++- src/gallium/drivers/virgl/virgl_resource.c | 3 ++- src/gallium/drivers/virgl/virgl_resource.h | 4 +++- src/gallium/drivers/virgl/virgl_screen.c | 3 --- src/gallium/drivers/virgl/virgl_screen.h | 7 ++----- src/gallium/drivers/virgl/virgl_streamout.c | 3 ++- src/gallium/drivers/virgl/virgl_texture.c | 8 ++++--- src/gallium/drivers/virgl/virgl_winsys.h | 5 ++++- .../winsys/virgl/drm/virgl_drm_winsys.c | 21 ++++++++++++------- .../winsys/virgl/drm/virgl_drm_winsys.h | 12 ++--------- .../winsys/virgl/vtest/virgl_vtest_public.h | 1 + .../winsys/virgl/vtest/virgl_vtest_socket.c | 6 ++++-- .../winsys/virgl/vtest/virgl_vtest_winsys.c | 7 ++++--- .../winsys/virgl/vtest/virgl_vtest_winsys.h | 6 +++--- 19 files changed, 72 insertions(+), 56 deletions(-) diff --git a/src/gallium/drivers/virgl/virgl_buffer.c b/src/gallium/drivers/virgl/virgl_buffer.c index 13e83846219..ce19fb949d0 100644 --- a/src/gallium/drivers/virgl/virgl_buffer.c +++ b/src/gallium/drivers/virgl/virgl_buffer.c @@ -21,9 +21,11 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include "util/u_inlines.h" #include "util/u_memory.h" #include "virgl_context.h" #include "virgl_resource.h" +#include "virgl_screen.h" static void virgl_buffer_destroy(struct pipe_screen *screen, struct pipe_resource *buf) diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c index 32dde06ae7d..cae6352c0fe 100644 --- a/src/gallium/drivers/virgl/virgl_context.c +++ b/src/gallium/drivers/virgl/virgl_context.c @@ -36,19 +36,16 @@ #include "util/u_upload_mgr.h" #include "util/u_blitter.h" #include "tgsi/tgsi_text.h" +#include "indices/u_primconvert.h" #include "pipebuffer/pb_buffer.h" #include "state_tracker/graw.h" -#include "state_tracker/drm_driver.h" #include "virgl_encode.h" - #include "virgl_context.h" - +#include "virgl_protocol.h" #include "virgl_resource.h" #include "virgl_screen.h" -#include "state_tracker/sw_winsys.h" - struct pipe_screen encscreen; static uint32_t next_handle; uint32_t virgl_object_assign_handle(void) diff --git a/src/gallium/drivers/virgl/virgl_context.h b/src/gallium/drivers/virgl/virgl_context.h index 3d8d3ce8bd4..adb8adef33c 100644 --- a/src/gallium/drivers/virgl/virgl_context.h +++ b/src/gallium/drivers/virgl/virgl_context.h @@ -25,15 +25,13 @@ #include "pipe/p_state.h" #include "pipe/p_context.h" -#include "virgl_protocol.h" - -#include "virgl_screen.h" #include "util/u_slab.h" #include "util/list.h" -#include "indices/u_primconvert.h" -struct virgl_resource; -struct virgl_buffer; +struct pipe_screen; +struct tgsi_token; +struct u_upload_mgr; +struct virgl_cmd_buf; struct virgl_sampler_view { struct pipe_sampler_view base; diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c index 4493c3f8ad2..22fb5292819 100644 --- a/src/gallium/drivers/virgl/virgl_encode.c +++ b/src/gallium/drivers/virgl/virgl_encode.c @@ -25,11 +25,15 @@ #include "util/u_memory.h" #include "util/u_math.h" #include "pipe/p_state.h" -#include "virgl_encode.h" -#include "virgl_resource.h" #include "tgsi/tgsi_dump.h" #include "tgsi/tgsi_parse.h" +#include "virgl_context.h" +#include "virgl_encode.h" +#include "virgl_protocol.h" +#include "virgl_resource.h" +#include "virgl_screen.h" + static int virgl_encoder_write_cmd_dword(struct virgl_context *ctx, uint32_t dword) { diff --git a/src/gallium/drivers/virgl/virgl_encode.h b/src/gallium/drivers/virgl/virgl_encode.h index d7923692793..030bcd6d16e 100644 --- a/src/gallium/drivers/virgl/virgl_encode.h +++ b/src/gallium/drivers/virgl/virgl_encode.h @@ -23,7 +23,17 @@ #ifndef VIRGL_ENCODE_H #define VIRGL_ENCODE_H -#include "virgl_context.h" +#include "pipe/p_defines.h" +#include "pipe/p_state.h" + +#include "virgl_winsys.h" + +struct tgsi_token; + +struct virgl_context; +struct virgl_resource; +struct virgl_sampler_view; + struct virgl_surface { struct pipe_surface base; uint32_t handle; diff --git a/src/gallium/drivers/virgl/virgl_query.c b/src/gallium/drivers/virgl/virgl_query.c index b06635b671a..b0200556342 100644 --- a/src/gallium/drivers/virgl/virgl_query.c +++ b/src/gallium/drivers/virgl/virgl_query.c @@ -23,9 +23,10 @@ #include "util/u_memory.h" #include "util/u_inlines.h" -#include "virgl_resource.h" #include "virgl_context.h" #include "virgl_encode.h" +#include "virgl_protocol.h" +#include "virgl_resource.h" struct virgl_query { uint32_t handle; diff --git a/src/gallium/drivers/virgl/virgl_resource.c b/src/gallium/drivers/virgl/virgl_resource.c index 52425f40e2a..0b2fc4ec497 100644 --- a/src/gallium/drivers/virgl/virgl_resource.c +++ b/src/gallium/drivers/virgl/virgl_resource.c @@ -21,8 +21,9 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "util/u_inlines.h" -#include "virgl_resource.h" #include "virgl_context.h" +#include "virgl_resource.h" +#include "virgl_screen.h" bool virgl_res_needs_flush_wait(struct virgl_context *vctx, struct virgl_resource *res, diff --git a/src/gallium/drivers/virgl/virgl_resource.h b/src/gallium/drivers/virgl/virgl_resource.h index cae83214ae3..bab9bcb9b4e 100644 --- a/src/gallium/drivers/virgl/virgl_resource.h +++ b/src/gallium/drivers/virgl/virgl_resource.h @@ -24,7 +24,7 @@ #ifndef VIRGL_RESOURCE_H #define VIRGL_RESOURCE_H -#include "util/u_inlines.h" +#include "util/u_resource.h" #include "util/u_range.h" #include "util/list.h" #include "util/u_transfer.h" @@ -32,8 +32,10 @@ #include "virgl_hw.h" #define VR_MAX_TEXTURE_2D_LEVELS 15 +struct winsys_handle; struct virgl_screen; struct virgl_context; + struct virgl_resource { struct u_resource u; struct virgl_hw_res *hw_res; diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c index 38bff4a50cf..cca379d47ab 100644 --- a/src/gallium/drivers/virgl/virgl_screen.c +++ b/src/gallium/drivers/virgl/virgl_screen.c @@ -28,10 +28,7 @@ #include "pipe/p_defines.h" #include "pipe/p_screen.h" #include "draw/draw_context.h" -#include "vl/vl_decoder.h" -#include "vl/vl_video_buffer.h" -#include "state_tracker/sw_winsys.h" #include "tgsi/tgsi_exec.h" #include "virgl_screen.h" diff --git a/src/gallium/drivers/virgl/virgl_screen.h b/src/gallium/drivers/virgl/virgl_screen.h index 1a24eec1bba..52e72ca4958 100644 --- a/src/gallium/drivers/virgl/virgl_screen.h +++ b/src/gallium/drivers/virgl/virgl_screen.h @@ -23,12 +23,9 @@ #ifndef VIRGL_H #define VIRGL_H -#include "util/u_transfer.h" - -#include "virgl_hw.h" - -#include "virgl_winsys.h" #include "pipe/p_screen.h" +#include "virgl_winsys.h" + struct virgl_screen { struct pipe_screen base; struct virgl_winsys *vws; diff --git a/src/gallium/drivers/virgl/virgl_streamout.c b/src/gallium/drivers/virgl/virgl_streamout.c index c449010e40e..b6a65fff29e 100644 --- a/src/gallium/drivers/virgl/virgl_streamout.c +++ b/src/gallium/drivers/virgl/virgl_streamout.c @@ -20,10 +20,11 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "util/u_memory.h" #include "util/u_inlines.h" +#include "util/u_memory.h" #include "virgl_context.h" #include "virgl_encode.h" +#include "virgl_protocol.h" #include "virgl_resource.h" static struct pipe_stream_output_target *virgl_create_so_target( diff --git a/src/gallium/drivers/virgl/virgl_texture.c b/src/gallium/drivers/virgl/virgl_texture.c index ebc4755f8b0..31189626144 100644 --- a/src/gallium/drivers/virgl/virgl_texture.c +++ b/src/gallium/drivers/virgl/virgl_texture.c @@ -20,11 +20,13 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "util/u_memory.h" #include "util/u_format.h" -#include "virgl_screen.h" -#include "virgl_resource.h" +#include "util/u_inlines.h" +#include "util/u_memory.h" + #include "virgl_context.h" +#include "virgl_resource.h" +#include "virgl_screen.h" static void virgl_copy_region_with_blit(struct pipe_context *pipe, struct pipe_resource *dst, diff --git a/src/gallium/drivers/virgl/virgl_winsys.h b/src/gallium/drivers/virgl/virgl_winsys.h index 76d401b5c12..ea21f2b6712 100644 --- a/src/gallium/drivers/virgl/virgl_winsys.h +++ b/src/gallium/drivers/virgl/virgl_winsys.h @@ -23,8 +23,11 @@ #ifndef VIRGL_WINSYS_H #define VIRGL_WINSYS_H -#include "pipe/p_compiler.h" +#include "pipe/p_defines.h" +#include "virgl_hw.h" +struct pipe_box; +struct pipe_fence_handle; struct winsys_handle; struct virgl_hw_res; diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c index 0616de31309..c9cdf68c5d0 100644 --- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c +++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c @@ -20,21 +20,26 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "virgl_drm_winsys.h" -#include "virgl_drm_public.h" + +#include +#include +#include +#include + +#include "os/os_mman.h" +#include "os/os_time.h" #include "util/u_memory.h" #include "util/u_format.h" +#include "util/u_hash_table.h" +#include "util/u_inlines.h" #include "state_tracker/drm_driver.h" -#include "os/os_mman.h" -#include "os/os_time.h" -#include -#include #include -#include -#include #include "virtgpu_drm.h" +#include "virgl_drm_winsys.h" +#include "virgl_drm_public.h" + static inline boolean can_cache_resource(struct virgl_hw_res *res) { return res->cacheable == TRUE; diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h index c83527206f5..da85ff87d2a 100644 --- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h +++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h @@ -24,22 +24,14 @@ #define VIRGL_DRM_WINSYS_H #include -#include "pipe/p_compiler.h" -#include "drm.h" - #include "os/os_thread.h" +#include "pipe/p_state.h" #include "util/list.h" -#include "util/u_inlines.h" -#include "util/u_hash_table.h" - -#include "pipe/p_screen.h" -#include "pipe/p_context.h" -#include "pipe/p_context.h" -#include "virgl/virgl_hw.h" #include "virgl/virgl_winsys.h" struct pipe_fence_handle; +struct util_hash_table; struct virgl_hw_res { struct pipe_reference reference; diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_public.h b/src/gallium/winsys/virgl/vtest/virgl_vtest_public.h index 72336499b44..47379d9c735 100644 --- a/src/gallium/winsys/virgl/vtest/virgl_vtest_public.h +++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_public.h @@ -24,6 +24,7 @@ #define VIRGL_VTEST_PUBLIC_H struct virgl_winsys; +struct sw_winsys; struct virgl_winsys *virgl_vtest_winsys_wrap(struct sw_winsys *sws); diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c index 8fd6a510f70..e33475334ce 100644 --- a/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c +++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c @@ -20,8 +20,7 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "virgl_vtest_winsys.h" -#include "virgl_vtest_public.h" + #include #include #include @@ -34,6 +33,9 @@ /* connect to remote socket */ #define VTEST_SOCKET_NAME "/tmp/.virgl_test" +#include "virgl_vtest_winsys.h" +#include "virgl_vtest_public.h" + /* block read/write routines */ static int virgl_block_write(int fd, void *buf, int size) { diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c index 28c4c62931b..6181d7c1976 100644 --- a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c +++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c @@ -21,13 +21,14 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include -#include "virgl_vtest_winsys.h" -#include "virgl_vtest_public.h" #include "util/u_memory.h" #include "util/u_format.h" #include "util/u_inlines.h" -#include "state_tracker/drm_driver.h" #include "os/os_time.h" +#include "state_tracker/sw_winsys.h" + +#include "virgl_vtest_winsys.h" +#include "virgl_vtest_public.h" static void *virgl_vtest_resource_map(struct virgl_winsys *vws, struct virgl_hw_res *res); static void virgl_vtest_resource_unmap(struct virgl_winsys *vws, struct virgl_hw_res *res); diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h index fd8cb7a6368..72ca2b207b1 100644 --- a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h +++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h @@ -27,15 +27,15 @@ #include "pipe/p_compiler.h" #include "pipe/p_defines.h" #include "pipe/p_state.h" -#include "state_tracker/sw_winsys.h" -#include "virgl/virgl_hw.h" -#include "virgl/virgl_winsys.h" #include "util/list.h" #include "os/os_thread.h" +#include "virgl/virgl_winsys.h" #include "vtest_protocol.h" struct pipe_fence_handle; +struct sw_winsys; +struct sw_displaytarget; struct virgl_vtest_winsys { struct virgl_winsys base; -- 2.30.2