Commit Graph

49464 Commits

Author SHA1 Message Date
Alexander Larsson
5bf28a3869 gdk: Drop support for native (and thus foreign) subwindows
We can't really support these on e.g. wayland anyway, and we're trying
to get rid of subwindow at totally in the long term, so lets drop this.
It allows us to drop a lot of complexity.
2016-12-16 12:28:44 +01:00
Olivier Fourdan
5c3192c75a wayland: apply empty input shape on parent commit
For subsurfaces, the new state which includes the input shape is not
applied by the compositor if the subsurface is in effective synchronous
mode.

So we need to apply the input shape once parent surface is in effective
desynchronized mode, which is when it's committed, otherwise the input
shape may never be applied if the widget is not using being_paint() /
end_paint() to draw on its subsurface, like clutter does.

We do that only for empty input shape as those won't need update when
the subsurface is resized, for all other non-empty input shape, the
client still has to use begin_paint()/end_paint() for the input shape to
be applied.

https://bugzilla.gnome.org/show_bug.cgi?id=774534
2016-12-15 13:27:39 +01:00
Baurzhan Muftakhidinov
cacd1da8a1 Update Kazakh translation 2016-12-14 11:13:24 +00:00
Matthias Clasen
c4fd5bc233 Add a css parser test for border-spacing 2016-12-10 20:41:07 -05:00
Matthias Clasen
b1f2e3b581 Remove -gtk-gradient from css parser tests
It is not supported anymore.
2016-12-10 20:40:48 -05:00
Matthias Clasen
8fb311cb4b Document the border-spacing CSS property 2016-12-10 20:34:24 -05:00
Benjamin Otte
0eecc6f686 grid: Implement support for CSS border-spacing 2016-12-10 04:32:55 +01:00
Benjamin Otte
404cdd5d02 boxgadget: Implement CSS border-spacing 2016-12-10 04:32:55 +01:00
Benjamin Otte
75c3d193f6 box: Implement support for border-spacing 2016-12-10 04:32:55 +01:00
Benjamin Otte
5aea108802 box: Remove unused member variable 2016-12-10 04:32:55 +01:00
Benjamin Otte
d7148a4718 css: Add "border-spacing" CSS property
It's using a GtkCssPositionValue, even though that name is wrong. But
the functionality of managing 2 lengths is exactly what we want.

Nobody is using this yet.
2016-12-10 04:32:55 +01:00
Matthias Clasen
438ad208e7 Use the new defines
It is no longer GDK_WINDOWING_VULKAN.
2016-12-09 15:51:58 -05:00
Benjamin Otte
cb8483b0a6 gtk: Remove unneeded gtk_snapshot_push()/pop() calls 2016-12-09 21:39:43 +01:00
Benjamin Otte
f8932d643d snapshot: Always create an initial node
This way we ensure that there is only one root node and everybody can
append() with impunity.
2016-12-09 21:39:43 +01:00
Benjamin Otte
2faad03f2f gsk: Improve GSK_RENDERER env var handling
- Recognize "gl" as well as "opengl" for the GL renderer
- GSK_RENDERER=help now works
- g_warning() for an unrecognized renderer (typo detection!)
- g_print() the actual renderer that is used (and error messages when
  selecting) when a GSK_RENDERER is given, so you'll notice if your
  renderer isn't taken.
