diff options
Diffstat (limited to 'src/mesa/drivers/dri/intel')
29 files changed, 259 insertions, 145 deletions
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..87da60a771 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, @@ -214,21 +214,28 @@ intel_bufferobj_subdata(GLcontext * ctx, memcpy((char *)intel_obj->sys_buffer + offset, data, size); else { /* Flush any existing batchbuffer that might reference this data. */ - if (drm_intel_bo_busy(intel_obj->buffer) || - drm_intel_bo_references(intel->batch->buf, intel_obj->buffer)) { - drm_intel_bo *temp_bo; + if (intel->gen < 6) { + if (drm_intel_bo_busy(intel_obj->buffer) || + drm_intel_bo_references(intel->batch->buf, intel_obj->buffer)) { + drm_intel_bo *temp_bo; - temp_bo = drm_intel_bo_alloc(intel->bufmgr, "subdata temp", size, 64); + temp_bo = drm_intel_bo_alloc(intel->bufmgr, "subdata temp", size, 64); - drm_intel_bo_subdata(temp_bo, 0, size, data); + drm_intel_bo_subdata(temp_bo, 0, size, data); - intel_emit_linear_blit(intel, - intel_obj->buffer, offset, - temp_bo, 0, - size); + intel_emit_linear_blit(intel, + intel_obj->buffer, offset, + temp_bo, 0, + size); - drm_intel_bo_unreference(temp_bo); + drm_intel_bo_unreference(temp_bo); + } else { + drm_intel_bo_subdata(intel_obj->buffer, offset, size, data); + } } else { + if (drm_intel_bo_references(intel->batch->buf, intel_obj->buffer)) { + intel_batchbuffer_flush(intel->batch); + } drm_intel_bo_subdata(intel_obj->buffer, offset, size, data); } } @@ -239,7 +246,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 +267,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 +329,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 +422,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 +456,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 +544,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, @@ -552,7 +559,7 @@ intel_bufferobj_copy_subdata(GLcontext *ctx, return; /* If we're in system memory, just map and memcpy. */ - if (intel_src->sys_buffer || intel_dst->sys_buffer) { + if (intel_src->sys_buffer || intel_dst->sys_buffer || intel->gen >= 6) { /* The same buffer may be used, but note that regions copied may * not overlap. */ @@ -575,6 +582,7 @@ intel_bufferobj_copy_subdata(GLcontext *ctx, intel_bufferobj_unmap(ctx, GL_COPY_READ_BUFFER, src); intel_bufferobj_unmap(ctx, GL_COPY_WRITE_BUFFER, dst); } + return; } /* Otherwise, we have real BOs, so blit them. */ @@ -596,7 +604,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 +617,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 +644,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 +658,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 +672,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 +686,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 +694,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 +708,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_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 edcc9536da..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; @@ -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); 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 d741f82767..974045730b 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -78,6 +78,7 @@ */ static const struct dri_extension card_extensions[] = { { "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 }, @@ -166,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 }, @@ -195,18 +197,35 @@ 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); driInitExtensions(ctx, card_extensions, GL_FALSE); _mesa_map_function_array(GL_VERSION_2_1_functions); - ctx->Const.GLSLVersion = 120; + + 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 984585027c..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) { @@ -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) { @@ -453,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"); @@ -487,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; @@ -518,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) { @@ -594,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); @@ -621,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); @@ -667,6 +715,10 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) 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_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 23410f063c..63fb4b37b1 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -58,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 ) @@ -167,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, @@ -320,7 +320,7 @@ out: * - 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, 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 470c4b9326..2ec7ed8e26 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c @@ -39,7 +39,7 @@ #include "intel_pixel.h" void -intelDrawPixels(GLcontext * ctx, +intelDrawPixels(struct gl_context * ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, 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_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index d200dc1f4a..061f0d278d 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -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) { @@ -488,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 c8d55c92a0..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; 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 e2bff0878a..3d9a2549db 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -10,7 +10,7 @@ #define FILE_DEBUG_FLAG DEBUG_TEXTURE static struct gl_texture_image * -intelNewTextureImage(GLcontext * ctx) +intelNewTextureImage(struct gl_context * ctx) { DBG("%s\n", __FUNCTION__); (void) ctx; @@ -19,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); @@ -30,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); @@ -44,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); @@ -150,7 +150,7 @@ 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)) { 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 03aba58e10..35f3d7d382 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -10,7 +10,6 @@ #include "main/texstore.h" #include "main/texgetimage.h" #include "main/texobj.h" -#include "main/texstore.h" #include "main/teximage.h" #include "intel_context.h" @@ -301,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, @@ -540,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, @@ -557,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, @@ -573,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, @@ -589,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, @@ -607,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) @@ -667,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) @@ -678,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) @@ -694,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; @@ -775,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) 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, |