Samsung have a built-in Hardware Module test feature that you can use to check various aspects of your devices hardware.
Go to your phone's keypad and enter...
*#0*#
This will atomatically take you to Samsung's very useful hardware test screen, (
Fig: #1), and allows you to check various aspects of your phone's hardware.
Now select, "
Sensor", and you are taken to the Sensor menu, (
Fig: #2), which offers under, "
Gyroscope Sensor", offers 4 further test options to check-out your gyroscope.
(
Fig: #3) shows the results for just one of the tests to see if your gyroscope is working correctly and that your hardware is O.K.
Fig: #1 Hardware Test Screen
Fig: #2 Sensor Menu
Fig: #3 Results from one of the 4 tests
This should help determine whether your issue is hardware related and requiring a repair or a software issue that you can track down yourself.
Hope that helps!