-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Chris Wilson wrote: > Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk> > --- > src/mesa/drivers/dri/intel/intel_buffer_objects.c | 43 > +++++++++++++++++++++ > src/mesa/drivers/dri/intel/intel_context.c | 1 + > 2 files changed, 44 insertions(+), 0 deletions(-) > > diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c > b/src/mesa/drivers/dri/intel/intel_buffer_objects.c > index ea9d5a6..856d71a 100644 > --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c > +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c > @@ -573,6 +573,44 @@ intel_bufferobj_copy_subdata(GLcontext *ctx, > intel_batchbuffer_emit_mi_flush(intel->batch); > } > > +#if FEATURE_APPLE_object_purgeable > +static GLenum > +intel_bufferobj_purgeable(GLcontext * ctx, > + struct gl_buffer_object *obj, > + GLenum option) > +{ > + struct intel_buffer_object *intel_obj = intel_buffer_object(obj); > + int retained; > + > + if (intel_obj->buffer != NULL) { > + retained = drm_intel_bo_madvise (intel_obj->buffer, > I915_MADV_DONTNEED); > + } else { > + if (intel_obj->sys_buffer != NULL) { > + _mesa_free(intel_obj->sys_buffer);
I don't think we want to free the buffer here. This case really only happens on i915 for vertex buffers. I don't expect these types of buffers to be marked purgeable very often. Can we do madvise(MADV_WONTNEED) instead? This isn't quite the same (it doesn't release the contents during memory pressure), but it seems close enough. > + intel_obj->sys_buffer = NULL; > + } > + retained = 0; > + } > + > + return retained ? GL_VOLATILE_APPLE : GL_RELEASED_APPLE; > +} > + > +static GLenum > +intel_bufferobj_unpurgeable(GLcontext * ctx, > + struct gl_buffer_object *obj, > + GLenum option) > +{ > + struct intel_buffer_object *intel_obj = intel_buffer_object(obj); > + int retained; > + > + retained = 1; > + if (intel_obj->buffer != NULL) > + retained = drm_intel_bo_madvise (intel_obj->buffer, > I915_MADV_WILLNEED); > + > + return retained ? GL_RETAINED_APPLE : GL_UNDEFINED_APPLE; > +} > +#endif > + > void > intelInitBufferObjectFuncs(struct dd_function_table *functions) > { > @@ -586,4 +624,9 @@ 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->ObjectPurgeable = intel_bufferobj_purgeable; > + functions->ObjectUnpurgeable = intel_bufferobj_unpurgeable; > +#endif > } > diff --git a/src/mesa/drivers/dri/intel/intel_context.c > b/src/mesa/drivers/dri/intel/intel_context.c > index e0022ad..cfdb867 100644 > --- a/src/mesa/drivers/dri/intel/intel_context.c > +++ b/src/mesa/drivers/dri/intel/intel_context.c > @@ -758,6 +758,7 @@ intelInitContext(struct intel_context *intel, > > intel_fbo_init(intel); > > + _mesa_enable_extension(ctx, "GL_APPLE_object_purgeable"); No! Add this to the ttm_extensions table in intel_extensions.c. > if (intel->ctx.Mesa_DXTn) { > _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); > _mesa_enable_extension(ctx, "GL_S3_s3tc"); -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkr7HDAACgkQX1gOwKyEAw96VACbBZUvJcL23m3SqqpKr0SiG9ce TJkAn0pWVLhfkjrGrbRjknABDVuKoIUA =1s2x -----END PGP SIGNATURE----- ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july -- _______________________________________________ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel