• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2017 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can
5  * be found in the LICENSE file.
6  *
7  */
8 
9 #pragma once
10 
11 //
12 //
13 //
14 
15 #include <CL/opencl.h>
16 
17 #include "composition.h"
18 #include "assert_state.h"
19 #include "grid.h"
20 #include "extent_cl_12.h"
21 #include "extent_ring.h"
22 
23 //
24 // composition states
25 //
26 
27 typedef enum skc_composition_state_e {
28 
29   SKC_COMPOSITION_STATE_UNSEALING,
30   SKC_COMPOSITION_STATE_UNSEALED,
31   SKC_COMPOSITION_STATE_SEALING,
32   SKC_COMPOSITION_STATE_SEALED
33 
34 } skc_composition_state_e;
35 
36 //
37 // IMPL
38 //
39 
40 struct skc_composition_impl
41 {
42   struct skc_composition        * composition;
43   struct skc_runtime            * runtime;
44 
45   SKC_ASSERT_STATE_DECLARE(skc_composition_state_e);
46 
47   skc_int                         lock_count; // wip renders
48 
49   struct {
50     skc_grid_t                    place;
51     skc_grid_t                    sort;
52   } grids;
53 
54   cl_command_queue                cq;
55 
56   struct {
57     cl_kernel                     place;
58     cl_kernel                     segment;
59   } kernels;
60 
61   // raster ids must be held until the composition is reset or
62   // released and then their refcounts can be decremented
63   struct {
64     struct skc_extent_phrw        extent;
65     skc_uint                      count;
66   } saved;
67 
68   struct {
69     struct skc_extent_ring        ring;   // how many slots left?
70     struct skc_extent_phw1g_tdrNs extent; // wip command extent
71   } cmds;
72 
73   // composition extent length
74   struct skc_extent_phr_pdrw      atomics;
75 
76   // composition ttck extent
77   struct skc_extent_pdrw          keys;
78 
79   // key offsets in sealed and sorted ttck extent
80   struct skc_extent_pdrw          offsets;
81 };
82 
83 //
84 // ATOMICS
85 //
86 
87 struct skc_place_atomics
88 {
89   skc_uint keys;
90   skc_uint offsets;
91 };
92 
93 //
94 // ONLY VISIBLE WITHIN THIS RUNTIME
95 //
96 
97 void
98 skc_composition_retain_and_lock(struct skc_composition * const composition);
99 
100 void
101 skc_composition_unlock_and_release(struct skc_composition * const composition);
102 
103 //
104 //
105 //
106