X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fintel%2Fintel_context.h;h=96493c0f2bb5810e1f63c0821b48b6166727c52e;hb=772b25e1f366edc857e77b8c1ccdc5297d82cc41;hp=da5d901abf9c196c87e4096e710c4f329dfd42e6;hpb=d449627829e1a4a3250a1a723af2f4e3cd5fd194;p=mesa.git diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index da5d901abf9..96493c0f2bb 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -32,14 +32,26 @@ #include "main/mtypes.h" #include "main/mm.h" -#include "texmem.h" #include "dri_metaops.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_tex_obj.h" #include "i915_drm.h" + +#ifdef __cplusplus + #undef virtual +} +#endif + #include "tnl/t_vertex.h" #define TAG(x) intel##x @@ -86,6 +98,16 @@ extern void intelFallback(struct intel_context *intel, GLbitfield bit, #define INTEL_MAX_FIXUP 64 +#ifndef likely +#ifdef __GNUC__ +#define likely(expr) (__builtin_expect(expr, 1)) +#define unlikely(expr) (__builtin_expect(expr, 0)) +#else +#define likely(expr) (expr) +#define unlikely(expr) (expr) +#endif +#endif + struct intel_sync_object { struct gl_sync_object Base; @@ -94,11 +116,11 @@ struct intel_sync_object { }; /** - * intel_context is derived from Mesa's context class: GLcontext. + * intel_context is derived from Mesa's context class: struct gl_context. */ struct intel_context { - GLcontext ctx; /**< base class, must be first field */ + struct gl_context ctx; /**< base class, must be first field */ struct { @@ -142,17 +164,17 @@ struct intel_context */ int gen; GLboolean needs_ff_sync; - GLboolean is_ironlake; GLboolean is_g4x; GLboolean is_945; GLboolean has_luminance_srgb; + GLboolean has_xrgb_textures; int urb_size; struct intel_batchbuffer *batch; drm_intel_bo *first_post_swapbuffers_batch; + GLboolean need_throttle; GLboolean no_batch_wrap; - GLboolean using_dri2_swapbuffers; struct { @@ -160,7 +182,7 @@ struct intel_context uint32_t primitive; /**< Current hardware primitive type */ void (*flush) (struct intel_context *); GLubyte *start_ptr; /**< for i8xx */ - dri_bo *vb_bo; + drm_intel_bo *vb_bo; uint8_t *vb; unsigned int start_offset; /**< Byte offset of primitive sequence */ unsigned int current_offset; /**< Byte offset of next vertex */ @@ -168,9 +190,6 @@ struct intel_context } prim; GLuint stats_wm; - GLboolean locked; - char *prevLockFile; - int prevLockLine; /* Offsets of fields within the current vertex: */ @@ -188,7 +207,6 @@ struct intel_context GLboolean hw_stipple; GLboolean depth_buffer_is_float; GLboolean no_rast; - GLboolean no_hw; GLboolean always_flush_batch; GLboolean always_flush_cache; @@ -243,10 +261,9 @@ struct intel_context int driFd; __DRIcontext *driContext; - __DRIdrawable *driDrawable; - __DRIdrawable *driReadDrawable; - __DRIscreen *driScreen; struct intel_screen *intelScreen; + void (*saved_viewport)(struct gl_context * ctx, + GLint x, GLint y, GLsizei width, GLsizei height); /** * Configuration cache @@ -262,6 +279,8 @@ extern char *__progname; #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) #define ALIGN(value, alignment) ((value + alignment - 1) & ~(alignment - 1)) +#define ROUND_DOWN_TO(value, alignment) (ALIGN(value - alignment - 1, \ + alignment)) #define IS_POWER_OF_TWO(val) (((val) & (val - 1)) == 0) static INLINE uint32_t @@ -328,12 +347,12 @@ extern int INTEL_DEBUG; #define DEBUG_BUFMGR 0x200 #define DEBUG_REGION 0x400 #define DEBUG_FBO 0x800 -#define DEBUG_LOCK 0x1000 +#define DEBUG_GS 0x1000 #define DEBUG_SYNC 0x2000 #define DEBUG_PRIMS 0x4000 #define DEBUG_VERTS 0x8000 #define DEBUG_DRI 0x10000 -#define DEBUG_DMA 0x20000 +#define DEBUG_SF 0x20000 #define DEBUG_SANITY 0x40000 #define DEBUG_SLEEP 0x80000 #define DEBUG_STATS 0x100000 @@ -342,10 +361,16 @@ extern int INTEL_DEBUG; #define DEBUG_WM 0x800000 #define DEBUG_URB 0x1000000 #define DEBUG_VS 0x2000000 +#define DEBUG_CLIP 0x8000000 #define DBG(...) do { \ - if (INTEL_DEBUG & FILE_DEBUG_FLAG) \ - _mesa_printf(__VA_ARGS__); \ + if (unlikely(INTEL_DEBUG & FILE_DEBUG_FLAG)) \ + printf(__VA_ARGS__); \ +} while(0) + +#define fallback_debug(...) do { \ + if (unlikely(INTEL_DEBUG & DEBUG_FALLBACKS)) \ + printf(__VA_ARGS__); \ } while(0) #define PCI_CHIP_845_G 0x2562 @@ -367,14 +392,14 @@ extern int INTEL_DEBUG; */ extern GLboolean intelInitContext(struct intel_context *intel, - const __GLcontextModes * mesaVis, + int api, + const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate, struct dd_function_table *functions); -extern void intelFinish(GLcontext * ctx); -extern void intelFlush(GLcontext * ctx); -extern void intel_flush(GLcontext * ctx, GLboolean needs_mi_flush); +extern void intelFinish(struct gl_context * ctx); +extern void intel_flush(struct gl_context * ctx); extern void intelInitDriverFunctions(struct dd_function_table *functions); @@ -449,9 +474,6 @@ extern int intel_translate_stencil_op(GLenum op); extern int intel_translate_blend_factor(GLenum factor); extern int intel_translate_logic_op(GLenum opcode); -void intel_viewport(GLcontext * ctx, GLint x, GLint y, - GLsizei width, GLsizei height); - void intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable); void intel_prepare_render(struct intel_context *intel); @@ -464,7 +486,7 @@ void i915_set_buf_info_for_region(uint32_t *state, struct intel_region *region, * These are better-typed than the macros used previously: */ static INLINE struct intel_context * -intel_context(GLcontext * ctx) +intel_context(struct gl_context * ctx) { return (struct intel_context *) ctx; } @@ -475,25 +497,4 @@ is_power_of_two(uint32_t value) return (value & (value - 1)) == 0; } -static INLINE void -intel_bo_map_gtt_preferred(struct intel_context *intel, - drm_intel_bo *bo, - GLboolean write) -{ - if (intel->intelScreen->kernel_exec_fencing) - drm_intel_gem_bo_map_gtt(bo); - else - drm_intel_bo_map(bo, write); -} - -static INLINE void -intel_bo_unmap_gtt_preferred(struct intel_context *intel, - drm_intel_bo *bo) -{ - if (intel->intelScreen->kernel_exec_fencing) - drm_intel_gem_bo_unmap_gtt(bo); - else - drm_intel_bo_unmap(bo); -} - #endif