Skip to content

Commit 68e6cdd

Browse files
committed
Enforce clang-format formatting on host/libs/wayland
Bug: b/512215781
1 parent 9ad0f8f commit 68e6cdd

19 files changed

Lines changed: 138 additions & 218 deletions

base/cvd/cuttlefish/host/libs/wayland/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ cf_cc_library(
3030
"wayland_utils.h",
3131
"wayland_virtio_gpu_metadata.h",
3232
],
33-
clang_format_enabled = False,
3433
deps = [
3534
"//cuttlefish/common/libs/fs",
3635
"//libbase",

base/cvd/cuttlefish/host/libs/wayland/wayland_compositor.cpp

Lines changed: 31 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717
#include "cuttlefish/host/libs/wayland/wayland_compositor.h"
1818

1919
#include "absl/log/log.h"
20-
21-
#include <wayland-server-core.h>
22-
#include <wayland-server-protocol.h>
20+
#include "wayland-server-core.h"
21+
#include "wayland-server-protocol.h"
2322

2423
#include "cuttlefish/host/libs/wayland/wayland_surface.h"
2524
#include "cuttlefish/host/libs/wayland/wayland_utils.h"
@@ -33,12 +32,8 @@ void region_destroy(wl_client*, wl_resource* region_resource) {
3332
wl_resource_destroy(region_resource);
3433
}
3534

36-
void region_add(wl_client*,
37-
wl_resource* region_resource,
38-
int32_t x,
39-
int32_t y,
40-
int32_t w,
41-
int32_t h) {
35+
void region_add(wl_client*, wl_resource* region_resource, int32_t x, int32_t y,
36+
int32_t w, int32_t h) {
4237
VLOG(1) << __FUNCTION__ << " region=" << region_resource << " x=" << x
4338
<< " y=" << y << " w=" << w << " h=" << h;
4439

@@ -49,12 +44,8 @@ void region_add(wl_client*,
4944
region->h = h;
5045
}
5146

52-
void region_subtract(wl_client*,
53-
wl_resource* region_resource,
54-
int32_t x,
55-
int32_t y,
56-
int32_t w,
57-
int32_t h) {
47+
void region_subtract(wl_client*, wl_resource* region_resource, int32_t x,
48+
int32_t y, int32_t w, int32_t h) {
5849
VLOG(1) << __FUNCTION__ << " region=" << region_resource << " x=" << x
5950
<< " y=" << y << " w=" << w << " h=" << h;
6051
}
@@ -71,23 +62,16 @@ void surface_destroy(wl_client*, wl_resource* surface) {
7162
delete GetUserData<Surface>(surface);
7263
}
7364

74-
void surface_attach(wl_client*,
75-
wl_resource* surface,
76-
wl_resource* buffer,
77-
int32_t x,
78-
int32_t y) {
65+
void surface_attach(wl_client*, wl_resource* surface, wl_resource* buffer,
66+
int32_t x, int32_t y) {
7967
VLOG(1) << __FUNCTION__ << " surface=" << surface << " buffer=" << buffer
8068
<< " x=" << x << " y=" << y;
8169

8270
GetUserData<Surface>(surface)->Attach(buffer);
8371
}
8472

85-
void surface_damage(wl_client*,
86-
wl_resource* surface_resource,
87-
int32_t x,
88-
int32_t y,
89-
int32_t w,
90-
int32_t h) {
73+
void surface_damage(wl_client*, wl_resource* surface_resource, int32_t x,
74+
int32_t y, int32_t w, int32_t h) {
9175
VLOG(1) << __FUNCTION__ << " surface=" << surface_resource << " x=" << x
9276
<< " y=" << y << " w=" << w << " h=" << h;
9377
}
@@ -96,8 +80,7 @@ void surface_frame(wl_client*, wl_resource* surface, uint32_t) {
9680
VLOG(1) << " surface=" << surface;
9781
}
9882

99-
void surface_set_opaque_region(wl_client*,
100-
wl_resource* surface_resource,
83+
void surface_set_opaque_region(wl_client*, wl_resource* surface_resource,
10184
wl_resource* region_resource) {
10285
VLOG(1) << __FUNCTION__ << " surface=" << surface_resource
10386
<< " region=" << region_resource;
@@ -108,8 +91,7 @@ void surface_set_opaque_region(wl_client*,
10891
surface->SetRegion(*region);
10992
}
11093

111-
void surface_set_input_region(wl_client*,
112-
wl_resource* surface_resource,
94+
void surface_set_input_region(wl_client*, wl_resource* surface_resource,
11395
wl_resource* region_resource) {
11496
VLOG(1) << __FUNCTION__ << " surface=" << surface_resource
11597
<< " region=" << region_resource;
@@ -121,47 +103,40 @@ void surface_commit(wl_client*, wl_resource* surface_resource) {
121103
GetUserData<Surface>(surface_resource)->Commit();
122104
}
123105

124-
void surface_set_buffer_transform(wl_client*,
125-
wl_resource* surface_resource,
106+
void surface_set_buffer_transform(wl_client*, wl_resource* surface_resource,
126107
int32_t transform) {
127108
VLOG(1) << __FUNCTION__ << " surface=" << surface_resource
128109
<< " transform=" << transform;
129110
}
130111

131-
void surface_set_buffer_scale(wl_client*,
132-
wl_resource* surface_resource,
112+
void surface_set_buffer_scale(wl_client*, wl_resource* surface_resource,
133113
int32_t scale) {
134114
VLOG(1) << __FUNCTION__ << " surface=" << surface_resource
135115
<< " scale=" << scale;
136116
}
137117

138-
void surface_damage_buffer(wl_client*,
139-
wl_resource* surface_resource,
140-
int32_t x,
141-
int32_t y,
142-
int32_t w,
143-
int32_t h) {
118+
void surface_damage_buffer(wl_client*, wl_resource* surface_resource, int32_t x,
119+
int32_t y, int32_t w, int32_t h) {
144120
VLOG(1) << __FUNCTION__ << " surface=" << surface_resource << " x=" << x
145121
<< " y=" << y << " w=" << w << " h=" << h;
146122
}
147123

148124
const struct wl_surface_interface surface_implementation = {
149-
.destroy = surface_destroy,
150-
.attach = surface_attach,
151-
.damage = surface_damage,
152-
.frame = surface_frame,
153-
.set_opaque_region = surface_set_opaque_region,
154-
.set_input_region = surface_set_input_region,
155-
.commit = surface_commit,
156-
.set_buffer_transform = surface_set_buffer_transform,
157-
.set_buffer_scale = surface_set_buffer_scale,
158-
.damage_buffer = surface_damage_buffer,
125+
.destroy = surface_destroy,
126+
.attach = surface_attach,
127+
.damage = surface_damage,
128+
.frame = surface_frame,
129+
.set_opaque_region = surface_set_opaque_region,
130+
.set_input_region = surface_set_input_region,
131+
.commit = surface_commit,
132+
.set_buffer_transform = surface_set_buffer_transform,
133+
.set_buffer_scale = surface_set_buffer_scale,
134+
.damage_buffer = surface_damage_buffer,
159135
};
160136

161137
void surface_destroy_resource_callback(struct wl_resource*) {}
162138

163-
void compositor_create_surface(wl_client* client,
164-
wl_resource* compositor,
139+
void compositor_create_surface(wl_client* client, wl_resource* compositor,
165140
uint32_t id) {
166141
VLOG(1) << __FUNCTION__ << " compositor=" << compositor << " id=" << id;
167142

@@ -175,15 +150,14 @@ void compositor_create_surface(wl_client* client,
175150
surface, surface_destroy_resource_callback);
176151
}
177152

178-
void compositor_create_region(wl_client* client,
179-
wl_resource* compositor,
153+
void compositor_create_region(wl_client* client, wl_resource* compositor,
180154
uint32_t id) {
181155
VLOG(1) << __FUNCTION__ << " compositor=" << compositor << " id=" << id;
182156

183157
std::unique_ptr<Surface::Region> region(new Surface::Region());
184158

185-
wl_resource* region_resource = wl_resource_create(
186-
client, &wl_region_interface, 1, id);
159+
wl_resource* region_resource =
160+
wl_resource_create(client, &wl_region_interface, 1, id);
187161

188162
wl_resource_set_implementation(region_resource, &region_implementation,
189163
region.release(),
@@ -199,9 +173,7 @@ constexpr const uint32_t kCompositorVersion = 3;
199173

200174
void compositor_destroy_resource_callback(struct wl_resource*) {}
201175

202-
void bind_compositor(wl_client* client,
203-
void* data,
204-
uint32_t version,
176+
void bind_compositor(wl_client* client, void* data, uint32_t version,
205177
uint32_t id) {
206178
wl_resource* resource =
207179
wl_resource_create(client, &wl_compositor_interface,

base/cvd/cuttlefish/host/libs/wayland/wayland_compositor.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17-
1817
#pragma once
1918

2019
#include <stdint.h>
2120

22-
#include <wayland-server-core.h>
21+
#include "wayland-server-core.h"
2322

2423
#include "cuttlefish/host/libs/wayland/wayland_surfaces.h"
2524

@@ -28,4 +27,4 @@ namespace wayland {
2827
// Binds the compositor interface to the given wayland server.
2928
void BindCompositorInterface(wl_display* display, Surfaces* surfaces);
3029

31-
} // namespace wayland
30+
} // namespace wayland

base/cvd/cuttlefish/host/libs/wayland/wayland_dmabuf.cpp

Lines changed: 22 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,18 @@
1717
#include "cuttlefish/host/libs/wayland/wayland_dmabuf.h"
1818

1919
#include "absl/log/log.h"
20-
21-
#include <drm/drm_fourcc.h>
22-
23-
#include <linux-dmabuf-unstable-v1-server-protocol.h>
24-
#include <wayland-server-core.h>
25-
#include <wayland-server-protocol.h>
20+
#include "drm/drm_fourcc.h"
21+
#include "linux-dmabuf-unstable-v1-server-protocol.h"
22+
#include "wayland-server-core.h"
23+
#include "wayland-server-protocol.h"
2624

2725
#include "cuttlefish/host/libs/wayland/wayland_utils.h"
2826

2927
namespace wayland {
3028
namespace {
3129

3230
void buffer_destroy_resource(struct wl_resource* buffer_resource) {
33-
wl_resource_destroy(buffer_resource);
31+
wl_resource_destroy(buffer_resource);
3432
}
3533

3634
void buffer_destroy(wl_client*, wl_resource* dmabuf_resource) {
@@ -47,7 +45,7 @@ const struct wl_buffer_interface buffer_implementation = {
4745
};
4846

4947
void params_destroy_resource(struct wl_resource* params_resource) {
50-
wl_resource_destroy(params_resource);
48+
wl_resource_destroy(params_resource);
5149
}
5250

5351
void params_destroy(struct wl_client*, struct wl_resource* params_resource) {
@@ -59,13 +57,8 @@ void params_destroy(struct wl_client*, struct wl_resource* params_resource) {
5957
}
6058
}
6159

62-
void params_add(wl_client*,
63-
wl_resource* params,
64-
int32_t fd,
65-
uint32_t plane,
66-
uint32_t offset,
67-
uint32_t stride,
68-
uint32_t modifier_hi,
60+
void params_add(wl_client*, wl_resource* params, int32_t fd, uint32_t plane,
61+
uint32_t offset, uint32_t stride, uint32_t modifier_hi,
6962
uint32_t modifier_lo) {
7063
VLOG(1) << __FUNCTION__ << " params=" << params << " fd=" << fd
7164
<< " plane=" << plane << " offset=" << offset << " stride=" << stride
@@ -85,12 +78,8 @@ void params_add(wl_client*,
8578
dmabuf_params->planes[plane] = std::move(dma_plane);
8679
}
8780

88-
void params_create(wl_client* client,
89-
wl_resource* params,
90-
int32_t w,
91-
int32_t h,
92-
uint32_t format,
93-
uint32_t flags) {
81+
void params_create(wl_client* client, wl_resource* params, int32_t w, int32_t h,
82+
uint32_t format, uint32_t flags) {
9483
VLOG(1) << __FUNCTION__ << " params=" << params << " w=" << w << " h=" << h
9584
<< " format=" << format << " flags=" << flags;
9685

@@ -112,12 +101,8 @@ void params_create(wl_client* client,
112101
zwp_linux_buffer_params_v1_send_created(params, buffer_resource);
113102
}
114103

115-
void params_create_immed(wl_client* client,
116-
wl_resource* params,
117-
uint32_t id,
118-
int32_t w,
119-
int32_t h,
120-
uint32_t format,
104+
void params_create_immed(wl_client* client, wl_resource* params, uint32_t id,
105+
int32_t w, int32_t h, uint32_t format,
121106
uint32_t flags) {
122107
VLOG(1) << __FUNCTION__ << " params=" << params << " id=" << id << " w=" << w
123108
<< " h=" << h << " format=" << format << " flags=" << flags;
@@ -135,16 +120,15 @@ const struct zwp_linux_buffer_params_v1_interface
135120
.add = params_add,
136121
.create = params_create,
137122
.create_immed = params_create_immed,
138-
};
123+
};
139124

140125
void linux_dmabuf_destroy(wl_client*, wl_resource* dmabuf) {
141126
VLOG(1) << __FUNCTION__ << " dmabuf=" << dmabuf;
142127

143128
wl_resource_destroy(dmabuf);
144129
}
145130

146-
void linux_dmabuf_create_params(wl_client* client,
147-
wl_resource* display,
131+
void linux_dmabuf_create_params(wl_client* client, wl_resource* display,
148132
uint32_t id) {
149133
VLOG(1) << __FUNCTION__ << " display=" << display << " id=" << id;
150134

@@ -155,21 +139,18 @@ void linux_dmabuf_create_params(wl_client* client,
155139

156140
wl_resource_set_implementation(buffer_params_resource,
157141
&zwp_linux_buffer_params_implementation,
158-
dmabuf_params,
159-
&params_destroy_resource);
142+
dmabuf_params, &params_destroy_resource);
160143
}
161144

162-
const struct zwp_linux_dmabuf_v1_interface
163-
zwp_linux_dmabuf_v1_implementation = {
145+
const struct zwp_linux_dmabuf_v1_interface zwp_linux_dmabuf_v1_implementation =
146+
{
164147
.destroy = linux_dmabuf_destroy,
165148
.create_params = linux_dmabuf_create_params,
166-
};
149+
};
167150

168151
constexpr uint32_t kLinuxDmabufVersion = 2;
169152

170-
void bind_linux_dmabuf(wl_client* client,
171-
void* data,
172-
uint32_t version,
153+
void bind_linux_dmabuf(wl_client* client, void* data, uint32_t version,
173154
uint32_t id) {
174155
wl_resource* resource =
175156
wl_resource_create(client, &zwp_linux_dmabuf_v1_interface,
@@ -184,13 +165,13 @@ void bind_linux_dmabuf(wl_client* client,
184165
} // namespace
185166

186167
void BindDmabufInterface(wl_display* display) {
187-
wl_global_create(display, &zwp_linux_dmabuf_v1_interface,
188-
kLinuxDmabufVersion, nullptr, bind_linux_dmabuf);
168+
wl_global_create(display, &zwp_linux_dmabuf_v1_interface, kLinuxDmabufVersion,
169+
nullptr, bind_linux_dmabuf);
189170
}
190171

191172
bool IsDmabufResource(struct wl_resource* resource) {
192173
return wl_resource_instance_of(resource, &wl_buffer_interface,
193174
&buffer_implementation);
194175
}
195176

196-
} // namespace wayland
177+
} // namespace wayland

base/cvd/cuttlefish/host/libs/wayland/wayland_dmabuf.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@
1414
* limitations under the License.
1515
*/
1616

17-
1817
#pragma once
1918

2019
#include <stdint.h>
21-
#include <map>
2220

23-
#include <android-base/unique_fd.h>
21+
#include <map>
2422

25-
#include <wayland-server-core.h>
23+
#include "android-base/unique_fd.h"
24+
#include "wayland-server-core.h"
2625

2726
namespace wayland {
2827

@@ -60,4 +59,4 @@ void BindDmabufInterface(wl_display* display);
6059

6160
bool IsDmabufResource(struct wl_resource* resource);
6261

63-
} // namespace wayland
62+
} // namespace wayland

0 commit comments

Comments
 (0)