2019-09-30 20:22:01 +02:00
|
|
|
#include <assert.h>
|
2019-08-21 22:07:37 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2019-09-08 16:41:25 +02:00
|
|
|
#include <sys/types.h>
|
2019-08-21 22:07:37 +02:00
|
|
|
#include "private.h"
|
|
|
|
|
2019-09-12 10:39:06 +02:00
|
|
|
struct liftoff_output *liftoff_output_create(struct liftoff_display *display,
|
|
|
|
uint32_t crtc_id)
|
2019-08-21 22:07:37 +02:00
|
|
|
{
|
2019-09-12 10:39:06 +02:00
|
|
|
struct liftoff_output *output;
|
2019-09-08 16:41:25 +02:00
|
|
|
ssize_t crtc_index;
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
crtc_index = -1;
|
|
|
|
for (i = 0; i < display->crtcs_len; i++) {
|
|
|
|
if (display->crtcs[i] == crtc_id) {
|
|
|
|
crtc_index = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (crtc_index < 0) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2019-08-21 22:07:37 +02:00
|
|
|
|
|
|
|
output = calloc(1, sizeof(*output));
|
|
|
|
if (output == NULL) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
output->display = display;
|
|
|
|
output->crtc_id = crtc_id;
|
2019-09-08 16:41:25 +02:00
|
|
|
output->crtc_index = crtc_index;
|
2019-09-12 10:39:06 +02:00
|
|
|
liftoff_list_init(&output->layers);
|
|
|
|
liftoff_list_insert(&display->outputs, &output->link);
|
2019-08-21 22:07:37 +02:00
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
2019-09-12 10:39:06 +02:00
|
|
|
void liftoff_output_destroy(struct liftoff_output *output)
|
2019-08-21 22:07:37 +02:00
|
|
|
{
|
2019-09-12 10:39:06 +02:00
|
|
|
liftoff_list_remove(&output->link);
|
2019-08-21 22:07:37 +02:00
|
|
|
free(output);
|
|
|
|
}
|
2019-09-30 20:22:01 +02:00
|
|
|
|
|
|
|
void liftoff_output_set_composition_layer(struct liftoff_output *output,
|
|
|
|
struct liftoff_layer *layer)
|
|
|
|
{
|
|
|
|
assert(layer->output == output);
|
|
|
|
output->composition_layer = layer;
|
|
|
|
}
|