aboutsummaryrefslogtreecommitdiff
path: root/render
AgeCommit message (Collapse)Author
2022-12-01wlr_texture: Expose owning rendererAlexander Orzechowski
2022-11-30linux-dmabuf-v1: add version arg to create()Simon Ser
To be able to add support for newer versions without breaking changes.
2022-11-30linux-dmabuf-v1: add "_with_renderer" suffix to create() functionSimon Ser
Make it clear this is a helper consuming a wlr_renderer. We'll add a lower-level create() function which doesn't take it in the next commit.
2022-11-28render/vulkan: import semaphore to DMA-BUF instead of blockingSimon Ser
Right now the Vulkan renderer blocks until the frame is complete after rendering. This is necessary because Vulkan doesn't interoperate well with implicit sync we use everywhere else. Use the new kernel API to import a sync_file into a DMA-BUF to avoid blocking.
2022-11-28render/dmabuf: add dmabuf_import_sync_fileSimon Ser
References: https://lore.kernel.org/dri-devel/20220506180216.2095060-1-jason@jlekstrand.net/
2022-11-28render/vulkan: release stage buffers after command buffer completesSimon Ser
We need to wait for the pending command buffer to complete before re-using stage buffers. Otherwise we'll overwrite the stage buffer with new contents before the texture is fully uploaded.
2022-11-28render/vulkan: destroy textures after command buffer completesSimon Ser
We need to wait for any pending command buffer to complete before we're able to fully destroy a struct wlr_vk_texture: the Vulkan spec requires the VkDescriptorSet to be kept alive. So far we've done this in vulkan_end(), after blocking until the command buffer completes. We'll soon stop blocking, so move this logic in get_command_buffer(), where we check which commands buffers have completed in a non-blocking fashion.
2022-11-28render/vulkan: drop unused fields from wlr_vk_format_modifier_propsSimon Ser
export_imported is never used, and dmabuf_flags is already checked in query_modifier_support().
2022-11-25render/vulkan: align staging buffers for texture uploadManuel Stoeckl
vkCmdCopyBufferToImage requires that the buffer offset be a multiple of the texel block size, which for single plane uncompressed formats is the same as the number of bytes per pixel. This commit adds an alignment parameter to vulkan_get_stage_span which ensures that the provided span (and the sequence of image copy operations derived which use it) have this alignment.
2022-11-25render/vulkan: add support for RGB565 texture formatManuel Stoeckl
Since this does not have a matching _SRGB-type vulkan format, add a new shader variant/pipeline to perform the sRGB->linear texture conversion.
2022-11-24render: stop pulling <wlr/backend.h>Simon Ser
Let's just forward-declare struct wlr_backend instead. We need to fixup the Vulkan renderer: it needs makedev(), which got included by chance via <wlr/backend.h> → <wlr/backend/session.h> → <libudev.h>.
2022-11-21render/vulkan: update shm texture data in one batchManuel Stoeckl
2022-11-17allocator/drm_dumb: use libdrm dumb buffer helpersSimon Ser
References: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/272
2022-11-15render: use wlr_shm in wlr_renderer_init_wl_shm()Simon Ser
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