XXXTentacion's legion of fans might be shocked by the baby news his mom dropped, but it wouldn't have been a surprise to him -- he knew weeks ago.
Sources close to the rapper tell TMZ ... X's girlfriend -- whom he'd been dating for months -- is the mystery baby mama. We're told the ultrasound photo shared by X's mother, Cleopatra Bernard, is definitely the girlfriend's.
As we reported ... Cleopatra posted the sonogram with the caption, "He left us a final gift."
Based on the womb snapshot, taken April 23, X's gf was just over 8 weeks along back then -- so, she's about 4 months pregnant now. That also means the due date is somewhere around mid-November.
We're told the gf is definitely not his ex, Geneva -- and the only reason X hadn't revealed the news is because he wanted her to have a stress-free pregnancy.