diff --git a/clients/simple-dmabuf-v4l.c b/clients/simple-dmabuf-v4l.c index de77e36d..af25d0ea 100644 --- a/clients/simple-dmabuf-v4l.c +++ b/clients/simple-dmabuf-v4l.c @@ -360,7 +360,12 @@ create_dmabuf_buffer(struct display *display, struct buffer *buffer) unsigned i; modifier = 0; - flags = ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT; + flags = 0; + + /* XXX: apparently some webcams may actually provide y-inverted images, + * in which case we should set + * flags = ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT + */ params = zwp_linux_dmabuf_v1_create_params(display->dmabuf); for (i = 0; i < display->format.num_planes; ++i) diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c index ff487908..031576bc 100644 --- a/libweston/gl-renderer.c +++ b/libweston/gl-renderer.c @@ -1824,8 +1824,14 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface, buffer->width = dmabuf->attributes.width; buffer->height = dmabuf->attributes.height; + + /* + * GL-renderer uses the OpenGL convention of texture coordinates, where + * the origin is at bottom-left. Because dmabuf buffers have the origin + * at top-left, we must invert the Y_INVERT flag to get the image right. + */ buffer->y_inverted = - !!(dmabuf->attributes.flags & ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT); + !(dmabuf->attributes.flags & ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT); for (i = 0; i < gs->num_images; i++) egl_image_unref(gs->images[i]);