cairo-1.12.10-xlib-regression-fix.patch: Fix a regression caused by

mit-shm surfaces.
This commit is contained in:
Adam Jackson 2013-01-28 16:39:25 -05:00
parent da605af93f
commit 150f31585d
4 changed files with 97 additions and 68 deletions

View File

@ -1,29 +0,0 @@
From 84338157ab9e06fa89785af14772e046e2f9e747 Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
Date: Tue, 18 Dec 2012 12:49:19 -0500
Subject: [PATCH] xlib/shm: Fix memory leak
Despite subclassing image surfaces, we never called down to the image
surface destructor, so we leaked a pixman_image_t every time.
Signed-off-by: Adam Jackson <ajax@redhat.com>
---
src/cairo-xlib-surface-shm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cairo-xlib-surface-shm.c b/src/cairo-xlib-surface-shm.c
index b03dd83..684d7e8 100644
--- a/src/cairo-xlib-surface-shm.c
+++ b/src/cairo-xlib-surface-shm.c
@@ -679,7 +679,7 @@ _cairo_xlib_shm_surface_finish (void *abstract_surface)
cairo_list_del (&shm->link);
cairo_device_release (&display->base);
- return CAIRO_STATUS_SUCCESS;
+ return _cairo_image_surface_finish (abstract_surface);
}
static const cairo_surface_backend_t cairo_xlib_shm_surface_backend = {
--
1.8.0.1

View File

@ -0,0 +1,90 @@
From fa4f48cccb6c7f4e1afb2ff4b98b906b7d8d4afc Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris@chris-wilson.co.uk>
Date: Wed, 23 Jan 2013 15:04:26 +0000
Subject: xlib: Do not upload the whole image just because we want an entire row
Fixes regression exposed by
commit a73e7ff0186176bc82cd3ae1432c054c1fd3aebd
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Sun Jan 6 11:29:27 2013 +0000
xlib: Simplify source creation by use of map-to-image
but ultimately from
commit 74941f822015cc50cd8477d0cf97f1a70dbff60b
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Wed Jan 2 22:27:55 2013 +0000
xlib: Use SHM transport for ordinary image uploads
Reported-by: Gökçen Eraslan <gokcen.eraslan@gmail.com>
Reported-by: Guillaume Ayoub <guillaume.ayoub@kozea.fr>
Reported-by: Emmanuel Benisty <benisty.e@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59635
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
diff --git a/src/cairo-xlib-source.c b/src/cairo-xlib-source.c
index 24290f7..ca55278 100644
--- a/src/cairo-xlib-source.c
+++ b/src/cairo-xlib-source.c
@@ -1035,7 +1035,13 @@ surface_source (cairo_xlib_surface_t *dst,
status = _cairo_surface_unmap_image (&xsrc->base, image);
if (unlikely (status)) {
- cairo_surface_destroy (src);
+ cairo_surface_destroy (&xsrc->base);
+ return _cairo_surface_create_in_error (status);
+ }
+
+ status = _cairo_xlib_surface_put_shm (xsrc);
+ if (unlikely (status)) {
+ cairo_surface_destroy (&xsrc->base);
return _cairo_surface_create_in_error (status);
}
}
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index dbc677e..ee69b66 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -1139,26 +1139,24 @@ _cairo_xlib_surface_draw_image (cairo_xlib_surface_t *surface,
max_request_size = XMaxRequestSize (display->display);
if (max_request_size > 8192)
max_request_size = 8192;
- if (image->stride * image->height > max_request_size) {
+ if (width * height * 4 > max_request_size) {
shm_image = _cairo_xlib_surface_create_shm__image (surface,
image->pixman_format,
- image->width,
- image->height);
+ width, height);
if (shm_image && shm_image->status == CAIRO_STATUS_SUCCESS) {
cairo_image_surface_t *clone = (cairo_image_surface_t *) shm_image;
- if (clone->stride == image->stride) {
- memcpy (clone->data, image->data, clone->stride * clone->height);
- } else {
- pixman_image_composite32 (PIXMAN_OP_SRC,
- image->pixman_image, NULL, clone->pixman_image,
- 0, 0,
- 0, 0,
- 0, 0,
- image->width, image->height);
- }
+ pixman_image_composite32 (PIXMAN_OP_SRC,
+ image->pixman_image, NULL, clone->pixman_image,
+ src_x, src_y,
+ 0, 0,
+ 0, 0,
+ width, height);
ximage.obdata = _cairo_xlib_shm_surface_get_obdata (shm_image);
ximage.data = (char *)clone->data;
ximage.bytes_per_line = clone->stride;
+ ximage.width = width;
+ ximage.height = height;
+ src_x = src_y = 0;
}
}
} else
--
cgit v0.9.0.2-2-gbebe

View File

@ -1,38 +0,0 @@
From f59b0914f4ddbff0d116c918343a6726d5f4317b Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris@chris-wilson.co.uk>
Date: Sat, 11 Aug 2012 16:38:36 +0000
Subject: egl: s/EGL_KHR_surfaceless_opengl/EGL_KHR_surfaceless_context/
Mesa changed the name of the extension it invented, so check for the
real name and the old name before falling back to pbuffers which are not
supported by most EGL implementations.
References: https://bugs.freedesktop.org/show_bug.cgi?id=53361
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
diff --git a/src/cairo-egl-context.c b/src/cairo-egl-context.c
index eb1ef29..b24bc80 100644
--- a/src/cairo-egl-context.c
+++ b/src/cairo-egl-context.c
@@ -122,8 +122,10 @@ _egl_make_current_surfaceless(cairo_egl_context_t *ctx)
const char *extensions;
extensions = eglQueryString(ctx->display, EGL_EXTENSIONS);
- if (!strstr(extensions, "EGL_KHR_surfaceless_opengl"))
+ if (strstr(extensions, "EGL_KHR_surfaceless_context") == NULL &&
+ strstr(extensions, "EGL_KHR_surfaceless_opengl") == NULL)
return FALSE;
+
if (!eglMakeCurrent(ctx->display,
EGL_NO_SURFACE, EGL_NO_SURFACE, ctx->context))
return FALSE;
@@ -174,7 +176,6 @@ cairo_egl_device_create (EGLDisplay dpy, EGLContext egl)
eglChooseConfig (dpy, config_attribs, &config, 1, &numConfigs);
ctx->dummy_surface = eglCreatePbufferSurface (dpy, config, attribs);
-
if (ctx->dummy_surface == NULL) {
free (ctx);
return _cairo_gl_context_create_in_error (CAIRO_STATUS_NO_MEMORY);
--
cgit v0.9.0.2-2-gbebe

View File

@ -5,7 +5,7 @@
Summary: A 2D graphics library
Name: cairo
Version: 1.12.10
Release: 1%{?dist}
Release: 2%{?dist}
URL: http://cairographics.org
#VCS: git:git://git.freedesktop.org/git/cairo
#Source0: http://cairographics.org/snapshots/%{name}-%{version}.tar.gz
@ -15,6 +15,7 @@ Group: System Environment/Libraries
Patch0: 0001-xlib-Don-t-crash-when-swapping-a-0-sized-glyph.patch
Patch1: 0002-xcb-Don-t-crash-when-swapping-a-0-sized-glyph.patch
Patch2: cairo-1.12.10-xlib-regression-fix.patch
BuildRequires: pkgconfig
BuildRequires: libXrender-devel
@ -96,6 +97,7 @@ This package contains tools for working with the cairo graphics library.
%setup -q
%patch0 -p1 -b .xlib-swap
%patch1 -p1 -b .xcb-swap
%patch2 -p1 -b .putimage
%build
%configure --disable-static \
@ -179,6 +181,10 @@ rm $RPM_BUILD_ROOT%{_libdir}/*.la
%{_libdir}/cairo/
%changelog
* Mon Jan 28 2013 Adam Jackson <ajax@redhat.com> 1.12.10-2
- cairo-1.12.10-xlib-regression-fix.patch: Fix a regression caused by
mit-shm surfaces.
* Wed Jan 16 2013 Adam Jackson <ajax@redhat.com> 1.12.10-1
- cairo 1.12.10
- 0001-xlib-shm-Fix-memory-leak.patch: Drop, merged.