drm: pass paint node to drm_fb_get_from_view
This is a preamble to saving a bit of matrix maths. Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
parent
0b9620b83e
commit
567ed2706a
@ -771,15 +771,16 @@ drm_output_ensure_hdr_output_metadata_blob(struct drm_output *output);
|
|||||||
|
|
||||||
#ifdef BUILD_DRM_GBM
|
#ifdef BUILD_DRM_GBM
|
||||||
extern struct drm_fb *
|
extern struct drm_fb *
|
||||||
drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev,
|
drm_fb_get_from_paint_node(struct drm_output_state *state,
|
||||||
uint32_t *try_view_on_plane_failure_reasons);
|
struct weston_paint_node *pnode);
|
||||||
|
|
||||||
extern bool
|
extern bool
|
||||||
drm_can_scanout_dmabuf(struct weston_compositor *ec,
|
drm_can_scanout_dmabuf(struct weston_compositor *ec,
|
||||||
struct linux_dmabuf_buffer *dmabuf);
|
struct linux_dmabuf_buffer *dmabuf);
|
||||||
#else
|
#else
|
||||||
static inline struct drm_fb *
|
static inline struct drm_fb *
|
||||||
drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev,
|
drm_fb_get_from_paint_node(struct drm_output_state *state,
|
||||||
uint32_t *try_view_on_plane_failure_reasons)
|
struct weston_paint_node *pnode)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -527,12 +527,13 @@ drm_fb_handle_buffer_destroy(struct wl_listener *listener, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct drm_fb *
|
struct drm_fb *
|
||||||
drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev,
|
drm_fb_get_from_paint_node(struct drm_output_state *state,
|
||||||
uint32_t *try_view_on_plane_failure_reasons)
|
struct weston_paint_node *pnode)
|
||||||
{
|
{
|
||||||
struct drm_output *output = state->output;
|
struct drm_output *output = state->output;
|
||||||
struct drm_backend *b = to_drm_backend(output->base.compositor);
|
struct drm_backend *b = to_drm_backend(output->base.compositor);
|
||||||
struct drm_device *device = output->device;
|
struct drm_device *device = output->device;
|
||||||
|
struct weston_view *ev = pnode->view;
|
||||||
struct weston_buffer *buffer = ev->surface->buffer_ref.buffer;
|
struct weston_buffer *buffer = ev->surface->buffer_ref.buffer;
|
||||||
struct drm_buffer_fb *buf_fb;
|
struct drm_buffer_fb *buf_fb;
|
||||||
bool is_opaque = weston_view_is_opaque(ev, &ev->transform.boundingbox);
|
bool is_opaque = weston_view_is_opaque(ev, &ev->transform.boundingbox);
|
||||||
@ -540,32 +541,32 @@ drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev,
|
|||||||
struct drm_plane *plane;
|
struct drm_plane *plane;
|
||||||
|
|
||||||
if (ev->alpha != 1.0f) {
|
if (ev->alpha != 1.0f) {
|
||||||
*try_view_on_plane_failure_reasons |=
|
pnode->try_view_on_plane_failure_reasons |=
|
||||||
FAILURE_REASONS_GLOBAL_ALPHA;
|
FAILURE_REASONS_GLOBAL_ALPHA;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!drm_view_transform_supported(ev, &output->base)) {
|
if (!drm_view_transform_supported(ev, &output->base)) {
|
||||||
*try_view_on_plane_failure_reasons |=
|
pnode->try_view_on_plane_failure_reasons |=
|
||||||
FAILURE_REASONS_INCOMPATIBLE_TRANSFORM;
|
FAILURE_REASONS_INCOMPATIBLE_TRANSFORM;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ev->surface->protection_mode == WESTON_SURFACE_PROTECTION_MODE_ENFORCED &&
|
if (ev->surface->protection_mode == WESTON_SURFACE_PROTECTION_MODE_ENFORCED &&
|
||||||
ev->surface->desired_protection > output->base.current_protection) {
|
ev->surface->desired_protection > output->base.current_protection) {
|
||||||
*try_view_on_plane_failure_reasons |=
|
pnode->try_view_on_plane_failure_reasons |=
|
||||||
FAILURE_REASONS_INADEQUATE_CONTENT_PROTECTION;
|
FAILURE_REASONS_INADEQUATE_CONTENT_PROTECTION;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
*try_view_on_plane_failure_reasons |= FAILURE_REASONS_NO_BUFFER;
|
pnode->try_view_on_plane_failure_reasons |= FAILURE_REASONS_NO_BUFFER;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buffer->backend_private) {
|
if (buffer->backend_private) {
|
||||||
buf_fb = buffer->backend_private;
|
buf_fb = buffer->backend_private;
|
||||||
*try_view_on_plane_failure_reasons |= buf_fb->failure_reasons;
|
pnode->try_view_on_plane_failure_reasons |= buf_fb->failure_reasons;
|
||||||
return buf_fb->fb ? drm_fb_ref(buf_fb->fb) : NULL;
|
return buf_fb->fb ? drm_fb_ref(buf_fb->fb) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -576,7 +577,7 @@ drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev,
|
|||||||
|
|
||||||
/* GBM is used for dmabuf import as well as from client wl_buffer. */
|
/* GBM is used for dmabuf import as well as from client wl_buffer. */
|
||||||
if (!b->gbm) {
|
if (!b->gbm) {
|
||||||
*try_view_on_plane_failure_reasons |= FAILURE_REASONS_NO_GBM;
|
pnode->try_view_on_plane_failure_reasons |= FAILURE_REASONS_NO_GBM;
|
||||||
goto unsuitable;
|
goto unsuitable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -595,13 +596,13 @@ drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev,
|
|||||||
|
|
||||||
fb = drm_fb_get_from_bo(bo, device, is_opaque, BUFFER_CLIENT);
|
fb = drm_fb_get_from_bo(bo, device, is_opaque, BUFFER_CLIENT);
|
||||||
if (!fb) {
|
if (!fb) {
|
||||||
*try_view_on_plane_failure_reasons |=
|
pnode->try_view_on_plane_failure_reasons |=
|
||||||
(1 << FAILURE_REASONS_ADD_FB_FAILED);
|
(1 << FAILURE_REASONS_ADD_FB_FAILED);
|
||||||
gbm_bo_destroy(bo);
|
gbm_bo_destroy(bo);
|
||||||
goto unsuitable;
|
goto unsuitable;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*try_view_on_plane_failure_reasons |= FAILURE_REASONS_BUFFER_TYPE;
|
pnode->try_view_on_plane_failure_reasons |= FAILURE_REASONS_BUFFER_TYPE;
|
||||||
goto unsuitable;
|
goto unsuitable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,7 +630,7 @@ drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev,
|
|||||||
return fb;
|
return fb;
|
||||||
|
|
||||||
unsuitable:
|
unsuitable:
|
||||||
*try_view_on_plane_failure_reasons |= buf_fb->failure_reasons;
|
pnode->try_view_on_plane_failure_reasons |= buf_fb->failure_reasons;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -115,8 +115,9 @@ drm_output_try_view_on_plane(struct drm_plane *plane,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* We hold one reference for the lifetime of this function; from
|
/* We hold one reference for the lifetime of this function; from
|
||||||
* calling drm_fb_get_from_view() in drm_output_prepare_plane_view(),
|
* calling drm_fb_get_from_paint_node() in
|
||||||
* so, we take another reference here to live within the state. */
|
* drm_output_prepare_plane_view(), so, we take another reference
|
||||||
|
* here to live within the state. */
|
||||||
state->ev = ev;
|
state->ev = ev;
|
||||||
state->fb = drm_fb_ref(fb);
|
state->fb = drm_fb_ref(fb);
|
||||||
state->in_fence_fd = ev->surface->acquire_fence_fd;
|
state->in_fence_fd = ev->surface->acquire_fence_fd;
|
||||||
@ -494,8 +495,7 @@ drm_output_find_plane_for_view(struct drm_output_state *state,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
fb = drm_fb_get_from_view(state, ev,
|
fb = drm_fb_get_from_paint_node(state, pnode);
|
||||||
&pnode->try_view_on_plane_failure_reasons);
|
|
||||||
if (!fb) {
|
if (!fb) {
|
||||||
drm_debug(b, "\t\t\t[view] couldn't get FB for view: 0x%lx\n",
|
drm_debug(b, "\t\t\t[view] couldn't get FB for view: 0x%lx\n",
|
||||||
(unsigned long) pnode->try_view_on_plane_failure_reasons);
|
(unsigned long) pnode->try_view_on_plane_failure_reasons);
|
||||||
|
Loading…
Reference in New Issue
Block a user