Re: [PATCH weston 18/68] compositor-drm: Drop output from release_fb

2017-02-21 Thread Pekka Paalanen
On Fri,  9 Dec 2016 19:57:33 +
Daniel Stone  wrote:

> We only need it for the GBM surface the FB was originally created
> against; a mismatch here is very bad indeed, so no reason to pass it in
> explictly every time rather than store it.
> 
> Differential Revision: https://phabricator.freedesktop.org/D1490
> 
> Signed-off-by: Daniel Stone 
> ---
>  libweston/compositor-drm.c | 20 +++-
>  1 file changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
> index 7dbfc6b..eb735b2 100644
> --- a/libweston/compositor-drm.c
> +++ b/libweston/compositor-drm.c
> @@ -148,6 +148,7 @@ struct drm_fb {
>  
>   /* Used by gbm fbs */
>   struct gbm_bo *bo;
> + struct gbm_surface *gbm_surface;
>  
>   /* Used by dumb fbs */
>   void *map;
> @@ -466,7 +467,7 @@ drm_fb_set_buffer(struct drm_fb *fb, struct weston_buffer 
> *buffer)
>  }
>  
>  static void
> -drm_output_release_fb(struct drm_output *output, struct drm_fb *fb)
> +drm_fb_unref(struct drm_fb *fb)


Hi,

first I was slightly surprised by the renaming, but reading the patch
thoroughly and seeing the following patch explained why it's nice to do
here. It would have saved a bit of effort if it was mentioned in the
commit message.

Reviewed-by: Pekka Paalanen 


Thanks,
pq


pgp4sQpVTTgju.pgp
Description: OpenPGP digital signature
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston 18/68] compositor-drm: Drop output from release_fb

2016-12-09 Thread Armin Krezović
On 09.12.2016 20:57, Daniel Stone wrote:
> We only need it for the GBM surface the FB was originally created
> against; a mismatch here is very bad indeed, so no reason to pass it in
> explictly every time rather than store it.
> 
> Differential Revision: https://phabricator.freedesktop.org/D1490
> 
> Signed-off-by: Daniel Stone 

Makes sense.

Reviewed-by: Armin Krezović 

