summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/intel
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/intel')
-rw-r--r--src/mesa/drivers/dri/intel/intel_batchbuffer.c10
-rw-r--r--src/mesa/drivers/dri/intel/intel_blit.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_blit.h2
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffer_objects.c38
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffers.c6
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffers.h4
-rw-r--r--src/mesa/drivers/dri/intel/intel_chipset.h20
-rw-r--r--src/mesa/drivers/dri/intel/intel_clear.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c44
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.h14
-rw-r--r--src/mesa/drivers/dri/intel/intel_extensions.c32
-rw-r--r--src/mesa/drivers/dri/intel/intel_extensions.h4
-rw-r--r--src/mesa/drivers/dri/intel/intel_extensions_es2.c3
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.c98
-rw-r--r--src/mesa/drivers/dri/intel/intel_mipmap_tree.c13
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel.h10
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_bitmap.c203
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_copy.c6
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_draw.c223
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_read.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_reg.h12
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c19
-rw-r--r--src/mesa/drivers/dri/intel/intel_span.c11
-rw-r--r--src/mesa/drivers/dri/intel/intel_span.h10
-rw-r--r--src/mesa/drivers/dri/intel/intel_state.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_syncobj.c12
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex.c33
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex.h2
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_copy.c12
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_format.c22
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c50
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_subimage.c10
33 files changed, 325 insertions, 610 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
index ff741fc39a..9b39823917 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
@@ -264,10 +264,18 @@ intel_batchbuffer_emit_mi_flush(struct intel_batchbuffer *batch)
struct intel_context *intel = batch->intel;
if (intel->gen >= 6) {
- BEGIN_BATCH(4);
+ BEGIN_BATCH(8);
+
+ /* XXX workaround: issue any post sync != 0 before write cache flush = 1 */
+ OUT_BATCH(_3DSTATE_PIPE_CONTROL);
+ OUT_BATCH(PIPE_CONTROL_WRITE_IMMEDIATE);
+ OUT_BATCH(0); /* write address */
+ OUT_BATCH(0); /* write data */
+
OUT_BATCH(_3DSTATE_PIPE_CONTROL);
OUT_BATCH(PIPE_CONTROL_INSTRUCTION_FLUSH |
PIPE_CONTROL_WRITE_FLUSH |
+ PIPE_CONTROL_DEPTH_CACHE_FLUSH |
PIPE_CONTROL_NO_WRITE);
OUT_BATCH(0); /* write address */
OUT_BATCH(0); /* write data */
diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c
index 2c85ad3c36..a74e21720f 100644
--- a/src/mesa/drivers/dri/intel/intel_blit.c
+++ b/src/mesa/drivers/dri/intel/intel_blit.c
@@ -210,7 +210,7 @@ intelEmitCopyBlit(struct intel_context *intel,
* \param mask bitmask of BUFFER_BIT_* values indicating buffers to clear
*/
void
-intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
+intelClearWithBlit(struct gl_context *ctx, GLbitfield mask)
{
struct intel_context *intel = intel_context(ctx);
struct gl_framebuffer *fb = ctx->DrawBuffer;
diff --git a/src/mesa/drivers/dri/intel/intel_blit.h b/src/mesa/drivers/dri/intel/intel_blit.h
index 70d277df3c..0163146573 100644
--- a/src/mesa/drivers/dri/intel/intel_blit.h
+++ b/src/mesa/drivers/dri/intel/intel_blit.h
@@ -33,7 +33,7 @@
extern void intelCopyBuffer(const __DRIdrawable * dpriv,
const drm_clip_rect_t * rect);
-extern void intelClearWithBlit(GLcontext * ctx, GLbitfield mask);
+extern void intelClearWithBlit(struct gl_context * ctx, GLbitfield mask);
GLboolean
intelEmitCopyBlit(struct intel_context *intel,
diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index 117d4daf3b..1e99f9040a 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -40,7 +40,7 @@
#include "intel_regions.h"
static GLboolean
-intel_bufferobj_unmap(GLcontext * ctx,
+intel_bufferobj_unmap(struct gl_context * ctx,
GLenum target, struct gl_buffer_object *obj);
/** Allocates a new drm_intel_bo to store the data for the buffer object. */
@@ -59,7 +59,7 @@ intel_bufferobj_alloc_buffer(struct intel_context *intel,
* internal structure where somehow shared.
*/
static struct gl_buffer_object *
-intel_bufferobj_alloc(GLcontext * ctx, GLuint name, GLenum target)
+intel_bufferobj_alloc(struct gl_context * ctx, GLuint name, GLenum target)
{
struct intel_buffer_object *obj = CALLOC_STRUCT(intel_buffer_object);
@@ -101,7 +101,7 @@ intel_bufferobj_cow(struct intel_context *intel,
* Called via glDeleteBuffersARB().
*/
static void
-intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj)
+intel_bufferobj_free(struct gl_context * ctx, struct gl_buffer_object *obj)
{
struct intel_context *intel = intel_context(ctx);
struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
@@ -136,7 +136,7 @@ intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj)
* \return GL_TRUE for success, GL_FALSE if out of memory
*/
static GLboolean
-intel_bufferobj_data(GLcontext * ctx,
+intel_bufferobj_data(struct gl_context * ctx,
GLenum target,
GLsizeiptrARB size,
const GLvoid * data,
@@ -193,7 +193,7 @@ intel_bufferobj_data(GLcontext * ctx,
* Called via glBufferSubDataARB().
*/
static void
-intel_bufferobj_subdata(GLcontext * ctx,
+intel_bufferobj_subdata(struct gl_context * ctx,
GLenum target,
GLintptrARB offset,
GLsizeiptrARB size,
@@ -239,7 +239,7 @@ intel_bufferobj_subdata(GLcontext * ctx,
* Called via glGetBufferSubDataARB().
*/
static void
-intel_bufferobj_get_subdata(GLcontext * ctx,
+intel_bufferobj_get_subdata(struct gl_context * ctx,
GLenum target,
GLintptrARB offset,
GLsizeiptrARB size,
@@ -260,7 +260,7 @@ intel_bufferobj_get_subdata(GLcontext * ctx,
* Called via glMapBufferARB().
*/
static void *
-intel_bufferobj_map(GLcontext * ctx,
+intel_bufferobj_map(struct gl_context * ctx,
GLenum target,
GLenum access, struct gl_buffer_object *obj)
{
@@ -322,7 +322,7 @@ intel_bufferobj_map(GLcontext * ctx,
* and blit it into the real BO at unmap time.
*/
static void *
-intel_bufferobj_map_range(GLcontext * ctx,
+intel_bufferobj_map_range(struct gl_context * ctx,
GLenum target, GLintptr offset, GLsizeiptr length,
GLbitfield access, struct gl_buffer_object *obj)
{
@@ -415,7 +415,7 @@ intel_bufferobj_map_range(GLcontext * ctx,
* would defeat the point.
*/
static void
-intel_bufferobj_flush_mapped_range(GLcontext *ctx, GLenum target,
+intel_bufferobj_flush_mapped_range(struct gl_context *ctx, GLenum target,
GLintptr offset, GLsizeiptr length,
struct gl_buffer_object *obj)
{
@@ -449,7 +449,7 @@ intel_bufferobj_flush_mapped_range(GLcontext *ctx, GLenum target,
* Called via glUnmapBuffer().
*/
static GLboolean
-intel_bufferobj_unmap(GLcontext * ctx,
+intel_bufferobj_unmap(struct gl_context * ctx,
GLenum target, struct gl_buffer_object *obj)
{
struct intel_context *intel = intel_context(ctx);
@@ -537,7 +537,7 @@ intel_bufferobj_buffer(struct intel_context *intel,
}
static void
-intel_bufferobj_copy_subdata(GLcontext *ctx,
+intel_bufferobj_copy_subdata(struct gl_context *ctx,
struct gl_buffer_object *src,
struct gl_buffer_object *dst,
GLintptr read_offset, GLintptr write_offset,
@@ -596,7 +596,7 @@ intel_bufferobj_copy_subdata(GLcontext *ctx,
#if FEATURE_APPLE_object_purgeable
static GLenum
-intel_buffer_purgeable(GLcontext * ctx,
+intel_buffer_purgeable(struct gl_context * ctx,
drm_intel_bo *buffer,
GLenum option)
{
@@ -609,7 +609,7 @@ intel_buffer_purgeable(GLcontext * ctx,
}
static GLenum
-intel_buffer_object_purgeable(GLcontext * ctx,
+intel_buffer_object_purgeable(struct gl_context * ctx,
struct gl_buffer_object *obj,
GLenum option)
{
@@ -636,7 +636,7 @@ intel_buffer_object_purgeable(GLcontext * ctx,
}
static GLenum
-intel_texture_object_purgeable(GLcontext * ctx,
+intel_texture_object_purgeable(struct gl_context * ctx,
struct gl_texture_object *obj,
GLenum option)
{
@@ -650,7 +650,7 @@ intel_texture_object_purgeable(GLcontext * ctx,
}
static GLenum
-intel_render_object_purgeable(GLcontext * ctx,
+intel_render_object_purgeable(struct gl_context * ctx,
struct gl_renderbuffer *obj,
GLenum option)
{
@@ -664,7 +664,7 @@ intel_render_object_purgeable(GLcontext * ctx,
}
static GLenum
-intel_buffer_unpurgeable(GLcontext * ctx,
+intel_buffer_unpurgeable(struct gl_context * ctx,
drm_intel_bo *buffer,
GLenum option)
{
@@ -678,7 +678,7 @@ intel_buffer_unpurgeable(GLcontext * ctx,
}
static GLenum
-intel_buffer_object_unpurgeable(GLcontext * ctx,
+intel_buffer_object_unpurgeable(struct gl_context * ctx,
struct gl_buffer_object *obj,
GLenum option)
{
@@ -686,7 +686,7 @@ intel_buffer_object_unpurgeable(GLcontext * ctx,
}
static GLenum
-intel_texture_object_unpurgeable(GLcontext * ctx,
+intel_texture_object_unpurgeable(struct gl_context * ctx,
struct gl_texture_object *obj,
GLenum option)
{
@@ -700,7 +700,7 @@ intel_texture_object_unpurgeable(GLcontext * ctx,
}
static GLenum
-intel_render_object_unpurgeable(GLcontext * ctx,
+intel_render_object_unpurgeable(struct gl_context * ctx,
struct gl_renderbuffer *obj,
GLenum option)
{
diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c
index 1bff344a45..ee551ef60d 100644
--- a/src/mesa/drivers/dri/intel/intel_buffers.c
+++ b/src/mesa/drivers/dri/intel/intel_buffers.c
@@ -88,7 +88,7 @@ intel_check_front_buffer_rendering(struct intel_context *intel)
* color buffers.
*/
void
-intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
+intel_draw_buffer(struct gl_context * ctx, struct gl_framebuffer *fb)
{
struct intel_context *intel = intel_context(ctx);
struct intel_region *colorRegions[MAX_DRAW_BUFFERS], *depthRegion = NULL;
@@ -262,7 +262,7 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
static void
-intelDrawBuffer(GLcontext * ctx, GLenum mode)
+intelDrawBuffer(struct gl_context * ctx, GLenum mode)
{
if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) {
struct intel_context *const intel = intel_context(ctx);
@@ -285,7 +285,7 @@ intelDrawBuffer(GLcontext * ctx, GLenum mode)
static void
-intelReadBuffer(GLcontext * ctx, GLenum mode)
+intelReadBuffer(struct gl_context * ctx, GLenum mode)
{
if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) {
struct intel_context *const intel = intel_context(ctx);
diff --git a/src/mesa/drivers/dri/intel/intel_buffers.h b/src/mesa/drivers/dri/intel/intel_buffers.h
index abb86aade6..2d4613b295 100644
--- a/src/mesa/drivers/dri/intel/intel_buffers.h
+++ b/src/mesa/drivers/dri/intel/intel_buffers.h
@@ -41,7 +41,7 @@ extern struct intel_region *intel_drawbuf_region(struct intel_context *intel);
extern void intel_check_front_buffer_rendering(struct intel_context *intel);
-extern void intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb);
+extern void intel_draw_buffer(struct gl_context * ctx, struct gl_framebuffer *fb);
extern void intelInitBufferFuncs(struct dd_function_table *functions);
@@ -50,7 +50,7 @@ void intel_get_cliprects(struct intel_context *intel,
unsigned int *num_cliprects,
int *x_off, int *y_off);
#ifdef I915
-void intelCalcViewport(GLcontext * ctx);
+void intelCalcViewport(struct gl_context * ctx);
#endif
#endif /* INTEL_BUFFERS_H */
diff --git a/src/mesa/drivers/dri/intel/intel_chipset.h b/src/mesa/drivers/dri/intel/intel_chipset.h
index b5f180bbc8..1e7ceed32a 100644
--- a/src/mesa/drivers/dri/intel/intel_chipset.h
+++ b/src/mesa/drivers/dri/intel/intel_chipset.h
@@ -71,9 +71,13 @@
#define PCI_CHIP_ILD_G 0x0042
#define PCI_CHIP_ILM_G 0x0046
-#define PCI_CHIP_SANDYBRIDGE 0x0102
-#define PCI_CHIP_SANDYBRIDGE_M 0x0106
-#define PCI_CHIP_SANDYBRIDGE_M_D0 0x0126
+#define PCI_CHIP_SANDYBRIDGE_GT1 0x0102 /* Desktop */
+#define PCI_CHIP_SANDYBRIDGE_GT2 0x0112
+#define PCI_CHIP_SANDYBRIDGE_GT2_PLUS 0x0122
+#define PCI_CHIP_SANDYBRIDGE_M_GT1 0x0106 /* Mobile */
+#define PCI_CHIP_SANDYBRIDGE_M_GT2 0x0116
+#define PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS 0x0126
+#define PCI_CHIP_SANDYBRIDGE_S 0x010A /* Server */
#define IS_MOBILE(devid) (devid == PCI_CHIP_I855_GM || \
devid == PCI_CHIP_I915_GM || \
@@ -119,9 +123,13 @@
/* Compat macro for intel_decode.c */
#define IS_IRONLAKE(devid) IS_GEN5(devid)
-#define IS_GEN6(devid) (devid == PCI_CHIP_SANDYBRIDGE || \
- devid == PCI_CHIP_SANDYBRIDGE_M || \
- devid == PCI_CHIP_SANDYBRIDGE_M_D0)
+#define IS_GEN6(devid) (devid == PCI_CHIP_SANDYBRIDGE_GT1 || \
+ devid == PCI_CHIP_SANDYBRIDGE_GT2 || \
+ devid == PCI_CHIP_SANDYBRIDGE_GT2_PLUS || \
+ devid == PCI_CHIP_SANDYBRIDGE_M_GT1 || \
+ devid == PCI_CHIP_SANDYBRIDGE_M_GT2 || \
+ devid == PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS || \
+ devid == PCI_CHIP_SANDYBRIDGE_S)
#define IS_965(devid) (IS_GEN4(devid) || \
IS_G4X(devid) || \
diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c
index 3c22118866..d7814635b7 100644
--- a/src/mesa/drivers/dri/intel/intel_clear.c
+++ b/src/mesa/drivers/dri/intel/intel_clear.c
@@ -62,7 +62,7 @@ static const char *buffer_names[] = {
* Called by ctx->Driver.Clear.
*/
static void
-intelClear(GLcontext *ctx, GLbitfield mask)
+intelClear(struct gl_context *ctx, GLbitfield mask)
{
struct intel_context *intel = intel_context(ctx);
const GLuint colorMask = *((GLuint *) & ctx->Color.ColorMask[0]);
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 08069d71dd..7ace50bde9 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -67,7 +67,7 @@ int INTEL_DEBUG = (0);
static const GLubyte *
-intelGetString(GLcontext * ctx, GLenum name)
+intelGetString(struct gl_context * ctx, GLenum name)
{
const struct intel_context *const intel = intel_context(ctx);
const char *chipset;
@@ -163,6 +163,19 @@ intelGetString(GLcontext * ctx, GLenum name)
case PCI_CHIP_ILM_G:
chipset = "Intel(R) Ironlake Mobile";
break;
+ case PCI_CHIP_SANDYBRIDGE_GT1:
+ case PCI_CHIP_SANDYBRIDGE_GT2:
+ case PCI_CHIP_SANDYBRIDGE_GT2_PLUS:
+ chipset = "Intel(R) Sandybridge Desktop";
+ break;
+ case PCI_CHIP_SANDYBRIDGE_M_GT1:
+ case PCI_CHIP_SANDYBRIDGE_M_GT2:
+ case PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS:
+ chipset = "Intel(R) Sandybridge Mobile";
+ break;
+ case PCI_CHIP_SANDYBRIDGE_S:
+ chipset = "Intel(R) Sandybridge Server";
+ break;
default:
chipset = "Unknown Intel Chipset";
break;
@@ -177,7 +190,7 @@ intelGetString(GLcontext * ctx, GLenum name)
}
static void
-intel_flush_front(GLcontext *ctx)
+intel_flush_front(struct gl_context *ctx)
{
struct intel_context *intel = intel_context(ctx);
__DRIcontext *driContext = intel->driContext;
@@ -354,7 +367,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
case __DRI_BUFFER_ACCUM:
default:
fprintf(stderr,
- "unhandled buffer attach event, attacment type %d\n",
+ "unhandled buffer attach event, attachment type %d\n",
buffers[i].attachment);
return;
}
@@ -465,7 +478,7 @@ intel_prepare_render(struct intel_context *intel)
}
static void
-intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+intel_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
struct intel_context *intel = intel_context(ctx);
__DRIcontext *driContext = intel->driContext;
@@ -514,7 +527,7 @@ static const struct dri_debug_control debug_control[] = {
static void
-intelInvalidateState(GLcontext * ctx, GLuint new_state)
+intelInvalidateState(struct gl_context * ctx, GLuint new_state)
{
struct intel_context *intel = intel_context(ctx);
@@ -531,7 +544,7 @@ intelInvalidateState(GLcontext * ctx, GLuint new_state)
}
void
-intel_flush(GLcontext *ctx)
+intel_flush(struct gl_context *ctx)
{
struct intel_context *intel = intel_context(ctx);
@@ -546,7 +559,7 @@ intel_flush(GLcontext *ctx)
}
static void
-intel_glFlush(GLcontext *ctx)
+intel_glFlush(struct gl_context *ctx)
{
struct intel_context *intel = intel_context(ctx);
@@ -556,7 +569,7 @@ intel_glFlush(GLcontext *ctx)
}
void
-intelFinish(GLcontext * ctx)
+intelFinish(struct gl_context * ctx)
{
struct gl_framebuffer *fb = ctx->DrawBuffer;
int i;
@@ -603,17 +616,17 @@ intelInitDriverFunctions(struct dd_function_table *functions)
GLboolean
intelInitContext(struct intel_context *intel,
int api,
- const __GLcontextModes * mesaVis,
+ const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate,
struct dd_function_table *functions)
{
- GLcontext *ctx = &intel->ctx;
- GLcontext *shareCtx = (GLcontext *) sharedContextPrivate;
+ struct gl_context *ctx = &intel->ctx;
+ struct gl_context *shareCtx = (struct gl_context *) sharedContextPrivate;
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
struct intel_screen *intelScreen = sPriv->private;
int bo_reuse_mode;
- __GLcontextModes visual;
+ struct gl_config visual;
/* we can't do anything without a connection to the device */
if (intelScreen->bufmgr == NULL)
@@ -724,7 +737,7 @@ intelInitContext(struct intel_context *intel,
ctx->Const.MaxSamples = 1.0;
/* reinitialize the context point state.
- * It depend on constants in __GLcontextRec::Const
+ * It depend on constants in __struct gl_contextRec::Const
*/
_mesa_init_point(ctx);
@@ -786,6 +799,11 @@ intelInitContext(struct intel_context *intel,
if (INTEL_DEBUG & DEBUG_BUFMGR)
dri_bufmgr_set_debug(intel->bufmgr, GL_TRUE);
+ /* XXX force SIMD8 kernel for Sandybridge before we fixed
+ SIMD16 interpolation. */
+ if (intel->gen == 6)
+ INTEL_DEBUG |= DEBUG_GLSL_FORCE;
+
intel->batch = intel_batchbuffer_alloc(intel);
intel_fbo_init(intel);
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index 28d53284fd..46d10d74ba 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -106,11 +106,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
{
@@ -256,7 +256,7 @@ struct intel_context
__DRIcontext *driContext;
struct intel_screen *intelScreen;
- void (*saved_viewport)(GLcontext * ctx,
+ void (*saved_viewport)(struct gl_context * ctx,
GLint x, GLint y, GLsizei width, GLsizei height);
/**
@@ -383,13 +383,13 @@ extern int INTEL_DEBUG;
extern GLboolean intelInitContext(struct intel_context *intel,
int api,
- const __GLcontextModes * mesaVis,
+ const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate,
struct dd_function_table *functions);
-extern void intelFinish(GLcontext * ctx);
-extern void intel_flush(GLcontext * ctx);
+extern void intelFinish(struct gl_context * ctx);
+extern void intel_flush(struct gl_context * ctx);
extern void intelInitDriverFunctions(struct dd_function_table *functions);
@@ -476,7 +476,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;
}
diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c
index bf22a423fc..974045730b 100644
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -31,7 +31,6 @@
#include "utils.h"
-#define need_GL_ARB_copy_buffer
#define need_GL_ARB_draw_elements_base_vertex
#define need_GL_ARB_framebuffer_object
#define need_GL_ARB_map_buffer_range
@@ -47,7 +46,6 @@
#define need_GL_EXT_blend_equation_separate
#define need_GL_EXT_blend_func_separate
#define need_GL_EXT_blend_minmax
-#define need_GL_EXT_cull_vertex
#define need_GL_EXT_draw_buffers2
#define need_GL_EXT_fog_coord
#define need_GL_EXT_framebuffer_blit
@@ -79,8 +77,8 @@
* i965_dri.
*/
static const struct dri_extension card_extensions[] = {
- { "GL_ARB_copy_buffer", GL_ARB_copy_buffer_functions },
{ "GL_ARB_draw_elements_base_vertex", GL_ARB_draw_elements_base_vertex_functions },
+ { "GL_ARB_explicit_attrib_location", NULL },
{ "GL_ARB_half_float_pixel", NULL },
{ "GL_ARB_map_buffer_range", GL_ARB_map_buffer_range_functions },
{ "GL_ARB_multitexture", NULL },
@@ -89,7 +87,6 @@ static const struct dri_extension card_extensions[] = {
{ "GL_ARB_point_sprite", NULL },
{ "GL_ARB_shader_objects", GL_ARB_shader_objects_functions },
{ "GL_ARB_shading_language_100", GL_VERSION_2_0_functions },
- { "GL_ARB_shading_language_120", GL_VERSION_2_1_functions },
{ "GL_ARB_sync", GL_ARB_sync_functions },
{ "GL_ARB_texture_border_clamp", NULL },
{ "GL_ARB_texture_cube_map", NULL },
@@ -109,7 +106,6 @@ static const struct dri_extension card_extensions[] = {
{ "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions },
{ "GL_EXT_blend_logic_op", NULL },
{ "GL_EXT_blend_subtract", NULL },
- { "GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions },
{ "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions },
{ "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
{ "GL_EXT_framebuffer_multisample", GL_EXT_framebuffer_multisample_functions },
@@ -133,7 +129,6 @@ static const struct dri_extension card_extensions[] = {
{ "GL_NV_blend_square", NULL },
{ "GL_NV_vertex_program", GL_NV_vertex_program_functions },
{ "GL_NV_vertex_program1_1", NULL },
- { "GL_SGIS_generate_mipmap", NULL },
#if FEATURE_OES_EGL_image
{ "GL_OES_EGL_image", GL_OES_EGL_image_functions },
#endif
@@ -172,6 +167,7 @@ static const struct dri_extension brw_extensions[] = {
{ "GL_ARB_shadow", NULL },
{ "GL_MESA_texture_signed_rgba", NULL },
{ "GL_ARB_texture_non_power_of_two", NULL },
+ { "GL_ARB_texture_rg", NULL },
{ "GL_EXT_draw_buffers2", GL_EXT_draw_buffers2_functions },
{ "GL_EXT_shadow_funcs", NULL },
{ "GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions },
@@ -201,18 +197,36 @@ static const struct dri_extension fragment_shader_extensions[] = {
};
/**
+ * \brief Get GLSL version from the environment.
+ *
+ * If the environment variable INTEL_GLSL_VERSION is set, convert its value
+ * to an integer and return it. Otherwise, return the default version, 120.
+ */
+static GLuint
+get_glsl_version()
+{
+ const char * s = getenv("INTEL_GLSL_VERSION");
+ if (s == NULL)
+ return 120;
+ else
+ return (GLuint) atoi(s);
+}
+
+/**
* Initializes potential list of extensions if ctx == NULL, or actually enables
* extensions for a context.
*/
void
-intelInitExtensions(GLcontext *ctx)
+intelInitExtensions(struct gl_context *ctx)
{
struct intel_context *intel = intel_context(ctx);
- /* Disable imaging extension until convolution is working in teximage paths.
- */
driInitExtensions(ctx, card_extensions, GL_FALSE);
+ _mesa_map_function_array(GL_VERSION_2_1_functions);
+
+ ctx->Const.GLSLVersion = get_glsl_version();
+
if (intel->gen >= 5)
driInitExtensions(ctx, ironlake_extensions, GL_FALSE);
diff --git a/src/mesa/drivers/dri/intel/intel_extensions.h b/src/mesa/drivers/dri/intel/intel_extensions.h
index 236442a4d6..fb2a846d39 100644
--- a/src/mesa/drivers/dri/intel/intel_extensions.h
+++ b/src/mesa/drivers/dri/intel/intel_extensions.h
@@ -30,10 +30,10 @@
extern void
-intelInitExtensions(GLcontext *ctx);
+intelInitExtensions(struct gl_context *ctx);
extern void
-intelInitExtensionsES2(GLcontext *ctx);
+intelInitExtensionsES2(struct gl_context *ctx);
#endif
diff --git a/src/mesa/drivers/dri/intel/intel_extensions_es2.c b/src/mesa/drivers/dri/intel/intel_extensions_es2.c
index 24f64045ef..71c86339c7 100644
--- a/src/mesa/drivers/dri/intel/intel_extensions_es2.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions_es2.c
@@ -69,6 +69,7 @@ static const char *es2_extensions[] = {
"GL_ARB_depth_texture",
"GL_EXT_packed_depth_stencil",
"GL_EXT_framebuffer_object",
+ "GL_EXT_texture_format_BGRA8888",
#if FEATURE_OES_EGL_image
"GL_OES_EGL_image",
@@ -82,7 +83,7 @@ static const char *es2_extensions[] = {
* extensions for a context.
*/
void
-intelInitExtensionsES2(GLcontext *ctx)
+intelInitExtensionsES2(struct gl_context *ctx)
{
int i;
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index 2693b5fa72..862a13d2ea 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -50,7 +50,7 @@
* Create a new framebuffer object.
*/
static struct gl_framebuffer *
-intel_new_framebuffer(GLcontext * ctx, GLuint name)
+intel_new_framebuffer(struct gl_context * ctx, GLuint name)
{
/* Only drawable state in intel_framebuffer at this time, just use Mesa's
* class
@@ -81,7 +81,7 @@ intel_delete_renderbuffer(struct gl_renderbuffer *rb)
* Return a pointer to a specific pixel in a renderbuffer.
*/
static void *
-intel_get_pointer(GLcontext * ctx, struct gl_renderbuffer *rb,
+intel_get_pointer(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLint x, GLint y)
{
/* By returning NULL we force all software rendering to go through
@@ -96,17 +96,35 @@ intel_get_pointer(GLcontext * ctx, struct gl_renderbuffer *rb,
* storage for a user-created renderbuffer.
*/
static GLboolean
-intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
+intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLenum internalFormat,
GLuint width, GLuint height)
{
struct intel_context *intel = intel_context(ctx);
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
- int cpp;
+ int cpp, tiling;
ASSERT(rb->Name != 0);
switch (internalFormat) {
+ case GL_RED:
+ case GL_R8:
+ rb->Format = MESA_FORMAT_R8;
+ rb->DataType = GL_UNSIGNED_BYTE;
+ break;
+ case GL_R16:
+ rb->Format = MESA_FORMAT_R16;
+ rb->DataType = GL_UNSIGNED_SHORT;
+ break;
+ case GL_RG:
+ case GL_RG8:
+ rb->Format = MESA_FORMAT_RG88;
+ rb->DataType = GL_UNSIGNED_BYTE;
+ break;
+ case GL_RG16:
+ rb->Format = MESA_FORMAT_RG1616;
+ rb->DataType = GL_UNSIGNED_SHORT;
+ break;
case GL_R3_G3_B2:
case GL_RGB4:
case GL_RGB5:
@@ -176,7 +194,13 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
/* alloc hardware renderbuffer */
DBG("Allocating %d x %d Intel RBO\n", width, height);
- irb->region = intel_region_alloc(intel->intelScreen, I915_TILING_NONE, cpp,
+ tiling = I915_TILING_NONE;
+
+ /* Gen6 requires depth must be tiling */
+ if (intel->gen >= 6 && rb->Format == MESA_FORMAT_S8_Z24)
+ tiling = I915_TILING_Y;
+
+ irb->region = intel_region_alloc(intel->intelScreen, tiling, cpp,
width, height, GL_TRUE);
if (!irb->region)
return GL_FALSE; /* out of memory? */
@@ -192,7 +216,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
#if FEATURE_OES_EGL_image
static void
-intel_image_target_renderbuffer_storage(GLcontext *ctx,
+intel_image_target_renderbuffer_storage(struct gl_context *ctx,
struct gl_renderbuffer *rb,
void *image_handle)
{
@@ -202,8 +226,8 @@ intel_image_target_renderbuffer_storage(GLcontext *ctx,
__DRIimage *image;
screen = intel->intelScreen->driScrnPriv;
- image = screen->dri2.image->lookupEGLImage(intel->driContext, image_handle,
- intel->driContext->loaderPrivate);
+ image = screen->dri2.image->lookupEGLImage(screen, image_handle,
+ screen->loaderPrivate);
if (image == NULL)
return;
@@ -228,7 +252,7 @@ intel_image_target_renderbuffer_storage(GLcontext *ctx,
* Not used for user-created renderbuffers!
*/
static GLboolean
-intel_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
+intel_alloc_window_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
ASSERT(rb->Name == 0);
@@ -241,7 +265,7 @@ intel_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
static void
-intel_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb,
+intel_resize_buffers(struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint width, GLuint height)
{
int i;
@@ -269,7 +293,7 @@ intel_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb,
/** Dummy function for gl_renderbuffer::AllocStorage() */
static GLboolean
-intel_nop_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
+intel_nop_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
_mesa_problem(ctx, "intel_op_alloc_storage should never be called.");
@@ -340,6 +364,14 @@ intel_create_renderbuffer(gl_format format)
irb->Base._BaseFormat = GL_ALPHA;
irb->Base.DataType = GL_UNSIGNED_BYTE;
break;
+ case MESA_FORMAT_R8:
+ irb->Base._BaseFormat = GL_RED;
+ irb->Base.DataType = GL_UNSIGNED_BYTE;
+ break;
+ case MESA_FORMAT_RG88:
+ irb->Base._BaseFormat = GL_RG;
+ irb->Base.DataType = GL_UNSIGNED_BYTE;
+ break;
default:
_mesa_problem(NULL,
"Unexpected intFormat in intel_create_renderbuffer");
@@ -364,7 +396,7 @@ intel_create_renderbuffer(gl_format format)
* Typically called via glBindRenderbufferEXT().
*/
static struct gl_renderbuffer *
-intel_new_renderbuffer(GLcontext * ctx, GLuint name)
+intel_new_renderbuffer(struct gl_context * ctx, GLuint name)
{
/*struct intel_context *intel = intel_context(ctx); */
struct intel_renderbuffer *irb;
@@ -392,7 +424,7 @@ intel_new_renderbuffer(GLcontext * ctx, GLuint name)
* Called via glBindFramebufferEXT().
*/
static void
-intel_bind_framebuffer(GLcontext * ctx, GLenum target,
+intel_bind_framebuffer(struct gl_context * ctx, GLenum target,
struct gl_framebuffer *fb, struct gl_framebuffer *fbread)
{
if (target == GL_FRAMEBUFFER_EXT || target == GL_DRAW_FRAMEBUFFER_EXT) {
@@ -408,7 +440,7 @@ intel_bind_framebuffer(GLcontext * ctx, GLenum target,
* Called via glFramebufferRenderbufferEXT().
*/
static void
-intel_framebuffer_renderbuffer(GLcontext * ctx,
+intel_framebuffer_renderbuffer(struct gl_context * ctx,
struct gl_framebuffer *fb,
GLenum attachment, struct gl_renderbuffer *rb)
{
@@ -422,7 +454,7 @@ intel_framebuffer_renderbuffer(GLcontext * ctx,
static GLboolean
-intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb,
+intel_update_wrapper(struct gl_context *ctx, struct intel_renderbuffer *irb,
struct gl_texture_image *texImage)
{
if (texImage->TexFormat == MESA_FORMAT_ARGB8888) {
@@ -433,6 +465,10 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb,
irb->Base.DataType = GL_UNSIGNED_BYTE;
DBG("Render to XGBA8 texture OK\n");
}
+ else if (texImage->TexFormat == MESA_FORMAT_SARGB8) {
+ irb->Base.DataType = GL_UNSIGNED_BYTE;
+ DBG("Render to SARGB8 texture OK\n");
+ }
else if (texImage->TexFormat == MESA_FORMAT_RGB565) {
irb->Base.DataType = GL_UNSIGNED_BYTE;
DBG("Render to RGB5 texture OK\n");
@@ -449,6 +485,22 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb,
irb->Base.DataType = GL_UNSIGNED_BYTE;
DBG("Render to A8 texture OK\n");
}
+ else if (texImage->TexFormat == MESA_FORMAT_R8) {
+ irb->Base.DataType = GL_UNSIGNED_BYTE;
+ DBG("Render to R8 texture OK\n");
+ }
+ else if (texImage->TexFormat == MESA_FORMAT_RG88) {
+ irb->Base.DataType = GL_UNSIGNED_BYTE;
+ DBG("Render to RG88 texture OK\n");
+ }
+ else if (texImage->TexFormat == MESA_FORMAT_R16) {
+ irb->Base.DataType = GL_UNSIGNED_SHORT;
+ DBG("Render to R8 texture OK\n");
+ }
+ else if (texImage->TexFormat == MESA_FORMAT_RG1616) {
+ irb->Base.DataType = GL_UNSIGNED_SHORT;
+ DBG("Render to RG88 texture OK\n");
+ }
else if (texImage->TexFormat == MESA_FORMAT_Z16) {
irb->Base.DataType = GL_UNSIGNED_SHORT;
DBG("Render to DEPTH16 texture OK\n");
@@ -483,7 +535,7 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb,
* This will have the region info needed for hardware rendering.
*/
static struct intel_renderbuffer *
-intel_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage)
+intel_wrap_texture(struct gl_context * ctx, struct gl_texture_image *texImage)
{
const GLuint name = ~0; /* not significant, but distinct for debugging */
struct intel_renderbuffer *irb;
@@ -514,7 +566,7 @@ intel_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage)
* before intel_finish_render_texture() is ever called.
*/
static void
-intel_render_texture(GLcontext * ctx,
+intel_render_texture(struct gl_context * ctx,
struct gl_framebuffer *fb,
struct gl_renderbuffer_attachment *att)
{
@@ -590,7 +642,7 @@ intel_render_texture(GLcontext * ctx,
* Called by Mesa when rendering to a texture is done.
*/
static void
-intel_finish_render_texture(GLcontext * ctx,
+intel_finish_render_texture(struct gl_context * ctx,
struct gl_renderbuffer_attachment *att)
{
struct intel_context *intel = intel_context(ctx);
@@ -599,6 +651,9 @@ intel_finish_render_texture(GLcontext * ctx,
tex_obj->Image[att->CubeMapFace][att->TextureLevel];
struct intel_texture_image *intel_image = intel_texture_image(image);
+ DBG("Finish render texture tid %lx tex=%u\n",
+ _glthread_GetID(), att->Texture->Name);
+
/* Flag that this image may now be validated into the object's miptree. */
intel_image->used_as_render_target = GL_FALSE;
@@ -614,7 +669,7 @@ intel_finish_render_texture(GLcontext * ctx,
* Do additional "completeness" testing of a framebuffer object.
*/
static void
-intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
+intel_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
{
const struct intel_renderbuffer *depthRb =
intel_get_renderbuffer(fb, BUFFER_DEPTH);
@@ -655,10 +710,15 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
switch (irb->Base.Format) {
case MESA_FORMAT_ARGB8888:
case MESA_FORMAT_XRGB8888:
+ case MESA_FORMAT_SARGB8:
case MESA_FORMAT_RGB565:
case MESA_FORMAT_ARGB1555:
case MESA_FORMAT_ARGB4444:
case MESA_FORMAT_A8:
+ case MESA_FORMAT_R8:
+ case MESA_FORMAT_R16:
+ case MESA_FORMAT_RG88:
+ case MESA_FORMAT_RG1616:
break;
default:
fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index d316d34d69..9c4e5c5ee8 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -333,7 +333,6 @@ intel_miptree_image_map(struct intel_context * intel,
GLuint * row_stride, GLuint * image_offsets)
{
GLuint x, y;
- DBG("%s \n", __FUNCTION__);
if (row_stride)
*row_stride = mt->region->pitch * mt->cpp;
@@ -348,6 +347,8 @@ intel_miptree_image_map(struct intel_context * intel,
image_offsets[i] = x + y * mt->region->pitch;
}
+ DBG("%s \n", __FUNCTION__);
+
return intel_region_map(intel, mt->region);
} else {
assert(mt->level[level].depth == 1);
@@ -355,6 +356,9 @@ intel_miptree_image_map(struct intel_context * intel,
&x, &y);
image_offsets[0] = 0;
+ DBG("%s: (%d,%d) -> (%d, %d)/%d\n",
+ __FUNCTION__, face, level, x, y, mt->region->pitch * mt->cpp);
+
return intel_region_map(intel, mt->region) +
(x + y * mt->region->pitch) * mt->cpp;
}
@@ -385,7 +389,6 @@ intel_miptree_image_data(struct intel_context *intel,
const GLuint depth = dst->level[level].depth;
GLuint i;
- DBG("%s: %d/%d\n", __FUNCTION__, face, level);
for (i = 0; i < depth; i++) {
GLuint dst_x, dst_y, height;
@@ -395,6 +398,12 @@ intel_miptree_image_data(struct intel_context *intel,
if(dst->compressed)
height = (height + 3) / 4;
+ DBG("%s: %d/%d %p/%d -> (%d, %d)/%d (%d, %d)\n",
+ __FUNCTION__, face, level,
+ src, src_row_pitch * dst->cpp,
+ dst_x, dst_y, dst->region->pitch * dst->cpp,
+ dst->level[level].width, height);
+
intel_region_data(intel,
dst->region, 0, dst_x, dst_y,
src,
diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c
index cb088e4032..60583ef4c0 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel.c
@@ -55,7 +55,7 @@ effective_func(GLenum func, GLboolean src_alpha_is_one)
* glDraw/CopyPixels.
*/
GLboolean
-intel_check_blit_fragment_ops(GLcontext * ctx, GLboolean src_alpha_is_one)
+intel_check_blit_fragment_ops(struct gl_context * ctx, GLboolean src_alpha_is_one)
{
if (ctx->NewState)
_mesa_update_state(ctx);
diff --git a/src/mesa/drivers/dri/intel/intel_pixel.h b/src/mesa/drivers/dri/intel/intel_pixel.h
index 743b6497c5..aef0e609da 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel.h
+++ b/src/mesa/drivers/dri/intel/intel_pixel.h
@@ -31,21 +31,21 @@
#include "main/mtypes.h"
void intelInitPixelFuncs(struct dd_function_table *functions);
-GLboolean intel_check_blit_fragment_ops(GLcontext * ctx,
+GLboolean intel_check_blit_fragment_ops(struct gl_context * ctx,
GLboolean src_alpha_is_one);
GLboolean intel_check_blit_format(struct intel_region *region,
GLenum format, GLenum type);
-void intelReadPixels(GLcontext * ctx,
+void intelReadPixels(struct gl_context * ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack,
GLvoid * pixels);
-void intelDrawPixels(GLcontext * ctx,
+void intelDrawPixels(struct gl_context * ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format,
@@ -53,12 +53,12 @@ void intelDrawPixels(GLcontext * ctx,
const struct gl_pixelstore_attrib *unpack,
const GLvoid * pixels);
-void intelCopyPixels(GLcontext * ctx,
+void intelCopyPixels(struct gl_context * ctx,
GLint srcx, GLint srcy,
GLsizei width, GLsizei height,
GLint destx, GLint desty, GLenum type);
-void intelBitmap(GLcontext * ctx,
+void intelBitmap(struct gl_context * ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
index 02c0ffce31..63fb4b37b1 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
@@ -26,27 +26,17 @@
**************************************************************************/
#include "main/glheader.h"
-#include "main/arbprogram.h"
#include "main/enums.h"
#include "main/image.h"
#include "main/colormac.h"
#include "main/mtypes.h"
#include "main/macros.h"
#include "main/bufferobj.h"
-#include "main/polygon.h"
-#include "main/pixelstore.h"
-#include "main/polygon.h"
#include "main/state.h"
-#include "main/teximage.h"
#include "main/texobj.h"
-#include "main/texstate.h"
-#include "main/texparam.h"
-#include "main/varray.h"
-#include "main/attrib.h"
-#include "main/enable.h"
-#include "main/viewport.h"
#include "main/context.h"
#include "swrast/swrast.h"
+#include "drivers/common/meta.h"
#include "intel_screen.h"
#include "intel_context.h"
@@ -68,7 +58,7 @@
* PBO bitmaps. I think they are probably pretty rare though - I
* wonder if Xgl uses them?
*/
-static const GLubyte *map_pbo( GLcontext *ctx,
+static const GLubyte *map_pbo( struct gl_context *ctx,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap )
@@ -177,7 +167,7 @@ y_flip(struct gl_framebuffer *fb, int y, int height)
* Render a bitmap.
*/
static GLboolean
-do_blit_bitmap( GLcontext *ctx,
+do_blit_bitmap( struct gl_context *ctx,
GLint dstx, GLint dsty,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
@@ -309,178 +299,6 @@ out:
return GL_TRUE;
}
-static GLboolean
-intel_texture_bitmap(GLcontext * ctx,
- GLint dst_x, GLint dst_y,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap)
-{
- struct intel_context *intel = intel_context(ctx);
- static const char *fp =
- "!!ARBfp1.0\n"
- "TEMP val;\n"
- "PARAM color=program.local[0];\n"
- "TEX val, fragment.texcoord[0], texture[0], 2D;\n"
- "ADD val, val.wwww, {-.5, -.5, -.5, -.5};\n"
- "KIL val;\n"
- "MOV result.color, color;\n"
- "END\n";
- GLuint texname;
- GLfloat vertices[4][4];
- GLint old_active_texture;
- GLubyte *a8_bitmap;
- GLfloat dst_z;
-
- /* We need a fragment program for the KIL effect */
- if (!ctx->Extensions.ARB_fragment_program ||
- !ctx->Extensions.ARB_vertex_program) {
- if (INTEL_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr,
- "glBitmap fallback: No fragment/vertex program support\n");
- return GL_FALSE;
- }
-
- /* We're going to mess with texturing with no regard to existing texture
- * state, so if there is some set up we have to bail.
- */
- if (ctx->Texture._EnabledUnits != 0) {
- if (INTEL_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "glBitmap fallback: texturing enabled\n");
- return GL_FALSE;
- }
-
- /* Can't do textured DrawPixels with a fragment program, unless we were
- * to generate a new program that sampled our texture and put the results
- * in the fragment color before the user's program started.
- */
- if (ctx->FragmentProgram.Enabled) {
- if (INTEL_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "glBitmap fallback: fragment program enabled\n");
- return GL_FALSE;
- }
-
- if (ctx->VertexProgram.Enabled) {
- if (INTEL_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "glBitmap fallback: vertex program enabled\n");
- return GL_FALSE;
- }
-
- if (!ctx->Extensions.ARB_texture_non_power_of_two &&
- (!is_power_of_two(width) || !is_power_of_two(height))) {
- if (INTEL_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr,
- "glBitmap() fallback: NPOT texture\n");
- return GL_FALSE;
- }
-
- if (ctx->Fog.Enabled) {
- if (INTEL_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "glBitmap() fallback: fog\n");
- return GL_FALSE;
- }
-
- /* Check that we can load in a texture this big. */
- if (width > (1 << (ctx->Const.MaxTextureLevels - 1)) ||
- height > (1 << (ctx->Const.MaxTextureLevels - 1))) {
- if (INTEL_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "glBitmap fallback: bitmap too large (%dx%d)\n",
- width, height);
- return GL_FALSE;
- }
-
- if (_mesa_is_bufferobj(unpack->BufferObj)) {
- bitmap = map_pbo(ctx, width, height, unpack, bitmap);
- if (bitmap == NULL)
- return GL_TRUE; /* even though this is an error, we're done */
- }
-
- /* Convert the A1 bitmap to an A8 format suitable for glTexImage */
- a8_bitmap = calloc(1, width * height);
- _mesa_expand_bitmap(width, height, unpack, bitmap, a8_bitmap, width, 0xff);
-
- if (_mesa_is_bufferobj(unpack->BufferObj)) {
- /* done with PBO so unmap it now */
- ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,
- unpack->BufferObj);
- }
-
- /* Save GL state before we start setting up our drawing */
- _mesa_PushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT | GL_POLYGON_BIT |
- GL_TEXTURE_BIT | GL_VIEWPORT_BIT);
- _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT |
- GL_CLIENT_PIXEL_STORE_BIT);
- old_active_texture = ctx->Texture.CurrentUnit;
-
- _mesa_Disable(GL_POLYGON_STIPPLE);
- _mesa_PolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-
- /* Upload our bitmap data to an alpha texture */
- _mesa_ActiveTextureARB(GL_TEXTURE0_ARB);
- _mesa_Enable(GL_TEXTURE_2D);
- _mesa_GenTextures(1, &texname);
- _mesa_BindTexture(GL_TEXTURE_2D, texname);
- _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-
- _mesa_PixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
- _mesa_PixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
- _mesa_PixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- _mesa_PixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
- _mesa_PixelStorei(GL_UNPACK_SKIP_ROWS, 0);
- _mesa_PixelStorei(GL_UNPACK_ALIGNMENT, 1);
- _mesa_TexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0,
- GL_ALPHA, GL_UNSIGNED_BYTE, a8_bitmap);
- free(a8_bitmap);
-
- meta_set_fragment_program(&intel->meta, &intel->meta.bitmap_fp, fp);
- _mesa_ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 0,
- ctx->Current.RasterColor);
- meta_set_passthrough_vertex_program(&intel->meta);
- meta_set_passthrough_transform(&intel->meta);
-
- /* convert rasterpos Z from [0,1] to NDC coord in [-1,1] */
- dst_z = -1.0 + 2.0 * ctx->Current.RasterPos[2];
-
- /* RasterPos[2] already takes into account the DepthRange mapping. */
- _mesa_DepthRange(0.0, 1.0);
-
- vertices[0][0] = dst_x;
- vertices[0][1] = dst_y;
- vertices[0][2] = dst_z;
- vertices[0][3] = 1.0;
- vertices[1][0] = dst_x + width;
- vertices[1][1] = dst_y;
- vertices[1][2] = dst_z;
- vertices[1][3] = 1.0;
- vertices[2][0] = dst_x + width;
- vertices[2][1] = dst_y + height;
- vertices[2][2] = dst_z;
- vertices[2][3] = 1.0;
- vertices[3][0] = dst_x;
- vertices[3][1] = dst_y + height;
- vertices[3][2] = dst_z;
- vertices[3][3] = 1.0;
-
- _mesa_VertexPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), &vertices);
- _mesa_Enable(GL_VERTEX_ARRAY);
- meta_set_default_texrect(&intel->meta);
- _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
- meta_restore_texcoords(&intel->meta);
- meta_restore_transform(&intel->meta);
- meta_restore_fragment_program(&intel->meta);
- meta_restore_vertex_program(&intel->meta);
-
- _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture);
- _mesa_PopClientAttrib();
- _mesa_PopAttrib();
-
- _mesa_DeleteTextures(1, &texname);
-
- return GL_TRUE;
-}
-
/* There are a large number of possible ways to implement bitmap on
* this hardware, most of them have some sort of drawback. Here are a
* few that spring to mind:
@@ -502,22 +320,21 @@ intel_texture_bitmap(GLcontext * ctx,
* - Chop bitmap up into 32x32 squares and render w/polygon stipple.
*/
void
-intelBitmap(GLcontext * ctx,
+intelBitmap(struct gl_context * ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte * pixels)
{
+ struct intel_context *intel = intel_context(ctx);
+
if (do_blit_bitmap(ctx, x, y, width, height,
unpack, pixels))
return;
- if (intel_texture_bitmap(ctx, x, y, width, height,
- unpack, pixels))
- return;
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- printf("%s: fallback to swrast\n", __FUNCTION__);
+ /* FIXME */
+ if (intel->gen == 6)
+ return _swrast_Bitmap(ctx, x, y, width, height, unpack, pixels);
- _swrast_Bitmap(ctx, x, y, width, height, unpack, pixels);
+ _mesa_meta_Bitmap(ctx, x, y, width, height, unpack, pixels);
}
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c
index 2008a4c2be..c6b36ed429 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c
@@ -76,7 +76,7 @@ copypix_src_region(struct intel_context *intel, GLenum type)
* we allow Scissor.
*/
static GLboolean
-intel_check_copypixel_blit_fragment_ops(GLcontext * ctx)
+intel_check_copypixel_blit_fragment_ops(struct gl_context * ctx)
{
if (ctx->NewState)
_mesa_update_state(ctx);
@@ -102,7 +102,7 @@ intel_check_copypixel_blit_fragment_ops(GLcontext * ctx)
* CopyPixels with the blitter. Don't support zooming, pixel transfer, etc.
*/
static GLboolean
-do_blit_copypixels(GLcontext * ctx,
+do_blit_copypixels(struct gl_context * ctx,
GLint srcx, GLint srcy,
GLsizei width, GLsizei height,
GLint dstx, GLint dsty, GLenum type)
@@ -198,7 +198,7 @@ out:
void
-intelCopyPixels(GLcontext * ctx,
+intelCopyPixels(struct gl_context * ctx,
GLint srcx, GLint srcy,
GLsizei width, GLsizei height,
GLint destx, GLint desty, GLenum type)
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
index a40b232fff..2ec7ed8e26 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
@@ -30,224 +30,16 @@
#include "main/image.h"
#include "main/mtypes.h"
#include "main/teximage.h"
-#include "main/texenv.h"
#include "main/texobj.h"
#include "main/texstate.h"
-#include "main/texparam.h"
-#include "main/varray.h"
-#include "main/attrib.h"
-#include "main/enable.h"
-#include "main/buffers.h"
-#include "main/fbobject.h"
-#include "main/depth.h"
-#include "main/hash.h"
-#include "main/blend.h"
#include "swrast/swrast.h"
#include "drivers/common/meta.h"
#include "intel_context.h"
#include "intel_pixel.h"
-#include "intel_fbo.h"
-
-
-/** XXX compare perf of this vs. _mesa_meta_DrawPixels(STENCIL) */
-static GLboolean
-intel_stencil_drawpixels(GLcontext * ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format,
- GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels)
-{
- struct intel_context *intel = intel_context(ctx);
- GLuint texname, rb_name, fb_name, old_fb_name;
- GLfloat vertices[4][2];
- struct intel_renderbuffer *irb;
- struct intel_renderbuffer *depth_irb;
- struct gl_pixelstore_attrib old_unpack;
- GLstencil *stencil_pixels;
- int row, y1, y2;
- GLint old_active_texture;
- GLboolean rendering_to_fbo = ctx->DrawBuffer->Name != 0;
-
- if (format != GL_STENCIL_INDEX)
- return GL_FALSE;
-
- /* If there's nothing to write, we're done. */
- if (ctx->Stencil.WriteMask[0] == 0)
- return GL_TRUE;
-
- /* Can't do a per-bit writemask while treating stencil as rgba data. */
- if ((ctx->Stencil.WriteMask[0] & 0xff) != 0xff) {
- if (INTEL_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "glDrawPixels(STENCIL_INDEX) fallback: "
- "stencil mask enabled\n");
- return GL_FALSE;
- }
-
- /* We don't support stencil testing/ops here */
- if (ctx->Stencil._Enabled)
- return GL_FALSE;
-
- /* We use FBOs for our wrapping of the depthbuffer into a color
- * destination.
- */
- if (!ctx->Extensions.EXT_framebuffer_object)
- return GL_FALSE;
-
- /* We're going to mess with texturing with no regard to existing texture
- * state, so if there is some set up we have to bail.
- */
- if (ctx->Texture._EnabledUnits != 0) {
- if (INTEL_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "glDrawPixels(STENCIL_INDEX) fallback: "
- "texturing enabled\n");
- return GL_FALSE;
- }
-
- /* Can't do textured DrawPixels with a fragment program, unless we were
- * to generate a new program that sampled our texture and put the results
- * in the fragment color before the user's program started.
- */
- if (ctx->FragmentProgram.Enabled) {
- if (INTEL_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "glDrawPixels(STENCIL_INDEX) fallback: "
- "fragment program enabled\n");
- return GL_FALSE;
- }
-
- /* Check that we can load in a texture this big. */
- if (width > (1 << (ctx->Const.MaxTextureLevels - 1)) ||
- height > (1 << (ctx->Const.MaxTextureLevels - 1))) {
- if (INTEL_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "glDrawPixels(STENCIL_INDEX) fallback: "
- "bitmap too large (%dx%d)\n",
- width, height);
- return GL_FALSE;
- }
-
- if (!ctx->Extensions.ARB_texture_non_power_of_two &&
- (!is_power_of_two(width) || !is_power_of_two(height))) {
- if (INTEL_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr,
- "glDrawPixels(GL_STENCIL_INDEX) fallback: NPOT texture\n");
- return GL_FALSE;
- }
-
- _mesa_PushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT |
- GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
- old_fb_name = ctx->DrawBuffer->Name;
- old_active_texture = ctx->Texture.CurrentUnit;
-
- _mesa_Disable(GL_POLYGON_STIPPLE);
- _mesa_Disable(GL_DEPTH_TEST);
- _mesa_Disable(GL_STENCIL_TEST);
-
- /* Unpack the supplied stencil values into a ubyte buffer. */
- assert(sizeof(GLstencil) == sizeof(GLubyte));
- stencil_pixels = malloc(width * height * sizeof(GLstencil));
- for (row = 0; row < height; row++) {
- GLvoid *source = _mesa_image_address2d(unpack, pixels,
- width, height,
- GL_COLOR_INDEX, type,
- row, 0);
- _mesa_unpack_stencil_span(ctx, width, GL_UNSIGNED_BYTE,
- stencil_pixels +
- row * width * sizeof(GLstencil),
- type, source, unpack, ctx->_ImageTransferState);
- }
-
- /* Take the current depth/stencil renderbuffer, and make a new one wrapping
- * it which will be treated as GL_RGBA8 so we can render to it as a color
- * buffer.
- */
- depth_irb = intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_DEPTH);
- irb = intel_create_renderbuffer(MESA_FORMAT_ARGB8888);
- irb->Base.Width = depth_irb->Base.Width;
- irb->Base.Height = depth_irb->Base.Height;
- intel_renderbuffer_set_region(intel, irb, depth_irb->region);
-
- /* Create a name for our renderbuffer, which lets us use other mesa
- * rb functions for convenience.
- */
- _mesa_GenRenderbuffersEXT(1, &rb_name);
- irb->Base.RefCount++;
- _mesa_HashInsert(ctx->Shared->RenderBuffers, rb_name, &irb->Base);
-
- /* Bind the new renderbuffer to the color attachment point. */
- _mesa_GenFramebuffersEXT(1, &fb_name);
- _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb_name);
- _mesa_FramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
- GL_COLOR_ATTACHMENT0_EXT,
- GL_RENDERBUFFER_EXT,
- rb_name);
- /* Choose to render to the color attachment. */
- _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
-
- _mesa_DepthMask(GL_FALSE);
- _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
-
- _mesa_ActiveTextureARB(GL_TEXTURE0_ARB);
- _mesa_Enable(GL_TEXTURE_2D);
- _mesa_GenTextures(1, &texname);
- _mesa_BindTexture(GL_TEXTURE_2D, texname);
- _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- _mesa_TexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- old_unpack = ctx->Unpack;
- ctx->Unpack = ctx->DefaultPacking;
- _mesa_TexImage2D(GL_TEXTURE_2D, 0, GL_INTENSITY, width, height, 0,
- GL_RED, GL_UNSIGNED_BYTE, stencil_pixels);
- ctx->Unpack = old_unpack;
- free(stencil_pixels);
-
- meta_set_passthrough_transform(&intel->meta);
-
- /* Since we're rendering to the framebuffer as if it was an FBO,
- * if it's the window system we have to flip the coordinates.
- */
- if (rendering_to_fbo) {
- y1 = y;
- y2 = y + height * ctx->Pixel.ZoomY;
- } else {
- y1 = irb->Base.Height - (y + height * ctx->Pixel.ZoomY);
- y2 = irb->Base.Height - y;
- }
- vertices[0][0] = x;
- vertices[0][1] = y1;
- vertices[1][0] = x + width * ctx->Pixel.ZoomX;
- vertices[1][1] = y1;
- vertices[2][0] = x + width * ctx->Pixel.ZoomX;
- vertices[2][1] = y2;
- vertices[3][0] = x;
- vertices[3][1] = y2;
-
- _mesa_VertexPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &vertices);
- _mesa_Enable(GL_VERTEX_ARRAY);
- meta_set_default_texrect(&intel->meta);
-
- _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
- meta_restore_texcoords(&intel->meta);
- meta_restore_transform(&intel->meta);
-
- _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture);
- _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, old_fb_name);
-
- _mesa_PopClientAttrib();
- _mesa_PopAttrib();
-
- _mesa_DeleteTextures(1, &texname);
- _mesa_DeleteFramebuffersEXT(1, &fb_name);
- _mesa_DeleteRenderbuffersEXT(1, &rb_name);
-
- return GL_TRUE;
-}
void
-intelDrawPixels(GLcontext * ctx,
+intelDrawPixels(struct gl_context * ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format,
@@ -255,24 +47,11 @@ intelDrawPixels(GLcontext * ctx,
const struct gl_pixelstore_attrib *unpack,
const GLvoid * pixels)
{
-#if 0
- /* XXX this function doesn't seem to work reliably even when all
- * the pre-requisite conditions are met.
- * Note that this function is never hit with conform.
- * Fall back to swrast because even the _mesa_meta_DrawPixels() approach
- * isn't working because of an apparent stencil bug.
- */
- if (intel_stencil_drawpixels(ctx, x, y, width, height, format, type,
- unpack, pixels))
- return;
-#else
- (void) intel_stencil_drawpixels; /* silence warning */
if (format == GL_STENCIL_INDEX) {
_swrast_DrawPixels(ctx, x, y, width, height, format, type,
unpack, pixels);
return;
}
-#endif
_mesa_meta_DrawPixels(ctx, x, y, width, height, format, type,
unpack, pixels);
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c
index 21d2a7a93e..b249f9a5a0 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c
@@ -65,7 +65,7 @@
*/
static GLboolean
-do_blit_readpixels(GLcontext * ctx,
+do_blit_readpixels(struct gl_context * ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack, GLvoid * pixels)
@@ -165,7 +165,7 @@ do_blit_readpixels(GLcontext * ctx,
}
void
-intelReadPixels(GLcontext * ctx,
+intelReadPixels(struct gl_context * ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack, GLvoid * pixels)
diff --git a/src/mesa/drivers/dri/intel/intel_reg.h b/src/mesa/drivers/dri/intel/intel_reg.h
index c1a281f261..955b100b21 100644
--- a/src/mesa/drivers/dri/intel/intel_reg.h
+++ b/src/mesa/drivers/dri/intel/intel_reg.h
@@ -55,6 +55,11 @@
* additional flushing control.
*/
#define _3DSTATE_PIPE_CONTROL (CMD_3D | (3 << 27) | (2 << 24) | 2)
+#define PIPE_CONTROL_CS_STALL (1 << 20)
+#define PIPE_CONTROL_GLOBAL_SNAPSHOT_COUNT_RESET (1 << 19)
+#define PIPE_CONTROL_TLB_INVALIDATE (1 << 18)
+#define PIPE_CONTROL_SYNC_GFDT (1 << 17)
+#define PIPE_CONTROL_MEDIA_STATE_CLEAR (1 << 16)
#define PIPE_CONTROL_NO_WRITE (0 << 14)
#define PIPE_CONTROL_WRITE_IMMEDIATE (1 << 14)
#define PIPE_CONTROL_WRITE_DEPTH_COUNT (2 << 14)
@@ -62,7 +67,14 @@
#define PIPE_CONTROL_DEPTH_STALL (1 << 13)
#define PIPE_CONTROL_WRITE_FLUSH (1 << 12)
#define PIPE_CONTROL_INSTRUCTION_FLUSH (1 << 11)
+#define PIPE_CONTROL_TC_FLUSH (1 << 10) /* GM45+ only */
+#define PIPE_CONTROL_ISP_DIS (1 << 9)
#define PIPE_CONTROL_INTERRUPT_ENABLE (1 << 8)
+/* GT */
+#define PIPE_CONTROL_VF_CACHE_INVALIDATE (1 << 4)
+#define PIPE_CONTROL_CONST_CACHE_INVALIDATE (1 << 3)
+#define PIPE_CONTROL_STATE_CACHE_INVALIDATE (1 << 2)
+#define PIPE_CONTROL_DEPTH_CACHE_FLUSH (1 << 0)
#define PIPE_CONTROL_PPGTT_WRITE (0 << 2)
#define PIPE_CONTROL_GLOBAL_GTT_WRITE (1 << 2)
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index 0a542a7303..061f0d278d 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -123,12 +123,12 @@ static const struct __DRI2flushExtensionRec intelFlushExtension = {
};
static __DRIimage *
-intel_create_image_from_name(__DRIcontext *context,
+intel_create_image_from_name(__DRIscreen *screen,
int width, int height, int format,
int name, int pitch, void *loaderPrivate)
{
+ struct intel_screen *intelScreen = screen->private;
__DRIimage *image;
- struct intel_context *intel = context->driverPrivate;
int cpp;
image = CALLOC(sizeof *image);
@@ -159,7 +159,7 @@ intel_create_image_from_name(__DRIcontext *context,
image->data = loaderPrivate;
cpp = _mesa_get_format_bytes(image->format);
- image->region = intel_region_alloc_for_handle(intel->intelScreen,
+ image->region = intel_region_alloc_for_handle(intelScreen,
cpp, width, height,
pitch, name, "image");
if (image->region == NULL) {
@@ -339,7 +339,7 @@ intelDestroyScreen(__DRIscreen * sPriv)
static GLboolean
intelCreateBuffer(__DRIscreen * driScrnPriv,
__DRIdrawable * driDrawPriv,
- const __GLcontextModes * mesaVis, GLboolean isPixmap)
+ const struct gl_config * mesaVis, GLboolean isPixmap)
{
struct intel_renderbuffer *rb;
@@ -415,22 +415,22 @@ intelDestroyBuffer(__DRIdrawable * driDrawPriv)
* init-designated function to register chipids and createcontext
* functions.
*/
-extern GLboolean i830CreateContext(const __GLcontextModes * mesaVis,
+extern GLboolean i830CreateContext(const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);
extern GLboolean i915CreateContext(int api,
- const __GLcontextModes * mesaVis,
+ const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);
extern GLboolean brwCreateContext(int api,
- const __GLcontextModes * mesaVis,
+ const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);
static GLboolean
intelCreateContext(gl_api api,
- const __GLcontextModes * mesaVis,
+ const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate)
{
@@ -465,7 +465,6 @@ intel_init_bufmgr(struct intel_screen *intelScreen)
intelScreen->no_hw = getenv("INTEL_NO_HW") != NULL;
intelScreen->bufmgr = intel_bufmgr_gem_init(spriv->fd, BATCH_SZ);
- /* Otherwise, use the classic buffer manager. */
if (intelScreen->bufmgr == NULL) {
fprintf(stderr, "[%s:%u] Error initializing buffer manager.\n",
__func__, __LINE__);
@@ -489,7 +488,7 @@ intel_init_bufmgr(struct intel_screen *intelScreen)
* This is the driver specific part of the createNewScreen entry point.
* Called when using DRI2.
*
- * \return the __GLcontextModes supported by this driver
+ * \return the struct gl_config supported by this driver
*/
static const
__DRIconfig **intelInitScreen2(__DRIscreen *psp)
diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c
index fb840c1020..104cadf0f9 100644
--- a/src/mesa/drivers/dri/intel/intel_span.c
+++ b/src/mesa/drivers/dri/intel/intel_span.c
@@ -246,7 +246,7 @@ intel_map_unmap_framebuffer(struct intel_context *intel,
* Old note: Moved locking out to get reasonable span performance.
*/
void
-intelSpanRenderStart(GLcontext * ctx)
+intelSpanRenderStart(struct gl_context * ctx)
{
struct intel_context *intel = intel_context(ctx);
GLuint i;
@@ -273,7 +273,7 @@ intelSpanRenderStart(GLcontext * ctx)
* the above function.
*/
void
-intelSpanRenderFinish(GLcontext * ctx)
+intelSpanRenderFinish(struct gl_context * ctx)
{
struct intel_context *intel = intel_context(ctx);
GLuint i;
@@ -294,7 +294,7 @@ intelSpanRenderFinish(GLcontext * ctx)
void
-intelInitSpanFuncs(GLcontext * ctx)
+intelInitSpanFuncs(struct gl_context * ctx)
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
swdd->SpanRenderStart = intelSpanRenderStart;
@@ -302,7 +302,7 @@ intelInitSpanFuncs(GLcontext * ctx)
}
void
-intel_map_vertex_shader_textures(GLcontext *ctx)
+intel_map_vertex_shader_textures(struct gl_context *ctx)
{
struct intel_context *intel = intel_context(ctx);
int i;
@@ -321,7 +321,7 @@ intel_map_vertex_shader_textures(GLcontext *ctx)
}
void
-intel_unmap_vertex_shader_textures(GLcontext *ctx)
+intel_unmap_vertex_shader_textures(struct gl_context *ctx)
{
struct intel_context *intel = intel_context(ctx);
int i;
@@ -366,6 +366,7 @@ intel_set_span_functions(struct intel_context *intel,
intel_InitPointers_xRGB8888(rb);
break;
case MESA_FORMAT_ARGB8888:
+ case MESA_FORMAT_SARGB8:
intel_InitPointers_ARGB8888(rb);
break;
case MESA_FORMAT_Z16:
diff --git a/src/mesa/drivers/dri/intel/intel_span.h b/src/mesa/drivers/dri/intel/intel_span.h
index bffe109aa5..aa8d08e843 100644
--- a/src/mesa/drivers/dri/intel/intel_span.h
+++ b/src/mesa/drivers/dri/intel/intel_span.h
@@ -28,15 +28,15 @@
#ifndef _INTEL_SPAN_H
#define _INTEL_SPAN_H
-extern void intelInitSpanFuncs(GLcontext * ctx);
+extern void intelInitSpanFuncs(struct gl_context * ctx);
-extern void intelSpanRenderFinish(GLcontext * ctx);
-extern void intelSpanRenderStart(GLcontext * ctx);
+extern void intelSpanRenderFinish(struct gl_context * ctx);
+extern void intelSpanRenderStart(struct gl_context * ctx);
void intel_renderbuffer_map(struct intel_context *intel,
struct gl_renderbuffer *rb);
void intel_renderbuffer_unmap(struct intel_context *intel,
struct gl_renderbuffer *rb);
-void intel_map_vertex_shader_textures(GLcontext *ctx);
-void intel_unmap_vertex_shader_textures(GLcontext *ctx);
+void intel_map_vertex_shader_textures(struct gl_context *ctx);
+void intel_unmap_vertex_shader_textures(struct gl_context *ctx);
#endif
diff --git a/src/mesa/drivers/dri/intel/intel_state.c b/src/mesa/drivers/dri/intel/intel_state.c
index c5ef909dbf..80598b7ef6 100644
--- a/src/mesa/drivers/dri/intel/intel_state.c
+++ b/src/mesa/drivers/dri/intel/intel_state.c
@@ -197,7 +197,7 @@ intel_translate_logic_op(GLenum opcode)
/* Fallback to swrast for select and feedback.
*/
static void
-intelRenderMode(GLcontext *ctx, GLenum mode)
+intelRenderMode(struct gl_context *ctx, GLenum mode)
{
struct intel_context *intel = intel_context(ctx);
FALLBACK(intel, INTEL_FALLBACK_RENDERMODE, (mode != GL_RENDER));
diff --git a/src/mesa/drivers/dri/intel/intel_syncobj.c b/src/mesa/drivers/dri/intel/intel_syncobj.c
index c2d86432ff..bbfac74b60 100644
--- a/src/mesa/drivers/dri/intel/intel_syncobj.c
+++ b/src/mesa/drivers/dri/intel/intel_syncobj.c
@@ -46,7 +46,7 @@
#include "intel_reg.h"
static struct gl_sync_object *
-intel_new_sync_object(GLcontext *ctx, GLuint id)
+intel_new_sync_object(struct gl_context *ctx, GLuint id)
{
struct intel_sync_object *sync;
@@ -56,7 +56,7 @@ intel_new_sync_object(GLcontext *ctx, GLuint id)
}
static void
-intel_delete_sync_object(GLcontext *ctx, struct gl_sync_object *s)
+intel_delete_sync_object(struct gl_context *ctx, struct gl_sync_object *s)
{
struct intel_sync_object *sync = (struct intel_sync_object *)s;
@@ -65,7 +65,7 @@ intel_delete_sync_object(GLcontext *ctx, struct gl_sync_object *s)
}
static void
-intel_fence_sync(GLcontext *ctx, struct gl_sync_object *s,
+intel_fence_sync(struct gl_context *ctx, struct gl_sync_object *s,
GLenum condition, GLbitfield flags)
{
struct intel_context *intel = intel_context(ctx);
@@ -87,7 +87,7 @@ intel_fence_sync(GLcontext *ctx, struct gl_sync_object *s,
* The fix would be a new kernel function to do the GTT transition with a
* timeout.
*/
-static void intel_client_wait_sync(GLcontext *ctx, struct gl_sync_object *s,
+static void intel_client_wait_sync(struct gl_context *ctx, struct gl_sync_object *s,
GLbitfield flags, GLuint64 timeout)
{
struct intel_sync_object *sync = (struct intel_sync_object *)s;
@@ -105,12 +105,12 @@ static void intel_client_wait_sync(GLcontext *ctx, struct gl_sync_object *s,
* any batchbuffers coming after this waitsync will naturally not occur until
* the previous one is done.
*/
-static void intel_server_wait_sync(GLcontext *ctx, struct gl_sync_object *s,
+static void intel_server_wait_sync(struct gl_context *ctx, struct gl_sync_object *s,
GLbitfield flags, GLuint64 timeout)
{
}
-static void intel_check_sync(GLcontext *ctx, struct gl_sync_object *s)
+static void intel_check_sync(struct gl_context *ctx, struct gl_sync_object *s)
{
struct intel_sync_object *sync = (struct intel_sync_object *)s;
diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c
index 8bb6ae99fb..3d9a2549db 100644
--- a/src/mesa/drivers/dri/intel/intel_tex.c
+++ b/src/mesa/drivers/dri/intel/intel_tex.c
@@ -9,25 +9,8 @@
#define FILE_DEBUG_FLAG DEBUG_TEXTURE
-static GLboolean
-intelIsTextureResident(GLcontext * ctx, struct gl_texture_object *texObj)
-{
-#if 0
- struct intel_context *intel = intel_context(ctx);
- struct intel_texture_object *intelObj = intel_texture_object(texObj);
-
- return
- intelObj->mt &&
- intelObj->mt->region &&
- intel_is_region_resident(intel, intelObj->mt->region);
-#endif
- return 1;
-}
-
-
-
static struct gl_texture_image *
-intelNewTextureImage(GLcontext * ctx)
+intelNewTextureImage(struct gl_context * ctx)
{
DBG("%s\n", __FUNCTION__);
(void) ctx;
@@ -36,7 +19,7 @@ intelNewTextureImage(GLcontext * ctx)
static struct gl_texture_object *
-intelNewTextureObject(GLcontext * ctx, GLuint name, GLenum target)
+intelNewTextureObject(struct gl_context * ctx, GLuint name, GLenum target)
{
struct intel_texture_object *obj = CALLOC_STRUCT(intel_texture_object);
@@ -47,7 +30,7 @@ intelNewTextureObject(GLcontext * ctx, GLuint name, GLenum target)
}
static void
-intelDeleteTextureObject(GLcontext *ctx,
+intelDeleteTextureObject(struct gl_context *ctx,
struct gl_texture_object *texObj)
{
struct intel_context *intel = intel_context(ctx);
@@ -61,7 +44,7 @@ intelDeleteTextureObject(GLcontext *ctx,
static void
-intelFreeTextureImageData(GLcontext * ctx, struct gl_texture_image *texImage)
+intelFreeTextureImageData(struct gl_context * ctx, struct gl_texture_image *texImage)
{
struct intel_context *intel = intel_context(ctx);
struct intel_texture_image *intelImage = intel_texture_image(texImage);
@@ -167,13 +150,17 @@ timed_memcpy(void *dest, const void *src, size_t n)
* map/unmap the base level texture image.
*/
static void
-intelGenerateMipmap(GLcontext *ctx, GLenum target,
+intelGenerateMipmap(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj)
{
if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, texObj)) {
/* sw path: need to map texture images */
struct intel_context *intel = intel_context(ctx);
struct intel_texture_object *intelObj = intel_texture_object(texObj);
+
+ if (INTEL_DEBUG & DEBUG_FALLBACKS)
+ fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__);
+
intel_tex_map_level_images(intel, intelObj, texObj->BaseLevel);
_mesa_generate_mipmap(ctx, target, texObj);
intel_tex_unmap_level_images(intel, intelObj, texObj->BaseLevel);
@@ -216,8 +203,6 @@ intelInitTextureFuncs(struct dd_function_table *functions)
functions->NewTextureImage = intelNewTextureImage;
functions->DeleteTexture = intelDeleteTextureObject;
functions->FreeTexImageData = intelFreeTextureImageData;
- functions->UpdateTexturePalette = 0;
- functions->IsTextureResident = intelIsTextureResident;
#if DO_DEBUG && !defined(__ia64__)
if (INTEL_DEBUG & DEBUG_BUFMGR)
diff --git a/src/mesa/drivers/dri/intel/intel_tex.h b/src/mesa/drivers/dri/intel/intel_tex.h
index cd77dd5b8e..7906554e45 100644
--- a/src/mesa/drivers/dri/intel/intel_tex.h
+++ b/src/mesa/drivers/dri/intel/intel_tex.h
@@ -40,7 +40,7 @@ void intelInitTextureSubImageFuncs(struct dd_function_table *functions);
void intelInitTextureCopyImageFuncs(struct dd_function_table *functions);
-gl_format intelChooseTextureFormat(GLcontext *ctx, GLint internalFormat,
+gl_format intelChooseTextureFormat(struct gl_context *ctx, GLint internalFormat,
GLenum format, GLenum type);
void intelSetTexBuffer(__DRIcontext *pDRICtx,
diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c
index 6efb2ddc55..2d046fd52d 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c
@@ -72,6 +72,7 @@ get_teximage_source(struct intel_context *intel, GLenum internalFormat)
if (irb && irb->region && irb->region->cpp == 4)
return irb->region;
return NULL;
+ case 4:
case GL_RGBA:
case GL_RGBA8:
irb = intel_renderbuffer(intel->ctx.ReadBuffer->_ColorReadBuffer);
@@ -82,6 +83,7 @@ get_teximage_source(struct intel_context *intel, GLenum internalFormat)
if (irb->Base._BaseFormat == GL_RGB)
return NULL;
return irb->region;
+ case 3:
case GL_RGB:
case GL_RGB8:
return intel_readbuf_region(intel);
@@ -99,7 +101,7 @@ do_copy_texsubimage(struct intel_context *intel,
GLint dstx, GLint dsty,
GLint x, GLint y, GLsizei width, GLsizei height)
{
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
const struct intel_region *src = get_teximage_source(intel, internalFormat);
if (!intelImage->mt || !src || !src->buffer) {
@@ -170,7 +172,7 @@ do_copy_texsubimage(struct intel_context *intel,
static void
-intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level,
+intelCopyTexImage1D(struct gl_context * ctx, GLenum target, GLint level,
GLenum internalFormat,
GLint x, GLint y, GLsizei width, GLint border)
{
@@ -218,7 +220,7 @@ intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level,
static void
-intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level,
+intelCopyTexImage2D(struct gl_context * ctx, GLenum target, GLint level,
GLenum internalFormat,
GLint x, GLint y, GLsizei width, GLsizei height,
GLint border)
@@ -267,7 +269,7 @@ intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level,
static void
-intelCopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level,
+intelCopyTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level,
GLint xoffset, GLint x, GLint y, GLsizei width)
{
struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
@@ -293,7 +295,7 @@ intelCopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level,
static void
-intelCopyTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
+intelCopyTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint x, GLint y, GLsizei width, GLsizei height)
{
diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c
index e03b203fb4..9d73a2fb37 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_format.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_format.c
@@ -15,7 +15,7 @@
* immediately after sampling...
*/
gl_format
-intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
+intelChooseTextureFormat(struct gl_context * ctx, GLint internalFormat,
GLenum format, GLenum type)
{
struct intel_context *intel = intel_context(ctx);
@@ -93,6 +93,10 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
case GL_LUMINANCE12_ALPHA4:
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
+ /* i915 could implement this mode using MT_32BIT_RG1616. However, this
+ * would require an extra swizzle instruction in the fragment shader to
+ * convert the { R, G, 1.0, 1.0 } to { R, R, R, G }.
+ */
#ifndef I915
return MESA_FORMAT_AL1616;
#else
@@ -193,6 +197,22 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
case GL_RGBA_SNORM:
case GL_RGBA8_SNORM:
return MESA_FORMAT_SIGNED_RGBA8888_REV;
+
+ /* i915 can do a RG16, but it can't do any of the other RED or RG formats.
+ * In addition, it only implements the broken D3D mode where undefined
+ * components are read as 1.0. I'm not sure who thought reading
+ * { R, G, 1.0, 1.0 } from a red-green texture would be useful.
+ */
+ case GL_RED:
+ case GL_R8:
+ return MESA_FORMAT_R8;
+ case GL_R16:
+ return MESA_FORMAT_R16;
+ case GL_RG:
+ case GL_RG8:
+ return MESA_FORMAT_RG88;
+ case GL_RG16:
+ return MESA_FORMAT_RG1616;
#endif
default:
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 7d33df3599..35f3d7d382 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -4,14 +4,12 @@
#include "main/mtypes.h"
#include "main/enums.h"
#include "main/bufferobj.h"
-#include "main/convolve.h"
#include "main/context.h"
#include "main/formats.h"
#include "main/texcompress.h"
#include "main/texstore.h"
#include "main/texgetimage.h"
#include "main/texobj.h"
-#include "main/texstore.h"
#include "main/teximage.h"
#include "intel_context.h"
@@ -74,10 +72,7 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel,
DBG("%s\n", __FUNCTION__);
- if (intelImage->base.Border ||
- ((intelImage->base._BaseFormat == GL_DEPTH_COMPONENT) &&
- ((intelObj->base.WrapS == GL_CLAMP_TO_BORDER) ||
- (intelObj->base.WrapT == GL_CLAMP_TO_BORDER))))
+ if (intelImage->base.Border)
return;
if (intelImage->level > intelObj->base.BaseLevel &&
@@ -305,7 +300,7 @@ try_pbo_zcopy(struct intel_context *intel,
static void
-intelTexImage(GLcontext * ctx,
+intelTexImage(struct gl_context * ctx,
GLint dims,
GLenum target, GLint level,
GLint internalFormat,
@@ -320,8 +315,6 @@ intelTexImage(GLcontext * ctx,
struct intel_context *intel = intel_context(ctx);
struct intel_texture_object *intelObj = intel_texture_object(texObj);
struct intel_texture_image *intelImage = intel_texture_image(texImage);
- GLint postConvWidth = width;
- GLint postConvHeight = height;
GLint texelBytes, sizeInBytes;
GLuint dstRowStride = 0, srcRowStride = texImage->RowStride;
@@ -331,25 +324,14 @@ intelTexImage(GLcontext * ctx,
intelImage->face = target_to_face(target);
intelImage->level = level;
- if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) {
- _mesa_adjust_image_for_convolution(ctx, dims, &postConvWidth,
- &postConvHeight);
- }
-
if (_mesa_is_format_compressed(texImage->TexFormat)) {
texelBytes = 0;
}
else {
texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
-
- /* Minimum pitch of 32 bytes */
- if (postConvWidth * texelBytes < 32) {
- postConvWidth = 32 / texelBytes;
- texImage->RowStride = postConvWidth;
- }
if (!intelImage->mt) {
- assert(texImage->RowStride == postConvWidth);
+ assert(texImage->RowStride == width);
}
}
@@ -502,8 +484,8 @@ intelTexImage(GLcontext * ctx,
assert(dims != 3);
}
else {
- dstRowStride = postConvWidth * texelBytes;
- sizeInBytes = depth * dstRowStride * postConvHeight;
+ dstRowStride = width * texelBytes;
+ sizeInBytes = depth * dstRowStride * height;
}
texImage->Data = _mesa_alloc_texmemory(sizeInBytes);
@@ -557,7 +539,7 @@ intelTexImage(GLcontext * ctx,
static void
-intelTexImage3D(GLcontext * ctx,
+intelTexImage3D(struct gl_context * ctx,
GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint depth,
@@ -574,7 +556,7 @@ intelTexImage3D(GLcontext * ctx,
static void
-intelTexImage2D(GLcontext * ctx,
+intelTexImage2D(struct gl_context * ctx,
GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
@@ -590,7 +572,7 @@ intelTexImage2D(GLcontext * ctx,
static void
-intelTexImage1D(GLcontext * ctx,
+intelTexImage1D(struct gl_context * ctx,
GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
@@ -606,7 +588,7 @@ intelTexImage1D(GLcontext * ctx,
static void
-intelCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level,
+intelCompressedTexImage2D( struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLsizei imageSize, const GLvoid *data,
@@ -624,7 +606,7 @@ intelCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level,
* then unmap it.
*/
static void
-intel_get_tex_image(GLcontext * ctx, GLenum target, GLint level,
+intel_get_tex_image(struct gl_context * ctx, GLenum target, GLint level,
GLenum format, GLenum type, GLvoid * pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage, GLboolean compressed)
@@ -684,7 +666,7 @@ intel_get_tex_image(GLcontext * ctx, GLenum target, GLint level,
static void
-intelGetTexImage(GLcontext * ctx, GLenum target, GLint level,
+intelGetTexImage(struct gl_context * ctx, GLenum target, GLint level,
GLenum format, GLenum type, GLvoid * pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
@@ -695,7 +677,7 @@ intelGetTexImage(GLcontext * ctx, GLenum target, GLint level,
static void
-intelGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level,
+intelGetCompressedTexImage(struct gl_context *ctx, GLenum target, GLint level,
GLvoid *pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
@@ -711,7 +693,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
{
struct gl_framebuffer *fb = dPriv->driverPrivate;
struct intel_context *intel = pDRICtx->driverPrivate;
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
struct intel_texture_object *intelObj;
struct intel_texture_image *intelImage;
struct intel_mipmap_tree *mt;
@@ -792,7 +774,7 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
#if FEATURE_OES_EGL_image
static void
-intel_image_target_texture_2d(GLcontext *ctx, GLenum target,
+intel_image_target_texture_2d(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage,
GLeglImageOES image_handle)
@@ -805,8 +787,8 @@ intel_image_target_texture_2d(GLcontext *ctx, GLenum target,
__DRIimage *image;
screen = intel->intelScreen->driScrnPriv;
- image = screen->dri2.image->lookupEGLImage(intel->driContext, image_handle,
- intel->driContext->loaderPrivate);
+ image = screen->dri2.image->lookupEGLImage(screen, image_handle,
+ screen->loaderPrivate);
if (image == NULL)
return;
diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
index b7ce50a820..c9b992a21b 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
@@ -40,7 +40,7 @@
#define FILE_DEBUG_FLAG DEBUG_TEXTURE
static void
-intelTexSubimage(GLcontext * ctx,
+intelTexSubimage(struct gl_context * ctx,
GLint dims,
GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
@@ -189,7 +189,7 @@ intelTexSubimage(GLcontext * ctx,
static void
-intelTexSubImage3D(GLcontext * ctx,
+intelTexSubImage3D(struct gl_context * ctx,
GLenum target,
GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
@@ -209,7 +209,7 @@ intelTexSubImage3D(GLcontext * ctx,
static void
-intelTexSubImage2D(GLcontext * ctx,
+intelTexSubImage2D(struct gl_context * ctx,
GLenum target,
GLint level,
GLint xoffset, GLint yoffset,
@@ -229,7 +229,7 @@ intelTexSubImage2D(GLcontext * ctx,
static void
-intelTexSubImage1D(GLcontext * ctx,
+intelTexSubImage1D(struct gl_context * ctx,
GLenum target,
GLint level,
GLint xoffset,
@@ -248,7 +248,7 @@ intelTexSubImage1D(GLcontext * ctx,
}
static void
-intelCompressedTexSubImage2D(GLcontext * ctx,
+intelCompressedTexSubImage2D(struct gl_context * ctx,
GLenum target,
GLint level,
GLint xoffset, GLint yoffset,