parent
8455f271a4
commit
1dc4c5c3d1
@ -1,277 +0,0 @@ |
|||||||
From e76f185050e86116ad03fdc0119505dd8c3b367a Mon Sep 17 00:00:00 2001
|
|
||||||
From: Derek Foreman <derekf@osg.samsung.com>
|
|
||||||
Date: Fri, 15 May 2015 12:12:39 -0500
|
|
||||||
Subject: [PATCH 1/2] gl-renderer: Take a list of acceptable formats in create
|
|
||||||
functions
|
|
||||||
|
|
||||||
Currently we pass either a single format or no formats to the gl renderer
|
|
||||||
create and output_create functions. We extend this to any number of
|
|
||||||
formats so we can allow fallback formats if we don't get our first pick.
|
|
||||||
|
|
||||||
Reviewed-By: Bryce Harrington <bryce@osg.samsung.com>
|
|
||||||
Reviewed-By: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
|
|
||||||
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
|
|
||||||
---
|
|
||||||
src/compositor-drm.c | 5 ++--
|
|
||||||
src/compositor-fbdev.c | 4 +--
|
|
||||||
src/compositor-wayland.c | 12 ++++----
|
|
||||||
src/compositor-x11.c | 5 ++--
|
|
||||||
src/gl-renderer.c | 71 ++++++++++++++++++++++++++++++++----------------
|
|
||||||
src/gl-renderer.h | 6 ++--
|
|
||||||
6 files changed, 66 insertions(+), 37 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
|
|
||||||
index 0cdb8f4..69bdcfd 100644
|
|
||||||
--- a/src/compositor-drm.c
|
|
||||||
+++ b/src/compositor-drm.c
|
|
||||||
@@ -1398,7 +1398,7 @@ drm_compositor_create_gl_renderer(struct drm_compositor *ec)
|
|
||||||
|
|
||||||
format = ec->format;
|
|
||||||
if (gl_renderer->create(&ec->base, EGL_PLATFORM_GBM_KHR, (void *) ec->gbm,
|
|
||||||
- gl_renderer->opaque_attribs, &format) < 0) {
|
|
||||||
+ gl_renderer->opaque_attribs, &format, 1) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1620,7 +1620,8 @@ drm_output_init_egl(struct drm_output *output, struct drm_compositor *ec)
|
|
||||||
(EGLNativeDisplayType)output->surface,
|
|
||||||
output->surface,
|
|
||||||
gl_renderer->opaque_attribs,
|
|
||||||
- &format) < 0) {
|
|
||||||
+ &format,
|
|
||||||
+ 1) < 0) {
|
|
||||||
weston_log("failed to create gl renderer output state\n");
|
|
||||||
gbm_surface_destroy(output->surface);
|
|
||||||
return -1;
|
|
||||||
diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
|
|
||||||
index 7c505ce..3f3394f 100644
|
|
||||||
--- a/src/compositor-fbdev.c
|
|
||||||
+++ b/src/compositor-fbdev.c
|
|
||||||
@@ -570,7 +570,7 @@ fbdev_output_create(struct fbdev_compositor *compositor,
|
|
||||||
if (gl_renderer->output_create(&output->base,
|
|
||||||
(EGLNativeWindowType)NULL, NULL,
|
|
||||||
gl_renderer->opaque_attribs,
|
|
||||||
- NULL) < 0) {
|
|
||||||
+ NULL, 0) < 0) {
|
|
||||||
weston_log("gl_renderer_output_create failed.\n");
|
|
||||||
goto out_shadow_surface;
|
|
||||||
}
|
|
||||||
@@ -871,7 +871,7 @@ fbdev_compositor_create(struct wl_display *display, int *argc, char *argv[],
|
|
||||||
if (gl_renderer->create(&compositor->base, NO_EGL_PLATFORM,
|
|
||||||
EGL_DEFAULT_DISPLAY,
|
|
||||||
gl_renderer->opaque_attribs,
|
|
||||||
- NULL) < 0) {
|
|
||||||
+ NULL, 0) < 0) {
|
|
||||||
weston_log("gl_renderer_create failed.\n");
|
|
||||||
goto out_launcher;
|
|
||||||
}
|
|
||||||
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
|
|
||||||
index 303151c..c9983e0 100644
|
|
||||||
--- a/src/compositor-wayland.c
|
|
||||||
+++ b/src/compositor-wayland.c
|
|
||||||
@@ -648,7 +648,8 @@ wayland_output_init_gl_renderer(struct wayland_output *output)
|
|
||||||
output->gl.egl_window,
|
|
||||||
output->gl.egl_window,
|
|
||||||
gl_renderer->alpha_attribs,
|
|
||||||
- NULL) < 0)
|
|
||||||
+ NULL,
|
|
||||||
+ 0) < 0)
|
|
||||||
goto cleanup_window;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
@@ -1970,10 +1971,11 @@ wayland_compositor_create(struct wl_display *display, int use_pixman,
|
|
||||||
|
|
||||||
if (!c->use_pixman) {
|
|
||||||
if (gl_renderer->create(&c->base,
|
|
||||||
- EGL_PLATFORM_WAYLAND_KHR,
|
|
||||||
- c->parent.wl_display,
|
|
||||||
- gl_renderer->alpha_attribs,
|
|
||||||
- NULL) < 0) {
|
|
||||||
+ EGL_PLATFORM_WAYLAND_KHR,
|
|
||||||
+ c->parent.wl_display,
|
|
||||||
+ gl_renderer->alpha_attribs,
|
|
||||||
+ NULL,
|
|
||||||
+ 0) < 0) {
|
|
||||||
weston_log("Failed to initialize the GL renderer; "
|
|
||||||
"falling back to pixman.\n");
|
|
||||||
c->use_pixman = 1;
|
|
||||||
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
|
|
||||||
index 5129e85..3565677 100644
|
|
||||||
--- a/src/compositor-x11.c
|
|
||||||
+++ b/src/compositor-x11.c
|
|
||||||
@@ -906,7 +906,8 @@ x11_compositor_create_output(struct x11_compositor *c, int x, int y,
|
|
||||||
(EGLNativeWindowType) output->window,
|
|
||||||
&xid,
|
|
||||||
gl_renderer->opaque_attribs,
|
|
||||||
- NULL);
|
|
||||||
+ NULL,
|
|
||||||
+ 0);
|
|
||||||
if (ret < 0)
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
@@ -1493,7 +1494,7 @@ init_gl_renderer(struct x11_compositor *c)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
ret = gl_renderer->create(&c->base, EGL_PLATFORM_X11_KHR, (void *) c->dpy,
|
|
||||||
- gl_renderer->opaque_attribs, NULL);
|
|
||||||
+ gl_renderer->opaque_attribs, NULL, 0);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
diff --git a/src/gl-renderer.c b/src/gl-renderer.c
|
|
||||||
index ae3122f..248c8aa 100644
|
|
||||||
--- a/src/gl-renderer.c
|
|
||||||
+++ b/src/gl-renderer.c
|
|
||||||
@@ -1898,14 +1898,38 @@ log_egl_config_info(EGLDisplay egldpy, EGLConfig eglconfig)
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
+match_config_to_visual(EGLDisplay egl_display,
|
|
||||||
+ EGLint visual_id,
|
|
||||||
+ EGLConfig *configs,
|
|
||||||
+ int count)
|
|
||||||
+{
|
|
||||||
+ int i;
|
|
||||||
+
|
|
||||||
+ for (i = 0; i < count; ++i) {
|
|
||||||
+ EGLint id;
|
|
||||||
+
|
|
||||||
+ if (!eglGetConfigAttrib(egl_display,
|
|
||||||
+ configs[i], EGL_NATIVE_VISUAL_ID,
|
|
||||||
+ &id))
|
|
||||||
+ continue;
|
|
||||||
+
|
|
||||||
+ if (id == visual_id)
|
|
||||||
+ return i;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ weston_log("Unable to find an appropriate EGL config.\n");
|
|
||||||
+ return -1;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int
|
|
||||||
egl_choose_config(struct gl_renderer *gr, const EGLint *attribs,
|
|
||||||
- const EGLint *visual_id,
|
|
||||||
+ const EGLint *visual_id, const int n_ids,
|
|
||||||
EGLConfig *config_out)
|
|
||||||
{
|
|
||||||
EGLint count = 0;
|
|
||||||
EGLint matched = 0;
|
|
||||||
EGLConfig *configs;
|
|
||||||
- int i;
|
|
||||||
+ int i, config_index = -1;
|
|
||||||
|
|
||||||
if (!eglGetConfigs(gr->egl_display, NULL, 0, &count) || count < 1)
|
|
||||||
return -1;
|
|
||||||
@@ -1915,31 +1939,27 @@ egl_choose_config(struct gl_renderer *gr, const EGLint *attribs,
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (!eglChooseConfig(gr->egl_display, attribs, configs,
|
|
||||||
- count, &matched))
|
|
||||||
+ count, &matched) || !matched)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
- for (i = 0; i < matched; ++i) {
|
|
||||||
- EGLint id;
|
|
||||||
+ if (!visual_id)
|
|
||||||
+ config_index = 0;
|
|
||||||
|
|
||||||
- if (visual_id) {
|
|
||||||
- if (!eglGetConfigAttrib(gr->egl_display,
|
|
||||||
- configs[i], EGL_NATIVE_VISUAL_ID,
|
|
||||||
- &id))
|
|
||||||
- continue;
|
|
||||||
+ for (i = 0; config_index == -1 && i < n_ids; i++)
|
|
||||||
+ config_index = match_config_to_visual(gr->egl_display,
|
|
||||||
+ visual_id[i],
|
|
||||||
+ configs,
|
|
||||||
+ matched);
|
|
||||||
|
|
||||||
- if (id != 0 && id != *visual_id)
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- *config_out = configs[i];
|
|
||||||
-
|
|
||||||
- free(configs);
|
|
||||||
- return 0;
|
|
||||||
- }
|
|
||||||
+ if (config_index != -1)
|
|
||||||
+ *config_out = configs[config_index];
|
|
||||||
|
|
||||||
out:
|
|
||||||
free(configs);
|
|
||||||
- return -1;
|
|
||||||
+ if (config_index == -1)
|
|
||||||
+ return -1;
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
@@ -1976,7 +1996,8 @@ gl_renderer_output_create(struct weston_output *output,
|
|
||||||
EGLNativeWindowType window_for_legacy,
|
|
||||||
void *window_for_platform,
|
|
||||||
const EGLint *attribs,
|
|
||||||
- const EGLint *visual_id)
|
|
||||||
+ const EGLint *visual_id,
|
|
||||||
+ int n_ids)
|
|
||||||
{
|
|
||||||
struct weston_compositor *ec = output->compositor;
|
|
||||||
struct gl_renderer *gr = get_renderer(ec);
|
|
||||||
@@ -1984,7 +2005,8 @@ gl_renderer_output_create(struct weston_output *output,
|
|
||||||
EGLConfig egl_config;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
- if (egl_choose_config(gr, attribs, visual_id, &egl_config) == -1) {
|
|
||||||
+ if (egl_choose_config(gr, attribs, visual_id,
|
|
||||||
+ n_ids, &egl_config) == -1) {
|
|
||||||
weston_log("failed to choose EGL config for output\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
@@ -2260,7 +2282,7 @@ platform_to_extension(EGLenum platform)
|
|
||||||
static int
|
|
||||||
gl_renderer_create(struct weston_compositor *ec, EGLenum platform,
|
|
||||||
void *native_window, const EGLint *attribs,
|
|
||||||
- const EGLint *visual_id)
|
|
||||||
+ const EGLint *visual_id, int n_ids)
|
|
||||||
{
|
|
||||||
struct gl_renderer *gr;
|
|
||||||
EGLint major, minor;
|
|
||||||
@@ -2323,7 +2345,8 @@ gl_renderer_create(struct weston_compositor *ec, EGLenum platform,
|
|
||||||
goto err_egl;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (egl_choose_config(gr, attribs, visual_id, &gr->egl_config) < 0) {
|
|
||||||
+ if (egl_choose_config(gr, attribs, visual_id,
|
|
||||||
+ n_ids, &gr->egl_config) < 0) {
|
|
||||||
weston_log("failed to choose EGL config\n");
|
|
||||||
goto err_egl;
|
|
||||||
}
|
|
||||||
diff --git a/src/gl-renderer.h b/src/gl-renderer.h
|
|
||||||
index ebc139f..ceb4206 100644
|
|
||||||
--- a/src/gl-renderer.h
|
|
||||||
+++ b/src/gl-renderer.h
|
|
||||||
@@ -76,7 +76,8 @@ struct gl_renderer_interface {
|
|
||||||
EGLenum platform,
|
|
||||||
void *native_window,
|
|
||||||
const EGLint *attribs,
|
|
||||||
- const EGLint *visual_id);
|
|
||||||
+ const EGLint *visual_id,
|
|
||||||
+ const int n_ids);
|
|
||||||
|
|
||||||
EGLDisplay (*display)(struct weston_compositor *ec);
|
|
||||||
|
|
||||||
@@ -84,7 +85,8 @@ struct gl_renderer_interface {
|
|
||||||
EGLNativeWindowType window_for_legacy,
|
|
||||||
void *window_for_platform,
|
|
||||||
const EGLint *attribs,
|
|
||||||
- const EGLint *visual_id);
|
|
||||||
+ const EGLint *visual_id,
|
|
||||||
+ const int n_ids);
|
|
||||||
|
|
||||||
void (*output_destroy)(struct weston_output *output);
|
|
||||||
|
|
||||||
--
|
|
||||||
2.4.1
|
|
||||||
|
|
@ -1,93 +0,0 @@ |
|||||||
From 2c8d0999bc4b83a0f8326f5c2706dd3bd00a6e7f Mon Sep 17 00:00:00 2001
|
|
||||||
From: Peter Hutterer <peter.hutterer@who-t.net>
|
|
||||||
Date: Thu, 15 Jan 2015 13:14:43 +1000
|
|
||||||
Subject: [PATCH weston] libinput-device: use the discrete axis value for wheel
|
|
||||||
events
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
libinput < 0.8 sent wheel click events with value 10. Since 0.8
|
|
||||||
the value is the angle of the click in degrees but it now provides
|
|
||||||
the click count as separate value. To keep backwards-compat with
|
|
||||||
existing clients, we just send multiples of the click count.
|
|
||||||
|
|
||||||
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
||||||
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
|
|
||||||
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
|
|
||||||
---
|
|
||||||
src/libinput-device.c | 44 ++++++++++++++++++++++++++++++++++++++++----
|
|
||||||
1 file changed, 40 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/libinput-device.c b/src/libinput-device.c
|
|
||||||
index 6bb7a75..0cd215a 100644
|
|
||||||
--- a/src/libinput-device.c
|
|
||||||
+++ b/src/libinput-device.c
|
|
||||||
@@ -126,6 +126,44 @@ handle_pointer_button(struct libinput_device *libinput_device,
|
|
||||||
libinput_event_pointer_get_button_state(pointer_event));
|
|
||||||
}
|
|
||||||
|
|
||||||
+static double
|
|
||||||
+normalize_scroll(struct libinput_event_pointer *pointer_event,
|
|
||||||
+ enum libinput_pointer_axis axis)
|
|
||||||
+{
|
|
||||||
+ static int warned;
|
|
||||||
+ enum libinput_pointer_axis_source source;
|
|
||||||
+ double value;
|
|
||||||
+
|
|
||||||
+ source = libinput_event_pointer_get_axis_source(pointer_event);
|
|
||||||
+ /* libinput < 0.8 sent wheel click events with value 10. Since 0.8
|
|
||||||
+ the value is the angle of the click in degrees. To keep
|
|
||||||
+ backwards-compat with existing clients, we just send multiples of
|
|
||||||
+ the click count.
|
|
||||||
+ */
|
|
||||||
+ switch (source) {
|
|
||||||
+ case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL:
|
|
||||||
+ value = 10 * libinput_event_pointer_get_axis_value_discrete(
|
|
||||||
+ pointer_event,
|
|
||||||
+ axis);
|
|
||||||
+ break;
|
|
||||||
+ case LIBINPUT_POINTER_AXIS_SOURCE_FINGER:
|
|
||||||
+ case LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS:
|
|
||||||
+ value = libinput_event_pointer_get_axis_value(pointer_event,
|
|
||||||
+ axis);
|
|
||||||
+ break;
|
|
||||||
+ default:
|
|
||||||
+ value = 0;
|
|
||||||
+ if (warned < 5) {
|
|
||||||
+ weston_log("Unknown scroll source %d. Event discarded\n",
|
|
||||||
+ source);
|
|
||||||
+ warned++;
|
|
||||||
+ }
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return value;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
static void
|
|
||||||
handle_pointer_axis(struct libinput_device *libinput_device,
|
|
||||||
struct libinput_event_pointer *pointer_event)
|
|
||||||
@@ -137,8 +175,7 @@ handle_pointer_axis(struct libinput_device *libinput_device,
|
|
||||||
|
|
||||||
axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
|
|
||||||
if (libinput_event_pointer_has_axis(pointer_event, axis)) {
|
|
||||||
- value = libinput_event_pointer_get_axis_value(pointer_event,
|
|
||||||
- axis);
|
|
||||||
+ value = normalize_scroll(pointer_event, axis);
|
|
||||||
notify_axis(device->seat,
|
|
||||||
libinput_event_pointer_get_time(pointer_event),
|
|
||||||
WL_POINTER_AXIS_VERTICAL_SCROLL,
|
|
||||||
@@ -147,8 +184,7 @@ handle_pointer_axis(struct libinput_device *libinput_device,
|
|
||||||
|
|
||||||
axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
|
|
||||||
if (libinput_event_pointer_has_axis(pointer_event, axis)) {
|
|
||||||
- value = libinput_event_pointer_get_axis_value(pointer_event,
|
|
||||||
- axis);
|
|
||||||
+ value = normalize_scroll(pointer_event, axis);
|
|
||||||
notify_axis(device->seat,
|
|
||||||
libinput_event_pointer_get_time(pointer_event),
|
|
||||||
WL_POINTER_AXIS_HORIZONTAL_SCROLL,
|
|
||||||
--
|
|
||||||
2.1.0
|
|
||||||
|
|
@ -1,57 +0,0 @@ |
|||||||
From 7a9318523c4dafdfb24f088af70fe84426368d3d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Peter Hutterer <peter.hutterer@who-t.net>
|
|
||||||
Date: Tue, 13 Jan 2015 11:55:37 +1000
|
|
||||||
Subject: [PATCH weston] libinput-device: use the new merged scroll events
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
libinput now provides a single event for scroll events. Extract the axes from
|
|
||||||
that event and split them into the wl events.
|
|
||||||
|
|
||||||
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
||||||
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
|
|
||||||
---
|
|
||||||
src/libinput-device.c | 25 ++++++++++++++++++++-----
|
|
||||||
1 file changed, 20 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/libinput-device.c b/src/libinput-device.c
|
|
||||||
index 0e3f46d..6bb7a75 100644
|
|
||||||
--- a/src/libinput-device.c
|
|
||||||
+++ b/src/libinput-device.c
|
|
||||||
@@ -133,12 +133,27 @@ handle_pointer_axis(struct libinput_device *libinput_device,
|
|
||||||
struct evdev_device *device =
|
|
||||||
libinput_device_get_user_data(libinput_device);
|
|
||||||
double value;
|
|
||||||
+ enum libinput_pointer_axis axis;
|
|
||||||
|
|
||||||
- value = libinput_event_pointer_get_axis_value(pointer_event);
|
|
||||||
- notify_axis(device->seat,
|
|
||||||
- libinput_event_pointer_get_time(pointer_event),
|
|
||||||
- libinput_event_pointer_get_axis(pointer_event),
|
|
||||||
- wl_fixed_from_double(value));
|
|
||||||
+ axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
|
|
||||||
+ if (libinput_event_pointer_has_axis(pointer_event, axis)) {
|
|
||||||
+ value = libinput_event_pointer_get_axis_value(pointer_event,
|
|
||||||
+ axis);
|
|
||||||
+ notify_axis(device->seat,
|
|
||||||
+ libinput_event_pointer_get_time(pointer_event),
|
|
||||||
+ WL_POINTER_AXIS_VERTICAL_SCROLL,
|
|
||||||
+ wl_fixed_from_double(value));
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
|
|
||||||
+ if (libinput_event_pointer_has_axis(pointer_event, axis)) {
|
|
||||||
+ value = libinput_event_pointer_get_axis_value(pointer_event,
|
|
||||||
+ axis);
|
|
||||||
+ notify_axis(device->seat,
|
|
||||||
+ libinput_event_pointer_get_time(pointer_event),
|
|
||||||
+ WL_POINTER_AXIS_HORIZONTAL_SCROLL,
|
|
||||||
+ wl_fixed_from_double(value));
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
--
|
|
||||||
2.1.0
|
|
||||||
|
|
@ -1,138 +0,0 @@ |
|||||||
From c4cfe85d3af007e9fa30f10d10fa502ca1336fa6 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Derek Foreman <derekf@osg.samsung.com>
|
|
||||||
Date: Fri, 15 May 2015 12:12:40 -0500
|
|
||||||
Subject: [PATCH 2/2] compositor-drm: pass ARGB fallback to gl create functions
|
|
||||||
for XRGB formats
|
|
||||||
|
|
||||||
If the GL implementation doesn't provide an XRGB visual we may still be
|
|
||||||
able to proceed with an ARGB one. Since we're not changing the scanout
|
|
||||||
buffer format, and our current rendering loop always results in saturated
|
|
||||||
alpha in the frame buffer, it should be Just Fine(tm) - and probably better
|
|
||||||
than just exiting.
|
|
||||||
|
|
||||||
This is a workaround for https://bugs.freedesktop.org/show_bug.cgi?id=89689
|
|
||||||
|
|
||||||
Reviewed-By: Bryce Harrington <bryce@osg.samsung.com>
|
|
||||||
Tested-By: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
|
|
||||||
Reviewed-By: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
|
|
||||||
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
|
|
||||||
---
|
|
||||||
src/compositor-drm.c | 57 +++++++++++++++++++++++++++++++++++++++++++---------
|
|
||||||
src/gl-renderer.c | 8 ++++++++
|
|
||||||
2 files changed, 55 insertions(+), 10 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
|
|
||||||
index 69bdcfd..313860b 100644
|
|
||||||
--- a/src/compositor-drm.c
|
|
||||||
+++ b/src/compositor-drm.c
|
|
||||||
@@ -1391,14 +1391,46 @@ create_gbm_device(int fd)
|
|
||||||
return gbm;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/* When initializing EGL, if the preferred buffer format isn't availble
|
|
||||||
+ * we may be able to susbstitute an ARGB format for an XRGB one.
|
|
||||||
+ *
|
|
||||||
+ * This returns 0 if substitution isn't possible, but 0 might be a
|
|
||||||
+ * legitimate format for other EGL platforms, so the caller is
|
|
||||||
+ * responsible for checking for 0 before calling gl_renderer->create().
|
|
||||||
+ *
|
|
||||||
+ * This works around https://bugs.freedesktop.org/show_bug.cgi?id=89689
|
|
||||||
+ * but it's entirely possible we'll see this again on other implementations.
|
|
||||||
+ */
|
|
||||||
static int
|
|
||||||
-drm_compositor_create_gl_renderer(struct drm_compositor *ec)
|
|
||||||
+fallback_format_for(uint32_t format)
|
|
||||||
{
|
|
||||||
- EGLint format;
|
|
||||||
+ switch (format) {
|
|
||||||
+ case GBM_FORMAT_XRGB8888:
|
|
||||||
+ return GBM_FORMAT_ARGB8888;
|
|
||||||
+ case GBM_FORMAT_XRGB2101010:
|
|
||||||
+ return GBM_FORMAT_ARGB2101010;
|
|
||||||
+ default:
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
|
|
||||||
- format = ec->format;
|
|
||||||
- if (gl_renderer->create(&ec->base, EGL_PLATFORM_GBM_KHR, (void *) ec->gbm,
|
|
||||||
- gl_renderer->opaque_attribs, &format, 1) < 0) {
|
|
||||||
+static int
|
|
||||||
+drm_compositor_create_gl_renderer(struct drm_compositor *ec)
|
|
||||||
+{
|
|
||||||
+ EGLint format[2] = {
|
|
||||||
+ ec->format,
|
|
||||||
+ fallback_format_for(ec->format),
|
|
||||||
+ };
|
|
||||||
+ int n_formats = 1;
|
|
||||||
+
|
|
||||||
+ if (format[1])
|
|
||||||
+ n_formats = 2;
|
|
||||||
+ if (gl_renderer->create(&ec->base,
|
|
||||||
+ EGL_PLATFORM_GBM_KHR,
|
|
||||||
+ (void *)ec->gbm,
|
|
||||||
+ gl_renderer->opaque_attribs,
|
|
||||||
+ format,
|
|
||||||
+ n_formats) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1602,13 +1634,16 @@ find_crtc_for_connector(struct drm_compositor *ec,
|
|
||||||
static int
|
|
||||||
drm_output_init_egl(struct drm_output *output, struct drm_compositor *ec)
|
|
||||||
{
|
|
||||||
- EGLint format = output->format;
|
|
||||||
- int i, flags;
|
|
||||||
+ EGLint format[2] = {
|
|
||||||
+ output->format,
|
|
||||||
+ fallback_format_for(output->format),
|
|
||||||
+ };
|
|
||||||
+ int i, flags, n_formats = 1;
|
|
||||||
|
|
||||||
output->surface = gbm_surface_create(ec->gbm,
|
|
||||||
output->base.current_mode->width,
|
|
||||||
output->base.current_mode->height,
|
|
||||||
- format,
|
|
||||||
+ format[0],
|
|
||||||
GBM_BO_USE_SCANOUT |
|
|
||||||
GBM_BO_USE_RENDERING);
|
|
||||||
if (!output->surface) {
|
|
||||||
@@ -1616,12 +1651,14 @@ drm_output_init_egl(struct drm_output *output, struct drm_compositor *ec)
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (format[1])
|
|
||||||
+ n_formats = 2;
|
|
||||||
if (gl_renderer->output_create(&output->base,
|
|
||||||
(EGLNativeDisplayType)output->surface,
|
|
||||||
output->surface,
|
|
||||||
gl_renderer->opaque_attribs,
|
|
||||||
- &format,
|
|
||||||
- 1) < 0) {
|
|
||||||
+ format,
|
|
||||||
+ n_formats) < 0) {
|
|
||||||
weston_log("failed to create gl renderer output state\n");
|
|
||||||
gbm_surface_destroy(output->surface);
|
|
||||||
return -1;
|
|
||||||
diff --git a/src/gl-renderer.c b/src/gl-renderer.c
|
|
||||||
index 248c8aa..772c6a8 100644
|
|
||||||
--- a/src/gl-renderer.c
|
|
||||||
+++ b/src/gl-renderer.c
|
|
||||||
@@ -934,6 +934,14 @@ output_rotate_damage(struct weston_output *output,
|
|
||||||
go->border_damage[go->buffer_damage_index] = border_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/* NOTE: We now allow falling back to ARGB gl visuals when XRGB is
|
|
||||||
+ * unavailable, so we're assuming the background has no transparency
|
|
||||||
+ * and that everything with a blend, like drop shadows, will have something
|
|
||||||
+ * opaque (like the background) drawn underneath it.
|
|
||||||
+ *
|
|
||||||
+ * Depending on the underlying hardware, violating that assumption could
|
|
||||||
+ * result in seeing through to another display plane.
|
|
||||||
+ */
|
|
||||||
static void
|
|
||||||
gl_renderer_repaint_output(struct weston_output *output,
|
|
||||||
pixman_region32_t *output_damage)
|
|
||||||
--
|
|
||||||
2.4.1
|
|
||||||
|
|
Loading…
Reference in new issue