aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Orzechowski <alex@ozal.ski>2023-08-19 21:39:57 -0400
committerAlexander Orzechowski <alex@ozal.ski>2023-11-30 20:11:50 -0500
commitd3a339a03e320c397696d3d0f49567670146a7a4 (patch)
treea90c12d449e1d909532d4e22e801aad7c2e4984a
parent3ed1268f64fd736712c2de1bf522d42d6694e3cc (diff)
renderer: Drop buffer binding
-rw-r--r--include/render/gles2.h4
-rw-r--r--include/render/pixman.h3
-rw-r--r--include/render/vulkan.h2
-rw-r--r--include/render/wlr_renderer.h8
-rw-r--r--include/wlr/render/gles2.h4
-rw-r--r--include/wlr/render/interface.h5
-rw-r--r--include/wlr/render/pixman.h5
-rw-r--r--include/wlr/render/vulkan.h2
-rw-r--r--include/wlr/render/wlr_renderer.h14
-rw-r--r--render/gles2/renderer.c112
-rw-r--r--render/pixman/renderer.c58
-rw-r--r--render/vulkan/renderer.c53
-rw-r--r--render/wlr_renderer.c37
13 files changed, 0 insertions, 307 deletions
diff --git a/include/render/gles2.h b/include/render/gles2.h
index c4540a39..db301c6e 100644
--- a/include/render/gles2.h
+++ b/include/render/gles2.h
@@ -41,7 +41,6 @@ struct wlr_gles2_tex_shader {
struct wlr_gles2_renderer {
struct wlr_renderer wlr_renderer;
- float projection[9];
struct wlr_egl *egl;
int drm_fd;
@@ -87,9 +86,6 @@ struct wlr_gles2_renderer {
struct wl_list buffers; // wlr_gles2_buffer.link
struct wl_list textures; // wlr_gles2_texture.link
-
- struct wlr_gles2_buffer *current_buffer;
- uint32_t viewport_width, viewport_height;
};
struct wlr_gles2_render_timer {
diff --git a/include/render/pixman.h b/include/render/pixman.h
index 24a27055..09842144 100644
--- a/include/render/pixman.h
+++ b/include/render/pixman.h
@@ -20,9 +20,6 @@ struct wlr_pixman_renderer {
struct wl_list buffers; // wlr_pixman_buffer.link
struct wl_list textures; // wlr_pixman_texture.link
- struct wlr_pixman_buffer *current_buffer;
- int32_t width, height;
-
struct wlr_drm_format_set drm_formats;
};
diff --git a/include/render/vulkan.h b/include/render/vulkan.h
index 90a9c4e7..a518ee4a 100644
--- a/include/render/vulkan.h
+++ b/include/render/vulkan.h
@@ -252,8 +252,6 @@ struct wlr_vk_renderer {
VkSemaphore timeline_semaphore;
uint64_t timeline_point;
- struct wlr_vk_render_buffer *current_render_buffer;
-
size_t last_pool_size;
struct wl_list descriptor_pools; // wlr_vk_descriptor_pool.link
struct wl_list render_format_setups; // wlr_vk_render_format_setup.link
diff --git a/include/render/wlr_renderer.h b/include/render/wlr_renderer.h
index c55b3ac8..a8777bc0 100644
--- a/include/render/wlr_renderer.h
+++ b/include/render/wlr_renderer.h
@@ -8,14 +8,6 @@
*/
struct wlr_renderer *renderer_autocreate_with_drm_fd(int drm_fd);
/**
- * Bind a buffer to the renderer.
- *
- * All subsequent rendering operations will operate on the supplied buffer.
- * After rendering operations are done, the caller must unbind a buffer by
- * calling renderer_bind_buffer with a NULL buffer.
- */
-bool renderer_bind_buffer(struct wlr_renderer *r, struct wlr_buffer *buffer);
-/**
* Get the supported render formats. Buffers allocated with a format from this
* list may be attached via wlr_renderer_begin_with_buffer.
*/
diff --git a/include/wlr/render/gles2.h b/include/wlr/render/gles2.h
index 740e2f2d..e096f4f3 100644
--- a/include/wlr/render/gles2.h
+++ b/include/wlr/render/gles2.h
@@ -33,10 +33,6 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl);
struct wlr_egl *wlr_gles2_renderer_get_egl(struct wlr_renderer *renderer);
bool wlr_gles2_renderer_check_ext(struct wlr_renderer *renderer,
const char *ext);
-/**
- * Returns the OpenGL FBO of current buffer.
- */
-GLuint wlr_gles2_renderer_get_current_fbo(struct wlr_renderer *wlr_renderer);
struct wlr_gles2_texture_attribs {
GLenum target; /* either GL_TEXTURE_2D or GL_TEXTURE_EXTERNAL_OES */
diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h
index a433ea2a..9cbf814f 100644
--- a/include/wlr/render/interface.h
+++ b/include/wlr/render/interface.h
@@ -20,11 +20,6 @@ struct wlr_box;
struct wlr_fbox;
struct wlr_renderer_impl {
- bool (*bind_buffer)(struct wlr_renderer *renderer,
- struct wlr_buffer *buffer);
- bool (*begin)(struct wlr_renderer *renderer, uint32_t width,
- uint32_t height);
- void (*end)(struct wlr_renderer *renderer);
const uint32_t *(*get_shm_texture_formats)(
struct wlr_renderer *renderer, size_t *len);
const struct wlr_drm_format_set *(*get_dmabuf_texture_formats)(
diff --git a/include/wlr/render/pixman.h b/include/wlr/render/pixman.h
index 7e19fa4e..436ff1a7 100644
--- a/include/wlr/render/pixman.h
+++ b/include/wlr/render/pixman.h
@@ -13,11 +13,6 @@
#include <wlr/render/wlr_renderer.h>
struct wlr_renderer *wlr_pixman_renderer_create(void);
-/**
- * Returns the image of current buffer.
- */
-pixman_image_t *wlr_pixman_renderer_get_current_image(
- struct wlr_renderer *wlr_renderer);
bool wlr_renderer_is_pixman(struct wlr_renderer *wlr_renderer);
bool wlr_texture_is_pixman(struct wlr_texture *texture);
diff --git a/include/wlr/render/vulkan.h b/include/wlr/render/vulkan.h
index 04c877e4..50f8c558 100644
--- a/include/wlr/render/vulkan.h
+++ b/include/wlr/render/vulkan.h
@@ -24,8 +24,6 @@ VkInstance wlr_vk_renderer_get_instance(struct wlr_renderer *renderer);
VkPhysicalDevice wlr_vk_renderer_get_physical_device(struct wlr_renderer *renderer);
VkDevice wlr_vk_renderer_get_device(struct wlr_renderer *renderer);
uint32_t wlr_vk_renderer_get_queue_family(struct wlr_renderer *renderer);
-void wlr_vk_renderer_get_current_image_attribs(struct wlr_renderer *renderer,
- struct wlr_vk_image_attribs *attribs);
bool wlr_renderer_is_vk(struct wlr_renderer *wlr_renderer);
bool wlr_texture_is_vk(struct wlr_texture *texture);
diff --git a/include/wlr/render/wlr_renderer.h b/include/wlr/render/wlr_renderer.h
index 9c5011ec..08333a52 100644
--- a/include/wlr/render/wlr_renderer.h
+++ b/include/wlr/render/wlr_renderer.h
@@ -39,8 +39,6 @@ struct wlr_renderer {
// private state
const struct wlr_renderer_impl *impl;
-
- bool rendering;
};
/**
@@ -52,18 +50,6 @@ struct wlr_renderer {
struct wlr_renderer *wlr_renderer_autocreate(struct wlr_backend *backend);
/**
- * Start a render pass on the provided struct wlr_buffer.
- *
- * Compositors must call wlr_renderer_end() when they are done.
- */
-bool wlr_renderer_begin_with_buffer(struct wlr_renderer *r,
- struct wlr_buffer *buffer);
-/**
- * End a render pass.
- */
-void wlr_renderer_end(struct wlr_renderer *r);
-
-/**
* Get the shared-memory formats supporting import usage. Buffers allocated
* with a format from this list may be imported via wlr_texture_from_pixels().
*/
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
index 93fe292c..92e80709 100644
--- a/render/gles2/renderer.c
+++ b/render/gles2/renderer.c
@@ -42,14 +42,6 @@ struct wlr_gles2_renderer *gles2_get_renderer(
return renderer;
}
-static struct wlr_gles2_renderer *gles2_get_renderer_in_context(
- struct wlr_renderer *wlr_renderer) {
- struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
- assert(wlr_egl_is_current(renderer->egl));
- assert(renderer->current_buffer != NULL);
- return renderer;
-}
-
bool wlr_render_timer_is_gles2(struct wlr_render_timer *timer) {
return timer->impl == &render_timer_impl;
}
@@ -175,101 +167,6 @@ error_buffer:
return NULL;
}
-static bool gles2_bind_buffer(struct wlr_renderer *wlr_renderer,
- struct wlr_buffer *wlr_buffer) {
- struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
-
- if (renderer->current_buffer != NULL) {
- assert(wlr_egl_is_current(renderer->egl));
-
- push_gles2_debug(renderer);
- glFlush();
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
- pop_gles2_debug(renderer);
-
- wlr_buffer_unlock(renderer->current_buffer->buffer);
- renderer->current_buffer = NULL;
- }
-
- if (wlr_buffer == NULL) {
- wlr_egl_unset_current(renderer->egl);
- return true;
- }
-
- wlr_egl_make_current(renderer->egl);
-
- GLint fbo = gles2_buffer_get_fbo(renderer->current_buffer);
- if (!fbo) {
- return false;
- }
-
- struct wlr_gles2_buffer *buffer = gles2_buffer_get_or_create(renderer, wlr_buffer);
- if (buffer == NULL) {
- return false;
- }
-
- wlr_buffer_lock(wlr_buffer);
- renderer->current_buffer = buffer;
-
- push_gles2_debug(renderer);
- glBindFramebuffer(GL_FRAMEBUFFER, fbo);
- pop_gles2_debug(renderer);
-
- return true;
-}
-
-static const char *reset_status_str(GLenum status) {
- switch (status) {
- case GL_GUILTY_CONTEXT_RESET_KHR:
- return "guilty";
- case GL_INNOCENT_CONTEXT_RESET_KHR:
- return "innocent";
- case GL_UNKNOWN_CONTEXT_RESET_KHR:
- return "unknown";
- default:
- return "<invalid>";
- }
-}
-
-static bool gles2_begin(struct wlr_renderer *wlr_renderer, uint32_t width,
- uint32_t height) {
- struct wlr_gles2_renderer *renderer =
- gles2_get_renderer_in_context(wlr_renderer);
-
- push_gles2_debug(renderer);
-
- if (renderer->procs.glGetGraphicsResetStatusKHR) {
- GLenum status = renderer->procs.glGetGraphicsResetStatusKHR();
- if (status != GL_NO_ERROR) {
- wlr_log(WLR_ERROR, "GPU reset (%s)", reset_status_str(status));
- wl_signal_emit_mutable(&wlr_renderer->events.lost, NULL);
- return false;
- }
- }
-
- glViewport(0, 0, width, height);
- renderer->viewport_width = width;
- renderer->viewport_height = height;
-
- // refresh projection matrix
- matrix_projection(renderer->projection, width, height,
- WL_OUTPUT_TRANSFORM_FLIPPED_180);
-
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
-
- // XXX: maybe we should save output projection and remove some of the need
- // for users to sling matricies themselves
-
- pop_gles2_debug(renderer);
-
- return true;
-}
-
-static void gles2_end(struct wlr_renderer *wlr_renderer) {
- gles2_get_renderer_in_context(wlr_renderer);
- // no-op
-}
-
static const uint32_t *gles2_get_shm_texture_formats(
struct wlr_renderer *wlr_renderer, size_t *len) {
struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
@@ -446,9 +343,6 @@ static void gles2_render_timer_destroy(struct wlr_render_timer *wlr_timer) {
static const struct wlr_renderer_impl renderer_impl = {
.destroy = gles2_destroy,
- .bind_buffer = gles2_bind_buffer,
- .begin = gles2_begin,
- .end = gles2_end,
.get_shm_texture_formats = gles2_get_shm_texture_formats,
.get_dmabuf_texture_formats = gles2_get_dmabuf_texture_formats,
.get_render_formats = gles2_get_render_formats,
@@ -799,9 +693,3 @@ bool wlr_gles2_renderer_check_ext(struct wlr_renderer *wlr_renderer,
struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
return check_gl_ext(renderer->exts_str, ext);
}
-
-GLuint wlr_gles2_renderer_get_current_fbo(struct wlr_renderer *wlr_renderer) {
- struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
- assert(renderer->current_buffer);
- return gles2_buffer_get_fbo(renderer->current_buffer);
-}
diff --git a/render/pixman/renderer.c b/render/pixman/renderer.c
index 398a661b..b9acef40 100644
--- a/render/pixman/renderer.c
+++ b/render/pixman/renderer.c
@@ -193,27 +193,6 @@ error_buffer:
return NULL;
}
-static bool pixman_begin(struct wlr_renderer *wlr_renderer, uint32_t width,
- uint32_t height) {
- struct wlr_pixman_renderer *renderer = get_renderer(wlr_renderer);
- renderer->width = width;
- renderer->height = height;
-
- struct wlr_pixman_buffer *buffer = renderer->current_buffer;
- assert(buffer != NULL);
-
- return begin_pixman_data_ptr_access(buffer->buffer, &buffer->image,
- WLR_BUFFER_DATA_PTR_ACCESS_READ | WLR_BUFFER_DATA_PTR_ACCESS_WRITE);
-}
-
-static void pixman_end(struct wlr_renderer *wlr_renderer) {
- struct wlr_pixman_renderer *renderer = get_renderer(wlr_renderer);
-
- assert(renderer->current_buffer != NULL);
-
- wlr_buffer_end_data_ptr_access(renderer->current_buffer->buffer);
-}
-
static const uint32_t *pixman_get_shm_texture_formats(
struct wlr_renderer *wlr_renderer, size_t *len) {
return get_pixman_drm_formats(len);
@@ -290,33 +269,6 @@ static struct wlr_texture *pixman_texture_from_buffer(
return &texture->wlr_texture;
}
-static bool pixman_bind_buffer(struct wlr_renderer *wlr_renderer,
- struct wlr_buffer *wlr_buffer) {
- struct wlr_pixman_renderer *renderer = get_renderer(wlr_renderer);
-
- if (renderer->current_buffer != NULL) {
- wlr_buffer_unlock(renderer->current_buffer->buffer);
- renderer->current_buffer = NULL;
- }
-
- if (wlr_buffer == NULL) {
- return true;
- }
-
- struct wlr_pixman_buffer *buffer = get_buffer(renderer, wlr_buffer);
- if (buffer == NULL) {
- buffer = create_buffer(renderer, wlr_buffer);
- }
- if (buffer == NULL) {
- return false;
- }
-
- wlr_buffer_lock(wlr_buffer);
- renderer->current_buffer = buffer;
-
- return true;
-}
-
static void pixman_destroy(struct wlr_renderer *wlr_renderer) {
struct wlr_pixman_renderer *renderer = get_renderer(wlr_renderer);
@@ -359,12 +311,9 @@ static struct wlr_render_pass *pixman_begin_buffer_pass(struct wlr_renderer *wlr
}
static const struct wlr_renderer_impl renderer_impl = {
- .begin = pixman_begin,
- .end = pixman_end,
.get_shm_texture_formats = pixman_get_shm_texture_formats,
.get_render_formats = pixman_get_render_formats,
.texture_from_buffer = pixman_texture_from_buffer,
- .bind_buffer = pixman_bind_buffer,
.destroy = pixman_destroy,
.get_render_buffer_caps = pixman_get_render_buffer_caps,
.begin_buffer_pass = pixman_begin_buffer_pass,
@@ -398,10 +347,3 @@ pixman_image_t *wlr_pixman_texture_get_image(struct wlr_texture *wlr_texture) {
struct wlr_pixman_texture *texture = get_texture(wlr_texture);
return texture->image;
}
-
-pixman_image_t *wlr_pixman_renderer_get_current_image(
- struct wlr_renderer *wlr_renderer) {
- struct wlr_pixman_renderer *renderer = get_renderer(wlr_renderer);
- assert(renderer->current_buffer);
- return renderer->current_buffer->image;
-}
diff --git a/render/vulkan/renderer.c b/render/vulkan/renderer.c
index 35d5f829..b3f76401 100644
--- a/render/vulkan/renderer.c
+++ b/render/vulkan/renderer.c
@@ -562,8 +562,6 @@ static void destroy_render_buffer(struct wlr_vk_render_buffer *buffer) {
wl_list_remove(&buffer->link);
wlr_addon_finish(&buffer->addon);
- assert(buffer->renderer->current_render_buffer != buffer);
-
VkDevice dev = buffer->renderer->dev->dev;
// TODO: asynchronously wait for the command buffers using this render
@@ -846,39 +844,6 @@ static struct wlr_vk_render_buffer *get_render_buffer(
return buffer;
}
-static bool vulkan_bind_buffer(struct wlr_renderer *wlr_renderer,
- struct wlr_buffer *wlr_buffer) {
- struct wlr_vk_renderer *renderer = vulkan_get_renderer(wlr_renderer);
-
- if (renderer->current_render_buffer) {
- wlr_buffer_unlock(renderer->current_render_buffer->wlr_buffer);
- renderer->current_render_buffer = NULL;
- }
-
- if (!wlr_buffer) {
- return true;
- }
-
- struct wlr_vk_render_buffer *buffer = get_render_buffer(renderer, wlr_buffer);
- if (!buffer) {
- buffer = create_render_buffer(renderer, wlr_buffer);
- if (!buffer) {
- return false;
- }
- }
-
- wlr_buffer_lock(wlr_buffer);
- renderer->current_render_buffer = buffer;
- return true;
-}
-
-static bool vulkan_begin(struct wlr_renderer *wlr_renderer,
- uint32_t width, uint32_t height) {
- struct wlr_vk_renderer *renderer = vulkan_get_renderer(wlr_renderer);
- assert(renderer->current_render_buffer);
- return true;
-}
-
bool vulkan_sync_foreign_texture(struct wlr_vk_texture *texture) {
struct wlr_vk_renderer *renderer = texture->renderer;
VkResult res;
@@ -991,11 +956,6 @@ bool vulkan_sync_render_buffer(struct wlr_vk_renderer *renderer,
return true;
}
-static void vulkan_end(struct wlr_renderer *wlr_renderer) {
- struct wlr_vk_renderer *renderer = vulkan_get_renderer(wlr_renderer);
- assert(renderer->current_render_buffer);
-}
-
static const uint32_t *vulkan_get_shm_texture_formats(
struct wlr_renderer *wlr_renderer, size_t *len) {
struct wlr_vk_renderer *renderer = vulkan_get_renderer(wlr_renderer);
@@ -1023,8 +983,6 @@ static void vulkan_destroy(struct wlr_renderer *wlr_renderer) {
return;
}
- assert(!renderer->current_render_buffer);
-
VkResult res = vkDeviceWaitIdle(renderer->dev->dev);
if (res != VK_SUCCESS) {
wlr_vk_error("vkDeviceWaitIdle", res);
@@ -1366,9 +1324,6 @@ static struct wlr_render_pass *vulkan_begin_buffer_pass(struct wlr_renderer *wlr
}
static const struct wlr_renderer_impl renderer_impl = {
- .bind_buffer = vulkan_bind_buffer,
- .begin = vulkan_begin,
- .end = vulkan_end,
.get_shm_texture_formats = vulkan_get_shm_texture_formats,
.get_dmabuf_texture_formats = vulkan_get_dmabuf_texture_formats,
.get_render_formats = vulkan_get_render_formats,
@@ -2303,11 +2258,3 @@ uint32_t wlr_vk_renderer_get_queue_family(struct wlr_renderer *renderer) {
struct wlr_vk_renderer *vk_renderer = vulkan_get_renderer(renderer);
return vk_renderer->dev->queue_family;
}
-
-void wlr_vk_renderer_get_current_image_attribs(struct wlr_renderer *renderer,
- struct wlr_vk_image_attribs *attribs) {
- struct wlr_vk_renderer *vk_renderer = vulkan_get_renderer(renderer);
- attribs->image = vk_renderer->current_render_buffer->image;
- attribs->format = vk_renderer->current_render_buffer->render_setup->render_format->vk;
- attribs->layout = VK_IMAGE_LAYOUT_UNDEFINED;
-}
diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c
index d05770da..7f571286 100644
--- a/render/wlr_renderer.c
+++ b/render/wlr_renderer.c
@@ -49,8 +49,6 @@ void wlr_renderer_destroy(struct wlr_renderer *r) {
return;
}
- assert(!r->rendering);
-
wl_signal_emit_mutable(&r->events.destroy, r);
if (r->impl && r->impl->destroy) {
@@ -60,41 +58,6 @@ void wlr_renderer_destroy(struct wlr_renderer *r) {
}
}
-bool renderer_bind_buffer(struct wlr_renderer *r, struct wlr_buffer *buffer) {
- assert(!r->rendering);
- if (!r->impl->bind_buffer) {
- return false;
- }
- return r->impl->bind_buffer(r, buffer);
-}
-
-bool wlr_renderer_begin_with_buffer(struct wlr_renderer *r,
- struct wlr_buffer *buffer) {
- assert(!r->rendering);
-
- if (!renderer_bind_buffer(r, buffer)) {
- return false;
- }
- if (!r->impl->begin(r, buffer->width, buffer->height)) {
- renderer_bind_buffer(r, NULL);
- return false;
- }
-
- r->rendering = true;
- return true;
-}
-
-void wlr_renderer_end(struct wlr_renderer *r) {
- assert(r->rendering);
-
- if (r->impl->end) {
- r->impl->end(r);
- }
-
- r->rendering = false;
- renderer_bind_buffer(r, NULL);
-}
-
const uint32_t *wlr_renderer_get_shm_texture_formats(struct wlr_renderer *r,
size_t *len) {
return r->impl->get_shm_texture_formats(r, len);