See Rashi there (on Yoma 22b), the last two Rashis on the page.
Rashi explains this, for Shaul, that in both these incidents, he sent the message that he was not worthy of kingship. מפני. שמחתילת מלכותו מחל על כבודו וגילה על עצמו שאינו כדאי למלוך. In the first instance, they did not bring him a mincha, and he overlooked his honor. In the second instance, people asked whether he was worthy to be king, and he did not punish them.
From the very beginning of his kingship, מחתילת מלכותו, he assumed this attitude. (I would add to the two incidents mentioned by the gemara an additional two incidents: when he hid among the luggage when first being appointed; and when he did not successfully insist to the people that they wait for Shmuel for the sacrifice, a failure for which Hashem stripped him of kingship.) He did not assume the honor of kingship.
For Shaul, then, perhaps besides being a punishment from On High, this is a natural consequence of not comporting himself in a kingly manner and assuming the mantle of rulership.
For David, this was not at the start of his rule but an incident much later on (II Shmuel 16:10), in the rebellion of his son Avshalom. He was already established in his kingly role. Also, this wasn't a general character flaw in his approach to kingship.
Update: Also, you might find this relevant. David was not all-forgiving. While he was forgiving at the time, he instructed Shlomo (I Melachim 2:8-9) to find a way to punish Shimi ben Gera.