+static void
+drm_create_planar_buffer(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t id, uint32_t name,
+ int32_t width, int32_t height, uint32_t format,
+ int32_t offset0, int32_t stride0,
+ int32_t offset1, int32_t stride1,
+ int32_t offset2, int32_t stride2)
+{
+ switch (format) {
+ case WL_DRM_FORMAT_YUV410:
+ case WL_DRM_FORMAT_YUV411:
+ case WL_DRM_FORMAT_YUV420:
+ case WL_DRM_FORMAT_YUV422:
+ case WL_DRM_FORMAT_YUV444:
+ case WL_DRM_FORMAT_NV12:
+ case WL_DRM_FORMAT_NV16:
+ break;
+ default:
+ wl_resource_post_error(resource,
+ WL_DRM_ERROR_INVALID_FORMAT,
+ "invalid format");
+ return;
+ }
+
+ create_buffer(client, resource, id, name, -1, width, height, format,
+ offset0, stride0, offset1, stride1, offset2, stride2);
+}
+
+static void
+drm_create_prime_buffer(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t id, int fd,
+ int32_t width, int32_t height, uint32_t format,
+ int32_t offset0, int32_t stride0,
+ int32_t offset1, int32_t stride1,
+ int32_t offset2, int32_t stride2)
+{
+ create_buffer(client, resource, id, 0, fd, width, height, format,
+ offset0, stride0, offset1, stride1, offset2, stride2);
+ close(fd);