summaryrefslogtreecommitdiff
path: root/pixman
Commit message (Collapse)AuthorAgeFilesLines
* meson: Fix warning about extract_all_objects usageNirbheek Chauhan2022-01-211-8/+1
| | | | | | | | | | | | | | We use this because of a meson bug that was fixed in 0.52: https://mesonbuild.com/Release-notes-for-0-52-0.html#improved-support-for-static-libraries Bump the requirement and remove the extract_all_objects workaround. This gets rid of a meson warning: WARNING: extract_all_objects called without setting recursive keyword argument. Meson currently defaults to non-recursive to maintain backward compatibility but the default will be changed in the future.
* added aarch64 bilinear implementations (ver.4.1)Mizuki Asakura2021-09-178-1/+6339
| | | | | | | | | | | | | | | | Since aarch64 has different neon syntax from aarch32 and has no support for (older) arm-simd, there are no SIMD accelerations for pixman on aarch64. We need new implementations. This patch also contains Ben Avions's series of patches for aarch32 and now the benchmark results are fine to aarch64. Please find the result at the below ticket. Added: https://bugs.freedesktop.org/show_bug.cgi?id=94758 Signed-off-by: Mizuki Asakura <ed6e117f@gmail.com>
* Constify region APIsSimon Ser2021-09-172-114/+114
| | | | | | | This allows callers to pass around const Pixman region in their APIs, improving type safety and documentation. Signed-off-by: Simon Ser <contact@emersion.fr>
* Fix -Wincompatible-function-pointer-types warningAlex Richardson2021-09-171-2/+2
| | | | | | | Adding const to the return type does nothing and means that the function pointer types do not match exactly: error: incompatible function pointer types passing 'const float (int, int)' to parameter of type 'dither_factor_t' (aka 'float (*)(int, int)')
* Fix masked pixel fetching with wide formatManuel Stoeckl2021-08-091-2/+6
| | | | | | | | | | | | | | | | In __bits_image_fetch_affine_no_alpha and __bits_image_fetch_general, when `wide` is true, the mask is actually an array of argb_t instead of the array of uint32_t it was cast to, and the access to `mask[i]` does not correctly detect when the pixel is nontrivial. The code now uses a check appropriate for argb_t when `wide` is true. One caveat: this new check only skips entries when the mask pixel data is binary all zero; this misses cases like `-0.f` which would be caught by the FLOAT_IS_ZERO macro. As the mask check only appears to be a performance optimization to avoid loading inconsequential pixels, it erring on the side of loading more pixels is safe. Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
* Fix signed-unsigned semantics in reduce_32Heiko Lewin2021-07-212-21/+34
|
* Fix AltiVec detection on FreeBSD.pkubaj2021-05-071-0/+18
|
* Avoid out-of-bounds read when accessing individual bytes from mask.Jonathan Kew2021-05-071-22/+23
| | | | | | | | | | | | | | | | | | | | | The important changes here are a handful of places where we replace memcpy(&m, mask++, sizeof(uint32_t)); or similar code with uint8_t m = *mask++; because we're only supposed to be reading a single byte from *mask, and accessing a 32-bit value may read out of bounds (besides that it reads values we don't actually want; whether this matters would depend exactly how the value in m is subsequently used). I've also changed a bunch of other places to use this same pattern (a local 8-bit variable) when reading individual bytes from the mask; the code was inconsistent about this, sometimes casting the byte to a uint32_t instead. This makes no actual difference, it just seemed better to use a consistent pattern throughout the file.
* meson: add cpu-features-path option for AndroidTim-Philipp Müller2020-06-021-1/+15
| | | | | | | | Add option to include cpu-features.[ch] from a given path into the build for platforms that don't provide this out of the box. This is needed on Android. Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
* Prevent empty top-level declarationMichael Forney2020-04-262-4/+4
| | | | | | | | The expansion of PIXMAN_DEFINE_THREAD_LOCAL(...) may end in a function definition, so the following semicolon is considered an empty top-level declaration, which is not allowed in ISO C. Reviewed-by: Matt Turner <mattst88@gmail.com>
* Distribute the blue-noise filesMatt Turner2020-04-192-0/+2
| | | | Signed-off-by: Matt Turner <mattst88@gmail.com>
* Enabled armv6 SIMD for 3DS (devkitARM) and arm neon SIMD for PS Vita ↵Ghabry2020-04-141-0/+25
| | | | (vitasdk) and Switch (devkitA64)
* loongson: Avoid C90 mixing-code-and-decls warningMatt Turner2020-04-071-8/+10
|
* fast-path: Fix some sketchy pointer arithmeticAdam Jackson2020-04-021-7/+7
| | | | | | | | | We want a uint8_t * at the end of this math, because that's what the function we're about to pass it to takes. But ->bits is a uint32_t, so if we just do the math in units of that we can avoid the explicit factor of four which would risk an integer overflow. Fixes: pixman/pixman#14
* Initialize temporary buffers in general_composite_rect()Federico Mena Quintero2020-03-181-0/+6
| | | | | | | | Otherwise, Valgrind shows things like "conditional jump or move depends on uninitialised values" errors much later in calling code. For example, see https://gitlab.gnome.org/GNOME/librsvg/issues/572 Fixes https://gitlab.freedesktop.org/pixman/pixman/issues/9
* pixman-compiler.h: fix building tests with MinGWAntonio Ospite2020-03-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | MinGW supports __declspec(dllexport) but the current logic that sets PIXMAN_EXPORT only uses it when building with MSVC, leaving some symbols hidden when building with MinGW. This results in an error when trying to link the tests: ----------------------------------------------------------------------- FAILED: subprojects/pixman/test/combiner-test.exe x86_64-w64-mingw32-gcc -o subprojects/pixman/test/combiner-test.exe 'subprojects/pixman/test/f48fa9c@@combiner-test@exe/combiner-test.c.obj' -Wl,--allow-shlib-undefined -Wl,--start-group subprojects/pixman/test/libtestutils.a subprojects/pixman/pixman/libpixman-1.dll.a -pthread -fopenmp -fopenmp -lm -mconsole -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -Wl,--end-group /usr/bin/x86_64-w64-mingw32-ld: subprojects/pixman/test/f48fa9c@@combiner-test@exe/combiner-test.c.obj: in function `main': .../build/../subprojects/pixman/test/combiner-test.c:124: undefined reference to `_pixman_internal_only_get_implementation' collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed. ----------------------------------------------------------------------- By using PIXMAN_API also when building with MinGW, the tests can link successfully and the build succeed. Tested with x86_64-w64-mingw32-gcc (GCC) 8.3-win32 20191201.
* pixman-combine: Fix wrong value of RB_MASK_PLUS_ONE.Yin Shiyou2020-02-201-1/+1
| | | | | No functional change, as explained by Søren in https://lists.freedesktop.org/archives/pixman/2020-February/004902.html
* pixman/meson.build: Define PIXMAN_API on MSVC-style compilersChun-wei Fan2019-11-191-1/+7
| | | | | This will make the public APIs exported from the DLL, so that we have an import libary that we can use.
* pixman-[compiler|private].h: Export symbols for testsChun-wei Fan2019-11-192-0/+5
| | | | | | | | | Define the existing PIXMAN_EXPORT to be PIXMAN_API, which can overriden to be __declspec(dllexport) during the build of the pixman DLL on MSVC builds, which will be in the next patch. Also, export more private symbols as they are needed for the test programs.
* pixman/pixman.h: Mark public APIs with PIXMAN_APIChun-wei Fan2019-11-191-0/+274
| | | | | We can override PIXMAN_API with a CFLAG or config.h define to export the symbols with compiler directives, if needed.
* pixman/pixman-version.h.in: Add a PIXMAN_API macroChun-wei Fan2019-11-191-0/+4
| | | | | | This prepares to mark the public APIs that we have in pixman.h so that we can use compiler directives such as __declspec(dllexport) to export those symbols.
* pixman-sse2: Fix undefined unaligned loadsAdam Jackson2019-11-131-15/+18
|
* pixman-mmx: Fix undefined unaligned loadsAdam Jackson2019-11-131-3/+7
|
* pixman-mmx: Fix undefined left-shiftsAdam Jackson2019-11-131-2/+2
|
* pixman-matrix: Fix left shift of a negative numberAdam Jackson2019-11-011-1/+1
| | | | ../pixman/pixman-matrix.c:276:35: runtime error: left shift of negative value -32768
* pixman-bits-image: Fix left shift of a negative numberAdam Jackson2019-11-011-2/+2
| | | | ../pixman/pixman-bits-image.c:678:33: runtime error: left shift of negative value -32768
* pixman-bits-image: Fix various undefined left shiftsAdam Jackson2019-10-151-14/+16
| | | | ../pixman/pixman-bits-image.c:221:20: runtime error: left shift of 204 by 24 places cannot be represented in type 'int'
* pixman-fast-path: Fix various undefined left shiftsAdam Jackson2019-10-151-2/+2
| | | | ../pixman/pixman-fast-path.c:3089:23: runtime error: left shift of 154 by 24 places cannot be represented in type 'int'
* pixman-sse2: Fix an undefined left shiftAdam Jackson2019-10-151-2/+2
| | | | ../pixman/pixman-sse2.c:3346:14: runtime error: left shift of 41891 by 16 places cannot be represented in type 'int'
* pixman-gradient-walker: Fix undefined left shiftAdam Jackson2019-10-151-4/+4
| | | | ../pixman/pixman-gradient-walker.c:216:35: runtime error: left shift of 163 by 24 places cannot be represented in type 'int'
* pixman-image: Fix undefined left shiftAdam Jackson2019-10-151-1/+1
| | | | ../pixman/pixman-image.c:963:46: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'
* pixman-combine: Fix various undefined left shiftsAdam Jackson2019-10-151-2/+2
| | | | | | | | ../pixman/pixman-combine32.c:657:1: runtime error: left shift of 128 by 24 places cannot be represented in type 'int' ../pixman/pixman-combine32.c:694:1: runtime error: left shift of 232 by 24 places cannot be represented in type 'int' ../pixman/pixman-combine32.c:712:1: runtime error: left shift of 255 by 24 places cannot be represented in type 'int' ../pixman/pixman-combine32.c:786:1: runtime error: left shift of 255 by 24 places cannot be represented in type 'int' ../pixman/pixman-combine32.c:805:1: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'
* pixman-access: Fix various undefined left shiftsAdam Jackson2019-10-151-16/+16
| | | | | | ../pixman/pixman-access.c:389:2: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' ../pixman/pixman-access.c:1101:2: runtime error: left shift of 2 by 30 places cannot be represented in type 'int' ../pixman/pixman-access.c:1152:2: runtime error: left shift of 2 by 30 places cannot be represented in type 'int'
* pixman: Fix undefined left shift in pixel_contract_from_floatAdam Jackson2019-10-151-1/+1
| | | | ../pixman/pixman-utils.c:216:14: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'
* Avoid undefined behavior (left-shifting negative value) in pixman_int_to_fixedJonathan Kew2019-09-111-1/+1
| | | Reported in https://bugzilla.mozilla.org/show_bug.cgi?id=1580352. Casting the argument to uint32_t should avoid invoking undefined behavior here. We'll still have *implementation-defined* behavior when casting the result back to pixman_fixed_t, but that's better than *undefined*.
* meson: don't use link_with for library()Dylan Baker2019-09-091-1/+8
| | | | | | | | | | | | Meson doesn't do the expected thing when library() creates a static library. Instead of combining the libraries together into a single archive it effectively discards them, resulting in missing symbols. To work around this we manually unpack the archives and shove the .o files into the final library. This doesn't affect the shared library at all, but makes the static library have the necessary symbols Fixes #33
* Explicitly cast byte to uint32_t before left-shifting.Jonathan Kew2019-08-301-2/+2
| | | | | To avoid potential signed integer overflow (undefined behavior), as implicit integer promotion means the operand becomes a (signed) int. (Issue originally reported at https://bugzilla.mozilla.org/show_bug.cgi?id=1577669)
* meson: allow building a static libraryChristoph Reiter2019-06-101-1/+1
| | | | | | | | So that passing "-Ddefault_library=both" also creates a static lib. Note that Libs.private in the .pc file will still be wrong because of https://github.com/mesonbuild/meson/issues/3934 (it contains things like -lpixman-mmx)
* Don't use GNU extension for binary numbersBasile Clement2019-06-101-3/+3
| | | | | | | | | | | | The dithering code (specifically `dither_factor_bayer_8`) uses a GNU extension for binary notation, eg 0b001. This is not supported by MSVC (at least) and breaks the build on this platform [1]. This patches uses hexadecimal notation instead, fixing the build. [1]: https://lists.freedesktop.org/archives/pixman/2019-June/004883.html Reviewed-by: Matt Turner <mattst88@gmail.com>
* Ordered dithering with blue noise, v2Basile Clement2019-05-254-1/+770
| | | | | | | | | | | | | | | | | | | | | | On some screens (typically low quality laptop screens), using Bayer ordered dithering has been observed to cause color changes depending on *where the gradient is rendered on the screen*, causing visible flickering when moving an image on the screen. To alleviate the issue, this patch adds support for ordered dithering using a 64x64 matrix tuned from blue noise. In addition to being devoid of the positional dependency on screen, the blue noise matrix also generates more pleasing and less discernable patterns. As such, it is now the method used for PIXMAN_DITHER_GOOD and PIXMAN_DITHER_BEST dithering methods. The 64x64 blue noise matrix has been generated using the provided `pixman/dither/make-blue-noise.c` script, which uses the void-and-cluster method. Changes since v1 (thanks Bill): - Use uint16_t for the blue noise matrix for lower memory usage - Use bitwise computation for array index
* Implement basic dithering for the wide pipeline, v3Basile Clement2019-05-255-1/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements dithering in pixman. A "dither" property is added to BITS images, which is used to: - Force rendering to the image to go through the floating point pipeline. Note that this is different from FAST_PATH_NARROW_FORMAT as it should not enable the floating point pipeline when reading from the image. - Enable dithering in dest_write_back_wide. The dithering uses the destination format to determine noise amplitude. This does not change pixman's behavior when dithering is disabled (the default). Additional types and functions are added to the public API: - The `pixman_dither_t` enum exposes the available dithering methods. Currently a single dithering method based on 8x8 Bayer matrices is implemented (PIXMAN_DITHER_ORDERED_BAYER_8). The PIXMAN_DITHER_FAST, PIXMAN_DITHER_GOOD and PIXMAN_DITHER_BEST aliases are provided and should be used to benefit from future specializations. - The `pixman_image_set_dither` function allows to set the dithering method to use when rendering to a bits image. - The `pixman_image_set_dither_offset` function allows to set a vertical and horizontal offsets for the dither matrix. This can be used after scrolling to ensure a consistent spatial positioning of the dither matrix. Changes since previous version (v2): - linear_gradient_is_horizontal optimization is still compatible with the wide pipeline. The code disabling it was a remnant of a previous patch which performed dithering directly inside linear_get_scanline, and thus needed to be called independently for each scanline. Changes since v1: - Renamed PIXMAN_DITHER_BAYER_8 to PIXMAN_DITHER_ORDERED_BAYER_8 - Disable dithering for channels with 32bpp or more (since they can represent exactly the wide values already). This makes the patches compatible with the newly added floating point format. Dithering is compatible with linear_gradient_is_horizontal
* add Hygon Dhyana support to enable X86_MMX_EXTENSIONS featureFan Jinke2019-05-021-0/+1
| | | | | Signed-off-by: Fan Jinke <fanjinke@hygon.cn> Signed-off-by: Matt Turner <mattst88@gmail.com>
* Fix bilinear filter computation in wide pipelineBasile Clement2019-04-112-1/+10
| | | | | | | | | | | | | | | | | | The recently introduced wide pipeline for filters has a typo which causes it to improperly compute bilinear interpolation positions, causing various glitches when enabled. This patch uses the proper computation for bilinear interpolation in the wide pipeline. It also makes related `if` statements conformant to the CODING_STYLE: * If a substatement spans multiple lines, then there must be braces around it. * If one substatement of an if statement has braces, then the other must too. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
* void function should not return a valueNiveditha Rau2019-03-271-6/+24
| | | | Signed-off-by: Matt Turner <mattst88@gmail.com>
* meson: simplify and fix mmx library compilationDylan Baker2019-03-271-9/+9
| | | | | This simplifies the logic and fixes the loongson-mmi implementation to build correctly.
* meson: fix copy-n-paste error for arm simd assemblyDylan Baker2019-03-271-1/+1
| | | | mentioned in #29
* pixman: Use maximum precision for pixman-bits-image, v2.Maarten Lankhorst2019-02-112-111/+328
| | | | | | | | | | | | | | | | | | | pixman-bits-image's wide helpers first obtains the 8-bits image, then converts it to float. This destroys all the precision that the wide path was offering. Fix this by making get_pixel() take a pointer instead of returning a value. Floating point will fill in a argb_t, while the 8-bits path will fill a 32-bits ARGB value. This also requires writing a floating point bilinear interpolator. With this change pixman can use the full floating point precision internally in all paths. Changes since v1: - Make accum and reduce an argument to convolution functions, to remove duplication. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Acked-by: Basile Clement <basile-pixman@clement.pm>
* Implement floating point gradient computation, v2.Basile Clement2019-02-115-110/+234
| | | | | | | | | | | | | | | | | | | | This patch modifies the gradient walker to be able to generate floating point values directly in addition to a8r8g8b8 32 bit values. This is then used by the various gradient implementations to render in floating point when asked to do so, instead of rendering to a8r8g8b8 and then expanding to floating point as they were doing previously. Changes since v1 (mlankhorst): - Implement pixman_gradient_walker_pixel_32 without calling pixman_gradient_walker_pixel_float, to prevent performance degradation. Suggested by Adam Jackson. - Fix whitespace errors. - Remove unnecessary function prototypes in pixman-private.h Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> [mlankhorst: Add comment about pixman_contract_from_float, based on Basille's suggestion] Acked-by: Basile Clement <basile-pixman@clement.pm>
* build: Add meson files to EXTRA_DISTDylan Baker2019-01-151-0/+1
| | | | Reviewed-by: Matt Turner <mattst88@gmail.com>
* meson: Add a meson build systemDylan Baker2018-11-291-0/+116
| | | | | | | | | | | | | | | | | | | | | This commit adds a meson build system for pixman. It carries the usual improvements of meson, better clean build time, much better incremental build times, while being simpler and easier to understand. This takes advantage of some features from the most recent versions of meson: the builtin openmp dependency and the feature option type. There are a couple of things that I've done a bit differently than the autotools build system, I've built a libdemos which is the utilities from the demos folder, and I've linked the demos with libtestutils from tetsts, otherwise I expect that most things will be the same. I've tested so far cross compiling from x86_64 -> x86, x86_64 -> Aarch64, and Linux to Windows via mingw, as well as native x86_64 Linux builds which all work. I've also built with mingw nativly, there are some test failures there. An MSVC build can be generated, but fails. v2: - set WORDS_BIGENDIAN in the config for big endian systems.