summaryrefslogtreecommitdiff
path: root/src/cairo-xcb-private.h
Commit message (Collapse)AuthorAgeFilesLines
* xcb: remove free pixmap/gc wrappersUli Schlachter2021-05-021-8/+0
| | | | | | | With the last commit, these became pointless. Just switch the code to call the underlying function directly. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Remove free XID cacheUli Schlachter2021-05-021-10/+0
| | | | | | | | | | | | | | cairo-xcb kept a cache of free xid to avoid calling xcb_generate_id() later. However, this is unsafe: When libxcb runs out of ids, it asks the X11 server for an empty range of ids to use. The X11 server of course does not know about cairo's cache and could hand out an id that cairo will use again later. This would then result in BadIdChoice errors later. Fix this by simply removing the whole cache. Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/434 Signed-off-by: Uli Schlachter <psychon@znc.in>
* headers: fix include order for AIX, bug#89354Michael Haubenwallner2015-03-051-2/+2
| | | | also for cairo-xcb-private.h
* xcb: Query the display's subpixel order via RENDERUli Schlachter2015-01-171-1/+3
| | | | | | | | | | | | | | | | | With commit e691d242, the xcb backend started parsing the resources, just like cairo-xlib does. One behavior from cairo-xlib was missing: If no Xft.rgba property was specified, cairo-xlib defaults to the screen's subpixel order. This commit brings that last bit of functionality to cairo-xcb (but currently disabled due to commit e0c0a673). This commits adds a new array to cairo_xcb_connection_t that contains the subpixel order for each screen. There is also a new member in cairo_xcb_screen_t which contains the subpixel order of that screen and which is initialized from the array when the screen is constructed. With this in place, the resource-parsing code can just pick the subpixel order from the screen if needed. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Add switches for whether XRender supports GOOD/BEST filteringBill Spitzak2014-10-101-1/+5
| | | | | | | Currently these are always false, but if XRender use a pixman that supports filtering these could be turned on for that version. Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
* xcb: Initialize font options from Xft resourcesLukáš Lalinský2014-09-121-0/+19
| | | | | | | | | There is a similar code in the Xlib backend. The logic here is the same, but XCB doesn't support X resources directly, so there is some custom code to get and parse the resources from the root window. Signed-off-by: Lukáš Lalinský <lukas@oxygene.sk> Reviewed-by: Uli Schlachter <psychon@znc.in>
* xcb: make use of _cairo_surface_is_xcb to check for surface typeRavi Nanjundappa2014-07-071-0/+15
| | | | | | | | Introduced a new inline function _cairo_surface_is_xcb() as similar to _cairo_surface_is_image() and used the same to check for xcb surface type Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
* xcb: Remove useless error handlingUli Schlachter2013-09-161-3/+2
| | | | | | | | | | | | | | | | | | | All the *_reply() functions in XCB return a pointer to their result and as last argument they get a xcb_generic_error_t** where pointers to errors are stored, if any occurs. However, a request can either fail or succeed. This means that if the returned result is a NULL pointer, then an error occurred and the other way around: If the error pointer is set to non-NULL, then the function must have returned NULL. Thus, all the code, which just checks if an error occurred and which does not care about the exact error code, does not need to get the error pointer at all. In this case, xcb will free() the error internally. While doing this, I noticed that _cairo_xcb_connection_get_image() always succeeds and thus its return value can be replaced with the GetImage result. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Switch to compositor architectureUli Schlachter2012-09-241-35/+24
| | | | | | | | This commit removes the hand-written code in cairo-xcb-surface.c and instead makes use of cairo_compositor_t. Surprisingly, this doesn't break a single test case. :-) Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Remove unimplemented cairo compositorUli Schlachter2012-09-241-44/+0
| | | | Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Fix make checkAndrea Canciani2012-07-241-0/+2
| | | | | | | | | | | | | | The xcb private header uses the ASSERT_NOT_REACHED macro. This macro is defined in cairoint.h, which needs to be included. Fixes: CHECK cairo-xcb-private.h In file included from headers-standalone-tmp.c:1: ./cairo-xcb-private.h: In function ‘_cairo_xcb_connection_shm_put_image’: ./cairo-xcb-private.h:636: error: ‘ASSERT_NOT_REACHED’ undeclared (first use in this function) ./cairo-xcb-private.h:636: error: (Each undeclared identifier is reported only once ./cairo-xcb-private.h:636: error: for each function it appears in.)
* xlib-xcb: Fix make checkUli Schlachter2012-03-031-0/+1
| | | | | | | | | | | | cairo_xcb_device_debug_cap_xrender_version is called by xlib-xcb's cairo_xlib_device_debug_cap_xrender_version and thus must be marked slim_hidden. Checking .libs/libcairo.so for local PLT entries 0000000000306ff8 0000024200000007 R_X86_64_JUMP_SLOT 000000000009e720 cairo_xcb_device_debug_cap_xrender_version + 0 FAIL: check-plt.sh Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Use int instead of uint16_t for rowstrideUli Schlachter2012-01-121-1/+1
| | | | | | Fixes negative-stride-image Signed-off-by: Uli Schlachter <psychon@znc.in>
* Add cairo_xcb_surface_set_drawableKeith Packard2011-12-021-0/+1
| | | | | | | | Mirrors cairo_xlib_surface_set_drawable, allowing the drawable targeted by a surface to be changed on the fly. Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xcb: track fallback damageChris Wilson2011-09-191-6/+8
| | | | | | | | And only upload the parts of the image that are modified during the fallback. I have to keep reminding myself that the goal is always to reduce the amount of fallbacks required... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xcb: Remove some dead codeUli Schlachter2011-09-141-1/+0
| | | | | | | surface->use_pixmap always had the value 0. This code is taken from cairo-xlib. However, in cairo-xlib use_pixmap is set to 20 if XGetImage() fails. Signed-off-by: Uli Schlachter <psychon@znc.in>
* Introduce a new compositor architectureChris Wilson2011-09-121-1/+3
| | | | | | | | | | | | | | | | | | 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. :)
* xcb: Steal from the pending list for GetImageUli Schlachter2011-09-021-0/+2
| | | | | | | | | | | | | | | | Before using some piece of SHM again, we must be sure that the X11 server is no longer working with it. For this, we send a GetInputFocus when we are done with the SHM locally and will only use the memory again when the reply comes in. However, if we are allocating the memory for SHM GetImage, then we can re-use memory earlier, because the server processes requests in order. So it will only start writing to the memory after it is done with earlier requests for this memory. So instead of using GetInputFocus for synchronisation, the SHM GetImage request will automatically do this for us. Thanks to Chris Wilson for this idea. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Fix fallback for *_shm_put_imageUli Schlachter2011-08-301-2/+2
| | | | | | | | | This function shouldn't ever be called is xcb-shm is disabled. However, it is still defined to avoid lots of #ifdefs. Additionally, this removes the only use of uint64_t from cairo-xcb. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Merge two functions for creating shm imagesUli Schlachter2011-08-181-0/+2
| | | | | | | | | | This merges most of _cairo_xcb_surface_create_similar_image() into _cairo_xcb_shm_image_create(). These two functions where already doing almost the same thing with only some differences in error handling. Signed-off-by: Uli Schlachter <psychon@znc.in>
* image: move surface definition to new header for subclassingChris Wilson2011-08-131-1/+1
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Make _cairo_xcb_surface_get_extents no_warnUli Schlachter2011-07-271-1/+1
| | | | | | | | This function never fails. However, since it's used to implement a operation for cairo_surface_backend_t, the return value can't be void. This commit instead uses cairo_private_no_warn to get rid of the warnings. Signed-off-by: Uli Schlachter <psychon@znc.in>
* composite: Pass unbounded extents to initialisationChris Wilson2011-07-261-0/+4
| | | | | | | | For an unbounded surface we cannot assume (0, 0, surface_width, surface_height) as that is wrong and causes the operation to appear clipped. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* API: map-to-image and create-similar-imageChris Wilson2011-07-261-4/+5
| | | | | | | | | | | | | | | | A common requirement is the fast upload of pixel data. In order to allocate the most appropriate image buffer, we need knowledge of the destination. The most obvious example is that we could use a shared-memory region for the image to avoid the transfer cost of uploading the pixels to the X server. Similarly, gl, win32, quartz... The other side of the equation is that for manual modification of a remote surface, it would be more efficient if we can create a similar image to reduce the transfer costs. This strategy is already followed for the destination fallbacks and this merely exposes the same capability for the application fallbacks. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xcb,xlib: Cleanup GC cache handlingAndrea Canciani2011-07-211-2/+5
| | | | | | | | 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.
* xcb: Make it possible to undo _cairo_xcb_device_debug_cap_*Uli Schlachter2011-07-211-1/+14
| | | | | | | | | | We now remember the original flags before any call to cairo_xcb_device_debug_cap_xshm_version() or cairo_xcb_device_debug_cap_xrender_version() was done and re-set these flags on any new call to these functions. This makes it possible to raise e.g. the used RENDER version again. Signed-off-by: Uli Schlachter <psychon@znc.in>
* XCB: Store the flags per-connection onlyUli Schlachter2011-07-211-1/+0
| | | | | | | | | | | | | | | Every xcb surface had its own copy of the flags from the time that it was created. This means that, if you want to make use of cairo_xcb_device_debug_cap_xrender_version() and cairo_xcb_device_debug_cap_xshm_version(), you first had to create a dummy xcb surface, use that to get access to the cairo_device_t so that you can use these functions and only then create your real surface, because the change only affected new surfaces. This commit changes everything to use the connection's flag and removes the per-surface flags. This avoids the dummy surfaces completely. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Take advantage of clip-boxesChris Wilson2011-07-201-0/+1
| | | | | | | | | | | | | | | | | A demonstration of step 2, improves performance for selected benchmarks on selected GPUs by up to 30%. firefox-fishbowl on snb {i5-2520m): 42s -> 29s. firefox-talos-gfx on snb: 7.6 -> 5.2s. firefox-fishbowl on pnv (n450): 380 -> 360s. Whist this looks like it is getting close to as good as we can achieve, we are constrained by both our API and Xrender and fishbowl is about 50% slower than peak performance (on snb). And it fixes the older performance regression in firefox-planet-gnome. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* clip: Rudimentary support for clip-polygon extractionChris Wilson2011-07-191-19/+19
| | | | | | | Step 1, fix the failings sighted recently by tracking clip-boxes as an explicit property of the clipping and of composition. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* cairo-xcb: Drop some unused definitions/fileUli Schlachter2011-07-181-1/+0
| | | | Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Remove more bits of drm integrationChris Wilson2011-07-151-3/+0
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* pattern: Add observer hooksChris Wilson2011-07-151-0/+1
| | | | | | | | | In order for custom context to automatically track when a pattern is modify after being set on the context (and before it is used in an operator), we need for there to be a callback when the pattern is modified. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Excise xcb-drmChris Wilson2011-07-141-2/+0
| | | | | | | | | | | | | | | | The experiment was at best a pyrrhic victory. Whilst it did show that you could successfully subvert cairo_xcb_surface_t and provide the rendering locally faster (than the xlib driver at that time), any performance benefits were lost in the synchronisation overheads and server-side buffer allocation. Once cairo-gl is mature, we need to look at how we can overcome these to improve client-side rendering In the meantime, cairo-xcb is no longer my playground for experimentation and is shaping up to become a stable backend... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xcb: Track cairo_xcb_picture_t surfacesUli Schlachter2011-07-091-0/+3
| | | | | | | | | | | | | | | | | | When e.g. using an image surface as the source for a xcb surface, a cairo_xcb_picture_t is created and attached to that image surface as a snapshot. This contains the Picture that was created on the X11 server. However, as soon as the cairo_xcb_picture_t's cairo_xcb_screen_t is finished and destroyed, this picture can't be used anymore. This commit now makes sure all these Pictures are freed when the screen is finished. This was found because my X server's memory usage grew quite large. Every time the app was done drawing, it destroyed its last surface which also destroyed the last reference to the cairo_xcb_screen_t. This meant that the existing Picture snapshots couldn't be used anymore, but they were still kept around and used up memory until there wasn't any free memory left. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Move cairo_xcb_picture_t to cairo-xcb-private.hUli Schlachter2011-07-091-0/+20
| | | | | | | | The next commit will make cairo-xcb-screen.c use this struct and add new members. Splitting off the move into its own commits makes that easier to understand. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xlib-xcb: Use slim_hidden_proto correctlyUli Schlachter2011-07-011-0/+2
| | | | | | | | | | | | | | | | There are debug functions for setting the precision on a xlib device, so xlib-xcb must redirect that to the xcb backend, too. However this means that these public functions now are also called internally, thus we have to make them go through the slim_hidden_* macros. This commit fixes the following error from "make check": Checking .libs/libcairo.so for local PLT entries 00000000002bb6d8 000001e300000007 R_X86_64_JUMP_SLOT 000000000006d8a0 cairo_xcb_device_debug_set_precision + 0 00000000002bb750 0000025e00000007 R_X86_64_JUMP_SLOT 000000000006d8b0 cairo_xcb_device_debug_get_precision + 0 FAIL: check-plt.sh Signed-off-by: Uli Schlachter <psychon@znc.in>
* XCB: Implement PDF blend operators nativelyUli Schlachter2011-06-111-0/+4
| | | | | | | The PDF blend operators, as offered by cairo, where added in RENDER 0.11. This commit makes the XCB backend use them, if they are available. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xlib,xcb: Force strict adherence to the Render specification when testingChris Wilson2011-06-011-0/+3
| | | | | | | | | | 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>
* xcb: Remove CAIRO_XCB_RENDER_HAS_COMPOSITE_SPANSUli Schlachter2011-02-281-17/+6
| | | | | | | | | This flag was only ever tested, but never set. Also, there is no X11 server out there which actually supports this. AFAIK it was just an experiment which turned into dead code. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Remove some unused codeUli Schlachter2011-02-281-2/+0
| | | | | | | All of these defines where not used anymore and this '#if 0'd code was so for ages and most likely would stay commented out for more ages, too. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Remove the surface pattern cacheUli Schlachter2011-02-121-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Whenever a surface is used as a source, cairo-xcb creates a Picture for it and adds it as a snapshot to the source. Additionally, there is a per-screen cache that makes sure old Pictures are destroyed when more than 16 MiB of image data is used. There are two problems here: - Normally, the Picture would be destroyed once it is no longer a snapshot for the original source surface. However, the cache kept it alive for longer which means it was using memory but couldn't actually be used any more. (The Pictures are found via _cairo_surface_has_snapshot) - When a xcb surface is used as a source, we create a new Picture for it, but when that surface is cairo_surface_finish'd, we don't FreePicture this Picture. When the drawable was a window, this may later on cause a BadPicture error when cairo tries to explicitly free a picture that was already implicitly freed when its window was destroyed. The second point caused lots of tests in the test suite to fail on an assert due to the above-mentioned BadPicture error, but just removing the cache makes both these problems go away. The only downside is that the cache enforced a limit of 16 MiB of pixel data that was used for source surfaces on the server. After this commit the Picture will be kept alive until the snapshot is detached. If this becomes a problem memory-wise, a new solution will have to be invented... Signed-off-by: Uli Schlachter <psychon@znc.in>
* XCB: Fix build with xcb-shm disabledUli Schlachter2011-01-311-1/+1
| | | | | | | | | | | | | The function _cairo_xcb_shm_image_create is defined and needed even when XCB-SHM is disabled. In this case it just falls back to an image surface. Thanks to Benjamin Otte for noticing this. cairo-xcb-surface-render.c: In function ‘_render_to_picture’: cairo-xcb-surface-render.c:749: error: implicit declaration of function ‘_cairo_xcb_shm_image_create’ cairo-xcb-surface-render.c:749: warning: nested extern declaration of ‘_cairo_xcb_shm_image_create’ Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Remove a duplicate static functionUli Schlachter2011-01-311-0/+7
| | | | | | | | | Both cairo-xcb-surface-core.c and cairo-xcb-surface-render.c contained an identical definition of _cairo_xcb_shm_image_create. This commits removes the one from cairo-xcb-surface-render.c and adds the other one to cairo-xcb-private.h. Signed-off-by: Uli Schlachter <psychon@znc.in>
* XCB: Make sure SHM memory isn't reused too earlyUli Schlachter2011-01-021-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit delays the return of a SHM area to the free pool. When _cairo_xcb_shm_info_destroy is called, it now adds the cairo_xcb_shm_info_t to a list of pending memory areas and sends a GetInputFocus request to the server. This cairo_xcb_shm_info_t is only really freed when the GetInputFocus request completes. To avoid unnecessarily waiting for the X server, we check via xcb_poll_for_reply for the reply which returns immediately if the reply isn't received yet. This commits fixes a race where the shared memory area is reused before the X server finished reading data from it. This does NOT fix races where cairo draws something new to the same cairo_xcb_shm_info_t while the X server still reads from it. However, there doesn't seem to exist any code currently where the shm info isn't immediately destroyed after it was used. This commit fixes the following tests for xcb-render-0.0 if SHM is enabled: joins mask mask-transformed-image push-group push-group-color radial-gradient radil-gradient-mask radial-gradient-mask-source radial-gradient-one-stop radial-gradient-source smask smask-mask smask-paint This also fixes mesh-pattern-transformed for all the xcb boilerplate "backends". Signed-off-by: Uli Schlachter <psychon@znc.in>
* Remove an unused field from cairo_xcb_shm_info_tUli Schlachter2011-01-021-2/+1
| | | | Signed-off-by: Uli Schlachter <psychon@znc.in>
* XCB: Stop taking the xcb socketUli Schlachter2010-12-251-20/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes the xcb backend use the auto-generated xcb API instead of hand-writing each request. This should also improve parallelism with non-cairo threads that use the same xcb connection. Big thanks to Andrea Canciani for taking a look at this and finding lots of good improvements (especially finding xcb_send_request was great). cairo-perf-trace and cairo-perf-diff-files between master (6732dbf2992891be4b1f08b14a5c449fd08b637c) and this change: $ ./cairo-perf-diff-files ../master_perf ../xcb_no_socket_perf old: master_perf new: xcb_no_socket_perf Speedups ======== xcb-rgba evolution-0 23558.86 (23558.86 0.00%) -> 19338.78 (19338.78 0.00%): 1.22x speedup ▎ xcb-rgba poppler-bug-12266-0 98.43 (98.43 0.00%) -> 82.36 (82.36 0.00%): 1.20x speedup ▎ xcb-rgba gnome-terminal-vim-0 5518.08 (5518.08 0.00%) -> 4905.92 (4905.92 0.00%): 1.12x speedup ▏ xcb-rgba gnome-terminal-20090601-0 45648.46 (45648.46 0.00%) -> 41231.25 (41231.25 0.00%): 1.11x speedup ▏ xcb-rgba evolution-20090607-0 71643.69 (71643.69 0.00%) -> 66314.95 (66314.95 0.00%): 1.08x speedup ▏ xcb-rgba poppler-0 3501.69 (3501.69 0.00%) -> 3322.26 (3322.26 0.00%): 1.05x speedup Slowdowns ========= xcb-rgba gnome-system-monitor-0 7500.01 (7500.01 0.00%) -> 7923.70 (7923.70 0.00%): 1.06x slowdown xcb-rgba swfdec-youtube-full-0 26409.89 (26409.89 0.00%) -> 28430.76 (28430.76 0.00%): 1.08x slowdown ▏ xcb-rgba gnome-system-monitor-20090821-0 34801.61 (34801.61 0.00%) -> 37891.14 (37891.14 0.00%): 1.09x slowdown Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: trivial memfault fixes.Chris Wilson2010-05-101-1/+1
| | | | | The first fixes required to kick-start memfault testing of the xcb backend.
* xcb: Upload images in place.Chris Wilson2010-05-081-0/+5
| | | | | | A common operation is to store an image in a similar surface, so construct a fast path to avoid the allocation and double-blit through a temporary pixmap.
* 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
* xcb: Make shm optionalChris Wilson2010-01-251-0/+21
| | | | | | Trying to build xcb on a system without SHM wrapped by xcb. The right answer would be to build libxcb-shm. The quick answer is to compile out shm support.