summaryrefslogtreecommitdiff
path: root/src/cairo-xlib-display.c
Commit message (Collapse)AuthorAgeFilesLines
* Add support for RGBA128F and RGB96F formats.Maarten Lankhorst2019-01-071-0/+12
| | | | | | | | | | | | | | IGT wants to add support for planes with a bit depth >10, which requires a higher precision format than we have currently. I'm using RGBA as format, because of its existence in OpenGL. With the new formats we can directly convert our bytes to half float, or multiply a colro vector with a matrix to go to the Y'CbCr colorspace. This requires pixman 0.36.0, so bump the version requirement. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Bryce Harrington <bryce@bryceharrington.org>
* Use _cairo_malloc instead of mallocAdrian Johnson2018-05-071-1/+1
| | | | | | | | | | _cairo_malloc(0) always returns NULL, but has not been used consistently. This patch replaces many calls to malloc() with _cairo_malloc(). Fixes: fdo# 101547 CVE: CVE-2017-9814 Heap buffer overflow at cairo-truetype-subset.c:1299 Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* xlib: Undo debug hack to force fallbacksChris Wilson2014-08-011-1/+1
| | | | | | | | | | | | | | | | | | Remove the debug hack from commit f337342c88092a251dc00476c4a9880d1cb90822 Author: Bill Spitzak <spitzak@gmail.com> Date: Fri Jul 18 18:46:26 2014 -0700 V6 image: Use convolution filters for sample reconstruction when downscaling as it forces the fallback image surface for xlib causing severe performance degradation. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82002 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Bill Spitzak <spitzak@gmail.com> Cc: Bryce Harrington <b.harrington@samsung.com>
* V6 image: Use convolution filters for sample reconstruction when downscalingBill Spitzak2014-07-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This version removes testing code and has some changes to match my current pixman version. My proposed pixman patch (not finished yet) will produce exactly the same results as this cairo patch. This code contains an all-new filter generator to replace the one that is in pixman. Results in 222 pass/298 failed image tests, which is much better than the previous versions of this patch. Filter generator (which should probably be in pixman): - Single filter, no "reconstruction" and "sample" filter - Filters for derivative < 1 work - Fixed IMPULSE and BOX - Added TENT, CATMULL_ROM, NOTCH. Remove LANZCOS2. - Renamed CUBIC to MITCHELL Cairo's filter settings: - CAIRO_FILTER_GOOD: uses BOX filter for scales less than .75 in either direction. Uses PIXMAN_FILTER_GOOD (ie BILINEAR) otherwise. - CAIRO_FILTER_BEST: uses CATMULL filter always. Upscaling more than 2x will produce anti-aliased square pixels, similar to OS/X. - CAIRO_FILTER_GAUSSIAN: this obsolete value is used to test other filters. The program must declare and poke the filter into the static varialbe ikernel. This should be removed for production code. NYI: This version uses the fallback for xlib always. The xlib and xcb backends must be rewritten to use the fallback version if filtering is needed. Or the filtering code must be moved to XRender.
* xlib: Fix mispelling in a commentBryce Harrington2014-07-241-1/+1
|
* xlib: Fix typo in documentationBenjamin Otte2014-03-031-1/+1
|
* Revert "[xlib] Fast-path the likely case of retrieving a known xrender_format"Uli Schlachter2013-10-031-6/+0
| | | | | | | | | | | | | | | | | This reverts commit 09a2b2ed3189fe12483cbd673c24ceddc2c20f3f. Back in 2009, _cairo_xlib_display_get_xrender_format() had to acquire a lock to do its job. The above commit added a fast-path which avoided the lock in most cases. However, in 2010 commit f74ad37e66bbdcc4d727ed6d931dde870d84c2f4 modified the locking in the cairo-xlib backend and now this function never takes any locks. Thus, the fast-path that was added a year earlier now just does the same thing that the regular code does and the list of cached formats was checked twice. Reverting the earlier commit fixes this. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xlib: Fix invocation of XRenderFindFormat()Chris Wilson2013-02-241-1/+1
| | | | | | | | The 'count' parameter is an indication to libXrender of the number of matches to skip before reporting (rather than a limit on the number to report). As we only want the first match, always pass 0. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Check for both X.org and Xorg ServerVendorsChris Wilson2012-10-261-1/+1
| | | | | | | | | | Martin Husemann reported that on his NetBSD machine the vendor was being reported as "The Xorg Foundation", a non-conformist separatist split of the Peoples' Liberation Army^W^W^W "The X.Org Foundation". Simply check for both during initialisation. Reported-by: Martin Husemann <martin@duskware.de> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Reorder CloseDisplay hooksChris Wilson2012-10-111-17/+17
| | | | | | | | | | | As we may utilize X extensions as we shutdown and release resources during CloseDisplay, we need to run our own callback first. If we run last, than we reinstantiate the extensions which often have the unfortunate habit of then persisting with stale data across the next Display connection, causing invalid requests to be generated and raise XErrors. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib/shm: Reduce the frequency at which we emit eventsChris Wilson2012-08-241-2/+2
| | | | | | | | | | Flushing the shm operation is a fairly rare event, as it is typically only involved with mixed rendering on a similar image, and should be triggering its own events. Therefore we should be able to reduce our event emission to the critical points in order to limit the amount of extra overhead we generate. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib/shm: Only check if we are expecting an eventChris Wilson2012-08-211-2/+0
| | | | | | | | | As the XCheckWindowEvent() has the unwanted side-effect of flushing the output queue when there is no event available (libX11 seems to be entirely anti-performant), we need to roll our own that only checks the already available event queue. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib/shm: Use a genuine event rather than an open-ended requestChris Wilson2012-08-211-1/+3
| | | | | | | | Adding lots of requests without popping the replies causes xcb to continually sort large lists of unprocessed data. Use an event instead and regularly dequeue them. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Move the shm cleanup from CloseDisplay to finish()Chris Wilson2012-08-191-2/+2
| | | | | | | Make sure that we always detach the ShmSegments upon dispose, or else we can trivially leak lots of memory when using serial Display connections. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Implement SHM fallbacks and fast upload pathsChris Wilson2012-08-171-1/+8
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Fix broken XRender ARGB32 formatsDaniel Stone2012-08-161-3/+2
| | | | | | | | | | | 46d79228 did indeed silence the compilation warning, but did so by never creating an ARGB32 format, as PictStandardARGB32 is defined to 0. Fix this by using PictStandardNUM as our canary value instead. This fixes GEdit and Chromium for me, both of which were only rendering backgrounds and text in their GTK+ sections. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* xlib: Silence compiler warningChris Wilson2012-08-111-4/+5
| | | | | | | | cairo-xlib-display.c: In function '_cairo_xlib_display_get_xrender_format': cairo-xlib-display.c:519:21: warning: 'pict_format' may be used uninitialized in this function [-Wmaybe-uninitialized] Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Split cairo-list into struct+inlinesChris Wilson2012-04-191-0/+1
| | | | | References: https://bugs.freedesktop.org/show_bug.cgi?id=48577 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* doc: Make the documentation name match the function nameAndrea Canciani2012-03-291-1/+1
| | | | | Fixes the 'symbol not found' errors caused by mismatches between the documentation name and the name in the code.
* xcb/xlib: Add missing "Since: 1.12"Uli Schlachter2012-03-261-0/+2
| | | | Signed-off-by: Uli Schlachter <psychon@znc.in>
* doc/xlib/xcb: document get/set_precision APINis Martensen2012-03-101-0/+20
| | | | Signed-off-by: Uli Schlachter <psychon@znc.in>
* Fix docs for cairo_xlib_device_debug_cap_xrender_versionUli Schlachter2012-03-031-2/+2
| | | | | | | The documentation was apparently copied from cairo_xcb_device_debug_cap_xrender_version without changing "XCB" into "Xlib". Signed-off-by: Uli Schlachter <psychon@znc.in>
* xlib: Replace obsolete disable-xrender with shiny new device debug interfaceChris Wilson2012-02-221-7/+50
| | | | | | As prototyped with xcb. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Introduce a new compositor architectureChris Wilson2011-09-121-218/+25
| | | | | | | | | | | | | | | | | | Having spent the last dev cycle looking at how we could specialize the compositors for various backends, we once again look for the commonalities in order to reduce the duplication. In part this is motivated by the idea that spans is a good interface for both the existent GL backend and pixman, and so they deserve a dedicated compositor. xcb/xlib target an identical rendering system and so they should be using the same compositor, and it should be possible to run that same compositor locally against pixman to generate reference tests. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> P.S. This brings massive upheaval (read breakage) I've tried delaying in order to fix as many things as possible but now this one patch does far, far, far too much. Apologies in advance for breaking your favourite backend, but trust me in that the end result will be much better. :)
* xlib: Move the Display pointer nullify into destroy from finishChris Wilson2011-08-141-4/+1
| | | | | | | Oops, should have checked with more than just the one test before claiming victory. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Mark surfaces as finished when the Display is finished/destroyed/closed.Chris Wilson2011-08-141-52/+55
| | | | | | Fixes xlib-surface-source with the recording-surface Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Xlib,xcb: Make *_debug_[sg]et_precision() more robustUli Schlachter2011-07-211-4/+18
| | | | | | | This adds checks for NULL pointers, devices in an error state and devices which aren't owned by the right backend. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xlib: Create an exact match for the image surface if possible using XrenderChris Wilson2011-06-251-18/+116
| | | | | | | | | | | In order to defer the pixel conversion till as late in the pipeline as possible, we want to try and preserve the pixman image format whilst uploading the pixel data. To do this, we want to create an XRender surface with a matching PictFormat to the source image. Then we need to make sure we take the quick path through _draw_image_surface for none and direct conversions. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Fix build of xlib-xcbAndrea Canciani2011-06-161-0/+4
| | | | | | | | | 45665c0d48396af7bd653d546115a5f36cfa9ae1 breaks the build of cairo-xlib-xcb because it does not disable the compilation of cairo-xlib implementation files when cairo-xlib-xcb is enable. This results in collisions when linking. Reported-by: James Cloos <cloos@jhcloos.com>
* xlib,xcb: Force strict adherence to the Render specification when testingChris Wilson2011-06-011-0/+21
| | | | | | | | | | Introduce cairo_xlib_device_debug_set_precision() to override the automatic selection of rendering precision and force the Xorg/DDX to strictly adhere to the precise rendering mode of the Render specification. This allows us to test drivers without worrying, too much, about minor discrepancies in antialiasing. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Expose 30bpp/10bpc support: CAIRO_FORMAT_RGB30Jesse Barnes2011-05-011-0/+1
| | | | | | | | | | This is a common format used by framebuffers to drive 10bpc displays and is often hardware accelerated by XRender with underlying support from pixman's x2r10g10b10 format (which provides coercion paths for fallbacks). Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* freelist: Separate freelist inlines from the datatype in headers.M Joonas Pihlaja2010-09-021-1/+1
| | | | | | | | | | | | | | | | The cairo-freelist-private.h header has a number of static inline functions which call hidden functions in libcairo. This poses a problem on Solaris where the native compiler compiles inline functions whether they are used or not, thereby adding the link time requirements on hidden functions from whatever code that includes cairo-freelist-private.h. Unfortunately the boilerplate code includes cairo-private headers and indirectly the freelist header, so linking the boilerplate helper library fails on Solaris. This patch separates the structure definitions from the function prototypes and static inlines in cairo-freelist-private.h by moving the datatypes to a new cairo-freelist-type-private.h.
* xlib: Remove reference counting for cairo_xlib_screen_tChris Wilson2010-05-061-65/+19
| | | | | | The screen is owned by the cairo_xlib_display_t device, so we can simplify and close the refleak by removing the surplus reference counting.
* xlib: Ensure the global display mutex is initialized before use.Chris Wilson2010-05-061-0/+2
|
* Update FSF addressAndrea Canciani2010-04-271-1/+1
| | | | | | | | | | | I updated the Free Software Foundation address using the following script. for i in $(git grep Temple | cut -d: -f1 ) do sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i" done Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21356
* xlib: Fix display closing to work properlyBenjamin Otte2010-04-231-14/+23
| | | | | Previously we free()'d the cairo_device's memory which was not good at all. Now the code causes cairo_device_finish() instead.
* xlib: Fix screen device handlingBenjamin Otte2010-04-231-15/+18
| | | | | | | Add a _cairo_xlib_device_create() function that could easily be exported as a replacement for _cairo_xlib_display_get(). This function returns a cairo_device_t instead of a cairo_xlib_display_t because the display isn't acquired.
* xlib: Simply release the ref, not destroy, from CloseDisplay.Chris Wilson2010-04-231-10/+12
| | | | | | | Do not call the destroy function directly, but rely on the reference counting to call the notifier upon the last reference. Instead, simply release the reference we were holding for the cache and CloseDisplay callback.
* xlib: Make display a cairo_device_tBenjamin Otte2010-04-181-141/+93
| | | | | | | | | | | | The code now uses the locking of the cairo_device_t instead of its own mutexes. The code was modified so that cairo_surface_t does no longer reference the display directly. Instead, it calls _cairo_xlib_display_acquire(). If a function assumes an already acquired display, it now requires the caller to provide a cairo_xlib_display_t parameter. Functions that do not require an acquired display will not require the display parameter or they will take the cairo_device_t instead.
* Add back support for CAIRO_FORMAT_RGB16_565Oleg Romashin2010-03-241-3/+25
| | | | | Due to slow memory speed, 16bpp color depth is still very popular on mobile devices. Maemo5 is also using 16bpp color depth.
* api: Introduce CAIRO_FORMAT_INVALID formally in the API.M Joonas Pihlaja2010-03-011-0/+1
| | | | | | We were exposing the actual value of CAIRO_FORMAT_INVALID through API functions already, so it makes sense to just go ahead and put it in the cairo_format_t enum.
* Move _cairo_error() to a standalone headerChris Wilson2010-01-221-0/+1
| | | | | A pending commit will want to include some utility code from cairo and so we need to extricate the error handling from the PLT symbol hiding.
* [xlib] Interim CAIRO_DEBUG variable to specify xrender levelChris Wilson2009-09-201-4/+19
| | | | | Use CAIRO_DEBUG=xrender-version=x.y to override what the server reports. Useful to test cairo's behaviour against older servers.
* [xlib] Enable pad_reflect by defaultChris Wilson2009-09-041-7/+12
| | | | | | | If the XServer claims to support the required Render extension then send it the operations. However for the cases where we know it does not work, i.e. the current and previous generations (<=1.6) of Xorg servers, enable the buggy_pad_reflect fallbacks.
* [xlib] Make xlib_display_t private and rename xlib_screen_info_tChris Wilson2009-09-011-5/+121
| | | | | | | | | | | | The issue Joonas was trying to solve was the unwanted inclusion of the inlines via cairo-freelist-private.h. Unwittingly he included cairoint.h from cairo-xlib-private.h instead, a far more heinous crime as that causes the boilerplate to try to use the hidden, private symbols. Instead we resolve this issue by making the cairo_xlib_display_t structure private to cairo-xlib-display.c and provide functions to manipulate the abstract data type. Whilst in the vicinity, we rename cairo_xlib_screen_info_t to cairo_xlib_screen_t for consistency and cleanliness.
* Fix build on systems with older Xrender headers.Damian Frank2009-08-291-0/+7
| | | | | | | | This patch revises xlib so that it doesn't depend on having recent Xrender headers to build. In particular, some definitions were added to the private xrender header file, and an ifdef render version check CAIRO_SURFACE_RENDER_SUPPORTS_OPERATOR was changed to a run-time check using CAIRO_SURFACE_RENDER_HAS_PDF_OPERATORS.
* [xlib] Use server-side gradients.Chris Wilson2009-07-311-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can offload creation of gradients to server that support RENDER 0.10 and later. This greatly reduces the amount of traffic we need to send over our display connection as the gradient patterns are much smaller than the full image. Even if the server fallbacks to using pixman, performance should be improved by the reduced transport overhead. Furthermore this is a requisite to enable hardware accelerated gradients with the xlib backend. Running cairo-perf-trace on tiny, Celeron/i915: before: firefox-20090601 211.585 after: firefox-20090601 270.939 and on tiger, CoreDuo/nvidia: before: firefox-20090601 70.143 after: firefox-20090601 87.326 where linear gradients are used extensively throughout the GTK+ theme. Not quite the result I was expecting! In particular, looking at tiny: xlib-rgba paint-with-alpha_linear-rgba_over-512 47.11 (47.16 0.05%) -> 123.42 (123.72 0.13%): 2.62x slowdown █▋ xlib-rgba paint-with-alpha_linear3-rgba_over-512 47.27 (47.32 0.04%) -> 123.78 (124.04 0.13%): 2.62x slowdown █▋ xlib-rgba paint-with-alpha_linear-rgb_over-512 47.19 (47.21 0.02%) -> 123.37 (123.70 0.13%): 2.61x slowdown █▋ xlib-rgba paint-with-alpha_linear3-rgb_over-512 47.30 (47.31 0.04%) -> 123.52 (123.62 0.09%): 2.61x slowdown █▋ xlib-rgba paint_linear3-rgb_over-512 47.29 (47.32 0.05%) -> 118.95 (119.60 0.29%): 2.52x slowdown █▌ xlib-rgba paint_linear-rgba_over-512 47.14 (47.17 0.06%) -> 116.76 (117.06 0.16%): 2.48x slowdown █▌ xlib-rgba paint_linear3-rgba_over-512 47.32 (47.34 0.04%) -> 116.85 (116.98 0.05%): 2.47x slowdown █▌ xlib-rgba paint_linear-rgb_over-512 47.15 (47.19 0.03%) -> 114.08 (114.55 0.20%): 2.42x slowdown █▍ xlib-rgba paint-with-alpha_radial-rgb_over-512 117.25 (119.43 1.21%) -> 194.36 (194.73 0.09%): 1.66x slowdown ▋ xlib-rgba paint-with-alpha_radial-rgba_over-512 117.22 (117.26 0.02%) -> 193.81 (194.17 0.11%): 1.65x slowdown ▋ xlib-rgba paint_radial-rgba_over-512 117.23 (117.26 0.02%) -> 186.35 (186.41 0.03%): 1.59x slowdown ▋ xlib-rgba paint_radial-rgb_over-512 117.23 (117.27 0.02%) -> 184.14 (184.62 1.51%): 1.57x slowdown ▋ Before 1.10, we may choose to disable server-side gradients for the current crop of Xorg servers, similar to the extended repeat modes. [Updated by Chris Wilson. All bugs are his.]
* [xlib] Fast-path the likely case of retrieving a known xrender_formatChris Wilson2009-07-271-0/+6
| | | | | | | If we know the CPU can read pointers atomically, then we can simply peek into the cached_xrender_formats to see if we already have a match, before taking the mutex. (Acquiring the mutex here is a minor nuisance that appears on the callgrind profiles.)
* [xlib] Check workqueue before taking the display mutexChris Wilson2009-07-241-0/+6
| | | | | | | Optimistically check to see if there is any outstanding work before checking under the mutex. We don't care if we occasionally do not run the queue this time due to contention, since we will most likely check again very shortly or clean up with the display.
* xlib, xcb: Hand off EXTEND_PAD/EXTEND_REFLECT to RenderThomas Jaeger2009-06-051-4/+11
| | | | | | | | | | | | | | | Most drivers and the X server used to have incorrect RepeatPad/RepeatReflect implementations, forcing cairo to fall back to client-side software rendering, which is painfully slow due to pixmaps being transfered over the wire. These issues are mostly fixed in the drivers (with the exception of radeonhd, whose developers didn't respond) and the RepeatPad software fallback is implemented correctly as of pixman-0.15.0, so this patch will hand off composite operations with EXTEND_PAD/EXTEND_REFLECT source patterns to XRender. There is no way to detect whether the X server or the drivers use a broken Render implementation, we make a guess based on the server version: It's probably safe to assume that 1.7 X servers will use fixed drivers and a recent enough version of pixman.