It looks like he has got the eyelid caught in something given the sudden yelp, inflammstion and hair loss. Alternatively it may be a lump but if it has suddenly appeared this is less likely. I would advise having it checked by the vet to rule out anything serious given the proximity to his eye. He will benefit from an antinflammatory even if it is a simple wound as it looks sire and swollen.