mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-08 13:29:45 -05:00
Add wlr_compositor buffer API
This also rolls wlr_buffer into wlr_renderer as a user of this new API.
This commit is contained in:
parent
21db2418b7
commit
8630988eae
10 changed files with 518 additions and 370 deletions
|
|
@ -1,8 +1,14 @@
|
|||
#include <fcntl.h>
|
||||
#include <gbm.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <wayland-server.h>
|
||||
|
||||
#include <wlr/types/wlr_compositor.h>
|
||||
#include <wlr/types/wlr_subcompositor.h>
|
||||
#include <wlr/render/wlr_renderer.h>
|
||||
#include <wlr/render/wlr_texture.h>
|
||||
#include <wlr/render/egl.h>
|
||||
|
||||
struct wl_display *display;
|
||||
|
||||
|
|
@ -18,12 +24,26 @@ int main(void)
|
|||
|
||||
signal(SIGINT, sigint);
|
||||
|
||||
struct wlr_compositor *comp = wlr_compositor_create(display, NULL);
|
||||
int fd = open("/dev/dri/renderD128", O_RDWR);
|
||||
struct gbm_device *gbm = gbm_create_device(fd);
|
||||
|
||||
struct wlr_egl egl = {0};
|
||||
struct wlr_renderer *renderer = wlr_renderer_autocreate(&egl,
|
||||
EGL_PLATFORM_GBM_MESA, gbm, NULL, GBM_FORMAT_XRGB8888);
|
||||
|
||||
struct wlr_compositor *comp = wlr_compositor_create(display);
|
||||
struct wlr_subcompositor *subcomp = wlr_subcompositor_create(comp);
|
||||
|
||||
wlr_renderer_set_compositor(renderer, comp);
|
||||
|
||||
(void)subcomp;
|
||||
wl_display_run(display);
|
||||
|
||||
wlr_renderer_destroy(renderer);
|
||||
wlr_egl_finish(&egl);
|
||||
gbm_device_destroy(gbm);
|
||||
close(fd);
|
||||
|
||||
wl_display_destroy_clients(display);
|
||||
wl_display_destroy(display);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue