Long-duration gamma-ray bursts (LGRBs) and ultra-LGRBs (ULGRBs) originate from collapsars, in the center of which a newborn rotating stellar-mass black hole (BH) surrounded by a massive accretion disk may form. In the scenario of BH hyperaccretion inflow-outflow model and BlandfordZnajek (BZ) mechanism to trigger gamma-ray bursts (GRBs), the real accretion rate to power a BZ jet is far lower than the mass supply rate from the progenitor star. The characteristics of the progenitor stars can be constrained by GRB luminosity observations, and the results exceed usual expectations.LGRBs lasting from several seconds to tens of seconds in the rest frame may originate from solar-metallicity (Z ∼ 1 Z ⊙ , where Z and Z ⊙ are the metallicities of progenitor stars and the Sun), massive (M 34 M ⊙ , where M and M ⊙ are the masses of progenitor stars and the Sun) stars or some zero-metallicity (Z ∼ 0) stars. A fraction of low-metallicity (Z 10 −2 Z ⊙ ) stars, including Population III stars, can produce ULGRBs such as GRB 111209A. The fraction of LGRBs lasting less than tens of seconds in the rest frame is more than 40%, which cannot conform to the fraction of the demanded type of progenitor star. It possibly implies that the activity timescale of central engine may be much longer than the observed timescale of prompt emission phase, as indicated by X-ray late-time activities. Alternatively, LGRBs and ULGRBs may be powered by a millisecond magnetar central engine.