2016-12-09 21:27:55 +01:00
Benjamin Otte
3e9811d91c build: Don't try to detect vulkan library if the header wasn't found.
We've already failed. No need to fail again.
2016-12-09 21:27:29 +01:00
Matthias Clasen
4ae50bf38e Trivial doc fixups 2016-12-09 14:59:46 -05:00
Benjamin Otte
2c0564a46e build: Make sure GTK compiles without Vulkan headers installed
Previously, code would work fine with --disable-vulkan if the Vulkan
headers were installed - code would happily just use them as they're
installed in /usr/include.
2016-12-09 20:23:06 +01:00
Matthias Clasen
98f5e794a6 Forgotten file 2016-12-09 14:22:14 -05:00
Matthias Clasen
3dd4f76703 Rename GDK_WINDOWING_VULKAN
The WINDOWING defines are only for GDK backends, really.
Define GDK_RENDERING_VULKAN instead.
2016-12-09 14:11:37 -05:00
Matthias Clasen
5b6a837b17 Only include vulkan.h if we have it 2016-12-09 14:05:26 -05:00
Matthias Clasen
17c8ebc4a8 Fix the configure check for Vulkan
GDK_WINDOWING_VULKAN was getting defined regardless of the tests.
2016-12-09 14:00:48 -05:00
Benjamin Otte
f52dd12569 vulkan: Implement texture caching
And with this change, the GPU looks bored again.
2016-12-09 18:35:52 +01:00
Benjamin Otte
6525fbe90f vulkan: Don't create more than one render object
By creating unlimited render objects, we would never wait on the GPU.

This would mean that if the GPU was the bottleneck, we would fill its
queue with render commands faster than it could process them.

And because the nvidia binary driver and my code work surprisingly well
and bugfree, this lead to exhaustion of RAM. I had 50GB of swap
configured and my hard disk was quicker as swap storage than my GPU was
at processing the commands, so stuff still filled up.

At that point my computer became rather unresponsive and I decided to
reboot it, so I that could write this patch.
2016-12-09 18:35:52 +01:00
Benjamin Otte
b3388aaca9 vulkan: Don't limit number of descriptor sets
If we need more than we have reserved as maximum, recreate the
descriptor pool with a higher maximum.
2016-12-09 18:35:52 +01:00
Benjamin Otte
35d1dc6dd5 vulkan: Add more node operations
Add SURFACE and TEXTURE operations. This way, we actually render more
than one node every frame because not everything is a fallback node
anymore that gets composited with its children into a cairo surface.
2016-12-09 18:35:52 +01:00
Benjamin Otte
cf470f31ca vulkan: Push the correct matrix when drawing
Instead of pushing the root matrix, push the world matrix for the
current node. That way, the bounds we emit as vertices are actually
properly transformed.
2016-12-09 18:35:52 +01:00
Benjamin Otte
93448b8c7e vulkan: Enable alpha blending
We will need that once we actually composite stuff.
2016-12-09 18:35:52 +01:00
Benjamin Otte
b3a1732a3e vulkan: Redo descriptor set handling
First, we collect all the info about descriptor sets into a hash table,
then we use its size to determine the amount of sets and allocate those
before we finally go ahead and use the hash table's contents to
initialize the descriptor sets.

And then we're ready to render.
2016-12-09 18:35:52 +01:00
Benjamin Otte
f4685e0291 vulkan: Move remaining structs to VulkanRender object
It now gets to maintain things.
2016-12-09 18:35:52 +01:00
Benjamin Otte
e989375c04 vulkan: Create framebuffers from GskVulkanRender object
Also create them on-demand, as they need to be created per-image and
per-framebuffer, so we don't want to create loads of them.
2016-12-09 18:35:52 +01:00
Benjamin Otte
8756deec58 vulkan: Turn swapchain image targets into GskVulkanImages
This gives us proper refcounting here, too. And there's no longer a
difference between the different types of images.
2016-12-09 18:35:52 +01:00
Benjamin Otte
17c11dd97b vulkan: Store width/height of GskVulkanImage
This is to enable lazy framebuffer creation later.
2016-12-09 18:35:51 +01:00
Benjamin Otte
c160ef16c1 vulkan: Turn GskVulkanImage into a GObject
This way, we can do real refcounting on them.
2016-12-09 18:35:51 +01:00
Benjamin Otte
85bc9ff36b vulkan: Hook up image upload mechanism to env variables
Instead of having to decie at compile-time, check if
GSK_RENDERING=staging-image was given, and if so, select the staging
image upload mode.
2016-12-09 18:35:51 +01:00
Benjamin Otte
b2e30fb66e vulkan: Don't wait until graphics are done computing
We can let the GPU do its stuff without waiting. The GPU knows what it's
doing.

