summaryrefslogtreecommitdiff
path: root/src/cairo-xlib-private.h
Commit message (Collapse)AuthorAgeFilesLines
* cairo-xlib: Check for maximum surface sizeUli Schlachter2021-01-131-0/+2
| | | | | | | | | | | | | X11 use uint16_t for the width/height of things. Anything too large will be truncated when sending the request to the X11 server. This commit adds a size check to a function that did not check things and then later caused a segmentation fault. Not adding a test case because the test case from the below bug report allocates 3,5 GiB of memory, which I find too much for a test. Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/414 Signed-off-by: Uli Schlachter <psychon@znc.in>
* Use HTTPS URLs for freedesktop.org domainsPaul Menzel2018-10-161-1/+1
| | | | | | | | Run the command below suggested by geirha in ##sed@irc.freenode.net. git grep -l 'http://.*freedesktop.org' | xargs sed -i 's|http\(://\([[:alnum:].-]*\.\)\{0,1\}freedesktop\.org\)|https\1|g' Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
* headers: fix include order for AIX, bug#89354Michael Haubenwallner2015-03-051-1/+1
|
* xlib: Add symbols to indicate if XRender supports GOOD/BEST filteringBill Spitzak2014-10-101-0/+2
| | | | | | | | Currently these are always false, but if some version of xlib uses a pixman supporting filtering they could be changed to return true for that version. Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
* cairo-xlib: Fix out of bounds array access in format cacheUli Schlachter2013-10-031-1/+1
| | | | | | | | | | | | | | | | | | The cairo-xlib backend maintains a mapping form cairo_format_t to xrender formats. This is done via an array. The size of this array is CAIRO_FORMAT_RGB16_565 + 1 which evaluates to 5. However, CAIRO_FORMAT_RGB30 has the numeric value 5, too. Thus, using this value as an index into the array would actually read the following force_precision field from cairo_xlib_display_t. This could be triggered by passing CAIRO_FORMAT_RGB30 to _cairo_xlib_display_get_xrender_format(). From a quick look, I didn't find any code which would allow doing this, but neither did I find anything allowing CAIRO_FORMAT_RGB16_565, so it's better to handle this correctly than assert()ing for this to never happen. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xlib: Handle lack of XRenderFillRectanglesChris Wilson2013-01-131-2/+13
| | | | | | | | Remember to check for a supported render version before making a FillRectangle request, and fallback to the core protocol where possible instead. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Fixup standalone header compilation for 'make check'Chris Wilson2012-11-011-0/+1
| | | | | | Missing include of string.h Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Check for both X.org and Xorg ServerVendorsChris Wilson2012-10-261-0/+7
| | | | | | | | | | 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/shm: Masquerade as an ordinary ShmCompletionEventChris Wilson2012-08-271-3/+3
| | | | | | | Needs a bit of extra work to create the extension event, but this leaves the application with only a single spurious event to filter. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib/shm: Only check if we are expecting an eventChris Wilson2012-08-211-3/+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-0/+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/shm: Use an impromptu upload ShmSegmentChris Wilson2012-08-171-3/+8
| | | | | | | | Reduce the number of copies required for uploading large image data. Ultimately we want the client to allocate the similar-image itself to acheive zero copy, this is just an intermediate step for legacy clients. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib/shm: Limit use of the impromptu fallback pixmap for uploadsChris Wilson2012-08-171-1/+2
| | | | | | | We want to avoid unnecessary readback and so only want to use the ShmPixmap when uploading the complete surface. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Implement SHM fallbacks and fast upload pathsChris Wilson2012-08-171-0/+59
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Introduce a new compositor architectureChris Wilson2011-09-121-43/+211
| | | | | | | | | | | | | | | | | | 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: Mark surfaces as finished when the Display is finished/destroyed/closed.Chris Wilson2011-08-141-0/+2
| | | | | | Fixes xlib-surface-source with the recording-surface Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xcb,xlib: Cleanup GC cache handlingAndrea Canciani2011-07-211-2/+4
| | | | | | | | Device mutexes guarantee the consistency between multiple threads, hence GC cache does not rely anymore on atomic operations. This makes it possible to avoid bit twiddling and to use a simple array.
* Include pixman.h in cairo-xlib-private.hSøren Sandmann Pedersen2011-06-271-0/+2
| | | | | Otherwise "make cairo-perf-trace" fails. Reported by Matt Turner on IRC.
* xlib: Create an exact match for the image surface if possible using XrenderChris Wilson2011-06-251-0/+4
| | | | | | | | | | | 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,xcb: Force strict adherence to the Render specification when testingChris Wilson2011-06-011-0/+6
| | | | | | | | | | 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>
* 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-17/+5
| | | | | | 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: Convert visual array to a cairo_list_tChris Wilson2010-05-061-1/+3
| | | | It's simpler and more memory efficient.
* xlib: Remove screen->has_renderChris Wilson2010-05-061-1/+0
| | | | Use the info from the display instead.
* 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 screen device handlingBenjamin Otte2010-04-231-2/+2
| | | | | | | 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: Make display a cairo_device_tBenjamin Otte2010-04-181-27/+39
| | | | | | | | | | | | 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.
* [atomic] Fallback to libatomic-ops-devChris Wilson2009-10-151-1/+1
| | | | | Use libatomic-ops-dev in preference to mutex-based atomics, if we do not have the builtin atomic intrinsics available.
* [xlib] Eliminate GC clippingChris Wilson2009-09-021-7/+5
| | | | | Eradicate the use of clipping with GC. By never using clipping, we never have to worry about retrieving a dirty clip from the GC cache.
* [xlib] Make xlib_display_t private and rename xlib_screen_info_tChris Wilson2009-09-011-36/+52
| | | | | | | | | | | | 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.
* [xlib] Use server-side gradients.Chris Wilson2009-07-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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] Improve GC caching efficacyChris Wilson2009-06-191-5/+6
| | | | | | | | | | | Shrink the overall size of the per-screen GC cache, but allow multiple GCs per depth, as it quite common to need up to two temporary GCs along some drawing paths. Decrease the number of GCs we obtain in total by returning clean (i.e. a GC without a clip set) back to the screen pool after use. Compensate for the increased number of put/get by performing the query using atomic operations where available. So overall we see a dramatic reduction on the numbers of XCreateGC and XFreeGC, of even greater benefit for RENDER-less servers.
* xlib, xcb: Hand off EXTEND_PAD/EXTEND_REFLECT to RenderThomas Jaeger2009-06-051-0/+1
| | | | | | | | | | | | | | | 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.
* [xlib] Only clear the GC clip mask as necessary.Chris Wilson2008-10-301-2/+8
| | | | Avoid redundant calls to XSetClipMask() for clean GCs.
* [xlib] Propagate real status from get_screen_info().Chris Wilson2008-10-301-2/+4
| | | | | Return the real error from _cairo_xlib_screen_info_get() in order to avoid having to create a fake NO_MEMORY error.
* [xlib] Propagate real status from get_display()Chris Wilson2008-10-301-2/+2
| | | | | Avoid throwing away the error and inventing a new NO_MEMORY error for _cairo_xlib_display_get().
* [xlib] Avoid repeated calls to XRenderQueryVersionChris Wilson2008-10-301-0/+2
| | | | | Use the value determined during display initialisation in order to avoid redundant XRenderQueryFormats requests.
* [xlib] Defer querying of font options until first useChris Wilson2008-10-301-0/+4
| | | | | | | | Constructing the font options cause the initialisation of Xlc and invoke several round-trips to the X server, significantly delaying the creation of the first surface. By deferring that operation until the first use of fonts then we avoid that overhead for very simple applications (like the test suite) and should improve start-up latency for larger application.
* [xlib] Keep a pointer to the cairo_xlib_display_t on the surface.Chris Wilson2008-09-021-5/+5
| | | | | | | | | | Cleanup the code somewhat by passing cairo_xlib_display_t around internally as opposed to a Display and then having to lookup the corresponding cairo_xlib_display_t each time. [To get a cairo_xlib_display_t from a Display is a list traversal under mutex (though the element we're looking for is most likely at the start), but to get the Display is just a lockless pointer dereference.]
* [xlib] Use an embedded doubly-linked list for the close display hooks.Chris Wilson2008-09-021-5/+8
| | | | | | | | Kill the allocation and linear search of the close display list on remove, by embedding a list node into the parent structure. Original patch by Karl Tomlinson <karlt+@karlt.net>, Mozilla Corporation. https://bugzilla.mozilla.org/show_bug.cgi?id=453199#c5
* [xlib] Remove the key parameter from the close display hook.Chris Wilson2008-08-141-3/+2
| | | | | | | By inspecting all the users of the close display hooks, we can see that (a) the key is redundant and (b) the data is unique to the hook. This means we can trim the interface and stop the linear searches as soon as we've found the correct element.
* [xlib] Implement ditheringBehdad Esfahbod2008-06-191-2/+10
| | | | | | | | Remove the intermediate rgb333 for PseudoColor and work on the cube directly. Also upgrade to a 6x6x6 cube instead of 5x5x5. Do dithering on both PseudoColor and TrueColor, using a 4x4 pattern. This only affects X servers with no XRender.
* [cairo-xlib] Cache standard xrender formats.Chris Wilson2008-05-061-0/+7
| | | | | | | XRender performs a round-trip in order to query the available formats on the xserver, before searching for a matching format. In order to save that round-trip and to avoid the short-lived allocation of the array of available formats, we cache the result on the display.
* [xlib] Add locking around GC cache.Chris Wilson2008-04-111-0/+1
| | | | | | The per-screen cached of most-recently freed GCs lacks suitable locking for it to be threadsafe. (cherry picked from commit dc714106e156cb7901e376c0935922446ae9bcdf)
* [cairo-xlib] Handle malloc failures for cairo_xlib_visual_info_t.Chris Wilson2008-04-021-4/+11
| | | | | | Tidy the error paths whilst handling visuals, in particular avoiding a couple of potential NULL deferences, missed status checks and fresh leaks.
* Mark new cairo_xlib_visual_info functions as private.Carl Worth2008-03-201-2/+2
|
* Add support for 8-bit PseudoColor visualsCarl Worth2008-03-201-0/+15
| | | | | | | | | | | | | | | | | This support involves allocating a 16-bit grayscale ramp as well as a 5x5x5 RGB color cube. Afterwards, the 256 colors are queried and an array is generated mapping from r3g3b3 colors to the closest available color. Both the queried colors and the reverse mapping are stored in a new visual-specific cairo_xlib_visual_info_t structure which hangs off of the cairo_xlib_screen_info_t. Both the color-cube allocation and the distance metric could be improved by someone sufficiently motivated, (for example, allocating and matching in a perceptually linear color space rather than just in RGB space). Also, making this work well in the face of a changing color map, or in the case of GrayScale, StaticGray, or DirectColor visuals are left entirely as exercises for the reader. StaticColor support should be fine as is, but is entirely untested.
* [cairo-xlib] Fixup --disable-xlib-xrenderChris Wilson2008-01-151-5/+1
| | | | | Fixup the headers and boilerplate to compile and run correctly when configured with --disable-xlib-xrender.
* [cairo-xlib] Move the buggy_repeat discovery to the display_t.Chris Wilson2007-10-181-0/+1
| | | | | | | The VendorString parsing (to detect broken Xserver versions) was being performed for each surface creation, but as it is a display invariant we can save a small amount of work by storing the result on the cairo_xlib_display_t.
* [cairo-atomic] Rewrite reference counting using atomic ops.Chris Wilson2007-09-251-2/+3
| | | | | | Introduce an opaque cairo_reference_count_t and define operations on it in terms of atomic ops. Update all users of reference counters to use the new opaque type.