[Mesa-dev] [PATCH 29/29] i965: Merge intel_context.h into brw_context.h.

Ian Romanick idr at freedesktop.org
Mon Sep 30 17:36:55 PDT 2013


On 09/27/2013 04:46 PM, Kenneth Graunke wrote:
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/brw_context.h   |  95 +++++++++++++++++++-
>  src/mesa/drivers/dri/i965/intel_context.h | 142 ------------------------------
>  2 files changed, 93 insertions(+), 144 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 4d4502a..d4e41a1 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -33,15 +33,35 @@
>  #ifndef BRWCONTEXT_INC
>  #define BRWCONTEXT_INC
>  
> -#include "intel_context.h"
> -#include "brw_structs.h"
> +#include <stdbool.h>
> +#include <string.h>
>  #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 "drm.h"
> +#include "intel_bufmgr.h"
> +#include "i915_drm.h"
> +#ifdef __cplusplus
> +	#undef virtual
> +}
> +#endif
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +#include "intel_debug.h"
> +#include "intel_screen.h"
> +#include "intel_tex_obj.h"
> +
>  /* Glossary:
>   *
>   * URB - uniform resource buffer.  A mid-sized buffer which is
> @@ -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)
>  
> @@ -859,6 +882,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
> @@ -1369,14 +1425,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;
> +}

Gallium has util_is_power_of_two.  It seems like these could be merged...

> +
>  /*======================================================================
>   * 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(int api,
>  		      const struct gl_config *mesaVis,
>  		      __DRIcontext *driContextPriv,
> @@ -1482,6 +1561,18 @@ bool brw_is_hiz_depth_format(struct brw_context *ctx, gl_format format);
>  bool brw_render_target_supported(struct brw_context *brw,
>                                   struct gl_renderbuffer *rb);
>  
> +/* 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,
> 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 89cbb7f..0000000
> --- a/src/mesa/drivers/dri/i965/intel_context.h
> +++ /dev/null
> @@ -1,142 +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 <stdbool.h>
> -#include <string.h>
> -#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;
> -};
> -
> -/* ================================================================
> - * 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
> 



More information about the mesa-dev mailing list