diff --git a/backend/backend.c b/backend/backend.c index ef1d523c..1cdddd16 100644 --- a/backend/backend.c +++ b/backend/backend.c @@ -18,7 +18,7 @@ #include #include "backend/backend.h" #include "backend/multi.h" -#include "render/allocator.h" +#include "render/allocator/allocator.h" #include "util/signal.h" #if WLR_HAS_DRM_BACKEND diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c index adda8fd5..4f1b102a 100644 --- a/backend/drm/renderer.c +++ b/backend/drm/renderer.c @@ -14,7 +14,7 @@ #include "backend/drm/drm.h" #include "backend/drm/util.h" #include "render/drm_format_set.h" -#include "render/allocator.h" +#include "render/allocator/allocator.h" #include "render/pixel_format.h" #include "render/swapchain.h" #include "render/wlr_renderer.h" diff --git a/backend/headless/backend.c b/backend/headless/backend.c index cf7f6026..51217f8b 100644 --- a/backend/headless/backend.c +++ b/backend/headless/backend.c @@ -12,7 +12,6 @@ #include "backend/backend.h" #include "backend/headless.h" #include "render/drm_format_set.h" -#include "render/gbm_allocator.h" #include "render/wlr_renderer.h" #include "util/signal.h" diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index 207c17d2..c11d25ca 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -17,7 +17,6 @@ #include "backend/backend.h" #include "backend/wayland.h" -#include "render/allocator.h" #include "render/drm_format_set.h" #include "render/pixel_format.h" #include "render/wlr_renderer.h" diff --git a/backend/x11/backend.c b/backend/x11/backend.c index acdd3f39..f55238cb 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -31,7 +31,6 @@ #include "backend/backend.h" #include "backend/x11.h" -#include "render/allocator.h" #include "render/drm_format_set.h" #include "util/signal.h" diff --git a/include/render/allocator.h b/include/render/allocator/allocator.h similarity index 94% rename from include/render/allocator.h rename to include/render/allocator/allocator.h index c33ab126..d67116cd 100644 --- a/include/render/allocator.h +++ b/include/render/allocator/allocator.h @@ -1,9 +1,8 @@ -#ifndef RENDER_ALLOCATOR -#define RENDER_ALLOCATOR +#ifndef RENDER_ALLOCATOR_ALLOCATOR_H +#define RENDER_ALLOCATOR_ALLOCATOR_H #include #include -#include #include struct wlr_allocator; diff --git a/include/render/drm_dumb_allocator.h b/include/render/allocator/drm_dumb.h similarity index 82% rename from include/render/drm_dumb_allocator.h rename to include/render/allocator/drm_dumb.h index ff10d54b..7e37acfb 100644 --- a/include/render/drm_dumb_allocator.h +++ b/include/render/allocator/drm_dumb.h @@ -1,9 +1,9 @@ -#ifndef RENDER_DRM_DUMB_ALLOCATOR_H -#define RENDER_DRM_DUMB_ALLOCATOR_H - -#include "render/allocator.h" +#ifndef RENDER_ALLOCATOR_DRM_DUMB_H +#define RENDER_ALLOCATOR_DRM_DUMB_H +#include #include +#include "render/allocator/allocator.h" struct wlr_drm_dumb_buffer { struct wlr_buffer base; diff --git a/include/render/gbm_allocator.h b/include/render/allocator/gbm.h similarity index 81% rename from include/render/gbm_allocator.h rename to include/render/allocator/gbm.h index df6b5e39..eb112e7c 100644 --- a/include/render/gbm_allocator.h +++ b/include/render/allocator/gbm.h @@ -1,9 +1,10 @@ -#ifndef RENDER_GBM_ALLOCATOR_H -#define RENDER_GBM_ALLOCATOR_H +#ifndef RENDER_ALLOCATOR_GBM_H +#define RENDER_ALLOCATOR_GBM_H #include +#include #include -#include "render/allocator.h" +#include "render/allocator/allocator.h" struct wlr_gbm_buffer { struct wlr_buffer base; diff --git a/include/render/shm_allocator.h b/include/render/allocator/shm.h similarity index 75% rename from include/render/shm_allocator.h rename to include/render/allocator/shm.h index d1f48f7f..4b80e475 100644 --- a/include/render/shm_allocator.h +++ b/include/render/allocator/shm.h @@ -1,8 +1,8 @@ -#ifndef RENDER_SHM_ALLOCATOR_H -#define RENDER_SHM_ALLOCATOR_H +#ifndef RENDER_ALLOCATOR_SHM_H +#define RENDER_ALLOCATOR_SHM_H #include -#include "render/allocator.h" +#include "render/allocator/allocator.h" struct wlr_shm_buffer { struct wlr_buffer base; diff --git a/render/allocator.c b/render/allocator/allocator.c similarity index 95% rename from render/allocator.c rename to render/allocator/allocator.c index 5b7e27ff..8664202f 100644 --- a/render/allocator.c +++ b/render/allocator/allocator.c @@ -3,10 +3,10 @@ #include #include #include "backend/backend.h" -#include "render/allocator.h" -#include "render/gbm_allocator.h" -#include "render/shm_allocator.h" -#include "render/drm_dumb_allocator.h" +#include "render/allocator/allocator.h" +#include "render/allocator/drm_dumb.h" +#include "render/allocator/gbm.h" +#include "render/allocator/shm.h" #include "render/wlr_renderer.h" void wlr_allocator_init(struct wlr_allocator *alloc, diff --git a/render/drm_dumb_allocator.c b/render/allocator/drm_dumb.c similarity index 99% rename from render/drm_dumb_allocator.c rename to render/allocator/drm_dumb.c index c0038dff..a47df624 100644 --- a/render/drm_dumb_allocator.c +++ b/render/allocator/drm_dumb.c @@ -13,7 +13,7 @@ #include #include -#include "render/drm_dumb_allocator.h" +#include "render/allocator/drm_dumb.h" #include "render/pixel_format.h" static const struct wlr_buffer_impl buffer_impl; diff --git a/render/gbm_allocator.c b/render/allocator/gbm.c similarity index 99% rename from render/gbm_allocator.c rename to render/allocator/gbm.c index 154e5137..ace7ca68 100644 --- a/render/gbm_allocator.c +++ b/render/allocator/gbm.c @@ -6,7 +6,7 @@ #include #include #include -#include "render/gbm_allocator.h" +#include "render/allocator/gbm.h" static const struct wlr_buffer_impl buffer_impl; diff --git a/render/allocator/meson.build b/render/allocator/meson.build new file mode 100644 index 00000000..db17ccb2 --- /dev/null +++ b/render/allocator/meson.build @@ -0,0 +1,9 @@ +wlr_files += files( + 'allocator.c', + 'gbm.c', + 'shm.c', + 'drm_dumb.c', +) + +has = cc.has_function('gbm_bo_get_fd_for_plane', dependencies: [gbm]) +add_project_arguments('-DHAS_GBM_BO_GET_FD_FOR_PLANE=@0@'.format(has.to_int()), language: 'c') diff --git a/render/shm_allocator.c b/render/allocator/shm.c similarity index 98% rename from render/shm_allocator.c rename to render/allocator/shm.c index 1797433f..7b32cf8d 100644 --- a/render/shm_allocator.c +++ b/render/allocator/shm.c @@ -5,7 +5,7 @@ #include #include #include "render/pixel_format.h" -#include "render/shm_allocator.h" +#include "render/allocator/shm.h" #include "util/shm.h" static const struct wlr_buffer_impl buffer_impl; diff --git a/render/meson.build b/render/meson.build index 8c1793f1..b35ba7c9 100644 --- a/render/meson.build +++ b/render/meson.build @@ -6,21 +6,14 @@ elif 'auto' in renderers and get_option('auto_features').disabled() endif wlr_files += files( - 'allocator.c', 'dmabuf.c', 'drm_format_set.c', - 'gbm_allocator.c', 'pixel_format.c', - 'shm_allocator.c', 'swapchain.c', 'wlr_renderer.c', 'wlr_texture.c', - 'drm_dumb_allocator.c', ) -has = cc.has_function('gbm_bo_get_fd_for_plane', dependencies: [gbm]) -add_project_arguments('-DHAS_GBM_BO_GET_FD_FOR_PLANE=@0@'.format(has.to_int()), language: 'c') - egl = dependency('egl', required: 'gles2' in renderers) if egl.found() wlr_deps += egl @@ -32,3 +25,5 @@ if 'gles2' in renderers or 'auto' in renderers endif subdir('pixman') + +subdir('allocator') diff --git a/render/swapchain.c b/render/swapchain.c index fd9f8725..8d3b55f0 100644 --- a/render/swapchain.c +++ b/render/swapchain.c @@ -2,7 +2,7 @@ #include #include #include -#include "render/allocator.h" +#include "render/allocator/allocator.h" #include "render/drm_format_set.h" #include "render/swapchain.h" diff --git a/types/wlr_output.c b/types/wlr_output.c index eea282dc..65c1d926 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -17,7 +17,7 @@ #include #include #include "backend/backend.h" -#include "render/allocator.h" +#include "render/allocator/allocator.h" #include "render/drm_format_set.h" #include "render/swapchain.h" #include "render/wlr_renderer.h"