[PATCH] Avoid unnecessarily re-allocating texture buffer when the size hasn't changed.

Sinclair Yeh sinclair.yeh at intel.com
Thu May 23 09:59:50 PDT 2013


On Thu, May 23, 2013 at 05:47:01PM +0100, Daniel Stone wrote:
> Hi,
> 
> On 23 May 2013 17:38, Sinclair Yeh <sinclair.yeh at intel.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->pitch)) {
> 
> It seems like this really should be a test against width rather than
> pitch; also, you're comparing buffer->height to gs->pitch, rather than
> gs->height.

I see what you mean.  I kept this notation because this is now the
existing code is using gs->pitch.  Looking around to see how it is being
used in the file, it does look like gs->pitch should be renamed to gs->width.

I'll wait a little and see what others think about changing the name of
this field.

I've changed the comparison to gs->height.

Thanks,

Sinclair




More information about the wayland-devel mailing list