  The electronic structure of Ba$_2$Ti$_2$Fe$_2$As$_4$O, a newly discovered superconductor, is investigated using first-principles calculations based on local density approximations. Multiple Fermi surface sheets originating from Ti-3$d$ and Fe-3$d$ states are present corresponding to the conducting Ti$_2$As$_2$O and Fe$_2$As$_2$ layers respectively. Compared with BaFe$_2$As$_2$, sizeable changes in the related Fermi surface sheets indicate significant electron transfer (about 0.12$e$) from Ti to Fe, which suppresses the stripe-like antiferromagnetism at the Fe sites and simultaneously induces superconductivity. Our calculations also suggest that an additional N\'{e}el-type antiferromagnetic instability at the Ti sites is relatively robust against the electron transfer, which accounts for the anomaly at 125 K in the superconducting Ba$_2$Ti$_2$Fe$_2$As$_4$O. 
Self-doping effect and possible antiferromagnetism at titanium-layers in   the iron-based superconductor Ba$_2$Ti$_2$Fe$_2$As$_4$O