From: Chris W. <ch...@ch...> - 2010-03-05 12:04:38
|
Thanks to Intel QA providing a few piglit cases to test the API, this has had a cursory test and identified the silly cases of using the wrong lookup functions. The ugly part is that I've used 3 different driver functions to handle each of the 3 object variants - the alternative would be pass in a void pointer and a type id. If we acquire more distinct object types, then multiplexing a single driver function would be preferable to adding multiple stubs. Please review and include in 7.7! :) Thanks, -ickle |
From: Chris W. <ch...@ch...> - 2010-03-05 12:04:25
|
Implement support for purgeable objects by using the GEM madvise ioctl. Signed-off-by: Chris Wilson <ch...@ch...> --- src/mesa/drivers/dri/intel/intel_buffer_objects.c | 134 ++++++++++++++++++++- src/mesa/drivers/dri/intel/intel_extensions.c | 3 + 2 files changed, 136 insertions(+), 1 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index 312866d..7599bea 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -31,10 +31,12 @@ #include "main/macros.h" #include "main/bufferobj.h" -#include "intel_context.h" #include "intel_blit.h" #include "intel_buffer_objects.h" #include "intel_batchbuffer.h" +#include "intel_context.h" +#include "intel_fbo.h" +#include "intel_mipmap_tree.h" #include "intel_regions.h" static GLboolean @@ -588,6 +590,126 @@ intel_bufferobj_copy_subdata(GLcontext *ctx, intel_batchbuffer_emit_mi_flush(intel->batch); } +#if FEATURE_APPLE_object_purgeable +static GLenum +intel_buffer_purgeable(GLcontext * ctx, + drm_intel_bo *buffer, + GLenum option) +{ + int retained = 0; + + if (buffer != NULL) + retained = drm_intel_bo_madvise (buffer, I915_MADV_DONTNEED); + + return retained ? GL_VOLATILE_APPLE : GL_RELEASED_APPLE; +} + +static GLenum +intel_buffer_object_purgeable(GLcontext * ctx, + struct gl_buffer_object *obj, + GLenum option) +{ + struct intel_buffer_object *intel; + + intel = intel_buffer_object (obj); + if (intel->buffer != NULL) + return intel_buffer_purgeable (ctx, intel->buffer, option); + + if (option == GL_RELEASED_APPLE) { + if (intel->sys_buffer != NULL) { + free(intel->sys_buffer); + intel->sys_buffer = NULL; + } + + return GL_RELEASED_APPLE; + } else { + /* XXX Create the buffer and madvise(MADV_DONTNEED)? */ + return intel_buffer_purgeable (ctx, + intel_bufferobj_buffer(intel_context(ctx), + intel, INTEL_READ), + option); + } +} + +static GLenum +intel_texture_object_purgeable(GLcontext * ctx, + struct gl_texture_object *obj, + GLenum option) +{ + struct intel_texture_object *intel; + + intel = intel_texture_object(obj); + if (intel->mt == NULL || intel->mt->region == NULL) + return GL_RELEASED_APPLE; + + return intel_buffer_purgeable (ctx, intel->mt->region->buffer, option); +} + +static GLenum +intel_render_object_purgeable(GLcontext * ctx, + struct gl_renderbuffer *obj, + GLenum option) +{ + struct intel_renderbuffer *intel; + + intel = intel_renderbuffer(obj); + if (intel->region == NULL) + return GL_RELEASED_APPLE; + + return intel_buffer_purgeable (ctx, intel->region->buffer, option); +} + +static GLenum +intel_buffer_unpurgeable(GLcontext * ctx, + drm_intel_bo *buffer, + GLenum option) +{ + int retained; + + retained = 0; + if (buffer != NULL) + retained = drm_intel_bo_madvise (buffer, I915_MADV_WILLNEED); + + return retained ? GL_RETAINED_APPLE : GL_UNDEFINED_APPLE; +} + +static GLenum +intel_buffer_object_unpurgeable(GLcontext * ctx, + struct gl_buffer_object *obj, + GLenum option) +{ + return intel_buffer_unpurgeable (ctx, intel_buffer_object (obj)->buffer, option); +} + +static GLenum +intel_texture_object_unpurgeable(GLcontext * ctx, + struct gl_texture_object *obj, + GLenum option) +{ + struct intel_texture_object *intel; + + intel = intel_texture_object(obj); + if (intel->mt == NULL || intel->mt->region == NULL) + return GL_UNDEFINED_APPLE; + + return intel_buffer_unpurgeable (ctx, intel->mt->region->buffer, option); +} + +static GLenum +intel_render_object_unpurgeable(GLcontext * ctx, + struct gl_renderbuffer *obj, + GLenum option) +{ + struct intel_renderbuffer *intel; + + intel = intel_renderbuffer(obj); + if (intel->region == NULL) + return GL_UNDEFINED_APPLE; + + return intel_buffer_unpurgeable (ctx, intel->region->buffer, option); +} +#endif + void intelInitBufferObjectFuncs(struct dd_function_table *functions) { @@ -601,4 +723,14 @@ intelInitBufferObjectFuncs(struct dd_function_table *functions) functions->FlushMappedBufferRange = intel_bufferobj_flush_mapped_range; functions->UnmapBuffer = intel_bufferobj_unmap; functions->CopyBufferSubData = intel_bufferobj_copy_subdata; + +#if FEATURE_APPLE_object_purgeable + functions->BufferObjectPurgeable = intel_buffer_object_purgeable; + functions->TextureObjectPurgeable = intel_texture_object_purgeable; + functions->RenderObjectPurgeable = intel_render_object_purgeable; + + functions->BufferObjectUnpurgeable = intel_buffer_object_unpurgeable; + functions->TextureObjectUnpurgeable = intel_texture_object_unpurgeable; + functions->RenderObjectUnpurgeable = intel_render_object_unpurgeable; +#endif } diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index e16c33b..a1aac69 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -58,6 +58,7 @@ #define need_GL_EXT_secondary_color #define need_GL_EXT_stencil_two_side #define need_GL_APPLE_vertex_array_object +#define need_GL_APPLE_object_purgeable #define need_GL_ATI_separate_stencil #define need_GL_ATI_envmap_bumpmap #define need_GL_NV_point_sprite @@ -121,6 +122,7 @@ static const struct dri_extension card_extensions[] = { { "GL_EXT_texture_lod_bias", NULL }, { "GL_3DFX_texture_compression_FXT1", NULL }, { "GL_APPLE_client_storage", NULL }, + { "GL_APPLE_object_purgeable", GL_APPLE_object_purgeable_functions }, { "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions}, { "GL_MESA_pack_invert", NULL }, { "GL_MESA_ycbcr_texture", NULL }, @@ -182,6 +184,7 @@ static const struct dri_extension arb_oq_extensions[] = { { NULL, NULL } }; + static const struct dri_extension fragment_shader_extensions[] = { { "GL_ARB_fragment_shader", NULL }, { NULL, NULL } -- 1.7.0 |
From: Chris W. <ch...@ch...> - 2010-03-05 12:04:26
|
Signed-off-by: Chris Wilson <ch...@ch...> --- src/mesa/main/api_exec.c | 6 + src/mesa/main/bufferobj.c | 356 ++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/bufferobj.h | 11 ++ src/mesa/main/dd.h | 17 ++ src/mesa/main/dlist.c | 6 + src/mesa/main/extensions.c | 4 + src/mesa/main/mfeatures.h | 1 + src/mesa/main/mtypes.h | 4 + 8 files changed, 405 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 70c154b..fa8d409 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -758,4 +758,10 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_EGLImageTargetTexture2DOES(exec, _mesa_EGLImageTargetTexture2DOES); SET_EGLImageTargetRenderbufferStorageOES(exec, _mesa_EGLImageTargetRenderbufferStorageOES); #endif + +#if FEATURE_APPLE_object_purgeable + SET_ObjectPurgeableAPPLE(exec, _mesa_ObjectPurgeableAPPLE); + SET_ObjectUnpurgeableAPPLE(exec, _mesa_ObjectUnpurgeableAPPLE); + SET_GetObjectParameterivAPPLE(exec, _mesa_GetObjectParameterivAPPLE); +#endif } diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 971b280..3c48f6c 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -37,6 +37,8 @@ #include "image.h" #include "context.h" #include "bufferobj.h" +#include "fbobject.h" +#include "texobj.h" /* Debug flags */ @@ -1710,3 +1712,357 @@ _mesa_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) if (ctx->Driver.FlushMappedBufferRange) ctx->Driver.FlushMappedBufferRange(ctx, target, offset, length, bufObj); } + +#if FEATURE_APPLE_object_purgeable +static GLenum +_mesa_BufferObjectPurgeable(GLcontext *ctx, GLuint name, GLenum option) +{ + struct gl_buffer_object *bufObj; + GLenum retval; + + bufObj = _mesa_lookup_bufferobj(ctx, name); + if (!bufObj) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glObjectPurgeable(name = 0x%x)", name); + return 0; + } + if (!_mesa_is_bufferobj(bufObj)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glObjectPurgeable(buffer 0)" ); + return 0; + } + + if (bufObj->Purgeable) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glObjectPurgeable(name = 0x%x) is already purgeable", name); + return GL_VOLATILE_APPLE; + } + + bufObj->Purgeable = GL_TRUE; + + retval = GL_VOLATILE_APPLE; + if (ctx->Driver.BufferObjectPurgeable) + retval = ctx->Driver.BufferObjectPurgeable(ctx, bufObj, option); + + return retval; +} + +static GLenum +_mesa_RenderObjectPurgeable(GLcontext *ctx, GLuint name, GLenum option) +{ + struct gl_renderbuffer *bufObj; + GLenum retval; + + bufObj = _mesa_lookup_renderbuffer(ctx, name); + if (!bufObj) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glObjectUnpurgeable(name = 0x%x)", name); + return 0; + } + + if (bufObj->Purgeable) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glObjectPurgeable(name = 0x%x) is already purgeable", name); + return GL_VOLATILE_APPLE; + } + + bufObj->Purgeable = GL_TRUE; + + retval = GL_VOLATILE_APPLE; + if (ctx->Driver.RenderObjectPurgeable) + retval = ctx->Driver.RenderObjectPurgeable(ctx, bufObj, option); + + return retval; +} + +static GLenum +_mesa_TextureObjectPurgeable(GLcontext *ctx, GLuint name, GLenum option) +{ + struct gl_texture_object *bufObj; + GLenum retval; + + bufObj = _mesa_lookup_texture(ctx, name); + if (!bufObj) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glObjectPurgeable(name = 0x%x)", name); + return 0; + } + + if (bufObj->Purgeable) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glObjectPurgeable(name = 0x%x) is already purgeable", name); + return GL_VOLATILE_APPLE; + } + + bufObj->Purgeable = GL_TRUE; + + retval = GL_VOLATILE_APPLE; + if (ctx->Driver.TextureObjectPurgeable) + retval = ctx->Driver.TextureObjectPurgeable(ctx, bufObj, option); + + return retval; +} + +GLenum GLAPIENTRY +_mesa_ObjectPurgeableAPPLE(GLenum objectType, GLuint name, GLenum option) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); + + if (name == 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glObjectPurgeable(name = 0x%x)", name); + return 0; + } + + switch (option) { + case GL_VOLATILE_APPLE: + case GL_RELEASED_APPLE: + break; + + default: + _mesa_error(ctx, GL_INVALID_ENUM, + "glObjectPurgeable(name = 0x%x) invalid option: %d", name, option); + return 0; + } + + switch (objectType) { + case GL_TEXTURE: + return _mesa_TextureObjectPurgeable (ctx, name, option); + case GL_RENDERBUFFER_EXT: + return _mesa_RenderObjectPurgeable (ctx, name, option); + case GL_BUFFER_OBJECT_APPLE: + return _mesa_BufferObjectPurgeable (ctx, name, option); + + default: + _mesa_error(ctx, GL_INVALID_ENUM, + "glObjectPurgeable(name = 0x%x) invalid type: %d", name, objectType); + return 0; + } +} + +static GLenum +_mesa_BufferObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option) +{ + struct gl_buffer_object *bufObj; + GLenum retval; + + bufObj = _mesa_lookup_bufferobj(ctx, name); + if (!bufObj) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glObjectUnpurgeable(name = 0x%x)", name); + return 0; + } + + if (! bufObj->Purgeable) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glObjectUnpurgeable(name = 0x%x) object is already \"unpurged\"", name); + return 0; + } + + bufObj->Purgeable = GL_FALSE; + + retval = GL_RETAINED_APPLE; + if (ctx->Driver.BufferObjectUnpurgeable) + retval = ctx->Driver.BufferObjectUnpurgeable(ctx, bufObj, option); + + return retval; +} + +static GLenum +_mesa_RenderObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option) +{ + struct gl_renderbuffer *bufObj; + GLenum retval; + + bufObj = _mesa_lookup_renderbuffer(ctx, name); + if (!bufObj) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glObjectUnpurgeable(name = 0x%x)", name); + return 0; + } + + if (! bufObj->Purgeable) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glObjectUnpurgeable(name = 0x%x) object is already \"unpurged\"", name); + return 0; + } + + bufObj->Purgeable = GL_FALSE; + + retval = GL_RETAINED_APPLE; + if (ctx->Driver.RenderObjectUnpurgeable) + retval = ctx->Driver.RenderObjectUnpurgeable(ctx, bufObj, option); + + return retval; +} + +static GLenum +_mesa_TextureObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option) +{ + struct gl_texture_object *bufObj; + GLenum retval; + + bufObj = _mesa_lookup_texture(ctx, name); + if (!bufObj) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glObjectUnpurgeable(name = 0x%x)", name); + return 0; + } + + if (! bufObj->Purgeable) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glObjectUnpurgeable(name = 0x%x) object is already \"unpurged\"", name); + return 0; + } + + bufObj->Purgeable = GL_FALSE; + + retval = GL_RETAINED_APPLE; + if (ctx->Driver.TextureObjectUnpurgeable) + retval = ctx->Driver.TextureObjectUnpurgeable(ctx, bufObj, option); + + return retval; +} + +GLenum GLAPIENTRY +_mesa_ObjectUnpurgeableAPPLE(GLenum objectType, GLuint name, GLenum option) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); + + if (name == 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glObjectUnpurgeable(name = 0x%x)", name); + return 0; + } + + switch (option) { + case GL_RETAINED_APPLE: + case GL_UNDEFINED_APPLE: + break; + + default: + _mesa_error(ctx, GL_INVALID_ENUM, + "glObjectUnpurgeable(name = 0x%x) invalid option: %d", name, option); + return 0; + } + + switch (objectType) { + case GL_BUFFER_OBJECT_APPLE: + return _mesa_BufferObjectUnpurgeable(ctx, name, option); + + case GL_TEXTURE: + return _mesa_TextureObjectUnpurgeable(ctx, name, option); + + case GL_RENDERBUFFER_EXT: + return _mesa_RenderObjectUnpurgeable(ctx, name, option); + + default: + _mesa_error(ctx, GL_INVALID_ENUM, + "glObjectUnpurgeable(name = 0x%x) invalid type: %d", name, objectType); + return 0; + } +} + +static void +_mesa_GetBufferObjectParameterivAPPLE(GLcontext *ctx, GLuint name, GLenum pname, GLint* params) +{ + struct gl_buffer_object *bufObj; + + bufObj = _mesa_lookup_bufferobj(ctx, name); + if (!bufObj) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glGetObjectParameteriv(name = 0x%x) invalid object", name); + return; + } + + switch (pname) { + case GL_PURGEABLE_APPLE: + *params = bufObj->Purgeable; + break; + + default: + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetObjectParameteriv(name = 0x%x) invalid enum: %d", name, pname); + break; + } +} + +static void +_mesa_GetRenderObjectParameterivAPPLE(GLcontext *ctx, GLuint name, GLenum pname, GLint* params) +{ + struct gl_renderbuffer *bufObj; + + bufObj = _mesa_lookup_renderbuffer(ctx, name); + if (!bufObj) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glObjectUnpurgeable(name = 0x%x)", name); + return; + } + + switch (pname) { + case GL_PURGEABLE_APPLE: + *params = bufObj->Purgeable; + break; + + default: + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetObjectParameteriv(name = 0x%x) invalid enum: %d", name, pname); + break; + } +} + +static void +_mesa_GetTextureObjectParameterivAPPLE(GLcontext *ctx, GLuint name, GLenum pname, GLint* params) +{ + struct gl_texture_object *bufObj; + + bufObj = _mesa_lookup_texture(ctx, name); + if (!bufObj) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glObjectUnpurgeable(name = 0x%x)", name); + return; + } + + switch (pname) { + case GL_PURGEABLE_APPLE: + *params = bufObj->Purgeable; + break; + + default: + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetObjectParameteriv(name = 0x%x) invalid enum: %d", name, pname); + break; + } +} + +void GLAPIENTRY +_mesa_GetObjectParameterivAPPLE(GLenum objectType, GLuint name, GLenum pname, GLint* params) +{ + GET_CURRENT_CONTEXT(ctx); + + if (name == 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glGetObjectParameteriv(name = 0x%x)", name); + return; + } + + switch (objectType) { + case GL_TEXTURE: + _mesa_GetTextureObjectParameterivAPPLE (ctx, name, pname, params); + break; + + case GL_BUFFER_OBJECT_APPLE: + _mesa_GetBufferObjectParameterivAPPLE (ctx, name, pname, params); + break; + + case GL_RENDERBUFFER_EXT: + _mesa_GetRenderObjectParameterivAPPLE (ctx, name, pname, params); + break; + + default: + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetObjectParameteriv(name = 0x%x) invalid type: %d", name, objectType); + } +} +#endif diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index f8bca5f..912529c 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -175,4 +175,15 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, extern void GLAPIENTRY _mesa_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length); +#if FEATURE_APPLE_object_purgeable +extern GLenum GLAPIENTRY +_mesa_ObjectPurgeableAPPLE(GLenum objectType, GLuint name, GLenum option); + +extern GLenum GLAPIENTRY +_mesa_ObjectUnpurgeableAPPLE(GLenum objectType, GLuint name, GLenum option); + +extern void GLAPIENTRY +_mesa_GetObjectParameterivAPPLE(GLenum objectType, GLuint name, GLenum pname, GLint* params); +#endif + #endif diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 84b83fe..197de09 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -777,6 +777,23 @@ struct dd_function_table { #endif /** + * \name Functions for GL_APPLE_object_purgeable + */ +#if FEATURE_APPLE_object_purgeable + /*@{*/ + /* variations on ObjectPurgeable */ + GLenum (*BufferObjectPurgeable)( GLcontext *ctx, struct gl_buffer_object *obj, GLenum option ); + GLenum (*RenderObjectPurgeable)( GLcontext *ctx, struct gl_renderbuffer *obj, GLenum option ); + GLenum (*TextureObjectPurgeable)( GLcontext *ctx, struct gl_texture_object *obj, GLenum option ); + + /* variations on ObjectUnpurgeable */ + GLenum (*BufferObjectUnpurgeable)( GLcontext *ctx, struct gl_buffer_object *obj, GLenum option ); + GLenum (*RenderObjectUnpurgeable)( GLcontext *ctx, struct gl_renderbuffer *obj, GLenum option ); + GLenum (*TextureObjectUnpurgeable)( GLcontext *ctx, struct gl_texture_object *obj, GLenum option ); + /*@}*/ +#endif + + /** * \name Functions for GL_EXT_framebuffer_object */ #if FEATURE_EXT_framebuffer_object diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 673db30..43aadb1 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -9285,6 +9285,12 @@ _mesa_init_save_table(struct _glapi_table *table) /* 364. GL_EXT_provoking_vertex */ SET_ProvokingVertexEXT(table, save_ProvokingVertexEXT); + /* 371. GL_APPLE_object_purgeable */ +#if FEATURE_APPLE_object_purgeable + SET_ObjectPurgeableAPPLE(table, _mesa_ObjectPurgeableAPPLE); + SET_ObjectUnpurgeableAPPLE(table, _mesa_ObjectUnpurgeableAPPLE); +#endif + /* GL 3.0 */ #if 0 SET_ClearBufferiv(table, save_ClearBufferiv); diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 0e7e52a..30245d6 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -153,6 +153,7 @@ static const struct { { OFF, "GL_APPLE_client_storage", F(APPLE_client_storage) }, { ON, "GL_APPLE_packed_pixels", F(APPLE_packed_pixels) }, { OFF, "GL_APPLE_vertex_array_object", F(APPLE_vertex_array_object) }, + { OFF, "GL_APPLE_object_purgeable", F(APPLE_object_purgeable) }, { OFF, "GL_ATI_blend_equation_separate", F(EXT_blend_equation_separate) }, { OFF, "GL_ATI_envmap_bumpmap", F(ATI_envmap_bumpmap) }, { OFF, "GL_ATI_texture_env_combine3", F(ATI_texture_env_combine3)}, @@ -265,6 +266,9 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.ARB_sync = GL_TRUE; #endif ctx->Extensions.APPLE_vertex_array_object = GL_TRUE; +#if FEATURE_APPLE_object_purgeable + ctx->Extensions.APPLE_object_purgeable = GL_TRUE; +#endif ctx->Extensions.ATI_envmap_bumpmap = GL_TRUE; #if FEATURE_ATI_fragment_shader ctx->Extensions.ATI_fragment_shader = GL_TRUE; diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index f0896ee..cb96c4d 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -116,6 +116,7 @@ #define FEATURE_EXT_framebuffer_blit _HAVE_FULL_GL #define FEATURE_EXT_framebuffer_object _HAVE_FULL_GL #define FEATURE_EXT_pixel_buffer_object _HAVE_FULL_GL +#define FEATURE_APPLE_object_purgeable _HAVE_FULL_GL #define FEATURE_EXT_texture_sRGB _HAVE_FULL_GL #define FEATURE_ATI_fragment_shader _HAVE_FULL_GL #define FEATURE_NV_fence _HAVE_FULL_GL diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 4d55ebb..9d9b475 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1244,6 +1244,7 @@ struct gl_texture_object GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */ GLboolean _Complete; /**< Is texture object complete? */ GLboolean _RenderToTexture; /**< Any rendering to this texture? */ + GLboolean Purgeable; /**< Is the buffer purgeable under memory pressure? */ /** Actual texture images, indexed by [cube face] and [mipmap level] */ struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS]; @@ -1439,6 +1440,7 @@ struct gl_buffer_object GLsizeiptr Length; /**< Mapped length */ /*@}*/ GLboolean Written; /**< Ever written to? (for debugging) */ + GLboolean Purgeable; /**< Is the buffer purgeable under memory pressure? */ }; @@ -2104,6 +2106,7 @@ struct gl_renderbuffer GLuint Name; GLint RefCount; GLuint Width, Height; + GLboolean Purgeable; /**< Is the buffer purgeable under memory pressure? */ GLenum InternalFormat; /**< The user-specified format */ GLenum _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT or @@ -2491,6 +2494,7 @@ struct gl_extensions GLboolean APPLE_client_storage; GLboolean APPLE_packed_pixels; GLboolean APPLE_vertex_array_object; + GLboolean APPLE_object_purgeable; GLboolean ATI_envmap_bumpmap; GLboolean ATI_texture_mirror_once; GLboolean ATI_texture_env_combine3; -- 1.7.0 |
From: Chris W. <ch...@ch...> - 2010-03-05 12:04:35
|
Signed-off-by: Chris Wilson <ch...@ch...> --- src/mesa/glapi/gen/APPLE_object_purgeable.xml | 37 +++++++++++++++++++++++++ src/mesa/glapi/gen/Makefile | 1 + src/mesa/glapi/gen/gl_API.xml | 1 + 3 files changed, 39 insertions(+), 0 deletions(-) create mode 100644 src/mesa/glapi/gen/APPLE_object_purgeable.xml diff --git a/src/mesa/glapi/gen/APPLE_object_purgeable.xml b/src/mesa/glapi/gen/APPLE_object_purgeable.xml new file mode 100644 index 0000000..62fa64a --- /dev/null +++ b/src/mesa/glapi/gen/APPLE_object_purgeable.xml @@ -0,0 +1,37 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<OpenGLAPI> +<category name="GL_APPLE_object_purgeable" number="371"> + <enum name="RELEASED_APPLE" value="0x8A19"/> + <enum name="VOLATILE_APPLE" value="0x8A1A"/> + <enum name="RETAINED_APPLE" value="0x8A1B"/> + <enum name="UNDEFINED_APPLE" value="0x8A1C"/> + <enum name="PURGEABLE_APPLE" count="1" value="0x8A1D"> + <size name="GetObjectParameterivAPPLE" count="1" mode="get"/> + </enum> + + <enum name="BUFFER_OBJECT_APPLE" value="0x85B3"/> + + <function name="ObjectPurgeableAPPLE" offset="assign"> + <param name="objectType" type="GLenum"/> + <param name="name" type="GLuint"/> + <param name="option" type="GLenum"/> + <return type="GLenum"/> + </function> + + <function name="ObjectUnpurgeableAPPLE" offset="assign"> + <param name="objectType" type="GLenum"/> + <param name="name" type="GLuint"/> + <param name="option" type="GLenum"/> + <return type="GLenum"/> + </function> + + <function name="GetObjectParameterivAPPLE" offset="assign"> + <param name="objectType" type="GLenum"/> + <param name="name" type="GLuint"/> + <param name="pname" type="GLenum"/> + <param name="value" type="GLint *" output="true"/> + </function> +</category> +</OpenGLAPI> diff --git a/src/mesa/glapi/gen/Makefile b/src/mesa/glapi/gen/Makefile index 8e9c909..8aa74ce 100644 --- a/src/mesa/glapi/gen/Makefile +++ b/src/mesa/glapi/gen/Makefile @@ -79,6 +79,7 @@ API_XML = \ ARB_seamless_cube_map.xml \ ARB_sync.xml \ ARB_vertex_array_object.xml \ + APPLE_object_purgeable.xml \ APPLE_vertex_array_object.xml \ EXT_draw_buffers2.xml \ EXT_framebuffer_object.xml \ diff --git a/src/mesa/glapi/gen/gl_API.xml b/src/mesa/glapi/gen/gl_API.xml index 0b3d57b..4a4d0d5 100644 --- a/src/mesa/glapi/gen/gl_API.xml +++ b/src/mesa/glapi/gen/gl_API.xml @@ -11978,6 +11978,7 @@ </function> </category> +<xi:include href="APPLE_object_purgeable.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> <xi:include href="APPLE_vertex_array_object.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> <category name="GL_APPLE_ycbcr_422" number="275"> -- 1.7.0 |
From: Brian P. <br...@vm...> - 2010-03-05 14:48:16
|
Chris Wilson wrote: > Thanks to Intel QA providing a few piglit cases to test the API, this has > had a cursory test and identified the silly cases of using the wrong > lookup functions. > > The ugly part is that I've used 3 different driver functions to handle > each of the 3 object variants - the alternative would be pass in a void > pointer and a type id. If we acquire more distinct object types, then > multiplexing a single driver function would be preferable to adding > multiple stubs. > > Please review and include in 7.7! :) This will go into Mesa 7.8, actually. I see patches 1/4, 3/4 and 4/4 but not 2/4. Are the patches misnumbered or did 2/4 not get posted? Can you commit these, Chris? Are the new piglit tests going into the fd.o repository? I don't see them yet. -Brian |
From: Michel D. <mi...@da...> - 2010-03-05 14:51:37
|
On Fri, 2010-03-05 at 07:48 -0700, Brian Paul wrote: > Chris Wilson wrote: > > Thanks to Intel QA providing a few piglit cases to test the API, this has > > had a cursory test and identified the silly cases of using the wrong > > lookup functions. > > > > The ugly part is that I've used 3 different driver functions to handle > > each of the 3 object variants - the alternative would be pass in a void > > pointer and a type id. If we acquire more distinct object types, then > > multiplexing a single driver function would be preferable to adding > > multiple stubs. > > > > Please review and include in 7.7! :) > > This will go into Mesa 7.8, actually. > > I see patches 1/4, 3/4 and 4/4 but not 2/4. Are the patches > misnumbered or did 2/4 not get posted? It's larger than half a megabyte and only contains changes for autogenerated files, so I discarded it from the list moderation queue. -- Earthling Michel Dänzer | http://www.vmware.com Libre software enthusiast | Debian, X and DRI developer |
From: Chris W. <ch...@ch...> - 2010-03-05 15:23:13
|
On Fri, 05 Mar 2010 07:48:06 -0700, Brian Paul <br...@vm...> wrote: > Chris Wilson wrote: > > Please review and include in 7.7! :) > > This will go into Mesa 7.8, actually. > > I see patches 1/4, 3/4 and 4/4 but not 2/4. Are the patches > misnumbered or did 2/4 not get posted? As Michael pointed out, the changes to the autogenerated files were rather large. > Can you commit these, Chris? Ok, pushed to master. Thanks. > Are the new piglit tests going into the fd.o repository? I don't see > them yet. I shall ping Shuang He and ask for the tests to go upstream. -ickle -- Chris Wilson, Intel Open Source Technology Centre |
From: Brian P. <br...@vm...> - 2010-03-05 15:57:47
|
Chris Wilson wrote: > On Fri, 05 Mar 2010 07:48:06 -0700, Brian Paul <br...@vm...> wrote: >> Chris Wilson wrote: >>> Please review and include in 7.7! :) >> This will go into Mesa 7.8, actually. >> >> I see patches 1/4, 3/4 and 4/4 but not 2/4. Are the patches >> misnumbered or did 2/4 not get posted? > > As Michael pointed out, the changes to the autogenerated files were rather > large. > >> Can you commit these, Chris? > > Ok, pushed to master. Thanks. Thanks, Chris. I'm just going to make some minor clean-ups in bufferobj.c (not just your code). -Brian |
From: Ian R. <id...@fr...> - 2010-03-05 18:47:05
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Chris Wilson wrote: > On Fri, 05 Mar 2010 07:48:06 -0700, Brian Paul <br...@vm...> wrote: >> Chris Wilson wrote: >>> Please review and include in 7.7! :) >> This will go into Mesa 7.8, actually. >> >> I see patches 1/4, 3/4 and 4/4 but not 2/4. Are the patches >> misnumbered or did 2/4 not get posted? > > As Michael pointed out, the changes to the autogenerated files were rather > large. > >> Can you commit these, Chris? > > Ok, pushed to master. Thanks. > >> Are the new piglit tests going into the fd.o repository? I don't see >> them yet. > > I shall ping Shuang He and ask for the tests to go upstream. That's my fault. I was supposed to commit those for him about a month ago. I'll take care of that today. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkuRUXEACgkQX1gOwKyEAw+kpgCeNN7Iauq5Gf8xltcbrGjX1tTQ Dz8AnioB2EjcRFuGDTjViNgmQD8J2Y3Y =jxej -----END PGP SIGNATURE----- |
From: Ian R. <id...@fr...> - 2010-03-05 18:48:19
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Chris Wilson wrote: > Thanks to Intel QA providing a few piglit cases to test the API, this has > had a cursory test and identified the silly cases of using the wrong > lookup functions. > > The ugly part is that I've used 3 different driver functions to handle > each of the 3 object variants - the alternative would be pass in a void > pointer and a type id. If we acquire more distinct object types, then > multiplexing a single driver function would be preferable to adding > multiple stubs. > > Please review and include in 7.7! :) ^^^ 7.8, naturally. Should also add something to the 7.8 release notes. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkuRUcMACgkQX1gOwKyEAw8byQCgip4+vxWlSHkeJXNTxwmLsH0n 6KQAoJMZjrZ3OVwLhp1TNhP//dHKWAAc =+fTs -----END PGP SIGNATURE----- |