• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "util/u_framebuffer.h"
29 #include "util/u_math.h"
30 #include "util/u_memory.h"
31 #include "util/reallocarray.h"
32 #include "util/u_inlines.h"
33 #include "util/format/u_format.h"
34 #include "lp_scene.h"
35 #include "lp_fence.h"
36 #include "lp_debug.h"
37 #include "lp_context.h"
38 #include "lp_state_fs.h"
39 #include "lp_setup_context.h"
40 
41 
42 #define RESOURCE_REF_SZ 32
43 /** List of resource references */
44 struct resource_ref {
45    struct pipe_resource *resource[RESOURCE_REF_SZ];
46    int count;
47    struct resource_ref *next;
48 };
49 
50 
51 #define SHADER_REF_SZ 32
52 /** List of shader variant references */
53 struct shader_ref {
54    struct lp_fragment_shader_variant *variant[SHADER_REF_SZ];
55    int count;
56    struct shader_ref *next;
57 };
58 
59 
60 /**
61  * Create a new scene object.
62  * \param queue  the queue to put newly rendered/emptied scenes into
63  */
64 struct lp_scene *
lp_scene_create(struct lp_setup_context * setup)65 lp_scene_create(struct lp_setup_context *setup)
66 {
67    struct lp_scene *scene = slab_alloc_st(&setup->scene_slab);
68    if (!scene)
69       return NULL;
70 
71    memset(scene, 0, sizeof(struct lp_scene));
72    scene->pipe = setup->pipe;
73    scene->setup = setup;
74    scene->data.head = &scene->data.first;
75 
76    (void) mtx_init(&scene->mutex, mtx_plain);
77 
78 #if MESA_DEBUG
79    /* Do some scene limit sanity checks here */
80    {
81       size_t maxBins = TILES_X * TILES_Y;
82       size_t maxCommandBytes = sizeof(struct cmd_block) * maxBins;
83       size_t maxCommandPlusData = maxCommandBytes + DATA_BLOCK_SIZE;
84       /* We'll need at least one command block per bin.  Make sure that's
85        * less than the max allowed scene size.
86        */
87       assert(maxCommandBytes < LP_SCENE_MAX_SIZE);
88       /* We'll also need space for at least one other data block */
89       assert(maxCommandPlusData <= LP_SCENE_MAX_SIZE);
90    }
91 #endif
92 
93    return scene;
94 }
95 
96 
97 /**
98  * Free all data associated with the given scene, and the scene itself.
99  */
100 void
lp_scene_destroy(struct lp_scene * scene)101 lp_scene_destroy(struct lp_scene *scene)
102 {
103    lp_scene_end_rasterization(scene);
104    mtx_destroy(&scene->mutex);
105    free(scene->tiles);
106    assert(scene->data.head == &scene->data.first);
107    slab_free_st(&scene->setup->scene_slab, scene);
108 }
109 
110 
111 /**
112  * Check if the scene's bins are all empty.
113  * For debugging purposes.
114  */
115 bool
lp_scene_is_empty(struct lp_scene * scene)116 lp_scene_is_empty(struct lp_scene *scene)
117 {
118    for (unsigned y = 0; y < scene->tiles_y; y++) {
119       for (unsigned x = 0; x < scene->tiles_x; x++) {
120          const struct cmd_bin *bin = lp_scene_get_bin(scene, x, y);
121          if (bin->head) {
122             return false;
123          }
124       }
125    }
126    return true;
127 }
128 
129 
130 /* Returns true if there has ever been a failed allocation attempt in
131  * this scene.  Used in triangle/rectangle emit to avoid having to
132  * check success at each bin.
133  */
134 bool
lp_scene_is_oom(struct lp_scene * scene)135 lp_scene_is_oom(struct lp_scene *scene)
136 {
137    return scene->alloc_failed;
138 }
139 
140 
141 /* Remove all commands from a bin.  Tries to reuse some of the memory
142  * allocated to the bin, however.
143  */
144 void
lp_scene_bin_reset(struct lp_scene * scene,unsigned x,unsigned y)145 lp_scene_bin_reset(struct lp_scene *scene, unsigned x, unsigned y)
146 {
147    struct cmd_bin *bin = lp_scene_get_bin(scene, x, y);
148 
149    bin->last_state = NULL;
150    bin->head = bin->tail;
151    if (bin->tail) {
152       bin->tail->next = NULL;
153       bin->tail->count = 0;
154    }
155 }
156 
157 
158 static void
init_scene_texture(struct lp_scene_surface * ssurf,struct pipe_surface * psurf)159 init_scene_texture(struct lp_scene_surface *ssurf, struct pipe_surface *psurf)
160 {
161    if (!psurf) {
162       ssurf->stride = 0;
163       ssurf->layer_stride = 0;
164       ssurf->sample_stride = 0;
165       ssurf->nr_samples = 0;
166       ssurf->map = NULL;
167       return;
168    }
169 
170    if (llvmpipe_resource_is_texture(psurf->texture)) {
171       ssurf->stride = llvmpipe_resource_stride(psurf->texture,
172                                                psurf->u.tex.level);
173       ssurf->layer_stride = llvmpipe_layer_stride(psurf->texture,
174                                                            psurf->u.tex.level);
175       ssurf->sample_stride = llvmpipe_sample_stride(psurf->texture);
176 
177       ssurf->map = llvmpipe_resource_map(psurf->texture,
178                                          psurf->u.tex.level,
179                                          psurf->u.tex.first_layer,
180                                          LP_TEX_USAGE_READ_WRITE);
181       assert(ssurf->map);
182       ssurf->format_bytes = util_format_get_blocksize(psurf->format);
183       ssurf->nr_samples = util_res_sample_count(psurf->texture);
184    } else {
185       struct llvmpipe_resource *lpr = llvmpipe_resource(psurf->texture);
186       unsigned pixstride = util_format_get_blocksize(psurf->format);
187       ssurf->stride = psurf->texture->width0;
188       ssurf->layer_stride = 0;
189       ssurf->sample_stride = 0;
190       ssurf->nr_samples = 1;
191       ssurf->map = lpr->data;
192       ssurf->map += psurf->u.buf.first_element * pixstride;
193       ssurf->format_bytes = util_format_get_blocksize(psurf->format);
194    }
195 }
196 
197 
198 void
lp_scene_begin_rasterization(struct lp_scene * scene)199 lp_scene_begin_rasterization(struct lp_scene *scene)
200 {
201    const struct pipe_framebuffer_state *fb = &scene->fb;
202 
203    //LP_DBG(DEBUG_RAST, "%s\n", __func__);
204 
205    for (unsigned i = 0; i < scene->fb.nr_cbufs; i++) {
206       struct pipe_surface *cbuf = scene->fb.cbufs[i];
207       init_scene_texture(&scene->cbufs[i], cbuf);
208    }
209 
210    if (fb->zsbuf) {
211       struct pipe_surface *zsbuf = scene->fb.zsbuf;
212       init_scene_texture(&scene->zsbuf, zsbuf);
213    }
214 }
215 
216 
217 /**
218  * Free all the temporary data in a scene.
219  */
220 void
lp_scene_end_rasterization(struct lp_scene * scene)221 lp_scene_end_rasterization(struct lp_scene *scene)
222 {
223    mtx_lock(&scene->mutex);
224 
225    /* Unmap color buffers */
226    for (unsigned i = 0; i < scene->fb.nr_cbufs; i++) {
227       if (scene->cbufs[i].map) {
228          struct pipe_surface *cbuf = scene->fb.cbufs[i];
229          if (llvmpipe_resource_is_texture(cbuf->texture)) {
230             llvmpipe_resource_unmap(cbuf->texture,
231                                     cbuf->u.tex.level,
232                                     cbuf->u.tex.first_layer);
233          }
234          scene->cbufs[i].map = NULL;
235       }
236    }
237 
238    /* Unmap z/stencil buffer */
239    if (scene->zsbuf.map) {
240       struct pipe_surface *zsbuf = scene->fb.zsbuf;
241       llvmpipe_resource_unmap(zsbuf->texture,
242                               zsbuf->u.tex.level,
243                               zsbuf->u.tex.first_layer);
244       scene->zsbuf.map = NULL;
245    }
246 
247    /* Reset all command lists:
248     */
249    memset(scene->tiles, 0, sizeof(struct cmd_bin) * scene->num_alloced_tiles);
250 
251    /* Decrement texture ref counts
252     */
253    int j = 0;
254    for (struct resource_ref *ref = scene->resources; ref; ref = ref->next) {
255       for (int i = 0; i < ref->count; i++) {
256          if (LP_DEBUG & DEBUG_SETUP)
257             debug_printf("resource %d: %p %dx%d sz %d\n",
258                          j,
259                          (void *) ref->resource[i],
260                          ref->resource[i]->width0,
261                          ref->resource[i]->height0,
262                          llvmpipe_resource_size(ref->resource[i]));
263          j++;
264          llvmpipe_resource_unmap(ref->resource[i], 0, 0);
265          pipe_resource_reference(&ref->resource[i], NULL);
266       }
267    }
268 
269    for (struct resource_ref *ref = scene->writeable_resources; ref;
270         ref = ref->next) {
271       for (int i = 0; i < ref->count; i++) {
272          if (LP_DEBUG & DEBUG_SETUP)
273             debug_printf("resource %d: %p %dx%d sz %d\n",
274                          j,
275                          (void *) ref->resource[i],
276                          ref->resource[i]->width0,
277                             ref->resource[i]->height0,
278                          llvmpipe_resource_size(ref->resource[i]));
279          j++;
280          llvmpipe_resource_unmap(ref->resource[i], 0, 0);
281          pipe_resource_reference(&ref->resource[i], NULL);
282       }
283    }
284 
285    if (LP_DEBUG & DEBUG_SETUP) {
286       debug_printf("scene %d resources, sz %d\n",
287                    j, scene->resource_reference_size);
288    }
289 
290    /* Decrement shader variant ref counts
291     */
292    j = 0;
293    for (struct shader_ref *ref = scene->frag_shaders; ref; ref = ref->next) {
294       for (int i = 0; i < ref->count; i++) {
295          if (LP_DEBUG & DEBUG_SETUP)
296             debug_printf("shader %d: %p\n", j, (void *) ref->variant[i]);
297          j++;
298          lp_fs_variant_reference(llvmpipe_context(scene->pipe),
299                                  &ref->variant[i], NULL);
300       }
301    }
302 
303    /* Free all scene data blocks:
304     */
305    {
306       struct data_block_list *list = &scene->data;
307       struct data_block *block, *tmp;
308 
309       for (block = list->head; block; block = tmp) {
310          tmp = block->next;
311          if (block != &list->first)
312             FREE(block);
313       }
314 
315       list->head = &list->first;
316       list->head->next = NULL;
317    }
318 
319    lp_fence_reference(&scene->fence, NULL);
320 
321    scene->resources = NULL;
322    scene->writeable_resources = NULL;
323    scene->frag_shaders = NULL;
324    scene->scene_size = 0;
325    scene->resource_reference_size = 0;
326 
327    scene->alloc_failed = false;
328 
329    util_unreference_framebuffer_state(&scene->fb);
330 
331    mtx_unlock(&scene->mutex);
332 }
333 
334 
335 struct cmd_block *
lp_scene_new_cmd_block(struct lp_scene * scene,struct cmd_bin * bin)336 lp_scene_new_cmd_block(struct lp_scene *scene,
337                        struct cmd_bin *bin)
338 {
339    struct cmd_block *block = lp_scene_alloc(scene, sizeof(struct cmd_block));
340    if (block) {
341       if (bin->tail) {
342          bin->tail->next = block;
343          bin->tail = block;
344       } else {
345          bin->head = block;
346          bin->tail = block;
347       }
348       //memset(block, 0, sizeof *block);
349       block->next = NULL;
350       block->count = 0;
351    }
352    return block;
353 }
354 
355 
356 struct data_block *
lp_scene_new_data_block(struct lp_scene * scene)357 lp_scene_new_data_block(struct lp_scene *scene)
358 {
359    if (scene->scene_size + DATA_BLOCK_SIZE > LP_SCENE_MAX_SIZE) {
360       if (0) debug_printf("%s: failed\n", __func__);
361       scene->alloc_failed = true;
362       return NULL;
363    } else {
364       struct data_block *block = MALLOC_STRUCT(data_block);
365       if (!block)
366          return NULL;
367 
368       scene->scene_size += sizeof *block;
369 
370       block->used = 0;
371       block->next = scene->data.head;
372       scene->data.head = block;
373 
374       return block;
375    }
376 }
377 
378 
379 /**
380  * Return number of bytes used for all bin data within a scene.
381  * This does not include resources (textures) referenced by the scene.
382  */
383 static unsigned
lp_scene_data_size(const struct lp_scene * scene)384 lp_scene_data_size(const struct lp_scene *scene)
385 {
386    unsigned size = 0;
387    const struct data_block *block;
388    for (block = scene->data.head; block; block = block->next) {
389       size += block->used;
390    }
391    return size;
392 }
393 
394 
395 
396 /**
397  * Add a reference to a resource by the scene.
398  */
399 bool
lp_scene_add_resource_reference(struct lp_scene * scene,struct pipe_resource * resource,bool initializing_scene,bool writeable)400 lp_scene_add_resource_reference(struct lp_scene *scene,
401                                 struct pipe_resource *resource,
402                                 bool initializing_scene,
403                                 bool writeable)
404 {
405    struct resource_ref *ref;
406    int i;
407    struct resource_ref **list = writeable ? &scene->writeable_resources : &scene->resources;
408    struct resource_ref **last = list;
409 
410    mtx_lock(&scene->mutex);
411 
412    /* Look at existing resource blocks:
413     */
414    for (ref = *list; ref; ref = ref->next) {
415       last = &ref->next;
416 
417       /* Search for this resource:
418        */
419       for (i = 0; i < ref->count; i++)
420          if (ref->resource[i] == resource) {
421             mtx_unlock(&scene->mutex);
422             return true;
423       }
424 
425       if (ref->count < RESOURCE_REF_SZ) {
426          /* If the block is half-empty, then append the reference here.
427           */
428          break;
429       }
430    }
431 
432    /* Create a new block if no half-empty block was found.
433     */
434    if (!ref) {
435       assert(*last == NULL);
436       *last = lp_scene_alloc(scene, sizeof *ref);
437       if (*last == NULL) {
438           mtx_unlock(&scene->mutex);
439           return false;
440       }
441 
442       ref = *last;
443       memset(ref, 0, sizeof *ref);
444    }
445 
446    /* Map resource again to increment the map count. We likely use the
447     * already-mapped pointer in a texture of the jit context, and that pointer
448     * needs to stay mapped during rasterization. This map is unmap'ed when
449     * finalizing scene rasterization. */
450    llvmpipe_resource_map(resource, 0, 0, LP_TEX_USAGE_READ);
451 
452    /* Append the reference to the reference block.
453     */
454    pipe_resource_reference(&ref->resource[ref->count++], resource);
455    scene->resource_reference_size += llvmpipe_resource_size(resource);
456 
457    /* Heuristic to advise scene flushes.  This isn't helpful in the
458     * initial setup of the scene, but after that point flush on the
459     * next resource added which exceeds 64MB in referenced texture
460     * data.
461     */
462    int flush = (initializing_scene || scene->resource_reference_size < LP_SCENE_MAX_RESOURCE_SIZE);
463    mtx_unlock(&scene->mutex);
464    return flush;
465 }
466 
467 /**
468  * Add a reference to a fragment shader variant
469  * Return FALSE if out of memory, TRUE otherwise.
470  */
471 bool
lp_scene_add_frag_shader_reference(struct lp_scene * scene,struct lp_fragment_shader_variant * variant)472 lp_scene_add_frag_shader_reference(struct lp_scene *scene,
473                                    struct lp_fragment_shader_variant *variant)
474 {
475    struct shader_ref *ref, **last = &scene->frag_shaders;
476 
477    /* Look at existing resource blocks:
478     */
479    for (ref = scene->frag_shaders; ref; ref = ref->next) {
480       last = &ref->next;
481 
482       /* Search for this resource:
483        */
484       for (int i = 0; i < ref->count; i++)
485          if (ref->variant[i] == variant)
486             return true;
487 
488       if (ref->count < SHADER_REF_SZ) {
489          /* If the block is half-empty, then append the reference here.
490           */
491          break;
492       }
493    }
494 
495    /* Create a new block if no half-empty block was found.
496     */
497    if (!ref) {
498       assert(*last == NULL);
499       *last = lp_scene_alloc(scene, sizeof *ref);
500       if (*last == NULL)
501           return false;
502 
503       ref = *last;
504       memset(ref, 0, sizeof *ref);
505    }
506 
507    /* Append the reference to the reference block.
508     */
509    lp_fs_variant_reference(llvmpipe_context(scene->pipe),
510                            &ref->variant[ref->count++], variant);
511 
512    return true;
513 }
514 
515 
516 /**
517  * Does this scene have a reference to the given resource?
518  * Returns bitmask of LP_REFERENCED_FOR_READ/WRITE bits.
519  */
520 unsigned
lp_scene_is_resource_referenced(const struct lp_scene * scene,const struct pipe_resource * resource)521 lp_scene_is_resource_referenced(const struct lp_scene *scene,
522                                 const struct pipe_resource *resource)
523 {
524    const struct resource_ref *ref;
525 
526    /* check the render targets */
527    for (unsigned j = 0; j < scene->fb.nr_cbufs; j++) {
528      if (scene->fb.cbufs[j] && scene->fb.cbufs[j]->texture == resource)
529        return LP_REFERENCED_FOR_READ | LP_REFERENCED_FOR_WRITE;
530    }
531    if (scene->fb.zsbuf && scene->fb.zsbuf->texture == resource) {
532      return LP_REFERENCED_FOR_READ | LP_REFERENCED_FOR_WRITE;
533    }
534 
535    for (ref = scene->resources; ref; ref = ref->next) {
536       for (int i = 0; i < ref->count; i++)
537          if (ref->resource[i] == resource)
538             return LP_REFERENCED_FOR_READ;
539    }
540 
541    for (ref = scene->writeable_resources; ref; ref = ref->next) {
542       for (int i = 0; i < ref->count; i++)
543          if (ref->resource[i] == resource)
544             return LP_REFERENCED_FOR_READ | LP_REFERENCED_FOR_WRITE;
545    }
546 
547    return 0;
548 }
549 
550 
551 /** advance curr_x,y to the next bin */
552 static bool
next_bin(struct lp_scene * scene)553 next_bin(struct lp_scene *scene)
554 {
555    scene->curr_x++;
556    if (scene->curr_x >= scene->tiles_x) {
557       scene->curr_x = 0;
558       scene->curr_y++;
559    }
560    if (scene->curr_y >= scene->tiles_y) {
561       /* no more bins */
562       return false;
563    }
564    return true;
565 }
566 
567 
568 void
lp_scene_bin_iter_begin(struct lp_scene * scene)569 lp_scene_bin_iter_begin(struct lp_scene *scene)
570 {
571    scene->curr_x = scene->curr_y = -1;
572 }
573 
574 
575 /**
576  * Return pointer to next bin to be rendered.
577  * The lp_scene::curr_x and ::curr_y fields will be advanced.
578  * Multiple rendering threads will call this function to get a chunk
579  * of work (a bin) to work on.
580  */
581 struct cmd_bin *
lp_scene_bin_iter_next(struct lp_scene * scene,int * x,int * y)582 lp_scene_bin_iter_next(struct lp_scene *scene , int *x, int *y)
583 {
584    struct cmd_bin *bin = NULL;
585 
586    mtx_lock(&scene->mutex);
587 
588    if (scene->curr_x < 0) {
589       /* first bin */
590       scene->curr_x = 0;
591       scene->curr_y = 0;
592    } else if (!next_bin(scene)) {
593       /* no more bins left */
594       goto end;
595    }
596 
597    bin = lp_scene_get_bin(scene, scene->curr_x, scene->curr_y);
598    *x = scene->curr_x;
599    *y = scene->curr_y;
600 
601 end:
602    /*printf("return bin %p at %d, %d\n", (void *) bin, *bin_x, *bin_y);*/
603    mtx_unlock(&scene->mutex);
604    return bin;
605 }
606 
607 
608 void
lp_scene_begin_binning(struct lp_scene * scene,struct pipe_framebuffer_state * fb)609 lp_scene_begin_binning(struct lp_scene *scene,
610                        struct pipe_framebuffer_state *fb)
611 {
612    assert(lp_scene_is_empty(scene));
613 
614    util_copy_framebuffer_state(&scene->fb, fb);
615 
616    scene->tiles_x = align(fb->width, TILE_SIZE) / TILE_SIZE;
617    scene->tiles_y = align(fb->height, TILE_SIZE) / TILE_SIZE;
618    assert(scene->tiles_x <= TILES_X);
619    assert(scene->tiles_y <= TILES_Y);
620 
621    unsigned num_required_tiles = scene->tiles_x * scene->tiles_y;
622    if (scene->num_alloced_tiles < num_required_tiles) {
623       scene->tiles = reallocarray(scene->tiles, num_required_tiles,
624                                   sizeof(struct cmd_bin));
625       if (!scene->tiles)
626          return;
627       memset(scene->tiles, 0, sizeof(struct cmd_bin) * num_required_tiles);
628       scene->num_alloced_tiles = num_required_tiles;
629    }
630 
631    /*
632     * Determine how many layers the fb has (used for clamping layer value).
633     * OpenGL (but not d3d10) permits different amount of layers per rt,
634     * however results are undefined if layer exceeds the amount of layers of
635     * ANY attachment hence don't need separate per cbuf and zsbuf max.
636     */
637    unsigned max_layer = ~0;
638    for (unsigned i = 0; i < scene->fb.nr_cbufs; i++) {
639       struct pipe_surface *cbuf = scene->fb.cbufs[i];
640       if (cbuf) {
641          if (llvmpipe_resource_is_texture(cbuf->texture)) {
642             max_layer = MIN2(max_layer,
643                              cbuf->u.tex.last_layer - cbuf->u.tex.first_layer);
644          } else {
645             max_layer = 0;
646          }
647       }
648    }
649 
650    if (fb->zsbuf) {
651       struct pipe_surface *zsbuf = scene->fb.zsbuf;
652       max_layer = MIN2(max_layer, zsbuf->u.tex.last_layer - zsbuf->u.tex.first_layer);
653    }
654 
655    scene->fb_max_layer = max_layer;
656    scene->fb_max_samples = util_framebuffer_get_num_samples(fb);
657    if (scene->fb_max_samples == 4) {
658       for (unsigned i = 0; i < 4; i++) {
659          scene->fixed_sample_pos[i][0] = util_iround(lp_sample_pos_4x[i][0] * FIXED_ONE);
660          scene->fixed_sample_pos[i][1] = util_iround(lp_sample_pos_4x[i][1] * FIXED_ONE);
661       }
662    }
663 }
664 
665 
666 void
lp_scene_end_binning(struct lp_scene * scene)667 lp_scene_end_binning(struct lp_scene *scene)
668 {
669    if (LP_DEBUG & DEBUG_SCENE) {
670       debug_printf("rasterize scene:\n");
671       debug_printf("  scene_size: %u\n",
672                    scene->scene_size);
673       debug_printf("  data size: %u\n",
674                    lp_scene_data_size(scene));
675 
676       if (0)
677          lp_debug_bins(scene);
678    }
679 }
680