[PATCH] compositor: fix pitch initialization
Kristian Høgsberg
krh at bitplanet.net
Fri Aug 19 07:06:25 PDT 2011
On Fri, Aug 19, 2011 at 8:10 AM, Tiago Vignatti
<tiago.vignatti at intel.com> wrote:
> texture_region was getting a trash value for computing. I don't
> understand how we couldn't see any artifact on surface output in such
> case. Nevertheless, this is fixed with this patch and I guess we may
> want to drop pitch field from the structure, because it's being
> suppressed by the width one which seems interchangeably used everywhere
> there.
They're not used interchangeably and can be different for a shm
buffer. A better name may be texture_width, as it's really the width
of the texture. We want to always just use glTexImage2D directly from
the client provided shm buffer so that we hit memcpy in that case.
For a shm buffer with stride > width * 4, that means that we'll get a
texture that's wider than the surface, with garbage pixels past the
end of the line. So we track both the width of the surface (width)
and the width of the texture (pitch) so we can generate texture
coordinates correctly.
This patch is good, of course, applied with a minor edit of the commit msg.
Kristian
> Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
> ---
> compositor/compositor.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/compositor/compositor.c b/compositor/compositor.c
> index 2b88440..b2342b4 100644
> --- a/compositor/compositor.c
> +++ b/compositor/compositor.c
> @@ -754,6 +754,7 @@ fade_output(struct wlsc_output *output,
> surface.compositor = compositor;
> surface.x = output->x;
> surface.y = output->y;
> + surface.pitch = output->current->width;
> surface.width = output->current->width;
> surface.height = output->current->height;
> surface.texture = GL_NONE;
> --
> 1.7.2.2
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
More information about the wayland-devel
mailing list