int vrend_renderer_transfer_iov(struct vrend_context *ctx,
                                uint32_t dst_handle,
                                const struct vrend_transfer_info *info,
                                int transfer_mode)
{
   struct vrend_resource *res;

   res = vrend_renderer_ctx_res_lookup(ctx, dst_handle);
   if (!res) {
      vrend_report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_RESOURCE, dst_handle);
      return EINVAL;
   }

   if (!check_transfer_iovec(res, info)) {
      if (has_bit(res->storage_bits, VREND_STORAGE_EGL_IMAGE))
         return 0;
      else {
         vrend_report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_RESOURCE, dst_handle);
         return EINVAL;
      }
   }

   return vrend_renderer_transfer_internal(ctx, res, info,
                                           transfer_mode);
}
int vrend_renderer_transfer_iov(struct vrend_context *ctx,
                                uint32_t dst_handle,
                                const struct vrend_transfer_info *info,
                                int transfer_mode)
{
   struct vrend_resource *res;

   res = vrend_renderer_ctx_res_lookup(ctx, dst_handle);
   if (!res) {
      vrend_report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_RESOURCE, dst_handle);
      return EINVAL;
   }

   if (!check_transfer_iovec(res, info)) {
      if (has_bit(res->storage_bits, VREND_STORAGE_EGL_IMAGE))
         return 0;
      else {
         vrend_report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_RESOURCE, dst_handle);
         return EINVAL;
      }
   }

   return vrend_renderer_transfer_internal(ctx, res, info,
                                           transfer_mode);
}