Line | Branch | Exec | Source |
---|---|---|---|
1 | #include <assert.h> | ||
2 | #include <inttypes.h> | ||
3 | #include <stdlib.h> | ||
4 | #include <string.h> | ||
5 | #include <sys/types.h> | ||
6 | #include "private.h" | ||
7 | |||
8 | struct liftoff_output * | ||
9 | 57 | liftoff_output_create(struct liftoff_device *device, uint32_t crtc_id) | |
10 | { | ||
11 | struct liftoff_output *output; | ||
12 | ssize_t crtc_index; | ||
13 | size_t i; | ||
14 | |||
15 | 57 | crtc_index = -1; | |
16 |
1/2✓ Branch 0 (6→3) taken 57 times.
✗ Branch 1 (6→7) not taken.
|
57 | for (i = 0; i < device->crtcs_len; i++) { |
17 |
1/2✓ Branch 0 (3→4) taken 57 times.
✗ Branch 1 (3→5) not taken.
|
57 | if (device->crtcs[i] == crtc_id) { |
18 | 57 | crtc_index = (ssize_t)i; | |
19 | 57 | break; | |
20 | } | ||
21 | } | ||
22 |
1/2✗ Branch 0 (7→8) not taken.
✓ Branch 1 (7→9) taken 57 times.
|
57 | if (crtc_index < 0) { |
23 | ✗ | return NULL; | |
24 | } | ||
25 | |||
26 | 57 | output = calloc(1, sizeof(*output)); | |
27 |
1/2✗ Branch 0 (9→10) not taken.
✓ Branch 1 (9→11) taken 57 times.
|
57 | if (output == NULL) { |
28 | ✗ | return NULL; | |
29 | } | ||
30 | 57 | output->device = device; | |
31 | 57 | output->crtc_id = crtc_id; | |
32 | 57 | output->crtc_index = (size_t)crtc_index; | |
33 | 57 | liftoff_list_init(&output->layers); | |
34 | 57 | liftoff_list_insert(&device->outputs, &output->link); | |
35 | 57 | return output; | |
36 | } | ||
37 | |||
38 | void | ||
39 | 23 | liftoff_output_destroy(struct liftoff_output *output) | |
40 | { | ||
41 |
1/2✗ Branch 0 (2→3) not taken.
✓ Branch 1 (2→4) taken 23 times.
|
23 | if (output == NULL) { |
42 | ✗ | return; | |
43 | } | ||
44 | |||
45 | 23 | liftoff_list_remove(&output->link); | |
46 | 23 | free(output); | |
47 | } | ||
48 | |||
49 | void | ||
50 | 6 | liftoff_output_set_composition_layer(struct liftoff_output *output, | |
51 | struct liftoff_layer *layer) | ||
52 | { | ||
53 |
1/2✗ Branch 0 (2→3) not taken.
✓ Branch 1 (2→4) taken 6 times.
|
6 | assert(layer->output == output); |
54 |
1/2✓ Branch 0 (5→6) taken 6 times.
✗ Branch 1 (5→7) not taken.
|
6 | if (layer != output->composition_layer) { |
55 | 6 | output->layers_changed = true; | |
56 | } | ||
57 | 6 | output->composition_layer = layer; | |
58 | 6 | } | |
59 | |||
60 | bool | ||
61 | 23 | liftoff_output_needs_composition(struct liftoff_output *output) | |
62 | { | ||
63 | struct liftoff_layer *layer; | ||
64 | |||
65 |
2/2✓ Branch 0 (7→3) taken 48 times.
✓ Branch 1 (7→8) taken 11 times.
|
59 | liftoff_list_for_each(layer, &output->layers, link) { |
66 |
2/2✓ Branch 0 (4→5) taken 12 times.
✓ Branch 1 (4→6) taken 36 times.
|
48 | if (liftoff_layer_needs_composition(layer)) { |
67 | 12 | return true; | |
68 | } | ||
69 | } | ||
70 | |||
71 | 11 | return false; | |
72 | } | ||
73 | |||
74 | static double | ||
75 | 704 | fp16_to_double(uint64_t val) | |
76 | { | ||
77 | 704 | return (double)(val >> 16) + (double)(val & 0xFFFF) / 0xFFFF; | |
78 | } | ||
79 | |||
80 | void | ||
81 | 79 | output_log_layers(struct liftoff_output *output) | |
82 | { | ||
83 | struct liftoff_layer *layer; | ||
84 | size_t i; | ||
85 | bool is_composition_layer; | ||
86 | |||
87 |
2/2✓ Branch 0 (3→4) taken 2 times.
✓ Branch 1 (3→5) taken 77 times.
|
79 | if (!log_has(LIFTOFF_DEBUG)) { |
88 | 2 | return; | |
89 | } | ||
90 | |||
91 | 77 | liftoff_log(LIFTOFF_DEBUG, "Layers on CRTC %"PRIu32" (%zu total):", | |
92 | 77 | output->crtc_id, liftoff_list_length(&output->layers)); | |
93 |
2/2✓ Branch 0 (32→8) taken 182 times.
✓ Branch 1 (32→33) taken 77 times.
|
259 | liftoff_list_for_each(layer, &output->layers, link) { |
94 |
2/2✓ Branch 0 (8→9) taken 1 times.
✓ Branch 1 (8→10) taken 181 times.
|
182 | if (layer->force_composition) { |
95 | 1 | liftoff_log(LIFTOFF_DEBUG, " Layer %p " | |
96 | "(forced composition):", (void *)layer); | ||
97 | } else { | ||
98 |
2/2✓ Branch 0 (11→12) taken 6 times.
✓ Branch 1 (11→13) taken 175 times.
|
181 | if (!layer_has_fb(layer)) { |
99 | 6 | continue; | |
100 | } | ||
101 | 175 | is_composition_layer = output->composition_layer == layer; | |
102 |
2/2✓ Branch 0 (13→14) taken 6 times.
✓ Branch 1 (13→15) taken 169 times.
|
175 | liftoff_log(LIFTOFF_DEBUG, " Layer %p%s:", |
103 | (void *)layer, is_composition_layer ? | ||
104 | " (composition layer)" : ""); | ||
105 | } | ||
106 | |||
107 | 176 | liftoff_log(LIFTOFF_DEBUG, " Priority = %"PRIi32, | |
108 | layer->current_priority); | ||
109 | |||
110 |
2/2✓ Branch 0 (30→19) taken 1681 times.
✓ Branch 1 (30→31) taken 176 times.
|
1857 | for (i = 0; i < layer->props_len; i++) { |
111 | 1681 | char *name = layer->props[i].name; | |
112 | 1681 | uint64_t value = layer->props[i].value; | |
113 | |||
114 |
2/2✓ Branch 0 (19→20) taken 1505 times.
✓ Branch 1 (19→21) taken 176 times.
|
1681 | if (strcmp(name, "CRTC_X") == 0 || |
115 |
2/2✓ Branch 0 (20→21) taken 176 times.
✓ Branch 1 (20→22) taken 1329 times.
|
1505 | strcmp(name, "CRTC_Y") == 0) { |
116 | 352 | liftoff_log(LIFTOFF_DEBUG, " %s = %+"PRIi32, | |
117 | name, (int32_t)value); | ||
118 |
2/2✓ Branch 0 (22→23) taken 1153 times.
✓ Branch 1 (22→26) taken 176 times.
|
1329 | } else if (strcmp(name, "SRC_X") == 0 || |
119 |
2/2✓ Branch 0 (23→24) taken 977 times.
✓ Branch 1 (23→26) taken 176 times.
|
1153 | strcmp(name, "SRC_Y") == 0 || |
120 |
2/2✓ Branch 0 (24→25) taken 801 times.
✓ Branch 1 (24→26) taken 176 times.
|
977 | strcmp(name, "SRC_W") == 0 || |
121 |
2/2✓ Branch 0 (25→26) taken 176 times.
✓ Branch 1 (25→28) taken 625 times.
|
801 | strcmp(name, "SRC_H") == 0) { |
122 | 704 | liftoff_log(LIFTOFF_DEBUG, " %s = %f", | |
123 | name, fp16_to_double(value)); | ||
124 | } else { | ||
125 | 625 | liftoff_log(LIFTOFF_DEBUG, " %s = %"PRIu64, | |
126 | name, value); | ||
127 | } | ||
128 | } | ||
129 | } | ||
130 | } | ||
131 |