We generalize the Gamma $z$ calculus to study degenerate drift-diffusion processes, where $z$ stands for extra directions introduced into the degenerate system. Based on this calculus, we establish the sub-Riemannian Ricci curvature tensor and the associated curvature dimension bound for general sub-Riemannian manifolds. These results do not require the commutative iteration of Gamma and Gamma z operator and go beyond the step two condition. These allow us to analyze the convergence properties of degenerate drift-diffusion processes and prove the entropy dissipation rate and several functional inequalities in sub-Riemannian manifolds. Several examples are provided. In particular, we show the global in time convergence result for displacement group with a weighted volume on a compact region. The new Gamma $z$ calculus is motivated by optimal transport and density manifold. We embed the probability density space over sub-Riemannian manifold with the $L^2$ sub-Riemannian Wasserstein metric. We call it sub-Riemannian density manifold (SDM). We study the dynamical behavior of the degenerate Fokker-Planck equation as gradient flows in SDM. Our derivation builds an equivalence relation between Gamma z calculus and second-order calculus in SDM.