[PATCH weston] compositor: Fix rendering with shm transformed buffers

Rob Bradford robert.bradford at intel.com
Wed Nov 28 08:56:50 PST 2012


Hi Ander, good catch..

On 28 November 2012 15:10, Ander Conselvan de Oliveira
<ander.conselvan.de.oliveira at intel.com> wrote:
> The implementation of buffer transformation didn't handle transformed
> shm buffers properly. The partial texture upload was broken since the
> damage is in surface coordinates that don't necessarily match the
> buffer's coordinates. It also wouldn't handle the buffer stride
> properly, resulting in incorrect rendering if it didn't match the
> buffer's width.
>

> +WL_EXPORT pixman_box32_t
> +weston_surface_to_buffer_rect(struct weston_surface *surface,
> +                             pixman_box32_t rect)
> +{
> +       float x1, x2, y1, y2;
> +
> +       pixman_box32_t ret;
> +
> +       weston_surface_to_buffer_float(surface, rect.x1, rect.y1, &x1, &y1);
> +       weston_surface_to_buffer_float(surface, rect.x2, rect.y2, &x2, &y2);
> +
> +       if (x1 <= x2) {
> +               ret.x1 = x1;
> +               ret.x2 = x2;
> +       } else {
> +               ret.x1 = x2;
> +               ret.x2 = x1;
> +       }
> +
> +       if (y1 <= y2) {
> +               ret.y1 = y1;
> +               ret.y2 = y2;
> +       } else {
> +               ret.y1 = y2;
> +               ret.y2 = y1;
> +       }

But since we pass these values into glTexImage2D - I think we might
need to floor the lower x/y bound and ceil the upper x/y bound?

Cheers,

Rob


More information about the wayland-devel mailing list