1 /**************************************************************************
2 *
3 * Copyright 2009, VMware, Inc.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27 /*
28 * Author: Keith Whitwell <[email protected]>
29 * Author: Jakob Bornecrantz <[email protected]>
30 */
31
32 #include "dri_screen.h"
33 #include "dri_context.h"
34 #include "dri_drawable.h"
35
36 #include "pipe/p_screen.h"
37 #include "util/format/u_format.h"
38 #include "util/u_memory.h"
39 #include "util/u_inlines.h"
40
41 #include "state_tracker/st_context.h"
42
43 static uint32_t drifb_ID = 0;
44
45 static bool
dri_st_framebuffer_validate(struct st_context * st,struct pipe_frontend_drawable * pdrawable,const enum st_attachment_type * statts,unsigned count,struct pipe_resource ** out,struct pipe_resource ** resolve)46 dri_st_framebuffer_validate(struct st_context *st,
47 struct pipe_frontend_drawable *pdrawable,
48 const enum st_attachment_type *statts,
49 unsigned count,
50 struct pipe_resource **out,
51 struct pipe_resource **resolve)
52 {
53 struct dri_context *ctx = (struct dri_context *)st->frontend_context;
54 struct dri_drawable *drawable = (struct dri_drawable *)pdrawable;
55 struct dri_screen *screen = drawable->screen;
56 unsigned statt_mask, new_mask;
57 bool new_stamp;
58 int i;
59 unsigned int lastStamp;
60 struct pipe_resource **textures =
61 drawable->stvis.samples > 1 ? drawable->msaa_textures
62 : drawable->textures;
63
64 statt_mask = 0x0;
65 for (i = 0; i < count; i++)
66 statt_mask |= (1 << statts[i]);
67
68 /* record newly allocated textures */
69 new_mask = (statt_mask & ~drawable->texture_mask);
70
71 do {
72 lastStamp = drawable->lastStamp;
73 new_stamp = (drawable->texture_stamp != lastStamp);
74
75 if (new_stamp || new_mask) {
76 if (new_stamp && drawable->update_drawable_info)
77 drawable->update_drawable_info(drawable);
78
79 drawable->allocate_textures(ctx, drawable, statts, count);
80
81 /* add existing textures */
82 for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
83 if (textures[i])
84 statt_mask |= (1 << i);
85 }
86
87 drawable->texture_stamp = lastStamp;
88 drawable->texture_mask = statt_mask;
89 }
90 } while (lastStamp != drawable->lastStamp);
91
92 /* Flush the pending set_damage_region request. */
93 struct pipe_screen *pscreen = screen->base.screen;
94
95 if (new_mask & (1 << ST_ATTACHMENT_BACK_LEFT) &&
96 pscreen->set_damage_region) {
97 struct pipe_resource *resource = textures[ST_ATTACHMENT_BACK_LEFT];
98
99 pscreen->set_damage_region(pscreen, resource,
100 drawable->num_damage_rects,
101 drawable->damage_rects);
102 }
103
104 if (!out)
105 return true;
106
107 /* Set the window-system buffers for the gallium frontend. */
108 for (i = 0; i < count; i++)
109 pipe_resource_reference(&out[i], textures[statts[i]]);
110 if (resolve && drawable->stvis.samples > 1) {
111 if (statt_mask & BITFIELD_BIT(ST_ATTACHMENT_FRONT_LEFT))
112 pipe_resource_reference(resolve, drawable->textures[ST_ATTACHMENT_FRONT_LEFT]);
113 else if (statt_mask & BITFIELD_BIT(ST_ATTACHMENT_BACK_LEFT))
114 pipe_resource_reference(resolve, drawable->textures[ST_ATTACHMENT_BACK_LEFT]);
115 }
116
117 return true;
118 }
119
120 static bool
dri_st_framebuffer_flush_front(struct st_context * st,struct pipe_frontend_drawable * pdrawable,enum st_attachment_type statt)121 dri_st_framebuffer_flush_front(struct st_context *st,
122 struct pipe_frontend_drawable *pdrawable,
123 enum st_attachment_type statt)
124 {
125 struct dri_context *ctx = (struct dri_context *)st->frontend_context;
126 struct dri_drawable *drawable = (struct dri_drawable *)pdrawable;
127
128 /* XXX remove this and just set the correct one on the framebuffer */
129 return drawable->flush_frontbuffer(ctx, drawable, statt);
130 }
131
132 /**
133 * The gallium frontend framebuffer interface flush_swapbuffers callback
134 */
135 static bool
dri_st_framebuffer_flush_swapbuffers(struct st_context * st,struct pipe_frontend_drawable * pdrawable)136 dri_st_framebuffer_flush_swapbuffers(struct st_context *st,
137 struct pipe_frontend_drawable *pdrawable)
138 {
139 struct dri_context *ctx = (struct dri_context *)st->frontend_context;
140 struct dri_drawable *drawable = (struct dri_drawable *)pdrawable;
141
142 if (drawable->flush_swapbuffers)
143 drawable->flush_swapbuffers(ctx, drawable);
144
145 return true;
146 }
147
148 /**
149 * This is called when we need to set up GL rendering to a new X window.
150 */
151 __DRIdrawable *
dri_create_drawable(__DRIscreen * psp,const __DRIconfig * config,bool isPixmap,void * loaderPrivate)152 dri_create_drawable(__DRIscreen *psp, const __DRIconfig *config,
153 bool isPixmap, void *loaderPrivate)
154 {
155 struct dri_screen *screen = dri_screen(psp);
156 const struct gl_config *visual = &config->modes;
157 struct dri_drawable *drawable = NULL;
158
159 drawable = CALLOC_STRUCT(dri_drawable);
160 if (!drawable)
161 return NULL;
162
163 drawable->loaderPrivate = loaderPrivate;
164 drawable->refcount = 1;
165 drawable->lastStamp = 0;
166 drawable->w = 0;
167 drawable->h = 0;
168
169 dri_fill_st_visual(&drawable->stvis, screen, visual);
170
171 /* setup the pipe_frontend_drawable */
172 drawable->base.visual = &drawable->stvis;
173 drawable->base.flush_front = dri_st_framebuffer_flush_front;
174 drawable->base.validate = dri_st_framebuffer_validate;
175 drawable->base.flush_swapbuffers = dri_st_framebuffer_flush_swapbuffers;
176
177 drawable->screen = screen;
178
179 p_atomic_set(&drawable->base.stamp, 1);
180 drawable->base.ID = p_atomic_inc_return(&drifb_ID);
181 drawable->base.fscreen = &screen->base;
182
183 switch (screen->type) {
184 case DRI_SCREEN_DRI3:
185 case DRI_SCREEN_KMS_SWRAST:
186 dri2_init_drawable(drawable, isPixmap, visual->alphaBits);
187 break;
188 case DRI_SCREEN_SWRAST:
189 drisw_init_drawable(drawable, isPixmap, visual->alphaBits);
190 break;
191 case DRI_SCREEN_KOPPER:
192 kopper_init_drawable(drawable, isPixmap, visual->alphaBits);
193 break;
194 }
195
196 return opaque_dri_drawable(drawable);
197 }
198
199 static void
dri_destroy_drawable(struct dri_drawable * drawable)200 dri_destroy_drawable(struct dri_drawable *drawable)
201 {
202 struct dri_screen *screen = drawable->screen;
203 int i;
204
205 for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
206 pipe_resource_reference(&drawable->textures[i], NULL);
207 for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
208 pipe_resource_reference(&drawable->msaa_textures[i], NULL);
209
210 screen->base.screen->fence_reference(screen->base.screen,
211 &drawable->throttle_fence, NULL);
212
213 /* Notify the st manager that this drawable is no longer valid */
214 st_api_destroy_drawable(&drawable->base);
215
216 FREE(drawable->damage_rects);
217 FREE(drawable);
218 }
219
220 void
dri_put_drawable(struct dri_drawable * drawable)221 dri_put_drawable(struct dri_drawable *drawable)
222 {
223 if (drawable) {
224 int refcount = --drawable->refcount;
225 assert(refcount >= 0);
226
227 if (!refcount)
228 dri_destroy_drawable(drawable);
229 }
230 }
231
232 /**
233 * Validate the texture at an attachment. Allocate the texture if it does not
234 * exist. Used by the TFP extension.
235 */
236 static void
dri_drawable_validate_att(struct dri_context * ctx,struct dri_drawable * drawable,enum st_attachment_type statt)237 dri_drawable_validate_att(struct dri_context *ctx,
238 struct dri_drawable *drawable,
239 enum st_attachment_type statt)
240 {
241 enum st_attachment_type statts[ST_ATTACHMENT_COUNT];
242 unsigned i, count = 0;
243
244 /* check if buffer already exists */
245 if (drawable->texture_mask & (1 << statt))
246 return;
247
248 /* make sure DRI2 does not destroy existing buffers */
249 for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
250 if (drawable->texture_mask & (1 << i)) {
251 statts[count++] = i;
252 }
253 }
254 statts[count++] = statt;
255
256 drawable->texture_stamp = drawable->lastStamp - 1;
257
258 drawable->base.validate(ctx->st, &drawable->base, statts, count, NULL, NULL);
259 }
260
261 /**
262 * These are used for GLX_EXT_texture_from_pixmap
263 */
264 void
dri_set_tex_buffer2(__DRIcontext * pDRICtx,GLint target,GLint format,__DRIdrawable * dPriv)265 dri_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target,
266 GLint format, __DRIdrawable *dPriv)
267 {
268 struct dri_context *ctx = dri_context(pDRICtx);
269 struct st_context *st = ctx->st;
270 struct dri_drawable *drawable = dri_drawable(dPriv);
271 struct pipe_resource *pt;
272
273 _mesa_glthread_finish(st->ctx);
274
275 dri_drawable_validate_att(ctx, drawable, ST_ATTACHMENT_FRONT_LEFT);
276
277 /* Use the pipe resource associated with the X drawable */
278 pt = drawable->textures[ST_ATTACHMENT_FRONT_LEFT];
279
280 if (pt) {
281 enum pipe_format internal_format = pt->format;
282
283 if (format == __DRI_TEXTURE_FORMAT_RGB) {
284 /* only need to cover the formats recognized by dri_fill_st_visual */
285 switch (internal_format) {
286 case PIPE_FORMAT_R16G16B16A16_FLOAT:
287 internal_format = PIPE_FORMAT_R16G16B16X16_FLOAT;
288 break;
289 case PIPE_FORMAT_B10G10R10A2_UNORM:
290 internal_format = PIPE_FORMAT_B10G10R10X2_UNORM;
291 break;
292 case PIPE_FORMAT_R10G10B10A2_UNORM:
293 internal_format = PIPE_FORMAT_R10G10B10X2_UNORM;
294 break;
295 case PIPE_FORMAT_BGRA8888_UNORM:
296 internal_format = PIPE_FORMAT_BGRX8888_UNORM;
297 break;
298 case PIPE_FORMAT_ARGB8888_UNORM:
299 internal_format = PIPE_FORMAT_XRGB8888_UNORM;
300 break;
301 default:
302 break;
303 }
304 }
305
306 drawable->update_tex_buffer(drawable, ctx, pt);
307
308 st_context_teximage(ctx->st, target, 0, internal_format, pt, false);
309 }
310 }
311
312 const __DRItexBufferExtension driTexBufferExtension = {
313 .base = { __DRI_TEX_BUFFER, 2 },
314
315 .setTexBuffer2 = dri_set_tex_buffer2,
316 };
317
318 /**
319 * Get the format and binding of an attachment.
320 */
321 void
dri_drawable_get_format(struct dri_drawable * drawable,enum st_attachment_type statt,enum pipe_format * format,unsigned * bind)322 dri_drawable_get_format(struct dri_drawable *drawable,
323 enum st_attachment_type statt,
324 enum pipe_format *format,
325 unsigned *bind)
326 {
327 switch (statt) {
328 case ST_ATTACHMENT_FRONT_LEFT:
329 case ST_ATTACHMENT_BACK_LEFT:
330 case ST_ATTACHMENT_FRONT_RIGHT:
331 case ST_ATTACHMENT_BACK_RIGHT:
332 /* Other pieces of the driver stack get confused and behave incorrectly
333 * when they get an sRGB drawable. st/mesa receives "drawable->stvis"
334 * though other means and handles it correctly, so we don't really need
335 * to use an sRGB format here.
336 */
337 *format = util_format_linear(drawable->stvis.color_format);
338 *bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
339 break;
340 case ST_ATTACHMENT_DEPTH_STENCIL:
341 *format = drawable->stvis.depth_stencil_format;
342 *bind = PIPE_BIND_DEPTH_STENCIL; /* XXX sampler? */
343 break;
344 default:
345 *format = PIPE_FORMAT_NONE;
346 *bind = 0;
347 break;
348 }
349 }
350
351 void
dri_pipe_blit(struct pipe_context * pipe,struct pipe_resource * dst,struct pipe_resource * src)352 dri_pipe_blit(struct pipe_context *pipe,
353 struct pipe_resource *dst,
354 struct pipe_resource *src)
355 {
356 struct pipe_blit_info blit;
357
358 if (!dst || !src)
359 return;
360
361 /* From the GL spec, version 4.2, section 4.1.11 (Additional Multisample
362 * Fragment Operations):
363 *
364 * If a framebuffer object is not bound, after all operations have
365 * been completed on the multisample buffer, the sample values for
366 * each color in the multisample buffer are combined to produce a
367 * single color value, and that value is written into the
368 * corresponding color buffers selected by DrawBuffer or
369 * DrawBuffers. An implementation may defer the writing of the color
370 * buffers until a later time, but the state of the framebuffer must
371 * behave as if the color buffers were updated as each fragment was
372 * processed. The method of combination is not specified. If the
373 * framebuffer contains sRGB values, then it is recommended that the
374 * an average of sample values is computed in a linearized space, as
375 * for blending (see section 4.1.7).
376 *
377 * In other words, to do a resolve operation in a linear space, we have
378 * to set sRGB formats if the original resources were sRGB, so don't use
379 * util_format_linear.
380 */
381
382 memset(&blit, 0, sizeof(blit));
383 blit.dst.resource = dst;
384 blit.dst.box.width = dst->width0;
385 blit.dst.box.height = dst->height0;
386 blit.dst.box.depth = 1;
387 blit.dst.format = dst->format;
388 blit.src.resource = src;
389 blit.src.box.width = src->width0;
390 blit.src.box.height = src->height0;
391 blit.src.box.depth = 1;
392 blit.src.format = src->format;
393 blit.mask = PIPE_MASK_RGBA;
394 blit.filter = PIPE_TEX_FILTER_NEAREST;
395
396 pipe->blit(pipe, &blit);
397 }
398
399 static void
dri_postprocessing(struct dri_context * ctx,struct dri_drawable * drawable,enum st_attachment_type att)400 dri_postprocessing(struct dri_context *ctx,
401 struct dri_drawable *drawable,
402 enum st_attachment_type att)
403 {
404 struct pipe_resource *src = drawable->textures[att];
405 struct pipe_resource *zsbuf = drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL];
406
407 if (ctx->pp && src)
408 pp_run(ctx->pp, src, src, zsbuf);
409 }
410
411 struct notify_before_flush_cb_args {
412 struct dri_context *ctx;
413 struct dri_drawable *drawable;
414 unsigned flags;
415 enum __DRI2throttleReason reason;
416 bool swap_msaa_buffers;
417 };
418
419 static void
notify_before_flush_cb(void * _args)420 notify_before_flush_cb(void* _args)
421 {
422 struct notify_before_flush_cb_args *args = (struct notify_before_flush_cb_args *) _args;
423 struct st_context *st = args->ctx->st;
424 struct pipe_context *pipe = st->pipe;
425
426 /* Wait for glthread to finish because we can't use pipe_context from
427 * multiple threads.
428 */
429 _mesa_glthread_finish(st->ctx);
430
431 if (args->drawable->stvis.samples > 1 &&
432 (args->reason == __DRI2_THROTTLE_SWAPBUFFER ||
433 args->reason == __DRI2_NOTHROTTLE_SWAPBUFFER ||
434 args->reason == __DRI2_THROTTLE_COPYSUBBUFFER)) {
435 /* Resolve the MSAA back buffer. */
436 dri_pipe_blit(st->pipe,
437 args->drawable->textures[ST_ATTACHMENT_BACK_LEFT],
438 args->drawable->msaa_textures[ST_ATTACHMENT_BACK_LEFT]);
439
440 if ((args->reason == __DRI2_THROTTLE_SWAPBUFFER ||
441 args->reason == __DRI2_NOTHROTTLE_SWAPBUFFER) &&
442 args->drawable->msaa_textures[ST_ATTACHMENT_FRONT_LEFT] &&
443 args->drawable->msaa_textures[ST_ATTACHMENT_BACK_LEFT]) {
444 args->swap_msaa_buffers = true;
445 }
446
447 /* FRONT_LEFT is resolved in drawable->flush_frontbuffer. */
448 }
449
450 dri_postprocessing(args->ctx, args->drawable, ST_ATTACHMENT_BACK_LEFT);
451
452 if (pipe->invalidate_resource &&
453 (args->flags & __DRI2_FLUSH_INVALIDATE_ANCILLARY)) {
454 if (args->drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL])
455 pipe->invalidate_resource(pipe, args->drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL]);
456 if (args->drawable->msaa_textures[ST_ATTACHMENT_DEPTH_STENCIL])
457 pipe->invalidate_resource(pipe, args->drawable->msaa_textures[ST_ATTACHMENT_DEPTH_STENCIL]);
458 }
459
460 if (args->ctx->hud) {
461 hud_run(args->ctx->hud, args->ctx->st->cso_context,
462 args->drawable->textures[ST_ATTACHMENT_BACK_LEFT]);
463 }
464
465 pipe->flush_resource(pipe, args->drawable->textures[ST_ATTACHMENT_BACK_LEFT]);
466 }
467
468 /**
469 * DRI2 flush extension, the flush_with_flags function.
470 *
471 * \param context the context
472 * \param drawable the drawable to flush
473 * \param flags a combination of _DRI2_FLUSH_xxx flags
474 * \param throttle_reason the reason for throttling, 0 = no throttling
475 */
476 void
dri_flush(__DRIcontext * cPriv,__DRIdrawable * dPriv,unsigned flags,enum __DRI2throttleReason reason)477 dri_flush(__DRIcontext *cPriv,
478 __DRIdrawable *dPriv,
479 unsigned flags,
480 enum __DRI2throttleReason reason)
481 {
482 struct dri_context *ctx = dri_context(cPriv);
483 struct dri_drawable *drawable = dri_drawable(dPriv);
484 struct st_context *st;
485 unsigned flush_flags;
486 struct notify_before_flush_cb_args args = { 0 };
487
488 if (!ctx) {
489 assert(0);
490 return;
491 }
492
493 st = ctx->st;
494 _mesa_glthread_finish(st->ctx);
495
496 if (drawable) {
497 /* prevent recursion */
498 if (drawable->flushing)
499 return;
500
501 drawable->flushing = true;
502 }
503 else {
504 flags &= ~__DRI2_FLUSH_DRAWABLE;
505 }
506
507 if ((flags & __DRI2_FLUSH_DRAWABLE) &&
508 drawable->textures[ST_ATTACHMENT_BACK_LEFT]) {
509 /* We can't do operations on the back buffer here, because there
510 * may be some pending operations that will get flushed by the
511 * call to st->flush (eg: FLUSH_VERTICES).
512 * Instead we register a callback to be notified when all operations
513 * have been submitted but before the call to st_flush.
514 */
515 args.ctx = ctx;
516 args.drawable = drawable;
517 args.flags = flags;
518 args.reason = reason;
519 }
520
521 flush_flags = 0;
522 if (flags & __DRI2_FLUSH_CONTEXT)
523 flush_flags |= ST_FLUSH_FRONT;
524 if (reason == __DRI2_THROTTLE_SWAPBUFFER ||
525 reason == __DRI2_NOTHROTTLE_SWAPBUFFER)
526 flush_flags |= ST_FLUSH_END_OF_FRAME;
527
528 /* Flush the context and throttle if needed. */
529 if (ctx->screen->throttle &&
530 drawable &&
531 (reason == __DRI2_THROTTLE_SWAPBUFFER ||
532 reason == __DRI2_THROTTLE_FLUSHFRONT)) {
533
534 struct pipe_screen *screen = drawable->screen->base.screen;
535 struct pipe_fence_handle *new_fence = NULL;
536
537 st_context_flush(st, flush_flags, &new_fence, args.ctx ? notify_before_flush_cb : NULL, &args);
538
539 /* throttle on the previous fence */
540 if (drawable->throttle_fence) {
541 screen->fence_finish(screen, NULL, drawable->throttle_fence, OS_TIMEOUT_INFINITE);
542 screen->fence_reference(screen, &drawable->throttle_fence, NULL);
543 }
544 drawable->throttle_fence = new_fence;
545 }
546 else if (flags & (__DRI2_FLUSH_DRAWABLE | __DRI2_FLUSH_CONTEXT)) {
547 st_context_flush(st, flush_flags, NULL, args.ctx ? notify_before_flush_cb : NULL, &args);
548 }
549
550 if (drawable) {
551 drawable->flushing = false;
552 }
553
554 /* Swap the MSAA front and back buffers, so that reading
555 * from the front buffer after SwapBuffers returns what was
556 * in the back buffer.
557 */
558 if (args.swap_msaa_buffers) {
559 struct pipe_resource *tmp =
560 drawable->msaa_textures[ST_ATTACHMENT_FRONT_LEFT];
561
562 drawable->msaa_textures[ST_ATTACHMENT_FRONT_LEFT] =
563 drawable->msaa_textures[ST_ATTACHMENT_BACK_LEFT];
564 drawable->msaa_textures[ST_ATTACHMENT_BACK_LEFT] = tmp;
565
566 /* Now that we have swapped the buffers, this tells the gallium
567 * frontend to revalidate the framebuffer.
568 */
569 p_atomic_inc(&drawable->base.stamp);
570 }
571
572 st_context_invalidate_state(st, ST_INVALIDATE_FB_STATE);
573 }
574
575 /**
576 * DRI2 flush extension.
577 */
578 void
dri_flush_drawable(__DRIdrawable * dPriv)579 dri_flush_drawable(__DRIdrawable *dPriv)
580 {
581 struct dri_context *ctx = dri_get_current();
582
583 if (ctx)
584 dri_flush(opaque_dri_context(ctx), dPriv, __DRI2_FLUSH_DRAWABLE, -1);
585 }
586
587 /**
588 * dri_throttle - A DRI2ThrottleExtension throttling function.
589 */
590 void
dri_throttle(__DRIcontext * cPriv,__DRIdrawable * dPriv,enum __DRI2throttleReason reason)591 dri_throttle(__DRIcontext *cPriv, __DRIdrawable *dPriv,
592 enum __DRI2throttleReason reason)
593 {
594 dri_flush(cPriv, dPriv, 0, reason);
595 }
596
597 /* vim: set sw=3 ts=8 sts=3 expandtab: */
598