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
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-09-18 15:17:05 -06:00
|
|
|
#include "main/mtypes.h"
|
|
|
|
#include "main/mm.h"
|
2006-11-01 12:03:11 +00:00
|
|
|
#include "texmem.h"
|
2009-07-15 09:35:09 +10:00
|
|
|
#include "dri_metaops.h"
|
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"
|
|
|
|
#include "tnl/t_vertex.h"
|
|
|
|
|
|
|
|
#define TAG(x) intel##x
|
|
|
|
#include "tnl_dd/t_dd_vertex.h"
|
|
|
|
#undef TAG
|
|
|
|
|
|
|
|
#define DV_PF_555 (1<<8)
|
|
|
|
#define DV_PF_565 (2<<8)
|
|
|
|
#define DV_PF_8888 (3<<8)
|
2009-04-09 18:30:12 -07:00
|
|
|
#define DV_PF_4444 (8<<8)
|
|
|
|
#define DV_PF_1555 (9<<8)
|
2006-11-01 12:03:11 +00:00
|
|
|
|
|
|
|
struct intel_region;
|
|
|
|
struct intel_context;
|
|
|
|
|
|
|
|
typedef void (*intel_tri_func) (struct intel_context *, intelVertex *,
|
|
|
|
intelVertex *, intelVertex *);
|
|
|
|
typedef void (*intel_line_func) (struct intel_context *, intelVertex *,
|
|
|
|
intelVertex *);
|
|
|
|
typedef void (*intel_point_func) (struct intel_context *, intelVertex *);
|
|
|
|
|
2009-10-22 16:33:36 -06:00
|
|
|
/**
|
|
|
|
* Bits for intel->Fallback field
|
|
|
|
*/
|
|
|
|
/*@{*/
|
2006-11-01 12:03:11 +00:00
|
|
|
#define INTEL_FALLBACK_DRAW_BUFFER 0x1
|
|
|
|
#define INTEL_FALLBACK_READ_BUFFER 0x2
|
|
|
|
#define INTEL_FALLBACK_DEPTH_BUFFER 0x4
|
|
|
|
#define INTEL_FALLBACK_STENCIL_BUFFER 0x8
|
|
|
|
#define INTEL_FALLBACK_USER 0x10
|
|
|
|
#define INTEL_FALLBACK_RENDERMODE 0x20
|
2008-02-22 00:51:52 -05:00
|
|
|
#define INTEL_FALLBACK_TEXTURE 0x40
|
2009-10-22 16:45:03 -06:00
|
|
|
#define INTEL_FALLBACK_DRIVER 0x1000 /**< first for drivers */
|
2009-10-22 16:33:36 -06:00
|
|
|
/*@}*/
|
2006-11-01 12:03:11 +00:00
|
|
|
|
2009-10-22 16:33:36 -06:00
|
|
|
extern void intelFallback(struct intel_context *intel, GLbitfield bit,
|
2006-11-01 12:03:11 +00:00
|
|
|
GLboolean mode);
|
|
|
|
#define FALLBACK( intel, bit, mode ) intelFallback( intel, bit, mode )
|
|
|
|
|
|
|
|
|
|
|
|
#define INTEL_WRITE_PART 0x1
|
|
|
|
#define INTEL_WRITE_FULL 0x2
|
|
|
|
#define INTEL_READ 0x4
|
|
|
|
|
|
|
|
#define INTEL_MAX_FIXUP 64
|
|
|
|
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* intel_context is derived from Mesa's context class: GLcontext.
|
|
|
|
*/
|
2006-11-01 12:03:11 +00:00
|
|
|
struct intel_context
|
|
|
|
{
|
2009-08-06 11:40:06 -06:00
|
|
|
GLcontext ctx; /**< base class, must be first field */
|
2006-11-01 12:03:11 +00:00
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
void (*destroy) (struct intel_context * intel);
|
|
|
|
void (*emit_state) (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);
|
2008-02-22 00:51:52 -05:00
|
|
|
void (*emit_invarient_state) (struct intel_context * intel);
|
|
|
|
void (*note_fence) (struct intel_context *intel, GLuint fence);
|
2006-11-01 12:03:11 +00:00
|
|
|
void (*update_texture_state) (struct intel_context * intel);
|
|
|
|
|
|
|
|
void (*render_start) (struct intel_context * intel);
|
2007-07-29 18:04:28 +02:00
|
|
|
void (*render_prevalidate) (struct intel_context * intel);
|
2006-11-01 12:03:11 +00:00
|
|
|
void (*set_draw_region) (struct intel_context * intel,
|
2008-03-13 14:46:38 +08:00
|
|
|
struct intel_region * draw_regions[],
|
|
|
|
struct intel_region * depth_region,
|
|
|
|
GLuint num_regions);
|
2006-11-01 12:03:11 +00:00
|
|
|
|
|
|
|
void (*reduced_primitive_state) (struct intel_context * intel,
|
|
|
|
GLenum rprim);
|
|
|
|
|
2008-02-22 00:51:52 -05:00
|
|
|
GLboolean (*check_vertex_size) (struct intel_context * intel,
|
|
|
|
GLuint expected);
|
|
|
|
void (*invalidate_state) (struct intel_context *intel,
|
|
|
|
GLuint new_state);
|
2006-11-01 12:03:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Metaops:
|
|
|
|
*/
|
|
|
|
void (*install_meta_state) (struct intel_context * intel);
|
|
|
|
void (*leave_meta_state) (struct intel_context * intel);
|
|
|
|
|
|
|
|
void (*meta_draw_region) (struct intel_context * intel,
|
|
|
|
struct intel_region * draw_region,
|
|
|
|
struct intel_region * depth_region);
|
|
|
|
|
|
|
|
void (*meta_color_mask) (struct intel_context * intel, GLboolean);
|
|
|
|
|
|
|
|
void (*meta_stencil_replace) (struct intel_context * intel,
|
|
|
|
GLuint mask, GLuint clear);
|
|
|
|
|
|
|
|
void (*meta_depth_replace) (struct intel_context * intel);
|
|
|
|
|
|
|
|
void (*meta_texture_blend_replace) (struct intel_context * intel);
|
|
|
|
|
|
|
|
void (*meta_no_stencil_write) (struct intel_context * intel);
|
|
|
|
void (*meta_no_depth_write) (struct intel_context * intel);
|
|
|
|
void (*meta_no_texture) (struct intel_context * intel);
|
|
|
|
|
|
|
|
void (*meta_import_pixel_state) (struct intel_context * intel);
|
2008-02-22 00:51:52 -05:00
|
|
|
void (*meta_frame_buffer_texture) (struct intel_context *intel,
|
|
|
|
GLint xoff, GLint yoff);
|
2006-11-01 12:03:11 +00:00
|
|
|
|
2007-05-17 15:28:01 -07:00
|
|
|
GLboolean(*meta_tex_rect_source) (struct intel_context * intel,
|
|
|
|
dri_bo * buffer,
|
|
|
|
GLuint offset,
|
|
|
|
GLuint pitch,
|
|
|
|
GLuint height,
|
|
|
|
GLenum format, GLenum type);
|
2006-11-01 12:03:11 +00:00
|
|
|
|
|
|
|
void (*assert_not_dirty) (struct intel_context *intel);
|
|
|
|
|
2007-12-07 16:15:49 -08:00
|
|
|
void (*debug_batch)(struct intel_context *intel);
|
2006-11-01 12:03:11 +00:00
|
|
|
} vtbl;
|
|
|
|
|
2009-07-15 09:35:09 +10:00
|
|
|
struct dri_metaops meta;
|
2008-12-31 00:02:43 -08:00
|
|
|
|
2009-10-22 16:33:36 -06:00
|
|
|
GLbitfield Fallback; /**< mask of INTEL_FALLBACK_x bits */
|
2006-11-01 12:03:11 +00:00
|
|
|
GLuint NewGLState;
|
|
|
|
|
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;
|
2009-12-16 14:45:50 -08:00
|
|
|
GLboolean needs_ff_sync;
|
|
|
|
GLboolean is_ironlake;
|
2009-10-26 09:28:32 -07:00
|
|
|
|
2007-12-12 10:25:19 -08:00
|
|
|
struct intel_region *front_region;
|
|
|
|
struct intel_region *back_region;
|
|
|
|
struct intel_region *depth_region;
|
|
|
|
|
2006-11-01 12:03:11 +00:00
|
|
|
struct intel_batchbuffer *batch;
|
2009-07-21 11:23:18 -07:00
|
|
|
drm_intel_bo *first_post_swapbuffers_batch;
|
2008-01-14 11:03:05 -08:00
|
|
|
GLboolean no_batch_wrap;
|
2006-11-01 12:03:11 +00:00
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
GLuint id;
|
2008-08-24 17:59:10 +10:00
|
|
|
uint32_t primitive; /**< Current hardware primitive type */
|
2006-11-01 12:03:11 +00:00
|
|
|
void (*flush) (struct intel_context *);
|
2008-11-28 19:38:47 +10:00
|
|
|
GLubyte *start_ptr; /**< for i8xx */
|
2008-08-24 17:59:10 +10:00
|
|
|
dri_bo *vb_bo;
|
|
|
|
uint8_t *vb;
|
|
|
|
unsigned int start_offset; /**< Byte offset of primitive sequence */
|
|
|
|
unsigned int current_offset; /**< Byte offset of next vertex */
|
|
|
|
unsigned int count; /**< Number of vertices in current primitive */
|
2006-11-01 12:03:11 +00:00
|
|
|
} prim;
|
|
|
|
|
2008-02-22 00:51:52 -05:00
|
|
|
GLuint stats_wm;
|
2006-11-01 12:03:11 +00:00
|
|
|
GLboolean locked;
|
|
|
|
char *prevLockFile;
|
|
|
|
int prevLockLine;
|
|
|
|
|
|
|
|
/* Offsets of fields within the current vertex:
|
|
|
|
*/
|
|
|
|
GLuint coloroffset;
|
|
|
|
GLuint specoffset;
|
|
|
|
GLuint wpos_offset;
|
|
|
|
GLuint wpos_size;
|
|
|
|
|
|
|
|
struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
|
|
|
|
GLuint vertex_attr_count;
|
|
|
|
|
|
|
|
GLfloat polygon_offset_scale; /* dependent on depth_scale, bpp */
|
|
|
|
|
2008-02-22 00:51:52 -05:00
|
|
|
GLboolean hw_stencil;
|
2006-11-01 12:03:11 +00:00
|
|
|
GLboolean hw_stipple;
|
2008-02-22 00:51:52 -05:00
|
|
|
GLboolean depth_buffer_is_float;
|
|
|
|
GLboolean no_rast;
|
2009-11-18 03:43:16 -08:00
|
|
|
GLboolean no_hw;
|
2009-03-05 17:18:49 -08:00
|
|
|
GLboolean always_flush_batch;
|
2009-03-05 17:08:36 -08:00
|
|
|
GLboolean always_flush_cache;
|
2009-03-04 16:48:51 -07:00
|
|
|
|
|
|
|
/* 0 - nonconformant, best performance;
|
|
|
|
* 1 - fallback to sw for known conformance bugs
|
|
|
|
* 2 - always fallback to sw
|
|
|
|
*/
|
|
|
|
GLuint conformance_mode;
|
2006-11-01 12:03:11 +00:00
|
|
|
|
|
|
|
/* State for intelvb.c and inteltris.c.
|
|
|
|
*/
|
|
|
|
GLuint RenderIndex;
|
|
|
|
GLmatrix ViewportMatrix;
|
|
|
|
GLenum render_primitive;
|
|
|
|
GLenum reduced_primitive;
|
|
|
|
GLuint vertex_size;
|
|
|
|
GLubyte *verts; /* points to tnl->clipspace.vertex_buf */
|
|
|
|
|
|
|
|
/* Fallback rasterization functions
|
|
|
|
*/
|
|
|
|
intel_point_func draw_point;
|
|
|
|
intel_line_func draw_line;
|
|
|
|
intel_tri_func draw_tri;
|
|
|
|
|
2008-10-19 17:46:41 -07:00
|
|
|
/**
|
|
|
|
* Set to true if a single constant cliprect should be used in the
|
|
|
|
* batchbuffer. Otherwise, cliprects must be calculated at batchbuffer
|
|
|
|
* flush time while the lock is held.
|
|
|
|
*/
|
|
|
|
GLboolean constant_cliprect;
|
2009-04-06 13:15:54 -07:00
|
|
|
|
2008-10-19 17:46:41 -07:00
|
|
|
/**
|
|
|
|
* In !constant_cliprect mode, set to true if the front cliprects should be
|
|
|
|
* used instead of back.
|
|
|
|
*/
|
|
|
|
GLboolean front_cliprects;
|
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.
|
|
|
|
*/
|
|
|
|
GLboolean front_buffer_dirty;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Track whether front-buffer rendering is currently enabled
|
|
|
|
*
|
|
|
|
* A separate flag is used to track this in order to support MRT more
|
|
|
|
* easily.
|
|
|
|
*/
|
|
|
|
GLboolean 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.
|
|
|
|
*/
|
|
|
|
GLboolean is_front_buffer_reading;
|
2009-04-06 13:15:54 -07:00
|
|
|
|
2009-06-03 16:40:20 +00:00
|
|
|
GLboolean use_texture_tiling;
|
2009-06-09 16:12:43 -07:00
|
|
|
GLboolean use_early_z;
|
2006-11-01 12:03:11 +00:00
|
|
|
drm_clip_rect_t fboRect; /**< cliprect for FBO rendering */
|
|
|
|
|
2008-02-22 00:51:52 -05:00
|
|
|
drm_clip_rect_t draw_rect;
|
|
|
|
drm_clip_rect_t scissor_rect;
|
|
|
|
|
2006-11-01 12:03:11 +00:00
|
|
|
drm_context_t hHWContext;
|
|
|
|
drmLock *driHwLock;
|
|
|
|
int driFd;
|
|
|
|
|
2008-08-13 11:46:25 -04:00
|
|
|
__DRIcontextPrivate *driContext;
|
2006-11-01 12:03:11 +00:00
|
|
|
__DRIdrawablePrivate *driDrawable;
|
2008-02-22 00:51:52 -05:00
|
|
|
__DRIdrawablePrivate *driReadDrawable;
|
2006-11-01 12:03:11 +00:00
|
|
|
__DRIscreenPrivate *driScreen;
|
|
|
|
intelScreenPrivate *intelScreen;
|
2009-08-14 08:50:43 -06:00
|
|
|
volatile drm_i915_sarea_t *sarea;
|
2006-11-01 12:03:11 +00:00
|
|
|
|
|
|
|
GLuint lastStamp;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Configuration cache
|
|
|
|
*/
|
|
|
|
driOptionCache optionCache;
|
|
|
|
|
2008-02-22 00:51:52 -05:00
|
|
|
int64_t swap_ust;
|
|
|
|
int64_t swap_missed_ust;
|
|
|
|
|
|
|
|
GLuint swap_count;
|
|
|
|
GLuint swap_missed_count;
|
2006-11-01 12:03:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* These are functions now:
|
|
|
|
*/
|
|
|
|
void LOCK_HARDWARE( struct intel_context *intel );
|
|
|
|
void UNLOCK_HARDWARE( struct intel_context *intel );
|
|
|
|
|
|
|
|
extern char *__progname;
|
|
|
|
|
|
|
|
|
|
|
|
#define SUBPIXEL_X 0.125
|
|
|
|
#define SUBPIXEL_Y 0.125
|
|
|
|
|
2008-08-24 17:59:10 +10:00
|
|
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
2007-10-04 12:07:25 -07:00
|
|
|
#define ALIGN(value, alignment) ((value + alignment - 1) & ~(alignment - 1))
|
2009-04-09 18:30:12 -07:00
|
|
|
#define IS_POWER_OF_TWO(val) (((val) & (val - 1)) == 0)
|
2007-10-04 12:07:25 -07:00
|
|
|
|
2009-10-29 11:52:28 -07:00
|
|
|
static inline uint32_t
|
|
|
|
U_FIXED(float value, uint32_t frac_bits)
|
|
|
|
{
|
|
|
|
value *= (1 << frac_bits);
|
|
|
|
return value < 0 ? 0 : value;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
S_FIXED(float value, uint32_t frac_bits)
|
|
|
|
{
|
|
|
|
return value * (1 << frac_bits);
|
|
|
|
}
|
|
|
|
|
2006-11-01 12:03:11 +00:00
|
|
|
#define INTEL_FIREVERTICES(intel) \
|
|
|
|
do { \
|
|
|
|
if ((intel)->prim.flush) \
|
|
|
|
(intel)->prim.flush(intel); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
/* ================================================================
|
|
|
|
* 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
|
|
|
|
#define DEBUG_FALLBACKS 0x20
|
|
|
|
#define DEBUG_VERBOSE 0x40
|
|
|
|
#define DEBUG_BATCH 0x80
|
|
|
|
#define DEBUG_PIXEL 0x100
|
|
|
|
#define DEBUG_BUFMGR 0x200
|
|
|
|
#define DEBUG_REGION 0x400
|
|
|
|
#define DEBUG_FBO 0x800
|
|
|
|
#define DEBUG_LOCK 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
|
|
|
|
#define DEBUG_DMA 0x20000
|
|
|
|
#define DEBUG_SANITY 0x40000
|
|
|
|
#define DEBUG_SLEEP 0x80000
|
|
|
|
#define DEBUG_STATS 0x100000
|
|
|
|
#define DEBUG_TILE 0x200000
|
|
|
|
#define DEBUG_SINGLE_THREAD 0x400000
|
|
|
|
#define DEBUG_WM 0x800000
|
|
|
|
#define DEBUG_URB 0x1000000
|
|
|
|
#define DEBUG_VS 0x2000000
|
|
|
|
|
|
|
|
#define DBG(...) do { \
|
|
|
|
if (INTEL_DEBUG & FILE_DEBUG_FLAG) \
|
|
|
|
_mesa_printf(__VA_ARGS__); \
|
|
|
|
} while(0)
|
2006-11-01 12:03:11 +00:00
|
|
|
|
|
|
|
#define PCI_CHIP_845_G 0x2562
|
|
|
|
#define PCI_CHIP_I830_M 0x3577
|
|
|
|
#define PCI_CHIP_I855_GM 0x3582
|
|
|
|
#define PCI_CHIP_I865_G 0x2572
|
|
|
|
#define PCI_CHIP_I915_G 0x2582
|
|
|
|
#define PCI_CHIP_I915_GM 0x2592
|
|
|
|
#define PCI_CHIP_I945_G 0x2772
|
|
|
|
#define PCI_CHIP_I945_GM 0x27A2
|
2007-05-30 16:18:26 +08:00
|
|
|
#define PCI_CHIP_I945_GME 0x27AE
|
2007-06-05 11:42:43 -07:00
|
|
|
#define PCI_CHIP_G33_G 0x29C2
|
|
|
|
#define PCI_CHIP_Q35_G 0x29B2
|
|
|
|
#define PCI_CHIP_Q33_G 0x29D2
|
2006-11-01 12:03:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* ================================================================
|
|
|
|
* intel_context.c:
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern GLboolean intelInitContext(struct intel_context *intel,
|
|
|
|
const __GLcontextModes * mesaVis,
|
|
|
|
__DRIcontextPrivate * driContextPriv,
|
|
|
|
void *sharedContextPrivate,
|
|
|
|
struct dd_function_table *functions);
|
|
|
|
|
|
|
|
extern void intelGetLock(struct intel_context *intel, GLuint flags);
|
|
|
|
|
|
|
|
extern void intelFinish(GLcontext * ctx);
|
|
|
|
extern void intelFlush(GLcontext * ctx);
|
|
|
|
|
|
|
|
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:
|
|
|
|
*/
|
|
|
|
extern void intelInitStateFuncs(struct dd_function_table *functions);
|
|
|
|
|
|
|
|
#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_blend_factor(GLenum factor);
|
|
|
|
extern int intel_translate_logic_op(GLenum opcode);
|
|
|
|
|
2008-11-13 18:32:44 -08:00
|
|
|
void intel_viewport(GLcontext * ctx, GLint x, GLint y,
|
|
|
|
GLsizei width, GLsizei height);
|
|
|
|
|
2008-09-03 16:13:18 +01:00
|
|
|
void intel_update_renderbuffers(__DRIcontext *context,
|
|
|
|
__DRIdrawable *drawable);
|
2006-11-01 12:03:11 +00:00
|
|
|
|
2009-06-04 10:21:29 +00:00
|
|
|
void i915_set_buf_info_for_region(uint32_t *state, struct intel_region *region,
|
|
|
|
uint32_t buffer_id);
|
|
|
|
|
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 *
|
|
|
|
intel_context(GLcontext * ctx)
|
|
|
|
{
|
|
|
|
return (struct intel_context *) ctx;
|
|
|
|
}
|
|
|
|
|
2009-05-26 20:45:29 -07:00
|
|
|
static INLINE GLboolean
|
|
|
|
is_power_of_two(uint32_t value)
|
|
|
|
{
|
|
|
|
return (value & (value - 1)) == 0;
|
|
|
|
}
|
|
|
|
|
2009-11-12 14:57:30 -08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2006-11-01 12:03:11 +00:00
|
|
|
#endif
|