Which means we now get a lot of time to spend on doing CPU things (read:
we're way better in benchmarks).

The old behavior is safer, so we want to keep it around for debugging.
It can be reenabled with GSK_RENDERING_MODE=sync.
2016-12-09 18:35:51 +01:00
Benjamin Otte
ac9d48151b vulkan: Keep render objects around
That way we can reuse them. We only create a new one if the last render
operation hasn't finished executing.
2016-12-09 18:35:51 +01:00
Benjamin Otte
adff39953d vulkan: Move command pool and fence into render object 2016-12-09 18:35:51 +01:00
Benjamin Otte
9635598124 vulkan: Make the GskVulkanRender struct private 2016-12-09 18:35:51 +01:00
Benjamin Otte
eb94153a2c vulkan: Make the VulkanRender object allocated
That way, we can have multiple of those and keep them around for reuse.
2016-12-09 18:35:51 +01:00
Benjamin Otte
747df7aa3c vulkan: Also wait on the draw semaphore when present()ing
That way we have a synchronization primitive at the start and at the
end.
2016-12-09 18:35:51 +01:00
Benjamin Otte
3c5b25b1d1 vulkan: Add GskVulkanRenderPass
And move the actual rendering code there.

A RenderPass is a collection of operations on the same target that
get executed one after another. It roughly targets VkRenderPass or
rather the subpasses of a VkRenderPass.

For now, only the infrastructure is there. No real stuff is happening.
2016-12-09 18:35:51 +01:00
Benjamin Otte
681554787b vulkan: Add GskVulkanRender object
This is refactoring work.

GskVulkanRender is supposed to be the global object for a render
operation, ie GskVulkanRenderer.render() will create this object for
what it does.

The object will be split into stages that perform the operations
necessary to create a drawing.
2016-12-09 18:35:51 +01:00
Benjamin Otte
583956266e vulkan: Make MVP matrix available to vertex shader
We use push constants for this.
2016-12-09 18:35:51 +01:00
Benjamin Otte
13b53656ea vulkan: Upload image data directly
Instead of using a staging iamge, we require the final image to be
linearly allocated and have host-visible memory.

This improves performance quite a bit.

The old code is still there and can be enabled with a simple change
to a #define in gskvulkanimage.h
2016-12-09 18:35:51 +01:00
Benjamin Otte
3c4b952256 vulkan: Make GskVulkanRenderer work
We now create a Cairo renderer, render to an image surface and upload
and retnder it with Vulkan.
2016-12-09 18:35:51 +01:00
Benjamin Otte
9120bdd9e9 xim: Use the native parent window for the X connection
Don't try to gdk_window_get_xid() on the current window.
2016-12-09 18:35:51 +01:00
Benjamin Otte
5e4f95d77f x11: Don't make random windows native
Instead, complain if somebody calls gdk_x11_window_get_xid() on a
non-native window.

We cannot make random windows native anymore because there's no GSK
renderer associated with them, so we cannot draw them.
2016-12-09 18:35:51 +01:00
Benjamin Otte
a7cbbaf8fc gsk: Pass texture coordinates to Vulkan renderer
We just render the coordinates as color, we don't do anything with them
yet.
2016-12-09 18:35:51 +01:00
Benjamin Otte
2a0e7f8829 gsk: Loads of work on Vulkan backend
We can now upload vertices.

And we use this to draw a yellow background. Which is clearly superior
to not drawing anything.

Also, we have shaders now. If you modify them, you need glslc installed
so they can be recompiled into Spir-V bytecode.
2016-12-09 18:35:51 +01:00