compositor-drm: Display the pixel format of the framebuffer used by the plane

With this patch we also display the format in usage by the HW-plane.
This touches both legacy and atomic paths.
dev
Marius Vlad 6 years ago
parent 2ce2339045
commit 1ca025cc5d
  1. 15
      libweston/compositor-drm.c

@ -2219,6 +2219,7 @@ drm_output_apply_state_legacy(struct drm_output_state *state)
struct drm_plane_state *ps; struct drm_plane_state *ps;
struct drm_mode *mode; struct drm_mode *mode;
struct drm_head *head; struct drm_head *head;
const struct pixel_format_info *pinfo = NULL;
uint32_t connectors[MAX_CLONED_CONNECTORS]; uint32_t connectors[MAX_CLONED_CONNECTORS];
int n_conn = 0; int n_conn = 0;
struct timespec now; struct timespec now;
@ -2298,6 +2299,7 @@ drm_output_apply_state_legacy(struct drm_output_state *state)
!scanout_plane->state_cur->fb || !scanout_plane->state_cur->fb ||
scanout_plane->state_cur->fb->strides[0] != scanout_plane->state_cur->fb->strides[0] !=
scanout_state->fb->strides[0]) { scanout_state->fb->strides[0]) {
ret = drmModeSetCrtc(backend->drm.fd, output->crtc_id, ret = drmModeSetCrtc(backend->drm.fd, output->crtc_id,
scanout_state->fb->fb_id, scanout_state->fb->fb_id,
0, 0, 0, 0,
@ -2309,6 +2311,11 @@ drm_output_apply_state_legacy(struct drm_output_state *state)
} }
} }
pinfo = scanout_state->fb->format;
drm_debug(backend, "\t[CRTC:%u, PLANE:%u] FORMAT: %s\n",
output->crtc_id, scanout_state->plane->plane_id,
pinfo ? pinfo->drm_format_name : "UNKNOWN");
if (drmModePageFlip(backend->drm.fd, output->crtc_id, if (drmModePageFlip(backend->drm.fd, output->crtc_id,
scanout_state->fb->fb_id, scanout_state->fb->fb_id,
DRM_MODE_PAGE_FLIP_EVENT, output) < 0) { DRM_MODE_PAGE_FLIP_EVENT, output) < 0) {
@ -2531,6 +2538,7 @@ drm_output_apply_state_atomic(struct drm_output_state *state,
wl_list_for_each(plane_state, &state->plane_list, link) { wl_list_for_each(plane_state, &state->plane_list, link) {
struct drm_plane *plane = plane_state->plane; struct drm_plane *plane = plane_state->plane;
const struct pixel_format_info *pinfo = NULL;
ret |= plane_add_prop(req, plane, WDRM_PLANE_FB_ID, ret |= plane_add_prop(req, plane, WDRM_PLANE_FB_ID,
plane_state->fb ? plane_state->fb->fb_id : 0); plane_state->fb ? plane_state->fb->fb_id : 0);
@ -2553,6 +2561,13 @@ drm_output_apply_state_atomic(struct drm_output_state *state,
ret |= plane_add_prop(req, plane, WDRM_PLANE_CRTC_H, ret |= plane_add_prop(req, plane, WDRM_PLANE_CRTC_H,
plane_state->dest_h); plane_state->dest_h);
if (plane_state->fb && plane_state->fb->format)
pinfo = plane_state->fb->format;
drm_debug(plane->backend, "\t\t\t[PLANE:%lu] FORMAT: %s\n",
(unsigned long) plane->plane_id,
pinfo ? pinfo->drm_format_name : "UNKNOWN");
if (ret != 0) { if (ret != 0) {
weston_log("couldn't set plane state\n"); weston_log("couldn't set plane state\n");
return ret; return ret;

Loading…
Cancel
Save