Weston: configuration for DRM/KMS for stm32mp machine

Signed-off-by: Christophe Priouzeau <christophe.priouzeau@st.com>
This commit is contained in:
Christophe Priouzeau 2019-02-04 15:49:14 +01:00
parent 26cbec3723
commit 0bddd1fa2c
7 changed files with 249 additions and 0 deletions

View File

@ -0,0 +1,44 @@
From 157a824d0a30927d6c617357adce968affda38d2 Mon Sep 17 00:00:00 2001
From: Stefan Agner <stefan@agner.ch>
Date: Wed, 22 Aug 2018 23:33:10 +0200
Subject: [PATCH 1/3] desktop-shell: always paint background color first
Only draw the background once, using the the current default
background color or the user specified background color.
This allows for non-filling background image implemenation
while still using the specified background color.
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
clients/desktop-shell.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index fcc0b65..4d0b1d0 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -756,7 +756,10 @@ background_draw(struct widget *widget, void *data)
cr = widget_cairo_create(background->widget);
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
- cairo_set_source_rgba(cr, 0.0, 0.0, 0.2, 1.0);
+ if (background->color == 0)
+ cairo_set_source_rgba(cr, 0.0, 0.0, 0.2, 1.0);
+ else
+ set_hex_color(cr, background->color);
cairo_paint(cr);
widget_get_allocation(widget, &allocation);
@@ -802,8 +805,6 @@ background_draw(struct widget *widget, void *data)
cairo_set_source(cr, pattern);
cairo_pattern_destroy (pattern);
cairo_surface_destroy(image);
- } else {
- set_hex_color(cr, background->color);
}
cairo_paint(cr);
--
2.7.4

View File

@ -0,0 +1,29 @@
From 81920a5a90d7a9efd9223f55be5f468d5313fa0d Mon Sep 17 00:00:00 2001
From: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Date: Tue, 17 Jul 2018 13:54:50 +0200
Subject: [PATCH] do not use GBM modifiers
GBM modifiers are broken do not use until we can fix GBM provider
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
---
configure.ac | 3 ---
1 file changed, 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 093d6b54..9e705f95 100644
--- a/configure.ac
+++ b/configure.ac
@@ -215,9 +215,6 @@ if test x$enable_drm_compositor = xyes; then
PKG_CHECK_MODULES(DRM_COMPOSITOR_FORMATS_BLOB, [libdrm >= 2.4.83],
[AC_DEFINE([HAVE_DRM_FORMATS_BLOB], 1, [libdrm supports modifier advertisement])],
[AC_MSG_WARN([libdrm does not support modifier advertisement])])
- PKG_CHECK_MODULES(DRM_COMPOSITOR_GBM_MODIFIERS, [gbm >= 17.1],
- [AC_DEFINE([HAVE_GBM_MODIFIERS], 1, [GBM supports modifiers])],
- [AC_MSG_WARN([GBM does not support modifiers])])
PKG_CHECK_MODULES(DRM_COMPOSITOR_GBM, [gbm >= 17.2],
[AC_DEFINE([HAVE_GBM_FD_IMPORT], 1, [gbm supports import with modifiers])],
[AC_MSG_WARN([GBM does not support dmabuf import, will omit that capability])])
--
2.15.0

View File

