aboutsummaryrefslogtreecommitdiff
path: root/render
AgeCommit message (Collapse)Author
2022-11-15render/pixel_format: import pixel_format_info_check_stride()Simon Ser
We'll use this function from wlr_shm too. Add some assertions, use int32_t (since the wire protocol uses that, and we don't want to use 16-bit integers on exotic systems) and switch the stride check to be overflow-safe.
2022-11-15render/vulkan: detect device lossSimon Ser
2022-11-15render/egl: enable EGL_LOSE_CONTEXT_ON_RESETSimon Ser
This allows the GLES2 renderer to figure out when a GPU reset happens.
2022-11-15render/gles2: query glGetGraphicsResetStatusKHRSimon Ser
Call glGetGraphicsResetStatusKHR in wlr_renderer_begin to figure out when a GPU reset occurs. Destroy the renderer when this happens (the OpenGL context is defunct).
2022-11-15render: add wlr_renderer.events.lostSimon Ser
2022-11-15render: make wlr_renderer_begin return a boolSimon Ser
2022-11-15render: allow wlr_renderer_impl.begin to failSimon Ser
Make it return a bool to indicate success/failure. Adapt the various implementations to check errors.
2022-11-15render/vulkan: add wlr_vk_texture_has_alphazccrs
Allow to get whether has alpha channel of the VkImage, it can help an optimization to disable blending when the texture doesn't have alpha. Because the VkFormat isn't enough because it's always set to VK_FORMAT_B8G8R8A8_SRGB or VK_FORMAT_R8G8B8A8_SRGB.
2022-11-11render/texture: constify wlr_texture_update_from_buffer()Simon Ser
2022-11-11render/vulkan: remove hardcoded validation layersSimon Zeni
Users should use the VK_INSTANCE_LAYERS env var to set layers at runtime
2022-11-11render/egl: fix uninitialized pointers in init_dmabuf_formatsSimon Zeni
`modifiers` and `external_only` are never initialized, and free'd later. This commit explicitly initializes them to NULL to prevent segfaults on `free()`
2022-11-11render/vulkan: use initializer for VkBufferImageCopySimon Ser
Missed that one it seems.
2022-11-11render/vulkan: wait for device to become idle in vulkan_destroy()Simon Ser
It's not safe to destroy any resources which might still be in-use by the GPU. Wait for any asynchronous tasks to complete before destroying everything.
2022-11-11render/vulkan: always wait for last stage to complete before renderingSimon Ser
When we have multiple command buffers in flight, we need to make sure we don't start rendering before the previous texture uploads are complete.
2022-11-11render/vulkan: use command buffer pool for stageSimon Ser
2022-11-11render/vulkan: add a command buffer poolSimon Ser
Before re-using a VkCommandBuffer, we need to wait for its operations to complete. Right now we unconditionally wait for rendering to complete in vulkan_end(), however we have plans to fix this [1]. To fully avoid blocking, we need to handle multiple command buffers in flight at the same time (e.g. for multi-output, or for rendering followed by texture uploads). Implement a pool of command buffers. When we need to render, we pick a command buffer from the pool which has completed its operations. If we don't find one, try to allocate a new command buffer. If we don't have slots in the pool anymore, block like we did before. [1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3574
2022-11-11render/vulkan: switch to timeline semaphoresSimon Ser
Up until now we were using a VkFence for GPU-to-CPU synchronization. This has some limitations that become a blocker when trying to have multiple command buffers in flight at once (e.g. for multi-output). It's desirable to implement a command buffer pool [1], but VkFence cannot be used to track command buffer completion for individual subpasses. Let's just switch to timeline semaphores [2], which fix this issue, make synchronization a lot more ergonomic and are a core Vulkan 1.2 feature. [1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3802 [2]: https://www.khronos.org/blog/vulkan-timeline-semaphores
2022-11-11render/vulkan: add helper to load command function pointerSimon Ser
If NULL is returned by vkGetDeviceProcAddr(), either the driver is buggy, either the wlroots code is buggy. For a valid device and command name, drivers are not allowed to return NULL per the spec. This mirrors what the GLES2 renderer does in load_gl_proc().
2022-11-08Revert "render/pixman: apply source image cropping"Kirill Primak
This reverts commit 9fefeb69d6fc1136cfad7d690e1d7385c058fd72. It doesn't really crop anything, actually.
2022-11-08render/vulkan: add some interfaces to allow compositors to integratezccrs
Added wlr_vk_renderer_get_* functions to allow get the VkInstance, VkPhysicalDevice, VkDevice, queue family of a wlr_vk_renderer. Added wlr_vk_renderer_get_current_image_attribs function to allow get the VkImage of current renderer buffer to use on compositors. Added wlr_renderer_is_vk function, it's like the wlr_renderer_is_gles2, returns true if the wlr_renderer is a wlr_vk_renderer. Added wlr_vk_image_get_attribs function to get a VkImage and it's extras information (e.g. a VkImageLayout and VkImageFormat of the VkImage) from a wlr_texture.
2022-11-08render/pixman: apply source image croppingKirill Primak
2022-11-07render/vulkan: use wl_array for wlr_vk_shared_buffer.allocsSimon Ser
Avoids the need to open-code the realloc() logic.
2022-11-07render/vulkan: simplify texture VkPipelineShaderStageCreateInfoSimon Ser
I simplified the quad VkPipelineShaderStageCreateInfo in [1], but missed the one for texture. [1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3823
2022-11-06render/vulkan: use struct initializersSimon Ser
Instead of filling the fields one by one, use a struct initializer. This avoids repeating the name of the variable and is more consistent with the wlroots code style.
2022-11-06render/vulkan: simplify extension checksSimon Ser
find_extensions() is clunky to use when checking only a single extension, and it's surprising that it returns NULL on success. Simplify by replacing it with a check_extension() function which just checks whether a single extension is in the list.
2022-11-04render/vulkan: remove exts arg from vulkan_instance_create()Simon Ser
2022-11-04render/vulkan: add caching to vulkan_read_pixelsDavid96
2022-10-28render/gles2: de-duplicate vertex shadersSimon Ser
The vertex shaders for quads and textures are identical.
2022-10-28render/gles2: move color uniform from quad.vert to quad.fragSimon Ser
We have no use for a v_color varying. We can use the uniform directly from the fragment shader without getting the vertex shader involved.
2022-10-28render/gles2: move shaders to individual filesSimon Ser
Instead of having a C file with strings for each shader, move each shader into its own file. Use a small POSIX shell script to convert the files into C strings (can't wait for C23 #embed...). The benefits from this are: - Improved readability and syntax highlighting. - Line numbers in shader compiler errors are easier to make sense of. - Consistency with the Vulkan renderer. - Shaders will become more complicated as we add color management features.
2022-10-27render/gles2: log error on shader compilation failureSimon Ser
2022-10-21egl: add WLR_EGL_NO_MODIFIERSSimon Ser
Same as WLR_DRM_NO_MODIFIERS but for EGL. For debugging purposes mostly. References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3451
2022-10-18render/vulkan: add missing entries in vulkan_strerror()Simon Ser
And update the sort order to follow Khronos' <vulkan/vulkan_core.h>.
2022-10-11Fixed false allocation failedGentaiii
2022-10-10render/vulkan: drop wlr_vk_instance.extensionsSimon Ser
This was unused. Even if it was, it'd be better to have bool fields instead.
2022-10-10render/gles2: assert that GL_OES_EGL_image_external is supportedSimon Ser
The target is set to GL_TEXTURE_EXTERNAL_OES when EGL_EXT_image_dma_buf_import_modifiers [1] returns an external_only flag. That spec states: > In order to support imports for the GL_TEXTURE_EXTERNAL_OES target, a > compatible OpenGL ES implementation supporting GL_OES_EGL_image_external > must be present. Fail hearder when a driver doesn't follow the spec instead of skipping rendering. See [2]. [1]: https://registry.khronos.org/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import_modifiers.txt [2]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3631#note_1584343
2022-10-09render/vulkan: Fix type-punned pointer warning/errorJohn Lindgren
2022-10-07render/vulkan: implement vulkan_preferred_read_formatDavid96
2022-10-07render/vulkan: Implement vulkan_read_pixelsDavid96
2022-10-04render: drop wlr_renderer_read_pixels() flagsSimon Ser
These are unused.
2022-10-01render/allocator/drm_dumb: drop finish_buffer()Simon Ser
Simplify things a bit.
2022-10-01render/allocator/drm_dumb: fix error handlingSimon Ser
In the CREATE_DUMB error code-path, we'd only free() the buffer, however it's already inserted in the alloc->buffers list at this point. Instead, make sure finish_buffer() is safe to call (by populating drm_fd) and call that function.
2022-10-01render/allocator/drm_dumb: get format info before allocatingSimon Ser
Simplifies error handling a bit.
2022-10-01render/allocator/drm_dumb: check modifier listSimon Ser
Check that the modifier list passed as input contains either INVALID or LINEAR. We don't support others.
2022-10-01render/allocator/drm_dumb: advertise LINEAR instead of INVALID modifierSimon Ser
INVALID means that the modifier is implicit. However dumb buffers are guaranteed to be LINEAR, so let's just advertise this. Fixes cursors with the DRM backend: cursor planes usually only support LINEAR.
2022-10-01render/pixman: advertise support for linear format modifierSimon Ser
When running with the DRM backend, the Pixman renderer needs to render the cursor buffer. However, DRM drivers only support linear buffers for these in general, they don't support implicit modifiers (aka. INVALID). Advertise support for LINEAR in the Pixman renderer to fix this.
2022-10-01render: don't fall back to Pixman if we have a render nodeSimon Ser
If we have a render node, it means there is a GPU which could be used. We probably failed GL because of a kernel or Mesa issue. Instead of automatically falling back to Pixman, error out. This makes it more obvious to users when something goes wrong, instead of silently exposing a slow unaccelerated desktop. References: https://github.com/swaywm/sway/issues/7194
2022-10-01render: don't automatically fall back to VulkanSimon Ser
The Vulkan renderer is still experimental. If GL fails, we don't want to automatically fall back to it by default. Fixes: 8bd7170fd95a ("Use env helpers")
2022-09-30render/vulkan: use addon for wlr_vk_textureSimon Ser
Avoids having to walk the list of all textures.
2022-09-30render/vulkan: use addon for wlr_vk_render_bufferSimon Ser
Avoids having to walk the list containing all of the render buffers.