[mutter/wip/nielsdg/add-yuv-support: 38/38] wip



commit ad4f642a4e88b2560339ce7c5a55a73d2be0d305
Author: Niels De Graef <niels degraef barco com>
Date:   Tue May 28 13:47:15 2019 +0200

    wip

 src/compositor/meta-shaped-texture.c | 10 ++++++----
 src/wayland/meta-wayland-dma-buf.c   | 20 ++++++++------------
 2 files changed, 14 insertions(+), 16 deletions(-)
---
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
index ab323c354..6749ac062 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -322,6 +322,7 @@ get_base_pipeline (MetaShapedTexture *stex,
 {
   CoglPipeline *pipeline;
   CoglMatrix matrix;
+  guint n_planes;
   guint i = 0;
 
   if (stex->base_pipeline)
@@ -329,7 +330,8 @@ get_base_pipeline (MetaShapedTexture *stex,
 
   pipeline = cogl_pipeline_new (ctx);
 
-  for (i = 0; i < cogl_multi_plane_texture_get_n_planes (stex->texture); i++)
+  n_planes = cogl_multi_plane_texture_get_n_planes (stex->texture);
+  for (i = 0; i < n_planes; i++)
     {
       cogl_pipeline_set_layer_wrap_mode_s (pipeline, i,
                                            COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
@@ -415,12 +417,12 @@ get_base_pipeline (MetaShapedTexture *stex,
                              0);
     }
 
-  cogl_pipeline_set_layer_matrix (pipeline, 0, &matrix);
-  cogl_pipeline_set_layer_matrix (pipeline, 1, &matrix);
+  for (i = 0; i < n_planes + 1; i++)
+    cogl_pipeline_set_layer_matrix (pipeline, i, &matrix);
 
   if (stex->snippet)
     {
-      for (i = 0; i < cogl_multi_plane_texture_get_n_planes (stex->texture); i++)
+      for (i = 0; i < n_planes; i++)
         cogl_pipeline_add_layer_snippet (pipeline, i, stex->snippet);
     }
 
diff --git a/src/wayland/meta-wayland-dma-buf.c b/src/wayland/meta-wayland-dma-buf.c
index 89bacb089..181ec00e5 100644
--- a/src/wayland/meta-wayland-dma-buf.c
+++ b/src/wayland/meta-wayland-dma-buf.c
@@ -123,6 +123,8 @@ static EGLImageKHR
 create_egl_image_from_dmabuf (MetaEgl                 *egl,
                               EGLDisplay               egl_display,
                               MetaWaylandDmaBufBuffer *dma_buf,
+                              int32_t                  width,
+                              int32_t                  height,
                               uint32_t                 drm_format,
                               GError                 **error)
 {
@@ -130,9 +132,9 @@ create_egl_image_from_dmabuf (MetaEgl                 *egl,
   int attr_idx = 0;
 
   attribs[attr_idx++] = EGL_WIDTH;
-  attribs[attr_idx++] = dma_buf->width;
+  attribs[attr_idx++] = width;
   attribs[attr_idx++] = EGL_HEIGHT;
-  attribs[attr_idx++] = dma_buf->height;
+  attribs[attr_idx++] = height;
   attribs[attr_idx++] = EGL_LINUX_DRM_FOURCC_EXT;
   attribs[attr_idx++] = drm_format;
 
@@ -217,23 +219,18 @@ meta_wayland_dma_buf_realize_texture (MetaWaylandBuffer  *buffer,
     return TRUE;
 
   cogl_format = drm_buffer_get_cogl_pixel_format (dma_buf);
+  g_warning ("Dmabuf: Got cogl format %s", cogl_pixel_format_to_string (cogl_format));
   if (G_UNLIKELY (cogl_format == COGL_PIXEL_FORMAT_ANY))
     {
-      g_set_error (error, G_IO_ERROR,
-                   G_IO_ERROR_FAILED,
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
                    "Unsupported buffer format %d", dma_buf->drm_format);
       return FALSE;
     }
-  g_warning ("Dmabuf: Got cogl format %s", cogl_pixel_format_to_string (cogl_format));
 
   n_planes = cogl_pixel_format_get_n_planes (cogl_format);
   /* If this isn't correct, then something went very wrong, so bail out */
+  g_return_val_if_fail (n_planes == dma_buf->n_planes, FALSE);
   g_warning ("n_planes == %d <-> dma_buf planes = %d", n_planes, dma_buf->n_planes);
-  /* FIXME uncomment */
-  /* g_return_val_if_fail (n_planes == dma_buf->n_planes, FALSE); */
-
-  /*XXX probeersel*/
-  /* cogl_format = COGL_PIXEL_FORMAT_NV12; */
 
   planes = g_ptr_array_new_full (n_planes, cogl_object_unref);
 
@@ -246,6 +243,7 @@ meta_wayland_dma_buf_realize_texture (MetaWaylandBuffer  *buffer,
       egl_img = create_egl_image_from_dmabuf (egl,
                                               egl_display,
                                               dma_buf,
+                                              dma_buf->width, dma_buf->height,
                                               dma_buf->drm_format,
                                               error);
       if (G_UNLIKELY (egl_img == EGL_NO_IMAGE_KHR))
@@ -309,8 +307,6 @@ buffer_params_add (struct wl_client   *client,
   drm_modifier = ((uint64_t) drm_modifier_hi) << 32;
   drm_modifier |= ((uint64_t) drm_modifier_lo) & 0xffffffff;
 
-  g_warning ("buffer_params_add %d", plane_idx);
-
   dma_buf = wl_resource_get_user_data (resource);
   if (G_UNLIKELY (!dma_buf))
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]