Skip to content

Commit fd8ee91

Browse files
committed
logging: use filename for logging instead of FILE_DESCR
- remove FILE_DESCR macro and all uses - log using `filename.c: ..." instead - use `-fmacro-prefix-map` for removing the `../src/` start of the `__FILE__` macro - nonportable for now
1 parent 1c4f83e commit fd8ee91

27 files changed

+78
-121
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,9 @@ endif()
381381

382382
configure_file(config.h.in config.h @ONLY)
383383

384+
# TODO: Make this portable
385+
target_compile_options(flutterpi_module PRIVATE "-fmacro-prefix-map=../src/=")
386+
384387
# Actual flutter-pi executable.
385388
add_executable(
386389
flutter-pi

src/compositor_ng.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@
5050
#include "vk_renderer.h"
5151
#endif
5252

53-
FILE_DESCR("compositor-ng")
54-
5553
/**
5654
* @brief A nicer, ref-counted version of the FlutterLayer's passed by the engine to the present layer callback.
5755
*

src/dmabuf_surface.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@
4747

4848
#include "config.h"
4949

50-
FILE_DESCR("dmabuf surface")
51-
5250
struct refcounted_dmabuf {
5351
refcount_t n_refs;
5452
struct dmabuf buf;

src/egl_gbm_render_surface.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#include "tracer.h"
2424
#include "util/collection.h"
2525

26-
FILE_DESCR("EGL/GBM render surface")
27-
2826
struct egl_gbm_render_surface;
2927

3028
struct locked_fb {

src/event_loop.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ struct evloop {
1919
pthread_t owning_thread;
2020
};
2121

22-
FILE_DESCR("event_loop.c")
23-
2422
DEFINE_STATIC_LOCK_OPS(evloop, mutex)
2523

2624
static int on_wakeup_event_loop(sd_event_source *s, int fd, uint32_t revents, void *userdata) {

src/filesystem_layout.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include "flutter-pi.h"
2020
#include "util/collection.h"
2121

22-
FILE_DESCR("fs layout")
23-
2422
static bool path_exists(const char *path) {
2523
return access(path, R_OK) == 0;
2624
}

src/flutter-pi.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@
7676
#include <mcheck.h>
7777
#endif
7878

79-
FILE_DESCR("flutter-pi")
80-
8179
#define PIXFMT_ARG_NAME(_name, _arg_name, ...) _arg_name ", "
8280

8381
const char *const usage =

src/gl_renderer.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include "tracer.h"
2020
#include "util/collection.h"
2121

22-
FILE_DESCR("EGL/GL renderer")
23-
2422
struct gl_renderer {
2523
refcount_t n_refs;
2624

src/keyboard.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
#include "util/collection.h"
2424

25-
FILE_DESCR("keyboard")
26-
2725
static int find_var_offset_in_string(const char *varname, const char *buffer, regmatch_t *match) {
2826
regmatch_t matches[2];
2927
char *pattern;

src/modesetting.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
#include "util/list.h"
2222
#include "util/macros.h"
2323

24-
FILE_DESCR("modesetting")
25-
2624
struct drm_fb {
2725
struct list_head entry;
2826

src/platformchannel.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
#include "flutter-pi.h"
1515
#include "jsmn.h"
1616

17-
FILE_DESCR("platform messages")
18-
1917
struct platch_msg_resp_handler_data {
2018
enum platch_codec codec;
2119
platch_msg_resp_callback on_response;

src/pluginregistry.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include "util/collection.h"
2020
#include "util/dynarray.h"
2121

22-
FILE_DESCR("plugin registry")
23-
2422
/**
2523
* @brief details of a plugin for flutter-pi.
2624
*

src/plugins/audioplayers/player.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#include "platformchannel.h"
1010
#include "plugins/audioplayers.h"
1111

12-
FILE_DESCR("audioplayers player")
13-
1412
struct audio_player {
1513
GstElement *playbin;
1614
GstBus *bus;

src/plugins/audioplayers/plugin.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
#include "plugins/audioplayers.h"
77
#include "util/collection.h"
88

9-
FILE_DESCR("audioplayers plugin")
10-
119
#define AUDIOPLAYERS_LOCAL_CHANNEL "xyz.luan/audioplayers"
1210
#define AUDIOPLAYERS_GLOBAL_CHANNEL "xyz.luan/audioplayers.global"
1311

src/plugins/gstreamer_video_player/frame.c

Lines changed: 52 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@
1414
#include "texture_registry.h"
1515

1616
// This will error if we don't have EGL / OpenGL ES support.
17-
#include "plugins/gstreamer_video_player.h"
18-
1917
#include "gl_renderer.h"
20-
21-
FILE_DESCR("gstreamer video_player")
18+
#include "plugins/gstreamer_video_player.h"
2219

2320
#define MAX_N_PLANES 4
2421

@@ -202,16 +199,16 @@ struct frame_interface *frame_interface_new(struct gl_renderer *renderer) {
202199
}
203200

204201
if (gl_renderer_supports_egl_extension(renderer, "EGL_EXT_image_dma_buf_import_modifiers")) {
205-
#ifdef EGL_EXT_image_dma_buf_import_modifiers
206-
LOG_ERROR(
207-
"EGL supports EGL_EXT_image_dma_buf_import_modifiers, "
208-
"but EGL headers didn't contain definitions for EGL_EXT_image_dma_buf_import_modifiers."
209-
"Extended imports and pixel format information will not be used.\n"
210-
);
211-
supports_extended_imports = false;
212-
#else
213-
supports_extended_imports = true;
214-
#endif
202+
#ifdef EGL_EXT_image_dma_buf_import_modifiers
203+
LOG_ERROR(
204+
"EGL supports EGL_EXT_image_dma_buf_import_modifiers, "
205+
"but EGL headers didn't contain definitions for EGL_EXT_image_dma_buf_import_modifiers."
206+
"Extended imports and pixel format information will not be used.\n"
207+
);
208+
supports_extended_imports = false;
209+
#else
210+
supports_extended_imports = true;
211+
#endif
215212
} else {
216213
supports_extended_imports = false;
217214
}
@@ -254,13 +251,15 @@ struct frame_interface *frame_interface_new(struct gl_renderer *renderer) {
254251
// These two are optional.
255252
// Might be useful in the future.
256253
#ifdef EGL_EXT_image_dma_buf_import_modifiers
257-
PFNEGLQUERYDMABUFFORMATSEXTPROC egl_query_dmabuf_formats = (PFNEGLQUERYDMABUFFORMATSEXTPROC) gl_renderer_get_proc_address(renderer, "eglQueryDmaBufFormatsEXT");
254+
PFNEGLQUERYDMABUFFORMATSEXTPROC egl_query_dmabuf_formats = (PFNEGLQUERYDMABUFFORMATSEXTPROC
255+
) gl_renderer_get_proc_address(renderer, "eglQueryDmaBufFormatsEXT");
258256
if (egl_query_dmabuf_formats == NULL && supports_extended_imports) {
259257
LOG_ERROR("Could not resolve eglQueryDmaBufFormatsEXT egl procedure, even though it is listed as supported.\n");
260258
supports_extended_imports = false;
261259
}
262260

263-
PFNEGLQUERYDMABUFMODIFIERSEXTPROC egl_query_dmabuf_modifiers = (PFNEGLQUERYDMABUFMODIFIERSEXTPROC) gl_renderer_get_proc_address(renderer, "eglQueryDmaBufModifiersEXT");
261+
PFNEGLQUERYDMABUFMODIFIERSEXTPROC egl_query_dmabuf_modifiers = (PFNEGLQUERYDMABUFMODIFIERSEXTPROC
262+
) gl_renderer_get_proc_address(renderer, "eglQueryDmaBufModifiersEXT");
264263
if (egl_query_dmabuf_modifiers == NULL && supports_extended_imports) {
265264
LOG_ERROR("Could not resolve eglQueryDmaBufModifiersEXT egl procedure, even though it is listed as supported.\n");
266265
supports_extended_imports = false;
@@ -274,11 +273,11 @@ struct frame_interface *frame_interface_new(struct gl_renderer *renderer) {
274273
}
275274

276275
if (supports_extended_imports) {
277-
#ifdef EGL_EXT_image_dma_buf_import_modifiers
278-
query_formats(display, egl_query_dmabuf_formats, egl_query_dmabuf_modifiers, &n_formats, &formats);
279-
#else
280-
UNREACHABLE();
281-
#endif
276+
#ifdef EGL_EXT_image_dma_buf_import_modifiers
277+
query_formats(display, egl_query_dmabuf_formats, egl_query_dmabuf_modifiers, &n_formats, &formats);
278+
#else
279+
UNREACHABLE();
280+
#endif
282281
} else {
283282
n_formats = 0;
284283
formats = NULL;
@@ -899,9 +898,9 @@ struct video_frame *frame_new(struct frame_interface *interface, GstSample *samp
899898
// Start putting together the EGL attributes.
900899
attr_index = 0;
901900

902-
#ifndef EGL_EXT_image_dma_buf_import
903-
#error "EGL header definitions for extension EGL_EXT_image_dma_buf_import are required."
904-
#endif
901+
#ifndef EGL_EXT_image_dma_buf_import
902+
#error "EGL header definitions for extension EGL_EXT_image_dma_buf_import are required."
903+
#endif
905904

906905
// first, put some of our basic attributes like
907906
// frame size and format
@@ -935,12 +934,12 @@ struct video_frame *frame_new(struct frame_interface *interface, GstSample *samp
935934
PUT_ATTR(EGL_DMA_BUF_PLANE0_PITCH_EXT, planes[0].pitch);
936935
if (planes[0].has_modifier) {
937936
if (interface->supports_extended_imports) {
938-
#ifdef EGL_EXT_image_dma_buf_import_modifiers
939-
PUT_ATTR(EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, uint32_to_int32(planes[0].modifier & 0xFFFFFFFFlu));
940-
PUT_ATTR(EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, uint32_to_int32(planes[0].modifier >> 32));
941-
#else
942-
UNREACHABLE();
943-
#endif
937+
#ifdef EGL_EXT_image_dma_buf_import_modifiers
938+
PUT_ATTR(EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, uint32_to_int32(planes[0].modifier & 0xFFFFFFFFlu));
939+
PUT_ATTR(EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, uint32_to_int32(planes[0].modifier >> 32));
940+
#else
941+
UNREACHABLE();
942+
#endif
944943
} else {
945944
LOG_ERROR(
946945
"video frame buffer uses modified format but EGL doesn't support the EGL_EXT_image_dma_buf_import_modifiers extension.\n"
@@ -956,12 +955,12 @@ struct video_frame *frame_new(struct frame_interface *interface, GstSample *samp
956955
PUT_ATTR(EGL_DMA_BUF_PLANE1_PITCH_EXT, planes[1].pitch);
957956
if (planes[1].has_modifier) {
958957
if (interface->supports_extended_imports) {
959-
#ifdef EGL_EXT_image_dma_buf_import_modifiers
960-
PUT_ATTR(EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT, uint32_to_int32(planes[1].modifier & 0xFFFFFFFFlu));
961-
PUT_ATTR(EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT, uint32_to_int32(planes[1].modifier >> 32));
962-
#else
963-
UNREACHABLE();
964-
#endif
958+
#ifdef EGL_EXT_image_dma_buf_import_modifiers
959+
PUT_ATTR(EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT, uint32_to_int32(planes[1].modifier & 0xFFFFFFFFlu));
960+
PUT_ATTR(EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT, uint32_to_int32(planes[1].modifier >> 32));
961+
#else
962+
UNREACHABLE();
963+
#endif
965964
} else {
966965
LOG_ERROR(
967966
"video frame buffer uses modified format but EGL doesn't support the EGL_EXT_image_dma_buf_import_modifiers "
@@ -979,12 +978,12 @@ struct video_frame *frame_new(struct frame_interface *interface, GstSample *samp
979978
PUT_ATTR(EGL_DMA_BUF_PLANE2_PITCH_EXT, planes[2].pitch);
980979
if (planes[2].has_modifier) {
981980
if (interface->supports_extended_imports) {
982-
#ifdef EGL_EXT_image_dma_buf_import_modifiers
983-
PUT_ATTR(EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT, uint32_to_int32(planes[2].modifier & 0xFFFFFFFFlu));
984-
PUT_ATTR(EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT, uint32_to_int32(planes[2].modifier >> 32));
985-
#else
986-
UNREACHABLE();
987-
#endif
981+
#ifdef EGL_EXT_image_dma_buf_import_modifiers
982+
PUT_ATTR(EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT, uint32_to_int32(planes[2].modifier & 0xFFFFFFFFlu));
983+
PUT_ATTR(EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT, uint32_to_int32(planes[2].modifier >> 32));
984+
#else
985+
UNREACHABLE();
986+
#endif
988987
} else {
989988
LOG_ERROR(
990989
"video frame buffer uses modified format but EGL doesn't support the EGL_EXT_image_dma_buf_import_modifiers "
@@ -1005,17 +1004,17 @@ struct video_frame *frame_new(struct frame_interface *interface, GstSample *samp
10051004
goto fail_release_planes;
10061005
}
10071006

1008-
#ifdef EGL_EXT_image_dma_buf_import_modifiers
1009-
PUT_ATTR(EGL_DMA_BUF_PLANE3_FD_EXT, planes[3].fd);
1010-
PUT_ATTR(EGL_DMA_BUF_PLANE3_OFFSET_EXT, planes[3].offset);
1011-
PUT_ATTR(EGL_DMA_BUF_PLANE3_PITCH_EXT, planes[3].pitch);
1012-
if (planes[3].has_modifier) {
1013-
PUT_ATTR(EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT, uint32_to_int32(planes[3].modifier & 0xFFFFFFFFlu));
1014-
PUT_ATTR(EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT, uint32_to_int32(planes[3].modifier >> 32));
1015-
}
1016-
#else
1017-
UNREACHABLE();
1018-
#endif
1007+
#ifdef EGL_EXT_image_dma_buf_import_modifiers
1008+
PUT_ATTR(EGL_DMA_BUF_PLANE3_FD_EXT, planes[3].fd);
1009+
PUT_ATTR(EGL_DMA_BUF_PLANE3_OFFSET_EXT, planes[3].offset);
1010+
PUT_ATTR(EGL_DMA_BUF_PLANE3_PITCH_EXT, planes[3].pitch);
1011+
if (planes[3].has_modifier) {
1012+
PUT_ATTR(EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT, uint32_to_int32(planes[3].modifier & 0xFFFFFFFFlu));
1013+
PUT_ATTR(EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT, uint32_to_int32(planes[3].modifier >> 32));
1014+
}
1015+
#else
1016+
UNREACHABLE();
1017+
#endif
10191018
}
10201019

10211020
assert(attr_index < ARRAY_SIZE(attributes));

src/plugins/gstreamer_video_player/player.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#include "texture_registry.h"
2424
#include "util/collection.h"
2525

26-
FILE_DESCR("gstreamer video_player")
27-
2826
#ifdef DEBUG
2927
#define DEBUG_TRACE_BEGIN(player, name) trace_begin(player, name)
3028
#define DEBUG_TRACE_END(player, name) trace_end(player, name)

src/plugins/gstreamer_video_player/plugin.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#include "texture_registry.h"
1919
#include "util/collection.h"
2020

21-
FILE_DESCR("gstreamer video_player plugin")
22-
2321
enum data_source_type { kDataSourceTypeAsset, kDataSourceTypeNetwork, kDataSourceTypeFile, kDataSourceTypeContentUri };
2422

2523
struct gstplayer_meta {

src/render_surface.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include "tracer.h"
2020
#include "util/collection.h"
2121

22-
FILE_DESCR("flutter render surface")
23-
2422
// just so we can be sure &render_surface->surface is the same as (struct surface*) render_surface
2523
COMPILE_ASSERT(offsetof(struct render_surface, surface) == 0);
2624

src/surface.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
#include "tracer.h"
2222
#include "util/collection.h"
2323

24-
FILE_DESCR("rendering surfaces")
25-
2624
void surface_deinit(struct surface *s);
2725

2826
#ifdef DEBUG

src/texture_registry.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
#include "flutter-pi.h"
1313

14-
FILE_DESCR("texture registry")
15-
1614
struct texture_registry {
1715
struct texture_registry_interface interface;
1816
void *userdata;

src/tracer.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
#include "util/collection.h"
1515

16-
FILE_DESCR("tracing")
17-
1816
struct tracer {
1917
refcount_t n_refs;
2018
atomic_bool has_cbs;

src/user_input.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include "keyboard.h"
2020
#include "util/collection.h"
2121

22-
FILE_DESCR("user input")
23-
2422
#define LIBINPUT_VER(major, minor, patch) ((((major) &0xFF) << 16) | (((minor) &0xFF) << 8) | ((patch) &0xFF))
2523
#define THIS_LIBINPUT_VER LIBINPUT_VER(LIBINPUT_VERSION_MAJOR, LIBINPUT_VERSION_MINOR, LIBINPUT_VERSION_PATCH)
2624

0 commit comments

Comments
 (0)