Spirit and Opportunity get commands from Earth, but some of the commands are fairly complex. New in the missions a couple years ago is a "go and touch" command. In this command, the rover is told to go to a certain rock and touch it with the arm. It saves a whole day over "go to the rock", because then you don't know if you are in range to then do something with it or have to move a little more. To perform a "go and touch" command, the rover has to avoid obstacles, and judge distances, do the arm stuff, and sense the results. So the path isn't preplanned, the computer on the rover has to map the rocks and stuff, plot a path, and execute it, sensing unforeseen events and obstacles on the way.
The rovers also have software that allow them to take lots of images, and recognize dust devils and other "interesting" features, so that those images can be given priority for transmission back to Earth. Transmission is slow, and not everything makes it.
So the answer is a little of both.