simple-egl: HACK to report presentation flags
So that we can test the per-surface ZERO_COPY flag: - start Weston on DRM backend - run ./weston-simple-egl -o (need to be opaque to end up on overlay) - hit debug key 'V' to enable the (broken) hw overlays The debug key is used by first hitting Mod+Shift+space, then hitting 'v'. Enabling overlays should change the flags from 0x7 to 0xe. To verify the window is really on an overlay, use debug key 'S' to tint all GL-composited things green. This patch is not intended for upstream. Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com> Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
This commit is contained in:
parent
63495864d3
commit
b77acf592f
@ -441,6 +441,8 @@ if BUILD_SIMPLE_EGL_CLIENTS
|
|||||||
demo_clients += weston-simple-egl
|
demo_clients += weston-simple-egl
|
||||||
weston_simple_egl_SOURCES = clients/simple-egl.c
|
weston_simple_egl_SOURCES = clients/simple-egl.c
|
||||||
nodist_weston_simple_egl_SOURCES = \
|
nodist_weston_simple_egl_SOURCES = \
|
||||||
|
protocol/presentation_timing-protocol.c \
|
||||||
|
protocol/presentation_timing-client-protocol.h \
|
||||||
protocol/xdg-shell-protocol.c \
|
protocol/xdg-shell-protocol.c \
|
||||||
protocol/xdg-shell-client-protocol.h \
|
protocol/xdg-shell-client-protocol.h \
|
||||||
protocol/ivi-application-protocol.c \
|
protocol/ivi-application-protocol.c \
|
||||||
|
@ -46,6 +46,8 @@
|
|||||||
#include "protocol/ivi-application-client-protocol.h"
|
#include "protocol/ivi-application-client-protocol.h"
|
||||||
#define IVI_SURFACE_ID 9000
|
#define IVI_SURFACE_ID 9000
|
||||||
|
|
||||||
|
#include "presentation_timing-client-protocol.h"
|
||||||
|
|
||||||
#ifndef EGL_EXT_swap_buffers_with_damage
|
#ifndef EGL_EXT_swap_buffers_with_damage
|
||||||
#define EGL_EXT_swap_buffers_with_damage 1
|
#define EGL_EXT_swap_buffers_with_damage 1
|
||||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)(EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
|
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)(EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
|
||||||
@ -81,6 +83,8 @@ struct display {
|
|||||||
struct ivi_application *ivi_application;
|
struct ivi_application *ivi_application;
|
||||||
|
|
||||||
PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC swap_buffers_with_damage;
|
PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC swap_buffers_with_damage;
|
||||||
|
|
||||||
|
struct presentation *presentation;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct geometry {
|
struct geometry {
|
||||||
@ -125,6 +129,43 @@ static const char *frag_shader_text =
|
|||||||
|
|
||||||
static int running = 1;
|
static int running = 1;
|
||||||
|
|
||||||
|
static void
|
||||||
|
feedback_sync_output(void *data,
|
||||||
|
struct presentation_feedback *presentation_feedback,
|
||||||
|
struct wl_output *output)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
feedback_presented(void *data,
|
||||||
|
struct presentation_feedback *feedback,
|
||||||
|
uint32_t tv_sec_hi,
|
||||||
|
uint32_t tv_sec_lo,
|
||||||
|
uint32_t tv_nsec,
|
||||||
|
uint32_t refresh_nsec,
|
||||||
|
uint32_t seq_hi,
|
||||||
|
uint32_t seq_lo,
|
||||||
|
uint32_t flags)
|
||||||
|
{
|
||||||
|
printf("presented %p, flags %#x at %" PRIu64 ".%09u\n",
|
||||||
|
feedback, flags,
|
||||||
|
((uint64_t)tv_sec_hi << 32) + tv_sec_lo, tv_nsec);
|
||||||
|
presentation_feedback_destroy(feedback);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
feedback_discarded(void *data, struct presentation_feedback *feedback)
|
||||||
|
{
|
||||||
|
printf("discarded %p\n", feedback);
|
||||||
|
presentation_feedback_destroy(feedback);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct presentation_feedback_listener feedback_listener = {
|
||||||
|
feedback_sync_output,
|
||||||
|
feedback_presented,
|
||||||
|
feedback_discarded
|
||||||
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_egl(struct display *display, struct window *window)
|
init_egl(struct display *display, struct window *window)
|
||||||
{
|
{
|
||||||
@ -456,6 +497,7 @@ redraw(void *data, struct wl_callback *callback, uint32_t time)
|
|||||||
EGLint rect[4];
|
EGLint rect[4];
|
||||||
EGLint buffer_age = 0;
|
EGLint buffer_age = 0;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
struct presentation_feedback *fback;
|
||||||
|
|
||||||
assert(window->callback == callback);
|
assert(window->callback == callback);
|
||||||
window->callback = NULL;
|
window->callback = NULL;
|
||||||
@ -515,6 +557,9 @@ redraw(void *data, struct wl_callback *callback, uint32_t time)
|
|||||||
wl_surface_set_opaque_region(window->surface, NULL);
|
wl_surface_set_opaque_region(window->surface, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fback = presentation_feedback(display->presentation, window->surface);
|
||||||
|
presentation_feedback_add_listener(fback, &feedback_listener, window);
|
||||||
|
|
||||||
if (display->swap_buffers_with_damage && buffer_age > 0) {
|
if (display->swap_buffers_with_damage && buffer_age > 0) {
|
||||||
rect[0] = window->geometry.width / 4 - 1;
|
rect[0] = window->geometry.width / 4 - 1;
|
||||||
rect[1] = window->geometry.height / 4 - 1;
|
rect[1] = window->geometry.height / 4 - 1;
|
||||||
@ -757,6 +802,10 @@ registry_handle_global(void *data, struct wl_registry *registry,
|
|||||||
d->compositor =
|
d->compositor =
|
||||||
wl_registry_bind(registry, name,
|
wl_registry_bind(registry, name,
|
||||||
&wl_compositor_interface, 1);
|
&wl_compositor_interface, 1);
|
||||||
|
} else if (strcmp(interface, "presentation") == 0) {
|
||||||
|
d->presentation =
|
||||||
|
wl_registry_bind(registry,
|
||||||
|
name, &presentation_interface, 1);
|
||||||
} else if (strcmp(interface, "xdg_shell") == 0) {
|
} else if (strcmp(interface, "xdg_shell") == 0) {
|
||||||
d->shell = wl_registry_bind(registry, name,
|
d->shell = wl_registry_bind(registry, name,
|
||||||
&xdg_shell_interface, 1);
|
&xdg_shell_interface, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user