Rick,
If your bedroom TV area is a shelf between 2 sets of upper cabinets and by wall, you mean the interior of that outside wall behind the shelf, then you are talking about 1/8" - 1/4" of luan, then block foam, then the exterior wall. I'd say use nothing greater than 1.75" to be safe.
That said, the block foam will not likely bear much weight with conventional screws. Better to use those drywall type anchors with the 1/2" coarse threads and a hole in the center of them for a screw.
When the factory mounts a TV there, they screw a vertical cleat onto the ends of those two cabinets. Those cleats are angled slightly inward at the top to give the TV some downward pitch. Then a carpeted board is screwed to the cleats. The TV we supply is mounted to that board.
Jim