libweston: consolidate weston_compositor_create_output(_with_head)
Add a struct weston_head parameter to weston_compositor_create_output() and fold weston_compositor_create_output_with_head() into it. See: https://gitlab.freedesktop.org/wayland/weston/-/issues/268 Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
committed by
Pekka Paalanen
parent
060ef82d93
commit
c6e47d177a
+3
-3
@@ -1696,8 +1696,8 @@ simple_head_enable(struct wet_compositor *wet, struct weston_head *head)
|
|||||||
struct weston_output *output;
|
struct weston_output *output;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
output = weston_compositor_create_output_with_head(wet->compositor,
|
output = weston_compositor_create_output(wet->compositor, head,
|
||||||
head);
|
head->name);
|
||||||
if (!output) {
|
if (!output) {
|
||||||
weston_log("Could not create an output for head \"%s\".\n",
|
weston_log("Could not create an output for head \"%s\".\n",
|
||||||
weston_head_get_name(head));
|
weston_head_get_name(head));
|
||||||
@@ -2162,7 +2162,7 @@ wet_layoutput_create_output(struct wet_layoutput *lo, const char *name)
|
|||||||
|
|
||||||
output->output =
|
output->output =
|
||||||
weston_compositor_create_output(lo->compositor->compositor,
|
weston_compositor_create_output(lo->compositor->compositor,
|
||||||
name);
|
NULL, name);
|
||||||
if (!output->output) {
|
if (!output->output) {
|
||||||
free(output);
|
free(output);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ msc {
|
|||||||
--- [label = "Compositor creates an output for a head"];
|
--- [label = "Compositor creates an output for a head"];
|
||||||
|
|
||||||
c box c [label = "Have an existing head to process."];
|
c box c [label = "Have an existing head to process."];
|
||||||
c => w [label = "weston_compositor_create_output_with_head()"];
|
c => w [label = "weston_compositor_create_output()"];
|
||||||
w => b [label = "weston_backend::create_output()"];
|
w => b [label = "weston_backend::create_output()"];
|
||||||
w << b [label = "an empty output, no hw resources"];
|
w << b [label = "an empty output, no hw resources"];
|
||||||
w => b [label = "weston_output::attach_head()"];
|
w => b [label = "weston_output::attach_head()"];
|
||||||
|
|||||||
@@ -2228,11 +2228,7 @@ weston_compositor_find_output_by_name(struct weston_compositor *compositor,
|
|||||||
|
|
||||||
struct weston_output *
|
struct weston_output *
|
||||||
weston_compositor_create_output(struct weston_compositor *compositor,
|
weston_compositor_create_output(struct weston_compositor *compositor,
|
||||||
const char *name);
|
struct weston_head *head, const char *name);
|
||||||
|
|
||||||
struct weston_output *
|
|
||||||
weston_compositor_create_output_with_head(struct weston_compositor *compositor,
|
|
||||||
struct weston_head *head);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
weston_output_destroy(struct weston_output *output);
|
weston_output_destroy(struct weston_output *output);
|
||||||
|
|||||||
+9
-27
@@ -7306,13 +7306,15 @@ weston_compositor_find_output_by_name(struct weston_compositor *compositor,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Create a named output
|
/** Create a named output for an unused head
|
||||||
*
|
*
|
||||||
* \param compositor The compositor.
|
* \param compositor The compositor.
|
||||||
|
* \param head The head to attach to the output.
|
||||||
* \param name The name for the output.
|
* \param name The name for the output.
|
||||||
* \return A new \c weston_output, or NULL on failure.
|
* \return A new \c weston_output, or NULL on failure.
|
||||||
*
|
*
|
||||||
* This creates a new weston_output that starts with no heads attached.
|
* This creates a new weston_output that starts with the given head attached.
|
||||||
|
* The head must not be already attached to another output.
|
||||||
*
|
*
|
||||||
* An output must be configured and it must have at least one head before
|
* An output must be configured and it must have at least one head before
|
||||||
* it can be enabled.
|
* it can be enabled.
|
||||||
@@ -7321,8 +7323,11 @@ weston_compositor_find_output_by_name(struct weston_compositor *compositor,
|
|||||||
*/
|
*/
|
||||||
WL_EXPORT struct weston_output *
|
WL_EXPORT struct weston_output *
|
||||||
weston_compositor_create_output(struct weston_compositor *compositor,
|
weston_compositor_create_output(struct weston_compositor *compositor,
|
||||||
|
struct weston_head *head,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
|
struct weston_output *output;
|
||||||
|
|
||||||
assert(compositor->backend->create_output);
|
assert(compositor->backend->create_output);
|
||||||
|
|
||||||
if (weston_compositor_find_output_by_name(compositor, name)) {
|
if (weston_compositor_find_output_by_name(compositor, name)) {
|
||||||
@@ -7331,34 +7336,11 @@ weston_compositor_create_output(struct weston_compositor *compositor,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return compositor->backend->create_output(compositor, name);
|
output = compositor->backend->create_output(compositor, name);
|
||||||
}
|
|
||||||
|
|
||||||
/** Create an output for an unused head
|
|
||||||
*
|
|
||||||
* \param compositor The compositor.
|
|
||||||
* \param head The head to attach to the output.
|
|
||||||
* \return A new \c weston_output, or NULL on failure.
|
|
||||||
*
|
|
||||||
* This creates a new weston_output that starts with the given head attached.
|
|
||||||
* The output inherits the name of the head. The head must not be already
|
|
||||||
* attached to another output.
|
|
||||||
*
|
|
||||||
* An output must be configured before it can be enabled.
|
|
||||||
*
|
|
||||||
* \ingroup compositor
|
|
||||||
*/
|
|
||||||
WL_EXPORT struct weston_output *
|
|
||||||
weston_compositor_create_output_with_head(struct weston_compositor *compositor,
|
|
||||||
struct weston_head *head)
|
|
||||||
{
|
|
||||||
struct weston_output *output;
|
|
||||||
|
|
||||||
output = weston_compositor_create_output(compositor, head->name);
|
|
||||||
if (!output)
|
if (!output)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (weston_output_attach_head(output, head) < 0) {
|
if (head && weston_output_attach_head(output, head) < 0) {
|
||||||
weston_output_destroy(output);
|
weston_output_destroy(output);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user