[PATCH] Avoid unnecessarily re-allocating texture buffer when the size hasn't changed.
Sinclair Yeh
sinclair.yeh at intel.com
Tue May 28 15:38:05 PDT 2013
On Sun, 26 May 2013 20:03:40 -0400
Kristian Høgsberg <hoegsberg at gmail.com> wrote:
> > + /* Only allocate a texture if it doesn't match
> > existing one */
> > + if (((wl_shm_buffer_get_stride(buffer) / 4) !=
> > gs->pitch) ||
> > + (buffer->height != gs->height)) {
>
> I would prefer a little fewer parentheses here - only the () required
> by if are necessary. Nitpicks aside, we need to also call
> glTexImage2D in case we're switching from a egl buffer to a shm
> buffer. If we don't the texture will remain backed by the EGLImage
> from the previous frame and the glTexSubImage2D in flush_damage will
> write into that buffer.
>
> The best way to check if we're coming from a EGLImage buffer is to
> see if gs->num_images is > 0, which I'd just add to the if statement.
I am unfamiliar with this particular case, but I've added the check.
What is the usage scenario for switching from DRM backed buffer to SHM?
Also, here do I need to do any of the house cleaning done by the
"if(!buffer)" condition above or are these going to be cleaned up by a
different API?
More information about the wayland-devel
mailing list