summarylogtreecommitdiffstats
path: root/0006-compositor-drm-Renaming-of-gbm-fields.patch
blob: 7048d84cad69fcc1834701e876dd9a817dfa6629 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
From b50d1674382c982747b9091215bb02c860380fd9 Mon Sep 17 00:00:00 2001
From: "Miguel A. Vico" <mvicomoya@nvidia.com>
Date: Mon, 21 Mar 2016 17:41:03 +0100
Subject: [PATCH 6/7] compositor-drm: Renaming of gbm fields
X-NVConfidentiality: public

In preparation for follow-on changes to support frame presentation
through EGLDevice+EGLOutput, this change includes the following:
  - Rename drm_backend::format   to gbm_format
  - Rename drm_output::format    to gbm_format
  - Rename drm_output::surface   to gbm_surface
  - Rename drm_output::cursor_bo to gbm_cursor_bo

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
[Pekka: trivial rebase out of the series]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

(cherry picked from commit fcf4b6c0aef3d2e3afda5fa8a4d4127585f7231b)

Conflicts:
	src/compositor-drm.c
---
 src/compositor-drm.c | 58 ++++++++++++++++++++++++++--------------------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index a6d4573a922f..6c2816152307 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -107,7 +107,7 @@ struct drm_backend {
 	uint32_t crtc_allocator;
 	uint32_t connector_allocator;
 	struct wl_listener session_listener;
-	uint32_t format;
+	uint32_t gbm_format;
 
 	/* we need these parameters in order to not fail drmModeAddFB2()
 	 * due to out of bounds dimensions, and then mistakenly set
@@ -170,7 +170,7 @@ struct drm_output {
 	drmModeCrtcPtr original_crtc;
 	struct drm_edid edid;
 	drmModePropertyPtr dpms_prop;
-	uint32_t format;
+	uint32_t gbm_format;
 
 	enum dpms_enum dpms;
 
@@ -178,8 +178,8 @@ struct drm_output {
 	int page_flip_pending;
 	int destroy_pending;
 
-	struct gbm_surface *surface;
-	struct gbm_bo *cursor_bo[2];
+	struct gbm_surface *gbm_surface;
+	struct gbm_bo *gbm_cursor_bo[2];
 	struct weston_plane cursor_plane;
 	struct weston_plane fb_plane;
 	struct weston_view *cursor_view;
@@ -439,7 +439,7 @@ drm_output_release_fb(struct drm_output *output, struct drm_fb *fb)
 		if (fb->is_client_buffer)
 			gbm_bo_destroy(fb->bo);
 		else
-			gbm_surface_release_buffer(output->surface,
+			gbm_surface_release_buffer(output->gbm_surface,
 						   fb->bo);
 	}
 }
@@ -468,7 +468,7 @@ drm_output_check_scanout_format(struct drm_output *output,
 		pixman_region32_fini(&r);
 	}
 
-	if (output->format == format)
+	if (output->gbm_format == format)
 		return format;
 
 	return 0;
@@ -531,16 +531,16 @@ drm_output_render_gl(struct drm_output *output, pixman_region32_t *damage)
 	output->base.compositor->renderer->repaint_output(&output->base,
 							  damage);
 
-	bo = gbm_surface_lock_front_buffer(output->surface);
+	bo = gbm_surface_lock_front_buffer(output->gbm_surface);
 	if (!bo) {
 		weston_log("failed to lock front buffer: %m\n");
 		return;
 	}
 
-	output->next = drm_fb_get_from_bo(bo, b, output->format);
+	output->next = drm_fb_get_from_bo(bo, b, output->gbm_format);
 	if (!output->next) {
 		weston_log("failed to get drm_fb for bo\n");
-		gbm_surface_release_buffer(output->surface, bo);
+		gbm_surface_release_buffer(output->gbm_surface, bo);
 		return;
 	}
 }
@@ -1210,7 +1210,7 @@ drm_output_set_cursor(struct drm_output *output)
 		pixman_region32_fini(&output->cursor_plane.damage);
 		pixman_region32_init(&output->cursor_plane.damage);
 		output->current_cursor ^= 1;
-		bo = output->cursor_bo[output->current_cursor];
+		bo = output->gbm_cursor_bo[output->current_cursor];
 
 		cursor_bo_update(b, bo, ev);
 		handle = gbm_bo_get_handle(bo).s32;
@@ -1362,7 +1362,7 @@ drm_output_destroy(struct weston_output *output_base)
 		drm_output_fini_pixman(output);
 	} else {
 		gl_renderer->output_destroy(output_base);
-		gbm_surface_destroy(output->surface);
+		gbm_surface_destroy(output->gbm_surface);
 	}
 
 	weston_plane_release(&output->fb_plane);
@@ -1463,7 +1463,7 @@ drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mo
 		}
 	} else {
 		gl_renderer->output_destroy(&output->base);
-		gbm_surface_destroy(output->surface);
+		gbm_surface_destroy(output->gbm_surface);
 
 		if (drm_output_init_egl(output, b) < 0) {
 			weston_log("failed to init output egl state with "
@@ -1595,8 +1595,8 @@ static int
 drm_backend_create_gl_renderer(struct drm_backend *b)
 {
 	EGLint format[3] = {
-		b->format,
-		fallback_format_for(b->format),
+		b->gbm_format,
+		fallback_format_for(b->gbm_format),
 		0,
 	};
 	int n_formats = 2;
@@ -1853,18 +1853,18 @@ static int
 drm_output_init_egl(struct drm_output *output, struct drm_backend *b)
 {
 	EGLint format[2] = {
-		output->format,
-		fallback_format_for(output->format),
+		output->gbm_format,
+		fallback_format_for(output->gbm_format),
 	};
 	int i, flags, n_formats = 1;
 
-	output->surface = gbm_surface_create(b->gbm,
+	output->gbm_surface = gbm_surface_create(b->gbm,
 					     output->base.current_mode->width,
 					     output->base.current_mode->height,
 					     format[0],
 					     GBM_BO_USE_SCANOUT |
 					     GBM_BO_USE_RENDERING);
-	if (!output->surface) {
+	if (!output->gbm_surface) {
 		weston_log("failed to create gbm surface\n");
 		return -1;
 	}
@@ -1872,28 +1872,28 @@ drm_output_init_egl(struct drm_output *output, struct drm_backend *b)
 	if (format[1])
 		n_formats = 2;
 	if (gl_renderer->output_window_create(&output->base,
-				       (EGLNativeWindowType)output->surface,
-				       output->surface,
+				       (EGLNativeWindowType)output->gbm_surface,
+				       output->gbm_surface,
 				       gl_renderer->opaque_attribs,
 				       format,
 				       n_formats) < 0) {
 		weston_log("failed to create gl renderer output state\n");
-		gbm_surface_destroy(output->surface);
+		gbm_surface_destroy(output->gbm_surface);
 		return -1;
 	}
 
 	flags = GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE;
 
 	for (i = 0; i < 2; i++) {
-		if (output->cursor_bo[i])
+		if (output->gbm_cursor_bo[i])
 			continue;
 
-		output->cursor_bo[i] =
+		output->gbm_cursor_bo[i] =
 			gbm_bo_create(b->gbm, b->cursor_width, b->cursor_height,
 				GBM_FORMAT_ARGB8888, flags);
 	}
 
-	if (output->cursor_bo[0] == NULL || output->cursor_bo[1] == NULL) {
+	if (output->gbm_cursor_bo[0] == NULL || output->gbm_cursor_bo[1] == NULL) {
 		weston_log("cursor buffers unavailable, using gl cursors\n");
 		b->cursors_are_broken = 1;
 	}
@@ -2375,9 +2375,9 @@ create_output_for_connector(struct drm_backend *b,
 	free(s);
 
 	if (get_gbm_format_from_section(section,
-					b->format,
-					&output->format) == -1)
-		output->format = b->format;
+					b->gbm_format,
+					&output->gbm_format) == -1)
+		output->gbm_format = b->gbm_format;
 
 	weston_config_section_get_string(section, "seat", &s, "");
 	setup_output_seat_constraint(b, &output->base, s);
@@ -2992,7 +2992,7 @@ recorder_binding(struct weston_keyboard *keyboard, uint32_t time, uint32_t key,
 			      struct drm_output, base.link);
 
 	if (!output->recorder) {
-		if (output->format != GBM_FORMAT_XRGB8888) {
+		if (output->gbm_format != GBM_FORMAT_XRGB8888) {
 			weston_log("failed to start vaapi recorder: "
 				   "output format not supported\n");
 			return;
@@ -3118,7 +3118,7 @@ drm_backend_create(struct weston_compositor *compositor,
 	section = weston_config_get_section(config, "core", NULL, NULL);
 	if (get_gbm_format_from_section(section,
 					GBM_FORMAT_XRGB8888,
-					&b->format) == -1)
+					&b->gbm_format) == -1)
 		goto err_base;
 
 	b->use_pixman = param->use_pixman;
-- 
2.7.4