I have seen this movie a couple years back and am willing to watch it again, but sadly can't remember the name of it. So I was wondering if any of you could help me identify the name of the movie.

Ok so I remember a scene where the main character I believe is in some sort of futuristic type of jail where they can see what they dream and have like these chips implanted into their brains or something. One guy was dreaming about sex and he gets woken up by a shock or something since they didn't want him dreaming about those sort of things. That is all I could remember from a couple years back.