Re: [PATCH weston] compositor-drm: Don't drop viewported surfaces into the cursor plane

2016-09-30 Thread Derek Foreman

On 30/09/16 02:39 PM, Daniel Stone wrote:

Hi Derek,

On Friday, 30 September 2016, Derek Foreman > wrote:

+static bool
+viewport_is_cursor_compatible(struct weston_buffer_viewport *viewport)
+{
+   /* While we could technically relax soem of these constraints
+* if we implemented cropping in cursor_bo_update, it doesn't
+* seem worth the effort.
+* It is also possible to more thoroughly test if src and dst
+* sizes match when widths aren't -1, but again, likely not
+* worth the complexity.
+*/
+   if (viewport->surface.width != -1)
+   return false;
+   if (wl_fixed_to_int(viewport->buffer.src_x) != 0)
+   return false;
+   if (wl_fixed_to_int(viewport->buffer.src_y) != 0)
+   return false;
+   if (wl_fixed_to_int(viewport->buffer.src_width) != -1)
+   return false;
+   if (viewport->surface.width != -1)
+   return false;


Presumably one of these should be height, and are we not missing a
src_height check too? Also, might as well merge the buffer_scale check
in here too.


Oops, one just shouldn't be there.

Height is actually left as 0 in init, so I can't assume it being != -1 
means anything useful - but I think width != -1 will always be true for 
any manner of scale or crop.


I left the buffer_scale check out because it's not technically a part of 
viewport protocol despite being stored in the viewport structure just 
for fun.  So I'd not only have to pass an entire extra parameter, but 
I'd have to think of a better function name. :)


In fact, on re-reading the protocol it seems that -1 for src_width is 
good enough to test if any manner of crop is in play, so maybe I'll just 
add the two width checks to the caller and skip the new function entirely.


Thanks,
Derek


Cheers,
Daniel



___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel



___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] compositor-drm: Don't drop viewported surfaces into the cursor plane

2016-09-30 Thread Daniel Stone
Hi Derek,

On Friday, 30 September 2016, Derek Foreman  wrote:
>
> +static bool
> +viewport_is_cursor_compatible(struct weston_buffer_viewport *viewport)
> +{
> +   /* While we could technically relax soem of these constraints
> +* if we implemented cropping in cursor_bo_update, it doesn't
> +* seem worth the effort.
> +* It is also possible to more thoroughly test if src and dst
> +* sizes match when widths aren't -1, but again, likely not
> +* worth the complexity.
> +*/
> +   if (viewport->surface.width != -1)
> +   return false;
> +   if (wl_fixed_to_int(viewport->buffer.src_x) != 0)
> +   return false;
> +   if (wl_fixed_to_int(viewport->buffer.src_y) != 0)
> +   return false;
> +   if (wl_fixed_to_int(viewport->buffer.src_width) != -1)
> +   return false;
> +   if (viewport->surface.width != -1)
> +   return false;


Presumably one of these should be height, and are we not missing a
src_height check too? Also, might as well merge the buffer_scale check in
here too.

Cheers,
Daniel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston] compositor-drm: Don't drop viewported surfaces into the cursor plane

2016-09-30 Thread Derek Foreman
No good can come of this... the cursor plane's constraints are too
heavy to make bothering with this worthwhile.

To see the bug this fixes, set your output scale to 2 and then
launch weston-scaler -s and perform an action that makes the cursor
disappear (such as typing in a weston terminal the cursor is over
top of).

The problem is that we don't implement cropping in the copy to the
cursor bo, and the cursor plane can't scale.  So viewport features
are unimplemented or unimplementable for cursor planes.

Signed-off-by: Derek Foreman 
---
 libweston/compositor-drm.c | 25 +
 1 file changed, 25 insertions(+)

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 8319d7c..06be565 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -1125,6 +1125,29 @@ drm_output_prepare_overlay_view(struct drm_output 
*output,
return >plane;
 }
 
+static bool
+viewport_is_cursor_compatible(struct weston_buffer_viewport *viewport)
+{
+   /* While we could technically relax soem of these constraints
+* if we implemented cropping in cursor_bo_update, it doesn't
+* seem worth the effort.
+* It is also possible to more thoroughly test if src and dst
+* sizes match when widths aren't -1, but again, likely not
+* worth the complexity.
+*/
+   if (viewport->surface.width != -1)
+   return false;
+   if (wl_fixed_to_int(viewport->buffer.src_x) != 0)
+   return false;
+   if (wl_fixed_to_int(viewport->buffer.src_y) != 0)
+   return false;
+   if (wl_fixed_to_int(viewport->buffer.src_width) != -1)
+   return false;
+   if (viewport->surface.width != -1)
+   return false;
+   return true;
+}
+
 static struct weston_plane *
 drm_output_prepare_cursor_view(struct drm_output *output,
   struct weston_view *ev)
@@ -1142,6 +1165,8 @@ drm_output_prepare_cursor_view(struct drm_output *output,
return NULL;
if (viewport->buffer.scale != output->base.current_scale)
return NULL;
+   if (!viewport_is_cursor_compatible(viewport))
+   return NULL;
if (output->cursor_view)
return NULL;
if (ev->output_mask != (1u << output->base.id))
-- 
2.9.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel