>> validate_and_get_current_sequence_number(), and the results reused in >> update_buffers(). > This works too. It assumes fast texture creation (as they are always asked > for), which is true with your DRI2 texture cache patch. It's even better, they would only asked for is the surface is updated. The validate_and_get_current_sequence_number would store the buffer names and updated dimensions in the private surface structure, and delete any textures it has stored that are outdated. Then, textures are only created from the names (if not already present) during the call to update_buffers(), which is only made if the sequence number changed.
It would be somewhat like this: /* Updates the surface dimensions and sequence number with a call to the window system. It returns the new width and height and sequence number. If the sequence number is updated, any previously returned texture may or may not be still displayable on the window system surface. Subsequent get_texture calls are only allowed to request a subset of the attachments specified there */ void (*update)(struct native_surface *nsurf, const enum native_attachment *natts, unsigned num_natts); { for each attachment not requested { set buffer name to null and destroy the texture if present } DRI2GetBuffers(); if(width changed || height changed || we destroyed a texture above) update seq num; for each buffer { if the name or pitch changed, destroy the associated texture if present. store buffer name/pitch update has_back, has_fake } return seq num; } /* Returns the current textures for the surface attachments specified, which must be a subset of those specified in the last update call. No window system calls are made. */ void (*get_textures)(struct native_surface *nsurf, const enum native_attachment *natts, unsigned num_natts, struct pipe_texture**textures) { for each requested attachment i { assert(dri2surf->names[i] != 0); if(!dri2surf->textures[i]) dri2surf->textures[i] = texture_from_name(dri2surf->names[i]) pipe_texture_reference(&textures[i], dri2surf->textures[i]); } } // this may be replaced by public fields unsigned (*get_info)(struct native_surface *nsurf, unsigned* width, unsigned* height) { if(width) *width = surf->width; if(height *height = surf->height; return surf->seq_num; } Note that for update there is the issue of having two context using the surface with different attachments. They will tramp over each other, but the last revalidating should work. This why I put a sequence number change on texture destruction in the pseudocode and read buffers unconditionally. Other approaches are possible though (e.g. remembering an attachment bitmask and comparing). This would be used as: if(the user has not specified that the surface should not be updated with some extension or other mechanism) surf->update(surf, attachments) seq_num = surf->get_info(surf, &width, &height); if(ctx just switched to a new surface || ctx->seq_num != seq_num) { surf->get_textures(attachments); put textures in framebuffer } ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev