Skip to content

Commit cd8183b

Browse files
committed
further destruct collection.h
Remove some imports from collection.h, include them directly in any files that needs them instead.
1 parent 8ca65de commit cd8183b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1484
-1263
lines changed

src/compositor_ng.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#define _GNU_SOURCE
1212
#include "compositor_ng.h"
1313

14+
#include <errno.h>
1415
#include <inttypes.h>
1516
#include <math.h>
1617
#include <stdlib.h>
@@ -21,6 +22,8 @@
2122
#include <flutter_embedder.h>
2223
#include <systemd/sd-event.h>
2324

25+
#include "cursor.h"
26+
#include "dummy_render_surface.h"
2427
#include "flutter-pi.h"
2528
#include "frame_scheduler.h"
2629
#include "modesetting.h"
@@ -31,9 +34,9 @@
3134
#include "tracer.h"
3235
#include "util/collection.h"
3336
#include "util/dynarray.h"
37+
#include "util/logging.h"
38+
#include "util/refcounting.h"
3439
#include "window.h"
35-
#include "cursor.h"
36-
#include "dummy_render_surface.h"
3740

3841
#include "config.h"
3942

@@ -343,7 +346,8 @@ static int compositor_push_fl_layers(struct compositor *compositor, size_t n_fl_
343346
/// TODO: Implement
344347
layer->surface = compositor_get_view_by_id_locked(compositor, fl_layer->platform_view->identifier);
345348
if (layer->surface == NULL) {
346-
layer->surface = CAST_SURFACE(dummy_render_surface_new(compositor->tracer, VEC2I(fl_layer->size.width, fl_layer->size.height)));
349+
layer->surface =
350+
CAST_SURFACE(dummy_render_surface_new(compositor->tracer, VEC2I(fl_layer->size.width, fl_layer->size.height)));
347351
}
348352
#else
349353
// in release mode, we just assume the id is valid.
@@ -529,7 +533,15 @@ const FlutterCompositor *compositor_get_flutter_compositor(struct compositor *co
529533
return &compositor->flutter_compositor;
530534
}
531535

532-
void compositor_set_cursor(struct compositor *compositor, bool has_enabled, bool enabled, bool has_kind, enum pointer_kind kind, bool has_delta, struct vec2f delta) {
536+
void compositor_set_cursor(
537+
struct compositor *compositor,
538+
bool has_enabled,
539+
bool enabled,
540+
bool has_kind,
541+
enum pointer_kind kind,
542+
bool has_delta,
543+
struct vec2f delta
544+
) {
533545
if (!has_enabled && !has_kind && !has_delta) {
534546
return;
535547
}

src/compositor_ng.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212

1313
#include <flutter_embedder.h>
1414

15+
#include "cursor.h"
1516
#include "flutter-pi.h"
1617
#include "frame_scheduler.h"
1718
#include "modesetting.h"
1819
#include "pixel_format.h"
1920
#include "util/collection.h"
20-
#include "cursor.h"
21+
#include "util/refcounting.h"
2122

2223
#include "config.h"
2324

@@ -183,7 +184,15 @@ int compositor_get_event_fd(struct compositor *compositor);
183184

184185
int compositor_on_event_fd_ready(struct compositor *compositor);
185186

186-
void compositor_set_cursor(struct compositor *compositor, bool has_enabled, bool enabled, bool has_kind, enum pointer_kind kind, bool has_delta, struct vec2f delta);
187+
void compositor_set_cursor(
188+
struct compositor *compositor,
189+
bool has_enabled,
190+
bool enabled,
191+
bool has_kind,
192+
enum pointer_kind kind,
193+
bool has_delta,
194+
struct vec2f delta
195+
);
187196

188197
struct fl_layer_composition;
189198

src/cursor.c

Lines changed: 1304 additions & 1150 deletions
Large diffs are not rendered by default.

src/dmabuf_surface.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
#include "dmabuf_surface.h"
3737

38+
#include <errno.h>
3839
#include <stdatomic.h>
3940
#include <stdint.h>
4041
#include <stdlib.h>
@@ -44,6 +45,8 @@
4445
#include "surface_private.h"
4546
#include "texture_registry.h"
4647
#include "util/collection.h"
48+
#include "util/logging.h"
49+
#include "util/refcounting.h"
4750

4851
#include "config.h"
4952

src/dummy_render_surface.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include "dummy_render_surface.h"
1212

13+
#include <errno.h>
1314
#include <stdatomic.h>
1415
#include <stdlib.h>
1516

@@ -19,7 +20,6 @@
1920
#include "render_surface_private.h"
2021
#include "surface.h"
2122
#include "surface_private.h"
22-
2323
#include "tracer.h"
2424
#include "util/geometry.h"
2525
#include "util/uuid.h"
@@ -61,11 +61,7 @@ static int dummy_render_surface_present_fbdev(struct surface *s, const struct fl
6161
static int dummy_render_surface_fill(struct render_surface *surface, FlutterBackingStore *fl_store);
6262
static int dummy_render_surface_queue_present(struct render_surface *surface, const FlutterBackingStore *fl_store);
6363

64-
int dummy_render_surface_init(
65-
struct dummy_render_surface *surface,
66-
struct tracer *tracer,
67-
struct vec2i size
68-
) {
64+
int dummy_render_surface_init(struct dummy_render_surface *surface, struct tracer *tracer, struct vec2i size) {
6965
int ok;
7066

7167
ok = render_surface_init(CAST_RENDER_SURFACE_UNCHECKED(surface), tracer, size);
@@ -85,10 +81,7 @@ int dummy_render_surface_init(
8581
return 0;
8682
}
8783

88-
struct dummy_render_surface *dummy_render_surface_new(
89-
struct tracer *tracer,
90-
struct vec2i size
91-
) {
84+
struct dummy_render_surface *dummy_render_surface_new(struct tracer *tracer, struct vec2i size) {
9285
struct dummy_render_surface *surface;
9386
int ok;
9487

@@ -115,7 +108,8 @@ void dummy_render_surface_deinit(struct surface *s) {
115108
render_surface_deinit(s);
116109
}
117110

118-
static int dummy_render_surface_present_kms(struct surface *s, UNUSED const struct fl_layer_props *props, UNUSED struct kms_req_builder *builder) {
111+
static int
112+
dummy_render_surface_present_kms(struct surface *s, UNUSED const struct fl_layer_props *props, UNUSED struct kms_req_builder *builder) {
119113
(void) props;
120114
(void) builder;
121115

@@ -124,8 +118,7 @@ static int dummy_render_surface_present_kms(struct surface *s, UNUSED const stru
124118
return 0;
125119
}
126120

127-
static int
128-
dummy_render_surface_present_fbdev(struct surface *s, const struct fl_layer_props *props, struct fbdev_commit_builder *builder) {
121+
static int dummy_render_surface_present_fbdev(struct surface *s, const struct fl_layer_props *props, struct fbdev_commit_builder *builder) {
129122
(void) s;
130123
(void) props;
131124
(void) builder;
@@ -147,6 +140,6 @@ static int dummy_render_surface_queue_present(struct render_surface *s, const Fl
147140
(void) fl_store;
148141

149142
TRACER_INSTANT(s->surface.tracer, "dummy_render_surface_queue_present");
150-
143+
151144
return 0;
152145
}

src/dummy_render_surface.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ ATTR_PURE struct dummy_render_surface *__checked_cast_dummy_render_surface(void
2424
#define CAST_DUMMY_RENDER_SURFACE(ptr) CAST_DUMMY_RENDER_SURFACE_UNCHECKED(ptr)
2525
#endif
2626

27-
struct dummy_render_surface *dummy_render_surface_new(
28-
struct tracer *tracer,
29-
struct vec2i size
30-
);
27+
struct dummy_render_surface *dummy_render_surface_new(struct tracer *tracer, struct vec2i size);
3128

3229
#endif // _FLUTTERPI_INCLUDE_DUMMY_RENDER_SURFACE_H

src/egl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,8 @@
401401
// For functions part of EGL 1.5 we dynamically resolve the functions at
402402
// runtime, since we can't be sure they're actually present.
403403
#if defined(EGL_VERSION_1_5) && !defined(EGL_EGL_PROTOTYPES)
404+
405+
// clang-format off
404406
typedef EGLSync(EGLAPIENTRYP PFNEGLCREATESYNCPROC)(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
405407
typedef EGLBoolean(EGLAPIENTRYP PFNEGLDESTROYSYNCPROC)(EGLDisplay dpy, EGLSync sync);
406408
typedef EGLint(EGLAPIENTRYP PFNEGLCLIENTWAITSYNCPROC)(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
@@ -427,6 +429,8 @@ typedef EGLSurface(EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC)(
427429
const EGLAttrib *attrib_list
428430
);
429431
typedef EGLBoolean(EGLAPIENTRYP PFNEGLWAITSYNCPROC)(EGLDisplay dpy, EGLSync sync, EGLint flags);
432+
// clang-format on
433+
430434
#endif
431435

432436
#ifdef HAVE_EGL

src/egl_gbm_render_surface.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include "egl_gbm_render_surface.h"
1212

13+
#include <errno.h>
1314
#include <stdlib.h>
1415

1516
#include "egl.h"
@@ -22,6 +23,8 @@
2223
#include "surface.h"
2324
#include "tracer.h"
2425
#include "util/collection.h"
26+
#include "util/logging.h"
27+
#include "util/refcounting.h"
2528

2629
struct egl_gbm_render_surface;
2730

@@ -418,9 +421,10 @@ static int egl_gbm_render_surface_present_kms(struct surface *s, const struct fl
418421
LOG_ERROR("Couldn't add GBM buffer as DRM framebuffer.\n");
419422
goto fail_free_meta;
420423
}
421-
424+
422425
// if this EGL surface is non-opaque and has an opaque equivalent
423-
if (!get_pixfmt_info(egl_surface->pixel_format)->is_opaque && pixfmt_opaque(egl_surface->pixel_format) != egl_surface->pixel_format) {
426+
if (!get_pixfmt_info(egl_surface->pixel_format)->is_opaque &&
427+
pixfmt_opaque(egl_surface->pixel_format) != egl_surface->pixel_format) {
424428
opaque_fb_id = drmdev_add_fb(
425429
drmdev,
426430
gbm_bo_get_width(bo),
@@ -638,7 +642,7 @@ static int egl_gbm_render_surface_queue_present(struct render_surface *s, const
638642
/// version: 1.4
639643
/// vendor: Mesa Project
640644
/// client extensions: EGL_EXT_client_extensions EGL_EXT_device_base EGL_EXT_device_enumeration EGL_EXT_device_query EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses EGL_KHR_debug EGL_EXT_platform_device EGL_MESA_platform_gbm EGL_KHR_platform_gbm EGL_MESA_platform_surfaceless
641-
/// display extensions: EGL_ANDROID_blob_cache EGL_EXT_buffer_age EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_context_flush_control EGL_KHR_create_context EGL_KHR_create_context_no_error EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_image_dma_buf_export EGL_MESA_query_driver
645+
/// display extensions: EGL_ANDROID_blob_cache EGL_EXT_buffer_age EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_context_flush_control EGL_KHR_create_context EGL_KHR_create_context_no_error EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_image_dma_buf_export EGL_MESA_query_driver
642646
/// ===================================
643647
/// ===================================
644648
/// OpenGL ES information:
@@ -655,7 +659,7 @@ static int egl_gbm_render_surface_queue_present(struct render_surface *s, const
655659
/// physical size: 154mm x 86mm
656660
/// flutter device pixel ratio: 1.367054
657661
/// pixel format: (any)
658-
/// pluginregistry.c: Initialized plugins: services, text input, raw keyboard plugin, gstreamer video_player, audioplayers,
662+
/// pluginregistry.c: Initialized plugins: services, text input, raw keyboard plugin, gstreamer video_player, audioplayers,
659663
/// flutter: The Dart VM service is listening on http://192.168.178.11:44515/F3wK7cUNFd0=/
660664
/// gl_renderer.c: Choosing EGL config with pixel format ARGB 8:8:8:8...
661665
/// gl_renderer.c: Choosing EGL config with pixel format ARGB 8:8:8:8...

src/event_loop.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <systemd/sd-event.h>
1111

1212
#include "util/collection.h"
13+
#include "util/refcounting.h"
1314

1415
struct evloop {
1516
refcount_t n_refs;

src/event_loop.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ struct evloop *evthread_get_evloop(struct evthread *thread);
4949

5050
void evthread_join(struct evthread *thread);
5151

52-
#endif // _EVENT_LOOP_H
52+
#endif // _EVENT_LOOP_H

0 commit comments

Comments
 (0)