{
pepper_output_t *output;
pepper_compositor_t *compositor = (pepper_compositor_t *)cmp;
+ uint32_t id;
CHECK_MAGIC_AND_NON_NULL(cmp, PEPPER_COMPOSITOR);
+ id = ffs(~compositor->output_id_allocator);
+
+ if (id == 0)
+ {
+ PEPPER_ERROR("No available output ids.\n");
+ return NULL;
+ }
+
+ id = id - 1;
+
output = (pepper_output_t *)pepper_object_alloc(sizeof(pepper_output_t), PEPPER_OUTPUT);
if (!output)
return NULL;
return NULL;
}
+ output->id = id;
+ compositor->output_id_allocator |= (1 << output->id);
+
/* Create backend-side object. */
output->backend = (pepper_output_backend_t *)backend;
output->data = data;
pepper_object_fini(&output->base);
+ output->compositor->output_id_allocator &= ~(1 << output->id);
wl_list_remove(&output->link);
if (output->backend && output->data)
CHECK_MAGIC(obj, val); \
} while (0)
+#define PEPPER_MAX_OUTPUT_ID 32
+
typedef struct pepper_region pepper_region_t;
typedef struct pepper_surface_state pepper_surface_state_t;
typedef struct pepper_data_source pepper_data_source_t;
struct wl_list regions;
struct wl_list seat_list;
struct wl_list output_list;
+ uint32_t output_id_allocator;
struct wl_list event_hook_chain;
pepper_list_t root_view_list;
pepper_list_t view_list;
{
pepper_object_t base;
pepper_compositor_t *compositor;
+ uint32_t id;
struct wl_global *global;
struct wl_list resources;