From 8958741e5a0c3cce95f0415ce8e6e8e840a5207d Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 27 Sep 2013 16:11:36 -0700 Subject: [PATCH] i965: Merge intel_context.h into brw_context.h. v2: Keep the random 32-bit only version of memcpy, since Ian says I can't delete it without data proving it isn't useful. Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/mesa/drivers/dri/i965/brw_context.h | 122 +++++++++++++++- src/mesa/drivers/dri/i965/intel_context.h | 170 ---------------------- 2 files changed, 120 insertions(+), 172 deletions(-) delete mode 100644 src/mesa/drivers/dri/i965/intel_context.h diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 88e03a7bddc..5725ef6e547 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -33,14 +33,34 @@ #ifndef BRWCONTEXT_INC #define BRWCONTEXT_INC -#include "intel_context.h" -#include "brw_structs.h" +#include +#include #include "main/imports.h" #include "main/macros.h" +#include "main/mm.h" +#include "main/mtypes.h" +#include "brw_structs.h" + +#ifdef __cplusplus +extern "C" { + /* Evil hack for using libdrm in a c++ compiler. */ + #define virtual virt +#endif + +#include +#include +#include +#ifdef __cplusplus + #undef virtual +} +#endif #ifdef __cplusplus extern "C" { #endif +#include "intel_debug.h" +#include "intel_screen.h" +#include "intel_tex_obj.h" /* Glossary: * @@ -119,6 +139,9 @@ extern "C" { * Handles blending and (presumably) depth and stencil testing. */ +#define INTEL_WRITE_PART 0x1 +#define INTEL_WRITE_FULL 0x2 +#define INTEL_READ 0x4 #define BRW_MAX_CURBE (32*16) @@ -876,6 +899,39 @@ struct brw_query_object { int last_index; }; +struct intel_sync_object { + struct gl_sync_object Base; + + /** Batch associated with this sync object */ + drm_intel_bo *bo; +}; + +struct intel_batchbuffer { + /** Current batchbuffer being queued up. */ + drm_intel_bo *bo; + /** Last BO submitted to the hardware. Used for glFinish(). */ + drm_intel_bo *last_bo; + /** BO for post-sync nonzero writes for gen6 workaround. */ + drm_intel_bo *workaround_bo; + bool need_workaround_flush; + + struct cached_batch_item *cached_items; + + uint16_t emit, total; + uint16_t used, reserved_space; + uint32_t *map; + uint32_t *cpu_map; +#define BATCH_SZ (8192*sizeof(uint32_t)) + + uint32_t state_batch_offset; + bool is_blit; + bool needs_sol_reset; + + struct { + uint16_t used; + int reloc_count; + } saved; +}; /** * Data shared between brw_context::vs and brw_context::gs @@ -1399,14 +1455,37 @@ struct brw_context GLint x, GLint y, GLsizei width, GLsizei height); }; +static INLINE bool +is_power_of_two(uint32_t value) +{ + return (value & (value - 1)) == 0; +} + /*====================================================================== * brw_vtbl.c */ void brwInitVtbl( struct brw_context *brw ); +/* brw_clear.c */ +extern void intelInitClearFuncs(struct dd_function_table *functions); + /*====================================================================== * brw_context.c */ +extern void intelFinish(struct gl_context * ctx); + +enum { + DRI_CONF_BO_REUSE_DISABLED, + DRI_CONF_BO_REUSE_ALL +}; + +void intel_update_renderbuffers(__DRIcontext *context, + __DRIdrawable *drawable); +void intel_prepare_render(struct brw_context *brw); + +void intel_resolve_for_dri2_flush(struct brw_context *brw, + __DRIdrawable *drawable); + bool brwCreateContext(gl_api api, const struct gl_config *mesaVis, __DRIcontext *driContextPriv, @@ -1515,6 +1594,18 @@ bool brw_render_target_supported(struct brw_context *brw, /* brw_performance_monitor.c */ void brw_init_performance_monitors(struct brw_context *brw); +/* intel_extensions.c */ +extern void intelInitExtensions(struct gl_context *ctx); + +/* intel_state.c */ +extern int intel_translate_shadow_compare_func(GLenum func); +extern int intel_translate_compare_func(GLenum func); +extern int intel_translate_stencil_op(GLenum op); +extern int intel_translate_logic_op(GLenum opcode); + +/* intel_syncobj.c */ +void intel_init_syncobj_functions(struct dd_function_table *functions); + /* gen6_sol.c */ void brw_begin_transform_feedback(struct gl_context *ctx, GLenum mode, @@ -1686,6 +1777,33 @@ gen6_upload_vec4_push_constants(struct brw_context *brw, struct brw_stage_state *stage_state, enum state_struct_type type); +/* ================================================================ + * From linux kernel i386 header files, copes with odd sizes better + * than COPY_DWORDS would: + * XXX Put this in src/mesa/main/imports.h ??? + */ +#if defined(i386) || defined(__i386__) +static INLINE void * __memcpy(void * to, const void * from, size_t n) +{ + int d0, d1, d2; + __asm__ __volatile__( + "rep ; movsl\n\t" + "testb $2,%b4\n\t" + "je 1f\n\t" + "movsw\n" + "1:\ttestb $1,%b4\n\t" + "je 2f\n\t" + "movsb\n" + "2:" + : "=&c" (d0), "=&D" (d1), "=&S" (d2) + :"0" (n/4), "q" (n),"1" ((long) to),"2" ((long) from) + : "memory"); + return (to); +} +#else +#define __memcpy(a,b,c) memcpy(a,b,c) +#endif + #ifdef __cplusplus } #endif diff --git a/src/mesa/drivers/dri/i965/intel_context.h b/src/mesa/drivers/dri/i965/intel_context.h deleted file mode 100644 index 58a6e861aa1..00000000000 --- a/src/mesa/drivers/dri/i965/intel_context.h +++ /dev/null @@ -1,170 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * 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 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 TUNGSTEN GRAPHICS AND/OR ITS 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. - * - **************************************************************************/ - -#ifndef INTELCONTEXT_INC -#define INTELCONTEXT_INC - - -#include -#include -#include "main/mtypes.h" -#include "main/mm.h" - -#ifdef __cplusplus -extern "C" { - /* Evil hack for using libdrm in a c++ compiler. */ - #define virtual virt -#endif - -#include "drm.h" -#include "intel_bufmgr.h" - -#include "intel_screen.h" -#include "intel_debug.h" -#include "intel_tex_obj.h" -#include "i915_drm.h" - -#ifdef __cplusplus - #undef virtual -#endif - -#include "tnl/t_vertex.h" - -struct intel_region; - -#define INTEL_WRITE_PART 0x1 -#define INTEL_WRITE_FULL 0x2 -#define INTEL_READ 0x4 - -struct intel_sync_object { - struct gl_sync_object Base; - - /** Batch associated with this sync object */ - drm_intel_bo *bo; -}; - -struct brw_context; - -struct intel_batchbuffer { - /** Current batchbuffer being queued up. */ - drm_intel_bo *bo; - /** Last BO submitted to the hardware. Used for glFinish(). */ - drm_intel_bo *last_bo; - /** BO for post-sync nonzero writes for gen6 workaround. */ - drm_intel_bo *workaround_bo; - bool need_workaround_flush; - - struct cached_batch_item *cached_items; - - uint16_t emit, total; - uint16_t used, reserved_space; - uint32_t *map; - uint32_t *cpu_map; -#define BATCH_SZ (8192*sizeof(uint32_t)) - - uint32_t state_batch_offset; - bool is_blit; - bool needs_sol_reset; - - struct { - uint16_t used; - int reloc_count; - } saved; -}; - -/* ================================================================ - * From linux kernel i386 header files, copes with odd sizes better - * than COPY_DWORDS would: - * XXX Put this in src/mesa/main/imports.h ??? - */ -#if defined(i386) || defined(__i386__) -static INLINE void * __memcpy(void * to, const void * from, size_t n) -{ - int d0, d1, d2; - __asm__ __volatile__( - "rep ; movsl\n\t" - "testb $2,%b4\n\t" - "je 1f\n\t" - "movsw\n" - "1:\ttestb $1,%b4\n\t" - "je 2f\n\t" - "movsb\n" - "2:" - : "=&c" (d0), "=&D" (d1), "=&S" (d2) - :"0" (n/4), "q" (n),"1" ((long) to),"2" ((long) from) - : "memory"); - return (to); -} -#else -#define __memcpy(a,b,c) memcpy(a,b,c) -#endif - - -/* ================================================================ - * intel_context.c: - */ - -extern void intelFinish(struct gl_context * ctx); - -extern void intelInitDriverFunctions(struct dd_function_table *functions); - -void intel_init_syncobj_functions(struct dd_function_table *functions); - -enum { - DRI_CONF_BO_REUSE_DISABLED, - DRI_CONF_BO_REUSE_ALL -}; - -extern int intel_translate_shadow_compare_func(GLenum func); -extern int intel_translate_compare_func(GLenum func); -extern int intel_translate_stencil_op(GLenum op); -extern int intel_translate_logic_op(GLenum opcode); - -void intel_update_renderbuffers(__DRIcontext *context, - __DRIdrawable *drawable); -void intel_prepare_render(struct brw_context *brw); - -void -intel_resolve_for_dri2_flush(struct brw_context *brw, - __DRIdrawable *drawable); - -extern void -intelInitExtensions(struct gl_context *ctx); -extern void -intelInitClearFuncs(struct dd_function_table *functions); - -static INLINE bool -is_power_of_two(uint32_t value) -{ - return (value & (value - 1)) == 0; -} - -#ifdef __cplusplus -} -#endif - -#endif -- 2.30.2