2006-11-01 12:03:11 +00:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
|
|
|
|
2010-12-13 11:02:15 -08:00
|
|
|
#include <stdbool.h>
|
2012-01-12 14:32:50 -08:00
|
|
|
#include <string.h>
|
2008-09-18 15:17:05 -06:00
|
|
|
#include "main/mtypes.h"
|
|
|
|
#include "main/mm.h"
|
2010-08-30 10:40:39 -07:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
/* Evil hack for using libdrm in a c++ compiler. */
|
|
|
|
#define virtual virt
|
|
|
|
#endif
|
|
|
|
|
2008-09-18 15:17:05 -06:00
|
|
|
#include "drm.h"
|
2008-08-24 17:59:10 +10:00
|
|
|
#include "intel_bufmgr.h"
|
2006-11-01 12:03:11 +00:00
|
|
|
|
|
|
|
#include "intel_screen.h"
|
2007-11-16 16:05:11 -08:00
|
|
|
#include "intel_tex_obj.h"
|
2006-11-01 12:03:11 +00:00
|
|
|
#include "i915_drm.h"
|
2010-08-30 10:40:39 -07:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#undef virtual
|
|
|
|
#endif
|
|
|
|
|
2006-11-01 12:03:11 +00:00
|
|
|
#include "tnl/t_vertex.h"
|
|
|
|
|
|
|
|
struct intel_region;
|
|
|
|
struct intel_context;
|
|
|
|
|
|
|
|
#define INTEL_WRITE_PART 0x1
|
|
|
|
#define INTEL_WRITE_FULL 0x2
|
|
|
|
#define INTEL_READ 0x4
|
|
|
|
|
2010-11-02 19:55:07 -07:00
|
|
|
#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
|
|
|
|
|
2009-09-01 12:20:10 -07:00
|
|
|
struct intel_sync_object {
|
|
|
|
struct gl_sync_object Base;
|
|
|
|
|
|
|
|
/** Batch associated with this sync object */
|
|
|
|
drm_intel_bo *bo;
|
|
|
|
};
|
2009-08-06 11:40:06 -06:00
|
|
|
|
2011-11-01 14:30:26 -07:00
|
|
|
struct brw_context;
|
|
|
|
|
2012-04-29 21:46:47 -07:00
|
|
|
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;
|
2013-01-18 18:18:57 -08:00
|
|
|
uint32_t *map;
|
|
|
|
uint32_t *cpu_map;
|
2012-04-29 21:46:47 -07:00
|
|
|
#define BATCH_SZ (8192*sizeof(uint32_t))
|
|
|
|
|
|
|
|
uint32_t state_batch_offset;
|
|
|
|
bool is_blit;
|
2013-05-23 20:19:19 -07:00
|
|
|
bool needs_sol_reset;
|
2012-04-29 21:46:47 -07:00
|
|
|
|
|
|
|
struct {
|
|
|
|
uint16_t used;
|
|
|
|
int reloc_count;
|
|
|
|
} saved;
|
|
|
|
};
|
|
|
|
|
2009-08-06 11:40:06 -06:00
|
|
|
/**
|
2010-10-12 12:26:10 -04:00
|
|
|
* intel_context is derived from Mesa's context class: struct gl_context.
|
2009-08-06 11:40:06 -06:00
|
|
|
*/
|
2006-11-01 12:03:11 +00:00
|
|
|
struct intel_context
|
|
|
|
{
|
2010-10-12 12:26:10 -04:00
|
|
|
struct gl_context ctx; /**< base class, must be first field */
|
2006-11-01 12:03:11 +00:00
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
void (*destroy) (struct intel_context * intel);
|
2008-08-24 17:59:10 +10:00
|
|
|
void (*finish_batch) (struct intel_context * intel);
|
2008-01-09 13:40:40 -08:00
|
|
|
void (*new_batch) (struct intel_context * intel);
|
2006-11-01 12:03:11 +00:00
|
|
|
|
2008-02-22 00:51:52 -05:00
|
|
|
void (*invalidate_state) (struct intel_context *intel,
|
|
|
|
GLuint new_state);
|
2006-11-01 12:03:11 +00:00
|
|
|
|
2007-12-07 16:15:49 -08:00
|
|
|
void (*debug_batch)(struct intel_context *intel);
|
2012-05-07 14:37:00 -07:00
|
|
|
void (*annotate_aub)(struct intel_context *intel);
|
2011-11-15 11:43:40 -08:00
|
|
|
bool (*render_target_supported)(struct intel_context *intel,
|
2012-01-19 17:23:25 -08:00
|
|
|
struct gl_renderbuffer *rb);
|
2011-05-23 13:47:57 -07:00
|
|
|
|
|
|
|
/** Can HiZ be enabled on a depthbuffer of the given format? */
|
|
|
|
bool (*is_hiz_depth_format)(struct intel_context *intel,
|
|
|
|
gl_format format);
|
2011-09-20 13:43:17 -07:00
|
|
|
|
2012-08-14 15:45:52 -07:00
|
|
|
void (*update_texture_surface)(struct gl_context *ctx,
|
|
|
|
unsigned unit,
|
|
|
|
uint32_t *binding_table,
|
|
|
|
unsigned surf_index);
|
2011-11-01 14:30:26 -07:00
|
|
|
void (*update_renderbuffer_surface)(struct brw_context *brw,
|
|
|
|
struct gl_renderbuffer *rb,
|
2013-04-19 01:00:20 -07:00
|
|
|
bool layered,
|
2011-11-01 14:30:26 -07:00
|
|
|
unsigned unit);
|
|
|
|
void (*update_null_renderbuffer_surface)(struct brw_context *brw,
|
|
|
|
unsigned unit);
|
|
|
|
void (*create_constant_surface)(struct brw_context *brw,
|
|
|
|
drm_intel_bo *bo,
|
2012-06-20 13:03:04 -07:00
|
|
|
uint32_t offset,
|
2013-03-20 10:46:20 -07:00
|
|
|
uint32_t size,
|
2013-03-14 14:41:37 -07:00
|
|
|
uint32_t *out_offset,
|
|
|
|
bool dword_pitch);
|
2013-03-26 13:24:43 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Send the appropriate state packets to configure depth, stencil, and
|
|
|
|
* HiZ buffers (i965+ only)
|
|
|
|
*/
|
|
|
|
void (*emit_depth_stencil_hiz)(struct brw_context *brw,
|
|
|
|
struct intel_mipmap_tree *depth_mt,
|
|
|
|
uint32_t depth_offset,
|
|
|
|
uint32_t depthbuffer_format,
|
|
|
|
uint32_t depth_surface_type,
|
|
|
|
struct intel_mipmap_tree *stencil_mt,
|
2013-04-08 13:45:49 -07:00
|
|
|
bool hiz, bool separate_stencil,
|
2013-03-26 13:24:43 -07:00
|
|
|
uint32_t width, uint32_t height,
|
|
|
|
uint32_t tile_x, uint32_t tile_y);
|
|
|
|
|
2006-11-01 12:03:11 +00:00
|
|
|
} vtbl;
|
|
|
|
|
|
|
|
GLuint NewGLState;
|
2013-03-14 14:41:37 -07:00
|
|
|
|
2007-12-12 10:25:19 -08:00
|
|
|
dri_bufmgr *bufmgr;
|
|
|
|
unsigned int maxBatchSize;
|
|
|
|
|
2009-10-26 09:28:32 -07:00
|
|
|
/**
|
|
|
|
* Generation number of the hardware: 2 is 8xx, 3 is 9xx pre-965, 4 is 965.
|
|
|
|
*/
|
|
|
|
int gen;
|
2011-09-24 01:10:04 -07:00
|
|
|
int gt;
|
2011-10-07 12:26:50 -07:00
|
|
|
bool needs_ff_sync;
|
2011-08-12 18:22:48 -07:00
|
|
|
bool is_haswell;
|
2012-10-03 14:26:29 -07:00
|
|
|
bool is_baytrail;
|
2011-10-07 12:26:50 -07:00
|
|
|
bool is_g4x;
|
|
|
|
bool has_separate_stencil;
|
|
|
|
bool must_use_separate_stencil;
|
|
|
|
bool has_hiz;
|
2012-02-01 18:06:53 -02:00
|
|
|
bool has_llc;
|
2012-03-02 21:38:44 +01:00
|
|
|
bool has_swizzling;
|
2009-12-16 15:22:26 -08:00
|
|
|
|
2012-06-12 12:07:09 -07:00
|
|
|
drm_intel_context *hw_ctx;
|
|
|
|
|
2012-04-29 21:46:47 -07:00
|
|
|
struct intel_batchbuffer batch;
|
2011-02-10 20:25:51 +00:00
|
|
|
|
2011-04-25 10:36:29 -07:00
|
|
|
drm_intel_bo *first_post_swapbuffers_batch;
|
2011-10-07 12:26:50 -07:00
|
|
|
bool need_throttle;
|
|
|
|
bool no_batch_wrap;
|
2006-11-01 12:03:11 +00:00
|
|
|
|
2013-02-22 13:15:20 -08:00
|
|
|
/**
|
|
|
|
* Set if we're either a debug context or the INTEL_DEBUG=perf environment
|
|
|
|
* variable is set, this is the flag indicating to do expensive work that
|
|
|
|
* might lead to a perf_debug() call.
|
|
|
|
*/
|
|
|
|
bool perf_debug;
|
|
|
|
|
2011-02-08 20:01:10 +00:00
|
|
|
struct {
|
|
|
|
drm_intel_bo *bo;
|
|
|
|
GLuint offset;
|
2011-02-21 20:56:06 +00:00
|
|
|
uint32_t buffer_len;
|
|
|
|
uint32_t buffer_offset;
|
2011-02-10 00:25:17 +00:00
|
|
|
char buffer[4096];
|
2011-02-08 20:01:10 +00:00
|
|
|
} upload;
|
|
|
|
|
2013-04-09 11:11:19 -07:00
|
|
|
uint32_t max_gtt_map_object_size;
|
|
|
|
|
2008-02-22 00:51:52 -05:00
|
|
|
GLuint stats_wm;
|
2006-11-01 12:03:11 +00:00
|
|
|
|
2011-10-07 12:26:50 -07:00
|
|
|
bool no_rast;
|
|
|
|
bool always_flush_batch;
|
|
|
|
bool always_flush_cache;
|
2013-03-19 11:49:08 -07:00
|
|
|
bool disable_throttling;
|
2009-03-04 16:48:51 -07:00
|
|
|
|
2013-06-21 09:54:58 -07:00
|
|
|
GLenum reduced_primitive;
|
2006-11-01 12:03:11 +00:00
|
|
|
|
2009-04-06 13:15:54 -07:00
|
|
|
/**
|
|
|
|
* Set if rendering has occured to the drawable's front buffer.
|
|
|
|
*
|
|
|
|
* This is used in the DRI2 case to detect that glFlush should also copy
|
|
|
|
* the contents of the fake front buffer to the real front buffer.
|
|
|
|
*/
|
2011-10-07 12:26:50 -07:00
|
|
|
bool front_buffer_dirty;
|
2009-04-06 13:15:54 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Track whether front-buffer rendering is currently enabled
|
|
|
|
*
|
|
|
|
* A separate flag is used to track this in order to support MRT more
|
|
|
|
* easily.
|
|
|
|
*/
|
2011-10-07 12:26:50 -07:00
|
|
|
bool is_front_buffer_rendering;
|
2009-06-19 22:12:52 -07:00
|
|
|
/**
|
|
|
|
* Track whether front-buffer is the current read target.
|
|
|
|
*
|
|
|
|
* This is closely associated with is_front_buffer_rendering, but may
|
|
|
|
* be set separately. The DRI2 fake front buffer must be referenced
|
|
|
|
* either way.
|
|
|
|
*/
|
2011-10-07 12:26:50 -07:00
|
|
|
bool is_front_buffer_reading;
|
2009-04-06 13:15:54 -07:00
|
|
|
|
2006-11-01 12:03:11 +00:00
|
|
|
int driFd;
|
|
|
|
|
2010-01-01 17:09:12 -05:00
|
|
|
__DRIcontext *driContext;
|
2010-02-11 16:44:21 -05:00
|
|
|
struct intel_screen *intelScreen;
|
2010-10-12 12:26:10 -04:00
|
|
|
void (*saved_viewport)(struct gl_context * ctx,
|
2010-05-11 10:23:34 -04:00
|
|
|
GLint x, GLint y, GLsizei width, GLsizei height);
|
2006-11-01 12:03:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Configuration cache
|
|
|
|
*/
|
|
|
|
driOptionCache optionCache;
|
|
|
|
};
|
|
|
|
|
intel: Fix ROUND_DOWN_TO macro
Previously the macro would (ALIGN(value - alignment - 1, alignment)).
At the very least, this was missing parenthesis around "alignment -
1". As a result, if value was already aligned, it would be reduced by
alignment. Condisder:
x = ROUND_DOWN_TO(256, 128);
This becomes:
x = ALIGN(256 - 128 - 1, 128);
Or:
x = ALIGN(127, 128);
Which becomes:
x = 128;
This macro is currently only used in brw_state_batch
(brw_state_batch.c). It looks like the original version of this macro
would just use too much space in the batch buffer. It's possible, but
not at all clear to me from the code, that the original behavior is
actually desired.
In any case, this patch does not cause any piglit regressions on my
Ironlake system.
I also think that ALIGN_FLOOR would be a better name for this macro,
but ROUND_DOWN_TO matches rounddown in the Linux kernel.
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Whitwell <keithw@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-04-08 16:31:22 -07:00
|
|
|
/**
|
|
|
|
* Align a value down to an alignment value
|
|
|
|
*
|
|
|
|
* If \c value is not already aligned to the requested alignment value, it
|
|
|
|
* will be rounded down.
|
|
|
|
*
|
|
|
|
* \param value Value to be rounded
|
|
|
|
* \param alignment Alignment value to be used. This must be a power of two.
|
|
|
|
*
|
|
|
|
* \sa ALIGN()
|
|
|
|
*/
|
|
|
|
#define ROUND_DOWN_TO(value, alignment) ((value) & ~(alignment - 1))
|
|
|
|
|
2009-12-28 18:46:15 -08:00
|
|
|
static INLINE uint32_t
|
2009-10-29 11:52:28 -07:00
|
|
|
U_FIXED(float value, uint32_t frac_bits)
|
|
|
|
{
|
|
|
|
value *= (1 << frac_bits);
|
|
|
|
return value < 0 ? 0 : value;
|
|
|
|
}
|
|
|
|
|
2009-12-28 18:46:15 -08:00
|
|
|
static INLINE uint32_t
|
2009-10-29 11:52:28 -07:00
|
|
|
S_FIXED(float value, uint32_t frac_bits)
|
|
|
|
{
|
|
|
|
return value * (1 << frac_bits);
|
|
|
|
}
|
|
|
|
|
2006-11-01 12:03:11 +00:00
|
|
|
/* ================================================================
|
|
|
|
* 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__)
|
2008-06-21 10:52:40 -06:00
|
|
|
static INLINE void * __memcpy(void * to, const void * from, size_t n)
|
2006-11-01 12:03:11 +00:00
|
|
|
{
|
|
|
|
int d0, d1, d2;
|
2008-02-22 00:51:52 -05:00
|
|
|
__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");
|
2006-11-01 12:03:11 +00:00
|
|
|
return (to);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define __memcpy(a,b,c) memcpy(a,b,c)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* ================================================================
|
|
|
|
* Debugging:
|
|
|
|
*/
|
|
|
|
extern int INTEL_DEBUG;
|
|
|
|
|
|
|
|
#define DEBUG_TEXTURE 0x1
|
|
|
|
#define DEBUG_STATE 0x2
|
|
|
|
#define DEBUG_IOCTL 0x4
|
|
|
|
#define DEBUG_BLIT 0x8
|
|
|
|
#define DEBUG_MIPTREE 0x10
|
2012-07-12 12:35:19 -07:00
|
|
|
#define DEBUG_PERF 0x20
|
2006-11-01 12:03:11 +00:00
|
|
|
#define DEBUG_BATCH 0x80
|
|
|
|
#define DEBUG_PIXEL 0x100
|
|
|
|
#define DEBUG_BUFMGR 0x200
|
|
|
|
#define DEBUG_REGION 0x400
|
|
|
|
#define DEBUG_FBO 0x800
|
2010-05-14 10:04:41 -07:00
|
|
|
#define DEBUG_GS 0x1000
|
2007-11-16 14:56:26 -08:00
|
|
|
#define DEBUG_SYNC 0x2000
|
2008-02-22 00:51:52 -05:00
|
|
|
#define DEBUG_PRIMS 0x4000
|
|
|
|
#define DEBUG_VERTS 0x8000
|
|
|
|
#define DEBUG_DRI 0x10000
|
2010-05-17 16:48:16 -07:00
|
|
|
#define DEBUG_SF 0x20000
|
2008-02-22 00:51:52 -05:00
|
|
|
#define DEBUG_STATS 0x100000
|
2011-10-23 21:42:27 -07:00
|
|
|
#define DEBUG_WM 0x400000
|
|
|
|
#define DEBUG_URB 0x800000
|
|
|
|
#define DEBUG_VS 0x1000000
|
|
|
|
#define DEBUG_CLIP 0x2000000
|
2012-03-06 15:31:42 -08:00
|
|
|
#define DEBUG_AUB 0x4000000
|
2012-11-27 14:10:52 -08:00
|
|
|
#define DEBUG_SHADER_TIME 0x8000000
|
2013-03-16 10:32:21 -07:00
|
|
|
#define DEBUG_BLORP 0x10000000
|
2013-01-11 14:08:05 -08:00
|
|
|
#define DEBUG_NO16 0x20000000
|
2008-02-22 00:51:52 -05:00
|
|
|
|
2012-09-25 17:47:45 +03:00
|
|
|
#ifdef HAVE_ANDROID_PLATFORM
|
|
|
|
#define LOG_TAG "INTEL-MESA"
|
|
|
|
#include <cutils/log.h>
|
|
|
|
#ifndef ALOGW
|
|
|
|
#define ALOGW LOGW
|
|
|
|
#endif
|
|
|
|
#define dbg_printf(...) ALOGW(__VA_ARGS__)
|
|
|
|
#else
|
|
|
|
#define dbg_printf(...) printf(__VA_ARGS__)
|
|
|
|
#endif /* HAVE_ANDROID_PLATFORM */
|
|
|
|
|
2008-02-22 00:51:52 -05:00
|
|
|
#define DBG(...) do { \
|
2010-11-02 19:55:07 -07:00
|
|
|
if (unlikely(INTEL_DEBUG & FILE_DEBUG_FLAG)) \
|
2012-09-25 17:47:45 +03:00
|
|
|
dbg_printf(__VA_ARGS__); \
|
2008-02-22 00:51:52 -05:00
|
|
|
} while(0)
|
2006-11-01 12:03:11 +00:00
|
|
|
|
2012-07-12 12:48:58 -07:00
|
|
|
#define perf_debug(...) do { \
|
2013-02-22 13:15:20 -08:00
|
|
|
static GLuint msg_id = 0; \
|
|
|
|
if (unlikely(INTEL_DEBUG & DEBUG_PERF)) \
|
|
|
|
dbg_printf(__VA_ARGS__); \
|
|
|
|
if (intel->perf_debug) \
|
|
|
|
_mesa_gl_debug(&intel->ctx, &msg_id, \
|
|
|
|
MESA_DEBUG_TYPE_PERFORMANCE, \
|
|
|
|
MESA_DEBUG_SEVERITY_MEDIUM, \
|
|
|
|
__VA_ARGS__); \
|
2012-07-12 12:48:58 -07:00
|
|
|
} while(0)
|
|
|
|
|
2012-10-12 12:41:56 -07:00
|
|
|
#define WARN_ONCE(cond, fmt...) do { \
|
|
|
|
if (unlikely(cond)) { \
|
|
|
|
static bool _warned = false; \
|
2013-02-22 13:03:51 -08:00
|
|
|
static GLuint msg_id = 0; \
|
2012-10-12 12:41:56 -07:00
|
|
|
if (!_warned) { \
|
|
|
|
fprintf(stderr, "WARNING: "); \
|
|
|
|
fprintf(stderr, fmt); \
|
|
|
|
_warned = true; \
|
2013-02-22 13:03:51 -08:00
|
|
|
\
|
|
|
|
_mesa_gl_debug(ctx, &msg_id, \
|
|
|
|
MESA_DEBUG_TYPE_OTHER, \
|
|
|
|
MESA_DEBUG_SEVERITY_HIGH, fmt); \
|
2012-10-12 12:41:56 -07:00
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2006-11-01 12:03:11 +00:00
|
|
|
/* ================================================================
|
|
|
|
* intel_context.c:
|
|
|
|
*/
|
|
|
|
|
2011-10-07 12:26:50 -07:00
|
|
|
extern bool intelInitContext(struct intel_context *intel,
|
2012-11-21 16:22:19 -08:00
|
|
|
int api,
|
|
|
|
unsigned major_version,
|
|
|
|
unsigned minor_version,
|
|
|
|
const struct gl_config * mesaVis,
|
|
|
|
__DRIcontext * driContextPriv,
|
|
|
|
void *sharedContextPrivate,
|
|
|
|
struct dd_function_table *functions,
|
|
|
|
unsigned *dri_ctx_error);
|
2006-11-01 12:03:11 +00:00
|
|
|
|
2010-10-12 12:26:10 -04:00
|
|
|
extern void intelFinish(struct gl_context * ctx);
|
2011-12-16 13:42:39 -08:00
|
|
|
extern void _intel_flush(struct gl_context * ctx, const char *file, int line);
|
|
|
|
|
|
|
|
#define intel_flush(ctx) _intel_flush(ctx, __FILE__, __LINE__)
|
2006-11-01 12:03:11 +00:00
|
|
|
|
|
|
|
extern void intelInitDriverFunctions(struct dd_function_table *functions);
|
|
|
|
|
2009-09-01 12:20:10 -07:00
|
|
|
void intel_init_syncobj_functions(struct dd_function_table *functions);
|
|
|
|
|
2006-11-01 12:03:11 +00:00
|
|
|
|
|
|
|
/* ================================================================
|
|
|
|
* intel_state.c:
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define COMPAREFUNC_ALWAYS 0
|
|
|
|
#define COMPAREFUNC_NEVER 0x1
|
|
|
|
#define COMPAREFUNC_LESS 0x2
|
|
|
|
#define COMPAREFUNC_EQUAL 0x3
|
|
|
|
#define COMPAREFUNC_LEQUAL 0x4
|
|
|
|
#define COMPAREFUNC_GREATER 0x5
|
|
|
|
#define COMPAREFUNC_NOTEQUAL 0x6
|
|
|
|
#define COMPAREFUNC_GEQUAL 0x7
|
|
|
|
|
|
|
|
#define STENCILOP_KEEP 0
|
|
|
|
#define STENCILOP_ZERO 0x1
|
|
|
|
#define STENCILOP_REPLACE 0x2
|
|
|
|
#define STENCILOP_INCRSAT 0x3
|
|
|
|
#define STENCILOP_DECRSAT 0x4
|
|
|
|
#define STENCILOP_INCR 0x5
|
|
|
|
#define STENCILOP_DECR 0x6
|
|
|
|
#define STENCILOP_INVERT 0x7
|
|
|
|
|
|
|
|
#define LOGICOP_CLEAR 0
|
|
|
|
#define LOGICOP_NOR 0x1
|
|
|
|
#define LOGICOP_AND_INV 0x2
|
|
|
|
#define LOGICOP_COPY_INV 0x3
|
|
|
|
#define LOGICOP_AND_RVRSE 0x4
|
|
|
|
#define LOGICOP_INV 0x5
|
|
|
|
#define LOGICOP_XOR 0x6
|
|
|
|
#define LOGICOP_NAND 0x7
|
|
|
|
#define LOGICOP_AND 0x8
|
|
|
|
#define LOGICOP_EQUIV 0x9
|
|
|
|
#define LOGICOP_NOOP 0xa
|
|
|
|
#define LOGICOP_OR_INV 0xb
|
|
|
|
#define LOGICOP_COPY 0xc
|
|
|
|
#define LOGICOP_OR_RVRSE 0xd
|
|
|
|
#define LOGICOP_OR 0xe
|
|
|
|
#define LOGICOP_SET 0xf
|
|
|
|
|
|
|
|
#define BLENDFACT_ZERO 0x01
|
|
|
|
#define BLENDFACT_ONE 0x02
|
|
|
|
#define BLENDFACT_SRC_COLR 0x03
|
|
|
|
#define BLENDFACT_INV_SRC_COLR 0x04
|
|
|
|
#define BLENDFACT_SRC_ALPHA 0x05
|
|
|
|
#define BLENDFACT_INV_SRC_ALPHA 0x06
|
|
|
|
#define BLENDFACT_DST_ALPHA 0x07
|
|
|
|
#define BLENDFACT_INV_DST_ALPHA 0x08
|
|
|
|
#define BLENDFACT_DST_COLR 0x09
|
|
|
|
#define BLENDFACT_INV_DST_COLR 0x0a
|
|
|
|
#define BLENDFACT_SRC_ALPHA_SATURATE 0x0b
|
|
|
|
#define BLENDFACT_CONST_COLOR 0x0c
|
|
|
|
#define BLENDFACT_INV_CONST_COLOR 0x0d
|
|
|
|
#define BLENDFACT_CONST_ALPHA 0x0e
|
|
|
|
#define BLENDFACT_INV_CONST_ALPHA 0x0f
|
|
|
|
#define BLENDFACT_MASK 0x0f
|
|
|
|
|
2008-03-05 14:14:54 -08:00
|
|
|
enum {
|
|
|
|
DRI_CONF_BO_REUSE_DISABLED,
|
|
|
|
DRI_CONF_BO_REUSE_ALL
|
|
|
|
};
|
|
|
|
|
2007-12-25 17:22:19 +08:00
|
|
|
extern int intel_translate_shadow_compare_func(GLenum func);
|
2006-11-01 12:03:11 +00:00
|
|
|
extern int intel_translate_compare_func(GLenum func);
|
|
|
|
extern int intel_translate_stencil_op(GLenum op);
|
|
|
|
extern int intel_translate_logic_op(GLenum opcode);
|
|
|
|
|
2008-09-03 16:13:18 +01:00
|
|
|
void intel_update_renderbuffers(__DRIcontext *context,
|
|
|
|
__DRIdrawable *drawable);
|
2010-02-17 21:17:55 -05:00
|
|
|
void intel_prepare_render(struct intel_context *intel);
|
2006-11-01 12:03:11 +00:00
|
|
|
|
2012-08-09 09:15:36 -07:00
|
|
|
void
|
2013-05-07 15:38:45 -07:00
|
|
|
intel_resolve_for_dri2_flush(struct intel_context *intel,
|
|
|
|
__DRIdrawable *drawable);
|
2012-08-09 09:15:36 -07:00
|
|
|
|
2013-07-01 21:28:27 -07:00
|
|
|
extern void
|
|
|
|
intelInitExtensions(struct gl_context *ctx);
|
|
|
|
|
2006-11-01 12:03:11 +00:00
|
|
|
/*======================================================================
|
|
|
|
* Inline conversion functions.
|
|
|
|
* These are better-typed than the macros used previously:
|
|
|
|
*/
|
|
|
|
static INLINE struct intel_context *
|
2010-10-12 12:26:10 -04:00
|
|
|
intel_context(struct gl_context * ctx)
|
2006-11-01 12:03:11 +00:00
|
|
|
{
|
|
|
|
return (struct intel_context *) ctx;
|
|
|
|
}
|
|
|
|
|
2011-10-07 12:26:50 -07:00
|
|
|
static INLINE bool
|
2009-05-26 20:45:29 -07:00
|
|
|
is_power_of_two(uint32_t value)
|
|
|
|
{
|
|
|
|
return (value & (value - 1)) == 0;
|
|
|
|
}
|
|
|
|
|
2012-04-27 07:40:34 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-11-01 12:03:11 +00:00
|
|
|
#endif
|