1 --- gtk+-2.24.33/configure.ac.orig
2 +++ gtk+-2.24.33/configure.ac
4 AC_DEFINE(HAVE_SYS_SYSINFO_H, 1,
5 [Define to 1 if sys/sysinfo.h is available]))
7 -AC_MSG_CHECKING(for mediaLib 2.3)
9 -# Check for a mediaLib 2.3 function since that is what the GTK+ mediaLib
10 +# Check for a mediaLib 2.5 function since that is what the GTK+ mediaLib
12 -AC_CHECK_LIB(mlib, mlib_ImageSetStruct, use_mlib=yes, use_mlib=no)
13 +AC_MSG_CHECKING(for mediaLib 2.5)
15 +# Check for a mediaLib 2.5 function since that is what is needed for
16 +# gdk_rgb_convert integration.
17 +AC_CHECK_LIB(mlib, mlib_VideoColorRGBint_to_BGRAint, use_mlib=yes, use_mlib=no)
18 if test $use_mlib = yes; then
19 AC_DEFINE(USE_MEDIALIB, 1,
20 - [Define to 1 if medialib is available and should be used])
23 - AC_MSG_CHECKING(for mediaLib 2.5)
24 - # Check for a mediaLib 2.5 function since that is what is needed for
25 - # gdk_rgb_convert integration.
26 - AC_CHECK_LIB(mlib, mlib_VideoColorRGBint_to_BGRAint, use_mlib25=yes, use_mlib25=no)
27 - if test $use_mlib25 = yes; then
28 - AC_DEFINE(USE_MEDIALIB25, 1,
29 - [Define to 1 if medialib 2.5 is available])
31 + [Define to 1 if medialib 2.5 is available])
33 AM_CONDITIONAL(USE_MEDIALIB, test $use_mlib = yes)
34 -AM_CONDITIONAL(USE_MEDIALIB25, test $use_mlib25 = yes)
36 dnl Look for a host system's gdk-pixbuf-csource if we are cross-compiling
38 --- gtk+-2.24.33/gdk/gdkdraw.c.orig
39 +++ gtk+-2.24.33/gdk/gdkdraw.c
40 @@ -1474,26 +1474,26 @@
42 mlib_image img_src, img_dst;
44 - mlib_ImageSetStruct (&img_dst,
51 + medialib_ImageSetStruct (&img_dst,
59 - mlib_ImageSetStruct (&img_src,
66 + medialib_ImageSetStruct (&img_src,
74 if (dest_byte_order == GDK_LSB_FIRST)
75 - mlib_ImageBlendRGBA2BGRA (&img_dst, &img_src);
76 + medialib_BlendRGBA2BGRA (&img_dst, &img_src);
78 - mlib_ImageBlendRGBA2ARGB (&img_dst, &img_src);
79 + medialib_BlendRGBA2ARGB (&img_dst, &img_src);
83 --- gtk+-2.24.33/gdk/gdkmedialib.c.orig
84 +++ gtk+-2.24.33/gdk/gdkmedialib.c
87 #include "gdkmedialib.h"
89 -typedef char * (*ml_version) (void);
90 +ml_ImageSetStruct medialib_ImageSetStruct = NULL;
91 +ml_BlendRGBA2BGRA medialib_BlendRGBA2BGRA = NULL;
92 +ml_BlendRGBA2ARGB medialib_BlendRGBA2ARGB = NULL;
93 +ml_ColorRGBint_to_BGRAint medialib_ColorRGBint_to_BGRAint = NULL;
95 -static ml_version medialib_version = mlib_version;
99 + void *handle = NULL;
102 -_gdk_use_medialib (void)
103 + if ((handle = dlopen ("libmlib.so.2", RTLD_LAZY)) != NULL)
105 + if ((handle = dlopen ("/usr/lib/libmlib.so.2", RTLD_LAZY)) != NULL)
112 +initialize_mediaLib (void *handle)
114 + medialib_ImageSetStruct = (ml_ImageSetStruct)dlsym (handle,
115 + "mlib_ImageSetStruct");
116 + medialib_BlendRGBA2BGRA = (ml_BlendRGBA2BGRA)dlsym (handle,
117 + "mlib_ImageBlendRGBA2BGRA");
118 + medialib_BlendRGBA2ARGB = (ml_BlendRGBA2ARGB)dlsym (handle,
119 + "mlib_ImageBlendRGBA2ARGB");
120 + medialib_ColorRGBint_to_BGRAint = (ml_ColorRGBint_to_BGRAint)dlsym (
122 + "mlib_VideoColorRGBint_to_BGRAint");
123 + if (medialib_ImageSetStruct == NULL || medialib_BlendRGBA2BGRA == NULL ||
124 + medialib_BlendRGBA2ARGB == NULL || medialib_ColorRGBint_to_BGRAint == NULL)
131 +mlib_x86_checks (void *handle)
133 + typedef char * (*ml_version) (void);
134 + ml_version medialib_version;
135 char *mlib_version_string;
136 - char sys_info[257];
138 + char *mlib_target_isa;
141 - * Sun mediaLib(tm) support.
143 - * http://www.sun.com/processors/vis/mlib.html
146 - if (getenv ("GDK_DISABLE_MEDIALIB"))
147 + medialib_version = (ml_version)dlsym (handle, "mlib_version");
148 + if (medialib_version == NULL)
152 - * The imaging functions we want to use were added in mediaLib version 2.
153 - * So turn off mediaLib support if the user has an older version.
154 * mlib_version returns a string in this format:
156 * mediaLib:0210:20011101:v8plusa
159 * The first 2 digits of the version are the major version. The 3rd digit
160 * is the minor version, and the 4th digit is the micro version. So the
161 - * above string corresponds to version 2.1.0.In the following test we only
162 - * care about the major version.
163 + * above string corresponds to version 2.1.0.
165 - mlib_version_string = medialib_version ();
166 + mlib_version_string = medialib_version ();
167 + mlib_target_isa = &mlib_version_string[23];
169 - count = sysinfo (SI_ARCHITECTURE, &sys_info[0], 257);
171 + * For x86 processors mediaLib generic C implementation
172 + * does not give any performance advantage so disable it.
174 + if (strncmp (mlib_target_isa, "sse", 3) != 0)
178 + * For x86 processors use of libumem conflicts with
179 + * mediaLib, so avoid using it.
181 + if (dlsym (RTLD_PROBE, "umem_alloc") != NULL)
188 + * Sun mediaLib(tm) support.
190 + * http://www.sun.com/processors/vis/mlib.html
194 +_gdk_use_medialib (void)
196 + static gboolean medialib_initialized = FALSE;
197 + static gboolean use_medialib = TRUE;
198 + void *medialib_handle = NULL;
199 + char sys_info[257];
202 + if (medialib_initialized == TRUE)
205 + if (use_medialib == FALSE)
208 + if (getenv ("GDK_DISABLE_MEDIALIB"))
210 + use_medialib = FALSE;
214 + medialib_handle = dlopen_mlib ();
215 + if (medialib_handle == NULL)
218 + count = sysinfo (SI_ARCHITECTURE, &sys_info[0], 257);
222 - if (strcmp (sys_info, "i386") == 0)
224 - char *mlib_target_isa = &mlib_version_string[23];
227 - * For x86 processors mediaLib generic C implementation
228 - * does not give any performance advantage so disable it.
230 - if (strncmp (mlib_target_isa, "sse", 3) != 0)
236 - * For x86 processors use of libumem conflicts with
237 - * mediaLib, so avoid using it.
239 - if (dlsym (RTLD_PROBE, "umem_alloc") != NULL)
247 - /* Failed to get system architecture, disable mediaLib */
252 + if (strcmp (sys_info, "i386") == 0)
254 + if (mlib_x86_checks (medialib_handle) == FALSE)
260 + /* Failed to get system architecture, disable mediaLib */
264 + if (initialize_mediaLib (medialib_handle) == FALSE)
267 + medialib_initialized = TRUE;
271 + dlclose (medialib_handle);
272 + use_medialib = FALSE;
275 --- gtk+-2.24.33/gdk/gdkmedialib.h.orig
276 +++ gtk+-2.24.33/gdk/gdkmedialib.h
281 +typedef mlib_image* (*ml_ImageSetStruct) (mlib_image *image,
288 +typedef mlib_status (*ml_BlendRGBA2BGRA) (mlib_image *dst,
289 + const mlib_image *src);
290 +typedef mlib_status (*ml_BlendRGBA2ARGB) (mlib_image *dst,
291 + const mlib_image *src);
292 +typedef void (*ml_ColorRGBint_to_BGRAint) (mlib_u8 *bgra,
293 + const mlib_u8 *rgb,
294 + const mlib_u8 *a_array,
302 +extern ml_ColorRGBint_to_BGRAint medialib_ColorRGBint_to_BGRAint;
303 +extern ml_ImageSetStruct medialib_ImageSetStruct;
304 +extern ml_BlendRGBA2BGRA medialib_BlendRGBA2BGRA;
305 +extern ml_BlendRGBA2ARGB medialib_BlendRGBA2ARGB;
307 gboolean _gdk_use_medialib (void);
310 --- gtk+-2.24.33/gdk/gdkrgb.c.orig
311 +++ gtk+-2.24.33/gdk/gdkrgb.c
312 @@ -2155,7 +2155,7 @@
316 -#ifdef USE_MEDIALIB25
318 /* convert 24-bit packed to 32-bit unpacked */
320 gdk_rgb_convert_0888_medialib (GdkRgbInfo *image_info, GdkImage *image,
321 @@ -2172,9 +2172,9 @@
323 obuf = ((guchar *)image->mem) + y0 * bpl + x0 * 4;
325 - mlib_VideoColorRGBint_to_BGRAint (obuf, bptr, NULL, 0xff,
326 - width, height, bpl,
328 + medialib_ColorRGBint_to_BGRAint (obuf, bptr, NULL, 0xff,
329 + width, height, bpl,
334 @@ -3158,7 +3158,7 @@
335 vtype == GDK_VISUAL_TRUE_COLOR &&
336 (mask_rgb && byte_order == GDK_LSB_FIRST))
338 -#ifdef USE_MEDIALIB25
340 if (_gdk_use_medialib ())
341 conv = gdk_rgb_convert_0888_medialib;
343 @@ -3185,7 +3185,7 @@
344 else if (bpp == 32 && depth == 32 && vtype == GDK_VISUAL_TRUE_COLOR &&
345 (mask_rgb && byte_order == GDK_LSB_FIRST))
347 -#ifdef USE_MEDIALIB25
349 if (_gdk_use_medialib ())
350 conv = gdk_rgb_convert_0888_medialib;