I have always said that solar works best as distributed energy. As long as it's not through force of government, solar roofs on houses, using an existing footprint, make a ton of sense.
If the usual suspects had been pushing that instead of ginormous desert solar farms, with their energy loss through long distribution networks, you could by now probably do solar roofs for the same cost as good quality comp roofs.
Energy loss in distribution is pretty minimal. If you can locate the panels somewhere even minutely better (better sun, cheaper land that letd you throw up a couple more panels, etc.) it will be worth it.
It depends what you optimize for, like always. But I don't think rooftop solar is actually efficient compared to solar farms. If the goal is to generate a fraction of our energy by solar, rooftop is maybe a small part of that but would be a terrible way to go about it.
The idea of rooftop solar is to use space that's otherwise available (your roof) and therefore cheap. The problem is nobody's roof is optimized for the angle, so there's a guaranteed steep loss there vs. a dedicated solar farm (50% is not out of the question). Then there's the quality of panels themselves, maintenance of them (dirty panels can easily lose another 50%), and the conversion efficiency of the small homeowner (read:cost-optimized) inverters is probably a tick worse than a grid scale inverter. So it really makes sense only if you are out of cheap land. You can stick solar panels a lot of places that are otherwise worthless for farming, building or anything else. So I don't think rooftop solar really competes with solar farms at all. They make sense if the individual with the panels can make some money off of them, but I think most people who think they are making money off their solar panels are bad at math and accounting. So that leaves the independence effect of generating your own power. If the panels give you some limited grid independence then they don't have to make money...grid independence is worth money all by itself (look at what gensets cost). I know people that have solar+battery setups as a replacement for a standby genset and they seem very good alternative if you have the space for the panels. I've never penciled out net-metering that makes any sense to me though.
In the category of putting panels in otherwise unused space, I'd rather see more solar farms over parking lots. Parking lots are a tragic waste of space. If you could park under the solar panels it would give shaded parking and walking plus basically open up whole fields that we could blanket with solar panels nearby. It might still be more efficient to park them in the desert though. The US southwest is one of the very best places on the planet for solar.