diff options
Diffstat (limited to 'render')
-rw-r--r-- | render/gles2/renderer.c | 112 | ||||
-rw-r--r-- | render/pixman/renderer.c | 58 | ||||
-rw-r--r-- | render/vulkan/renderer.c | 53 | ||||
-rw-r--r-- | render/wlr_renderer.c | 37 |
4 files changed, 0 insertions, 260 deletions
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); |