libweston/compositor-drm: Print composition mode in weston-debug

This fixes the situation when using only plane-state mode for
compositing there's no obvious debug message stating that. This patch
makes it slightly better/easier to dermine what mode the compositor is
using currently.

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
dev
Marius Vlad 6 years ago
parent 0161802aa0
commit 5d767416c1
  1. 45
      libweston/compositor-drm.c

@ -409,6 +409,12 @@ struct drm_pending_state {
struct wl_list output_list; struct wl_list output_list;
}; };
enum drm_output_propose_state_mode {
DRM_OUTPUT_PROPOSE_STATE_MIXED, /**< mix renderer & planes */
DRM_OUTPUT_PROPOSE_STATE_RENDERER_ONLY, /**< only assign to renderer & cursor */
DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY, /**< no renderer use, only planes */
};
/* /*
* Output state holds the dynamic state for one Weston output, i.e. a KMS CRTC, * Output state holds the dynamic state for one Weston output, i.e. a KMS CRTC,
* plus >= 1 each of encoder/connector/plane. Since everything but the planes * plus >= 1 each of encoder/connector/plane. Since everything but the planes
@ -568,6 +574,12 @@ static const char *const aspect_ratio_as_string[] = {
[WESTON_MODE_PIC_AR_256_135] = " 256:135", [WESTON_MODE_PIC_AR_256_135] = " 256:135",
}; };
static const char *const drm_output_propose_state_mode_as_string[] = {
[DRM_OUTPUT_PROPOSE_STATE_MIXED] = "mixed state",
[DRM_OUTPUT_PROPOSE_STATE_RENDERER_ONLY] = "render-only state",
[DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY] = "plane-only state"
};
static struct gl_renderer_interface *gl_renderer; static struct gl_renderer_interface *gl_renderer;
static const char default_seat[] = "seat0"; static const char default_seat[] = "seat0";
@ -1972,12 +1984,6 @@ drm_output_assign_state(struct drm_output_state *state,
} }
} }
enum drm_output_propose_state_mode {
DRM_OUTPUT_PROPOSE_STATE_MIXED, /**< mix renderer & planes */
DRM_OUTPUT_PROPOSE_STATE_RENDERER_ONLY, /**< only assign to renderer & cursor */
DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY, /**< no renderer use, only planes */
};
static struct drm_plane_state * static struct drm_plane_state *
drm_output_prepare_scanout_view(struct drm_output_state *output_state, drm_output_prepare_scanout_view(struct drm_output_state *output_state,
struct weston_view *ev, struct weston_view *ev,
@ -3736,7 +3742,6 @@ drm_output_propose_state(struct weston_output *output_base,
scanout_state->fb->type == BUFFER_PIXMAN_DUMB); scanout_state->fb->type == BUFFER_PIXMAN_DUMB);
drm_plane_state_put_back(scanout_state); drm_plane_state_put_back(scanout_state);
} }
return state; return state;
err_region: err_region:
@ -3747,6 +3752,15 @@ err:
return NULL; return NULL;
} }
static const char *
drm_propose_state_mode_to_string(enum drm_output_propose_state_mode mode)
{
if (mode < 0 || mode >= ARRAY_LENGTH(drm_output_propose_state_mode_as_string))
return " unknown compositing mode";
return drm_output_propose_state_mode_as_string[mode];
}
static void static void
drm_assign_planes(struct weston_output *output_base, void *repaint_data) drm_assign_planes(struct weston_output *output_base, void *repaint_data)
{ {
@ -3757,18 +3771,21 @@ drm_assign_planes(struct weston_output *output_base, void *repaint_data)
struct drm_plane_state *plane_state; struct drm_plane_state *plane_state;
struct weston_view *ev; struct weston_view *ev;
struct weston_plane *primary = &output_base->compositor->primary_plane; struct weston_plane *primary = &output_base->compositor->primary_plane;
enum drm_output_propose_state_mode mode = DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY;
drm_debug(b, "\t[repaint] preparing state for output %s (%lu)\n", drm_debug(b, "\t[repaint] preparing state for output %s (%lu)\n",
output_base->name, (unsigned long) output_base->id); output_base->name, (unsigned long) output_base->id);
if (!b->sprites_are_broken && !output->virtual) { if (!b->sprites_are_broken && !output->virtual) {
state = drm_output_propose_state(output_base, pending_state, drm_debug(b, "\t[repaint] trying planes-only build state\n");
DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY); state = drm_output_propose_state(output_base, pending_state, mode);
if (!state) { if (!state) {
drm_debug(b, "\t[repaint] could not build planes-only " drm_debug(b, "\t[repaint] could not build planes-only "
"state, trying mixed\n"); "state, trying mixed\n");
state = drm_output_propose_state(output_base, pending_state, mode = DRM_OUTPUT_PROPOSE_STATE_MIXED;
DRM_OUTPUT_PROPOSE_STATE_MIXED); state = drm_output_propose_state(output_base,
pending_state,
mode);
} }
if (!state) { if (!state) {
drm_debug(b, "\t[repaint] could not build mixed-mode " drm_debug(b, "\t[repaint] could not build mixed-mode "
@ -3778,11 +3795,15 @@ drm_assign_planes(struct weston_output *output_base, void *repaint_data)
drm_debug(b, "\t[state] no overlay plane support\n"); drm_debug(b, "\t[state] no overlay plane support\n");
} }
if (!state) if (!state) {
mode = DRM_OUTPUT_PROPOSE_STATE_RENDERER_ONLY;
state = drm_output_propose_state(output_base, pending_state, state = drm_output_propose_state(output_base, pending_state,
DRM_OUTPUT_PROPOSE_STATE_RENDERER_ONLY); DRM_OUTPUT_PROPOSE_STATE_RENDERER_ONLY);
}
assert(state); assert(state);
drm_debug(b, "\t[repaint] Using %s composition\n",
drm_propose_state_mode_to_string(mode));
wl_list_for_each(ev, &output_base->compositor->view_list, link) { wl_list_for_each(ev, &output_base->compositor->view_list, link) {
struct drm_plane *target_plane = NULL; struct drm_plane *target_plane = NULL;

Loading…
Cancel
Save