@ -0,0 +1,86 @@
From 852d302b703754fe90de1185e816069a32078ae1 Mon Sep 17 00:00:00 2001
From: Stefan Agner <stefan@agner.ch>
Date: Wed, 22 Aug 2018 23:56:07 +0200
Subject: [PATCH 2/3] desktop-shell: allow to center background image
Add the centered option as background-type. This draws the image
once in the center of the screen. If the image is larger, it will
be cropped like scale-crop.
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
clients/desktop-shell.c | 20 ++++++++++++++++++--
man/weston.ini.man | 5 ++++-
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index 4d0b1d0..0dc0f0b 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -736,7 +736,8 @@ panel_add_launcher(struct panel *panel, const char *icon, const char *path)
enum {
BACKGROUND_SCALE,
BACKGROUND_SCALE_CROP,
- BACKGROUND_TILE
+ BACKGROUND_TILE,
+ BACKGROUND_CENTERED
};
static void
@@ -800,14 +801,27 @@ background_draw(struct widget *widget, void *data)
case BACKGROUND_TILE:
cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT);
break;
+ case BACKGROUND_CENTERED:
+ s = (sx < sy) ? sx : sy;
+ if (s < 1.0)
+ s = 1.0;
+
+ /* align center */
+ tx = (im_w - s * allocation.width) * 0.5;
+ ty = (im_h - s * allocation.height) * 0.5;
+
+ cairo_matrix_init_translate(&matrix, tx, ty);
+ cairo_matrix_scale(&matrix, s, s);
+ cairo_pattern_set_matrix(pattern, &matrix);
+ break;
}
cairo_set_source(cr, pattern);
cairo_pattern_destroy (pattern);
cairo_surface_destroy(image);
+ cairo_mask(cr, pattern);
}
- cairo_paint(cr);
cairo_destroy(cr);
cairo_surface_destroy(surface);
@@ -1143,6 +1157,8 @@ background_create(struct desktop *desktop, struct output *output)
background->type = BACKGROUND_SCALE_CROP;
} else if (strcmp(type, "tile") == 0) {
background->type = BACKGROUND_TILE;
+ } else if (strcmp(type, "centered") == 0) {
+ background->type = BACKGROUND_CENTERED;
} else {
background->type = -1;
fprintf(stderr, "invalid background-type: %s\n",
diff --git a/man/weston.ini.man b/man/weston.ini.man
index 199b465..3ee47fa 100644
--- a/man/weston.ini.man
+++ b/man/weston.ini.man
@@ -260,7 +260,10 @@ sets the path for the background image file (string).
.TP 7
.BI "background-type=" tile
determines how the background image is drawn (string). Can be
-.BR scale ", " scale-crop " or " tile " (default)."
+.BR centered ", " scale ", " scale-crop " or " tile " (default)."
+Centered shows the image once centered. If the image is smaller than the
+output, the rest of the surface will be in background color. If the image
+size does fit the output it will be cropped left and right, or top and bottom.
Scale means scaled to fit the output precisely, not preserving aspect ratio.
Scale-crop preserves aspect ratio, scales the background image just big
enough to cover the output, and centers it. The image ends up cropped from
--
2.7.4

View File

@ -0,0 +1,40 @@
From b18247205600b3648197bb5d2cf5bde703bf6af7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Yannick=20Fertr=C3=A9?= <yannick.fertre@st.com>
Date: Thu, 20 Dec 2018 11:38:10 +0100
Subject: [PATCH 3/3] Allow to get hdmi output with several outputs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If an ouput fail to be attach or enable then this output must be only
destroyed and an error doesn't be re which detach & destroy
all other output.
Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
---
compositor/main.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/compositor/main.c b/compositor/main.c
index b5b4fc5..cf94d17 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1743,8 +1743,14 @@ drm_process_layoutput(struct wet_compositor *wet, struct wet_layoutput *lo)
return -1;
if (drm_try_attach_enable(output->output, lo) < 0) {
+ /*
+ * if a wet_ouput fail to be attach or enable
+ * then this output must be destroyed
+ * but don't return an error which dettatch & destroy
+ * all other output.
+ */
wet_output_destroy(output);
- return -1;
+
}
}
--
2.7.4

View File

@ -0,0 +1,36 @@
From b9cc563f142f2d3b8edd976bbdb2bf302220e1fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Yannick=20Fertr=C3=A9?= <yannick.fertre@st.com>
Date: Fri, 11 Jan 2019 10:55:05 +0100
Subject: [PATCH] Force to close all output
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In case of plug/unplug HMDI, it's necessary to close all output enabled.
Without this patch, weston is stuck on DSI output.
Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
---
compositor/main.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/compositor/main.c b/compositor/main.c
index cf94d17..71c547b 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1819,7 +1819,11 @@ drm_heads_changed(struct wl_listener *listener, void *arg)
if ((connected || forced) && !enabled) {
drm_head_prepare_enable(wet, head);
- } else if (!(connected || forced) && enabled) {
+ } else if (enabled) {
+ /*
+ * closed all output (connected or not connected)
+ * this is neccessary to switch between HDMI <> DSI
+ */
drm_head_disable(head);
} else if (enabled && changed) {
weston_log("Detected a monitor change on head '%s', "
--
2.7.4

View File

@ -0,0 +1,7 @@
#!/bin/sh
if type Xwayland >/dev/null 2>/dev/null; then
mkdir -p /tmp/.X11-unix
add_weston_argument "--xwayland"
fi

View File

@ -0,0 +1,7 @@
FILESEXTRAPATHS_prepend_stm32mpcommon := "${THISDIR}/${PN}:"
SRC_URI_append_stm32mpcommon = " file://0001-do-not-use-GBM-modifiers.patch "
SRC_URI_append_stm32mpcommon = " file://0001-desktop-shell-always-paint-background-color-first.patch "
SRC_URI_append_stm32mpcommon = " file://0002-desktop-shell-allow-to-center-background-image.patch "
SRC_URI_append_stm32mpcommon = " file://0003-Allow-to-get-hdmi-output-with-several-outputs.patch "
SRC_URI_append_stm32mpcommon = " file://0004-Force-to-close-all-output.patch "