Skip to content
Commits on Source (7)
......@@ -663,16 +663,13 @@ struct drm_head *
drm_head_find_by_connector(struct drm_backend *backend, uint32_t connector_id);
static inline bool
drm_view_transform_supported(struct weston_view *ev, struct weston_output *output)
drm_paint_node_transform_supported(struct weston_paint_node *node, struct weston_output *output)
{
struct weston_matrix transform;
enum wl_output_transform wt;
weston_view_buffer_to_output_matrix(ev, output, &transform);
/* if false, the transform doesn't map to any of the standard
* (ie: 90 degree) output transformations. */
if (!weston_matrix_to_transform(&transform, &wt))
if (!weston_matrix_to_transform(&node->buffer_to_output_matrix, &wt))
return false;
if (wt != WL_OUTPUT_TRANSFORM_NORMAL)
......@@ -771,15 +768,16 @@ drm_output_ensure_hdr_output_metadata_blob(struct drm_output *output);
#ifdef BUILD_DRM_GBM
extern struct drm_fb *
drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev,
uint32_t *try_view_on_plane_failure_reasons);
drm_fb_get_from_paint_node(struct drm_output_state *state,
struct weston_paint_node *pnode);
extern bool
drm_can_scanout_dmabuf(struct weston_compositor *ec,
struct linux_dmabuf_buffer *dmabuf);
#else
static inline struct drm_fb *
drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev,
uint32_t *try_view_on_plane_failure_reasons)
drm_fb_get_from_paint_node(struct drm_output_state *state,
struct weston_paint_node *pnode)
{
return NULL;
}
......@@ -837,8 +835,9 @@ drm_plane_state_free(struct drm_plane_state *state, bool force);
void
drm_plane_state_put_back(struct drm_plane_state *state);
bool
drm_plane_state_coords_for_view(struct drm_plane_state *state,
struct weston_view *ev, uint64_t zpos);
drm_plane_state_coords_for_paint_node(struct drm_plane_state *state,
struct weston_paint_node *node,
uint64_t zpos);
void
drm_plane_reset_state(struct drm_plane *plane);
......
......@@ -527,12 +527,13 @@ drm_fb_handle_buffer_destroy(struct wl_listener *listener, void *data)
}
struct drm_fb *
drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev,
uint32_t *try_view_on_plane_failure_reasons)
drm_fb_get_from_paint_node(struct drm_output_state *state,
struct weston_paint_node *pnode)
{
struct drm_output *output = state->output;
struct drm_backend *b = to_drm_backend(output->base.compositor);
struct drm_device *device = output->device;
struct weston_view *ev = pnode->view;
struct weston_buffer *buffer = ev->surface->buffer_ref.buffer;
struct drm_buffer_fb *buf_fb;
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;
if (ev->alpha != 1.0f) {
*try_view_on_plane_failure_reasons |=
pnode->try_view_on_plane_failure_reasons |=
FAILURE_REASONS_GLOBAL_ALPHA;
return NULL;
}
if (!drm_view_transform_supported(ev, &output->base)) {
*try_view_on_plane_failure_reasons |=
if (!drm_paint_node_transform_supported(pnode, &output->base)) {
pnode->try_view_on_plane_failure_reasons |=
FAILURE_REASONS_INCOMPATIBLE_TRANSFORM;
return NULL;
}
if (ev->surface->protection_mode == WESTON_SURFACE_PROTECTION_MODE_ENFORCED &&
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;
return NULL;
}
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;
}
if (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;
}
......@@ -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. */
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;
}
......@@ -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);
if (!fb) {
*try_view_on_plane_failure_reasons |=
pnode->try_view_on_plane_failure_reasons |=
(1 << FAILURE_REASONS_ADD_FB_FAILED);
gbm_bo_destroy(bo);
goto unsuitable;
}
} else {
*try_view_on_plane_failure_reasons |= FAILURE_REASONS_BUFFER_TYPE;
pnode->try_view_on_plane_failure_reasons |= FAILURE_REASONS_BUFFER_TYPE;
goto unsuitable;
}
......@@ -629,7 +630,7 @@ drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev,
return fb;
unsuitable:
*try_view_on_plane_failure_reasons |= buf_fb->failure_reasons;
pnode->try_view_on_plane_failure_reasons |= buf_fb->failure_reasons;
return NULL;
}
#endif
......@@ -204,16 +204,18 @@ drm_plane_state_put_back(struct drm_plane_state *state)
* a given plane.
*/
bool
drm_plane_state_coords_for_view(struct drm_plane_state *state,
struct weston_view *ev, uint64_t zpos)
drm_plane_state_coords_for_paint_node(struct drm_plane_state *state,
struct weston_paint_node *node,
uint64_t zpos)
{
struct drm_output *output = state->output;
struct weston_view *ev = node->view;
struct weston_buffer *buffer = ev->surface->buffer_ref.buffer;
pixman_region32_t dest_rect, src_rect;
pixman_box32_t *box;
float sxf1, syf1, sxf2, syf2;
if (!drm_view_transform_supported(ev, &output->base))
if (!drm_paint_node_transform_supported(node, &output->base))
return false;
/* Update the base weston_plane co-ordinates. */
......
......@@ -77,13 +77,14 @@ drm_output_check_plane_has_view_assigned(struct drm_plane *plane,
}
static struct drm_plane_state *
drm_output_try_view_on_plane(struct drm_plane *plane,
struct drm_output_state *output_state,
struct weston_view *ev,
enum drm_output_propose_state_mode mode,
struct drm_fb *fb, uint64_t zpos)
drm_output_try_paint_node_on_plane(struct drm_plane *plane,
struct drm_output_state *output_state,
struct weston_paint_node *node,
enum drm_output_propose_state_mode mode,
struct drm_fb *fb, uint64_t zpos)
{
struct drm_output *output = output_state->output;
struct weston_view *ev = node->view;
struct weston_surface *surface = ev->surface;
struct drm_device *device = output->device;
struct drm_backend *b = device->backend;
......@@ -101,7 +102,7 @@ drm_output_try_view_on_plane(struct drm_plane *plane,
assert(!state->fb);
state->output = output;
if (!drm_plane_state_coords_for_view(state, ev, zpos)) {
if (!drm_plane_state_coords_for_paint_node(state, node, zpos)) {
drm_debug(b, "\t\t\t\t[view] not placing view %p on plane: "
"unsuitable transform\n", ev);
goto out;
......@@ -115,8 +116,9 @@ drm_output_try_view_on_plane(struct drm_plane *plane,
}
/* We hold one reference for the lifetime of this function; from
* calling drm_fb_get_from_view() in drm_output_prepare_plane_view(),
* so, we take another reference here to live within the state. */
* calling drm_fb_get_from_paint_node() in
* drm_output_prepare_plane_view(), so, we take another reference
* here to live within the state. */
state->ev = ev;
state->fb = drm_fb_ref(fb);
state->in_fence_fd = ev->surface->acquire_fence_fd;
......@@ -191,13 +193,15 @@ cursor_bo_update(struct drm_plane_state *plane_state, struct weston_view *ev)
}
static struct drm_plane_state *
drm_output_prepare_cursor_view(struct drm_output_state *output_state,
struct weston_view *ev, uint64_t zpos)
drm_output_prepare_cursor_paint_node(struct drm_output_state *output_state,
struct weston_paint_node *node,
uint64_t zpos)
{
struct drm_output *output = output_state->output;
struct drm_device *device = output->device;
struct drm_backend *b = device->backend;
struct drm_plane *plane = output->cursor_plane;
struct weston_view *ev = node->view;
struct drm_plane_state *plane_state;
bool needs_update = false;
const char *p_name = drm_output_get_plane_type_name(plane);
......@@ -216,7 +220,7 @@ drm_output_prepare_cursor_view(struct drm_output_state *output_state,
/* We can't scale with the legacy API, and we don't try to account for
* simple cropping/translation in cursor_bo_update. */
plane_state->output = output;
if (!drm_plane_state_coords_for_view(plane_state, ev, zpos)) {
if (!drm_plane_state_coords_for_paint_node(plane_state, node, zpos)) {
drm_debug(b, "\t\t\t\t[%s] not placing view %p on %s: "
"unsuitable transform\n", p_name, ev, p_name);
goto err;
......@@ -279,8 +283,9 @@ err:
}
#else
static struct drm_plane_state *
drm_output_prepare_cursor_view(struct drm_output_state *output_state,
struct weston_view *ev, uint64_t zpos)
drm_output_prepare_cursor_paint_node(struct drm_output_state *output_state,
struct weston_paint_node *node,
uint64_t zpos)
{
return NULL;
}
......@@ -494,8 +499,7 @@ drm_output_find_plane_for_view(struct drm_output_state *state,
return NULL;
}
fb = drm_fb_get_from_view(state, ev,
&pnode->try_view_on_plane_failure_reasons);
fb = drm_fb_get_from_paint_node(state, pnode);
if (!fb) {
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);
......@@ -602,10 +606,11 @@ drm_output_find_plane_for_view(struct drm_output_state *state,
plane->plane_id, p_name);
if (plane->type == WDRM_PLANE_TYPE_CURSOR) {
ps = drm_output_prepare_cursor_view(state, ev, zpos);
ps = drm_output_prepare_cursor_paint_node(state, pnode, zpos);
} else {
ps = drm_output_try_view_on_plane(plane, state, ev,
mode, fb, zpos);
ps = drm_output_try_paint_node_on_plane(plane, state,
pnode, mode,
fb, zpos);
}
if (ps) {
......@@ -1032,8 +1037,9 @@ drm_assign_planes(struct weston_output *output_base)
/* We rely on output->cursor_view being both an accurate reflection of
* the cursor plane's state, but also being maintained across repaints
* to avoid unnecessary damage uploads, per the comment in
* drm_output_prepare_cursor_view. In the event that we go from having
* a cursor view to not having a cursor view, we need to clear it. */
* drm_output_prepare_cursor_paint_node. In the event that we go from
* having a cursor view to not having a cursor view, we need to clear
* it. */
if (output->cursor_view) {
plane_state =
drm_output_state_get_existing_plane(state,
......@@ -1057,7 +1063,7 @@ drm_output_handle_cursor_view_destroy(struct wl_listener *listener, void *data)
*
* Ensure the stored value will be properly cleared if the view is destroyed.
* The stored cursor view helps avoid unnecessary uploads of cursor data to
* cursor plane buffer objects (see drm_output_prepare_cursor_view).
* cursor plane buffer objects (see drm_output_prepare_cursor_paint_node).
*/
void
drm_output_set_cursor_view(struct drm_output *output, struct weston_view *ev)
......
......@@ -105,11 +105,10 @@ weston_output_create_heads_string(struct weston_output *output);
static void
paint_node_update(struct weston_paint_node *pnode)
{
struct weston_matrix tmp_matrix;
struct weston_matrix *mat = &pnode->buffer_to_output_matrix;
weston_view_buffer_to_output_matrix(pnode->view, pnode->output,
&tmp_matrix);
pnode->needs_filtering = weston_matrix_needs_filtering(&tmp_matrix);
weston_view_buffer_to_output_matrix(pnode->view, pnode->output, mat);
pnode->needs_filtering = weston_matrix_needs_filtering(mat);
}
static struct weston_paint_node *
......
......@@ -480,6 +480,7 @@ struct weston_paint_node {
/* Mutable members: */
struct weston_matrix buffer_to_output_matrix;
bool needs_filtering;
/* struct weston_output::paint_node_z_order_list */
......