  Let p > 2 be prime. We state and prove (under mild hypotheses on the residual
representation) a geometric refinement of the Breuil-M\'ezard conjecture for
2-dimensional mod p representations of the absolute Galois group of Qp. We also
state a conjectural generalisation to n-dimensional representations of the
absolute Galois group of an arbitrary finite extension of Qp, and give a
conditional proof of this conjecture, subject to a certain R = T-type theorem
together with a strong version of the weight part of Serre's conjecture for
rank n unitary groups. We deduce an unconditional result in the case of
two-dimensional potentially Barsotti-Tate representations.
