Get drm_format without accessing private swapchain field
This commit is contained in:
parent
ff0ced7254
commit
b9a8fa4f8a
3 changed files with 16 additions and 4 deletions
|
@ -173,8 +173,8 @@ struct fx_renderer {
|
||||||
GLuint wlr_main_buffer_fbo;
|
GLuint wlr_main_buffer_fbo;
|
||||||
struct wlr_gles2_texture_attribs wlr_main_texture_attribs;
|
struct wlr_gles2_texture_attribs wlr_main_texture_attribs;
|
||||||
|
|
||||||
// The framebuffer used by wlroots
|
const struct wlr_drm_format *drm_format;
|
||||||
struct fx_framebuffer wlr_buffer;
|
|
||||||
// Contains the blurred background for tiled windows
|
// Contains the blurred background for tiled windows
|
||||||
struct fx_framebuffer blur_buffer;
|
struct fx_framebuffer blur_buffer;
|
||||||
// Contains the original pixels to draw over the areas where artifact are visible
|
// Contains the original pixels to draw over the areas where artifact are visible
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include <wlr/interfaces/wlr_buffer.h>
|
#include <wlr/interfaces/wlr_buffer.h>
|
||||||
#include <wlr/render/interface.h>
|
#include <wlr/render/interface.h>
|
||||||
#include <wlr/render/allocator.h>
|
#include <wlr/render/allocator.h>
|
||||||
#include <wlr/render/swapchain.h>
|
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "render/egl.h"
|
#include "render/egl.h"
|
||||||
|
@ -53,7 +52,7 @@ void fx_framebuffer_update(struct fx_renderer *fx_renderer, struct fx_framebuffe
|
||||||
fx_buffer->wlr_buffer->height != height) {
|
fx_buffer->wlr_buffer->height != height) {
|
||||||
wlr_buffer_drop(fx_buffer->wlr_buffer);
|
wlr_buffer_drop(fx_buffer->wlr_buffer);
|
||||||
fx_buffer->wlr_buffer = wlr_allocator_create_buffer(output->allocator,
|
fx_buffer->wlr_buffer = wlr_allocator_create_buffer(output->allocator,
|
||||||
width, height, output->swapchain->format);
|
width, height, fx_renderer->drm_format);
|
||||||
first_alloc = true;
|
first_alloc = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,10 @@
|
||||||
#include <GLES2/gl2.h>
|
#include <GLES2/gl2.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <wlr/backend.h>
|
#include <wlr/backend.h>
|
||||||
|
#include <wlr/render/drm_format_set.h>
|
||||||
#include <wlr/render/egl.h>
|
#include <wlr/render/egl.h>
|
||||||
#include <wlr/render/gles2.h>
|
#include <wlr/render/gles2.h>
|
||||||
|
#include <wlr/render/interface.h>
|
||||||
#include <wlr/types/wlr_matrix.h>
|
#include <wlr/types/wlr_matrix.h>
|
||||||
#include <wlr/util/box.h>
|
#include <wlr/util/box.h>
|
||||||
|
|
||||||
|
@ -264,6 +266,17 @@ struct fx_renderer *fx_renderer_create(struct wlr_egl *egl, struct wlr_output *w
|
||||||
renderer->wlr_output = wlr_output;
|
renderer->wlr_output = wlr_output;
|
||||||
renderer->egl = egl;
|
renderer->egl = egl;
|
||||||
|
|
||||||
|
// Get DRM format
|
||||||
|
const struct wlr_drm_format_set *display_formats =
|
||||||
|
wlr_output_get_primary_formats(wlr_output, wlr_output->allocator->buffer_caps);
|
||||||
|
if (!(renderer->drm_format =
|
||||||
|
wlr_drm_format_set_get(display_formats, wlr_output->render_format))) {
|
||||||
|
sway_log(SWAY_ERROR,
|
||||||
|
"FX RENDERER: Could not get drm format: %u",
|
||||||
|
wlr_output->render_format);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: wlr_egl_make_current or eglMakeCurrent?
|
// TODO: wlr_egl_make_current or eglMakeCurrent?
|
||||||
// TODO: assert instead of conditional statement?
|
// TODO: assert instead of conditional statement?
|
||||||
if (!eglMakeCurrent(wlr_egl_get_display(egl), EGL_NO_SURFACE, EGL_NO_SURFACE,
|
if (!eglMakeCurrent(wlr_egl_get_display(egl), EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||||
|
|
Loading…
Add table
Reference in a new issue