> ---
>  libweston/compositor-drm.c | 20 +++-
>  1 file changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
> index 7dbfc6b..eb735b2 100644
> --- a/libweston/compositor-drm.c
> +++ b/libweston/compositor-drm.c
> @@ -148,6 +148,7 @@ struct drm_fb {
>  
>   /* Used by gbm fbs */
>   struct gbm_bo *bo;
> + struct gbm_surface *gbm_surface;
>  
>   /* Used by dumb fbs */
>   void *map;
> @@ -466,7 +467,7 @@ drm_fb_set_buffer(struct drm_fb *fb, struct weston_buffer 
> *buffer)
>  }
>  
>  static void
> -drm_output_release_fb(struct drm_output *output, struct drm_fb *fb)
> +drm_fb_unref(struct drm_fb *fb)
>  {
>   if (!fb)
>   return;
> @@ -479,7 +480,7 @@ drm_output_release_fb(struct drm_output *output, struct 
> drm_fb *fb)
>   gbm_bo_destroy(fb->bo);
>   break;
>   case BUFFER_GBM_SURFACE:
> - gbm_surface_release_buffer(output->gbm_surface, fb->bo);
> + gbm_surface_release_buffer(fb->gbm_surface, fb->bo);
>   break;
>   default:
>   assert(NULL);
> @@ -615,6 +616,7 @@ drm_output_render_gl(struct drm_output *output, 
> pixman_region32_t *damage)
>   gbm_surface_release_buffer(output->gbm_surface, bo);
>   return;
>   }
> + output->next->gbm_surface = output->gbm_surface;
>  }
>  
>  static void
> @@ -798,7 +800,7 @@ drm_output_repaint(struct weston_output *output_base,
>  err_pageflip:
>   output->cursor_view = NULL;
>   if (output->next) {
> - drm_output_release_fb(output, output->next);
> + drm_fb_unref(output->next);
>   output->next = NULL;
>   }
>  
> @@ -900,7 +902,7 @@ vblank_handler(int fd, unsigned int frame, unsigned int 
> sec, unsigned int usec,
>   drm_output_update_msc(output, frame);
>   output->vblank_pending = 0;
>  
> - drm_output_release_fb(output, s->current);
> + drm_fb_unref(s->current);
>   s->current = s->next;
>   s->next = NULL;
>  
> @@ -930,7 +932,7 @@ page_flip_handler(int fd, unsigned int frame,
>* we just want to page flip to the current buffer to get an accurate
>* timestamp */
>   if (output->page_flip_pending) {
> - drm_output_release_fb(output, output->current);
> + drm_fb_unref(output->current);
>   output->current = output->next;
>   output->next = NULL;
>   }
> @@ -1452,8 +1454,8 @@ drm_output_switch_mode(struct weston_output 
> *output_base, struct weston_mode *mo
>   WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
>  
>   /* reset rendering stuff. */
> - drm_output_release_fb(output, output->current);
> - drm_output_release_fb(output, output->next);
> + drm_fb_unref(output->current);
> + drm_fb_unref(output->next);
>   output->current = output->next = NULL;
>  
>   if (b->use_pixman) {
> @@ -2672,8 +2674,8 @@ destroy_sprites(struct drm_backend *backend)
>   sprite->plane_id,
>   output->crtc_id, 0, 0,
>   0, 0, 0, 0, 0, 0, 0, 0);
> - drm_output_release_fb(output, sprite->current);
> - drm_output_release_fb(output, sprite->next);
> + drm_fb_unref(sprite->current);
> + drm_fb_unref(sprite->next);
>   weston_plane_release(&sprite->plane);
>   free(sprite);
>   }
> 




signature.asc
Description: OpenPGP digital signature
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston 18/68] compositor-drm: Drop output from release_fb

2016-12-09 Thread Daniel Stone
We only need it for the GBM surface the FB was originally created
against; a mismatch here is very bad indeed, so no reason to pass it in
explictly every time rather than store it.

Differential Revision: https://phabricator.freedesktop.org/D1490

Signed-off-by: Daniel Stone 
---
 libweston/compositor-drm.c | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 7dbfc6b..eb735b2 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -148,6 +148,7 @@ struct drm_fb {
 
/* Used by gbm fbs */
struct gbm_bo *bo;
+   struct gbm_surface *gbm_surface;
 
/* Used by dumb fbs */
void *map;
@@ -466,7 +467,7 @@ drm_fb_set_buffer(struct drm_fb *fb, struct weston_buffer 
*buffer)
 }
 
 static void
-drm_output_release_fb(struct drm_output *output, struct drm_fb *fb)
+drm_fb_unref(struct drm_fb *fb)
 {
if (!fb)
return;
@@ -479,7 +480,7 @@ drm_output_release_fb(struct drm_output *output, struct 
drm_fb *fb)
gbm_bo_destroy(fb->bo);
break;
case BUFFER_GBM_SURFACE:
-   gbm_surface_release_buffer(output->gbm_surface, fb->bo);
+   gbm_surface_release_buffer(fb->gbm_surface, fb->bo);
break;
default:
assert(NULL);
@@ -615,6 +616,7 @@ drm_output_render_gl(struct drm_output *output, 
pixman_region32_t *damage)
gbm_surface_release_buffer(output->gbm_surface, bo);
return;
}
+   output->next->gbm_surface = output->gbm_surface;
 }
 
 static void
@@ -798,7 +800,7 @@ drm_output_repaint(struct weston_output *output_base,
 err_pageflip:
output->cursor_view = NULL;
if (output->next) {
-   drm_output_release_fb(output, output->next);
+   drm_fb_unref(output->next);
output->next = NULL;
}
 
@@ -900,7 +902,7 @@ vblank_handler(int fd, unsigned int frame, unsigned int 
sec, unsigned int usec,
drm_output_update_msc(output, frame);
output->vblank_pending = 0;
 
-   drm_output_release_fb(output, s->current);
+   drm_fb_unref(s->current);
s->current = s->next;
s->next = NULL;
 
@@ -930,7 +932,7 @@ page_flip_handler(int fd, unsigned int frame,
 * we just want to page flip to the current buffer to get an accurate
 * timestamp */
if (output->page_flip_pending) {
-   drm_output_release_fb(output, output->current);
+   drm_fb_unref(output->current);
output->current = output->next;
output->next = NULL;
}
@@ -1452,8 +1454,8 @@ drm_output_switch_mode(struct weston_output *output_base, 
struct weston_mode *mo
WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
 
/* reset rendering stuff. */
-   drm_output_release_fb(output, output->current);
-   drm_output_release_fb(output, output->next);
+   drm_fb_unref(output->current);
+   drm_fb_unref(output->next);
output->current = output->next = NULL;
 
if (b->use_pixman) {
@@ -2672,8 +2674,8 @@ destroy_sprites(struct drm_backend *backend)
sprite->plane_id,
output->crtc_id, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0);
-   drm_output_release_fb(output, sprite->current);
-   drm_output_release_fb(output, sprite->next);
+   drm_fb_unref(sprite->current);
+   drm_fb_unref(sprite->next);
weston_plane_release(&sprite->plane);
free(sprite);
}
-- 
2.9.3

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