- cookie =
- xcb_dri3_pixmap_from_buffer_checked(chain->conn,
- image->pixmap,
- chain->window,
- size,
- pCreateInfo->imageExtent.width,
- pCreateInfo->imageExtent.height,
- row_pitch,
- chain->depth, bpp, fd);
+#ifdef HAVE_DRI3_MODIFIERS
+ if (image->base.drm_modifier != DRM_FORMAT_MOD_INVALID) {
+ /* If the image has a modifier, we must have DRI3 v1.2. */
+ assert(chain->has_dri3_modifiers);
+
+ cookie =
+ xcb_dri3_pixmap_from_buffers_checked(chain->conn,
+ image->pixmap,
+ chain->window,
+ image->base.num_planes,
+ pCreateInfo->imageExtent.width,
+ pCreateInfo->imageExtent.height,
+ image->base.row_pitches[0],
+ image->base.offsets[0],
+ image->base.row_pitches[1],
+ image->base.offsets[1],
+ image->base.row_pitches[2],
+ image->base.offsets[2],
+ image->base.row_pitches[3],
+ image->base.offsets[3],
+ chain->depth, bpp,
+ image->base.drm_modifier,
+ image->base.fds);
+ } else
+#endif
+ {
+ /* Without passing modifiers, we can't have multi-plane RGB images. */
+ assert(image->base.num_planes == 1);
+
+ cookie =
+ xcb_dri3_pixmap_from_buffer_checked(chain->conn,
+ image->pixmap,
+ chain->window,
+ image->base.sizes[0],
+ pCreateInfo->imageExtent.width,
+ pCreateInfo->imageExtent.height,
+ image->base.row_pitches[0],
+ chain->depth, bpp,
+ image->base.fds[0]);
+ }
+