I am getting quite confused with the purpose of gamma correction and the relationship between gamma corrected and uncorrected images in terms of graphics and photography as well as color management in general (conversion from linear RGB to gamma-corrected RGB spaces and then displaying it on the screen).
From many sources, mainly http://www.guillermoluijk.com/article/gamma/index.htm and question #23026151 at StackOverflow (Do I need to gamma correct the final color output on a modern computer/monitor?), I've come to the conclusion that:
Gamma correction was originally designed to compensate for CRT monitors' non-linear response to input signal. CRTs were not able to amplify the input signal themselves and thus the output signal from the PC needed to be adjusted giving rise to (as of today) standard gamma 2.2 correction and sRGB color space.
Modern screens, however, do not suffer from the signal loss like CRTs did. They too may show some non-linearities but given that the input signal is most often carried by only 8 bits per channel (256 shades), they should be able to compensate for some non-linearities in their color reproduction themselves as they are probably capable of reproducing more than 256 shades in one channel. This would mean that gamma correction along with sRGB and all gamma-corrected color spaces are just a heritage from the CRT era and its only purpose was to display input signal linearly.
There are also articles claiming that gamma correction is here to compensate for non-linearity of human vision (CambridgeInColour.com - Understanding gamma correction) which should roughly correspond to the gamma curve as we are capable of spotting small differences in darker shades but don't do so well with brighter ones (the brightness of a point must grow exponentially for it to appear brighter). This is not how camera sensors record the scene. Raw data from a sensor are obtained in linear RGB and developed into gamma-corrected RGB color space (shadows raised and lights darkened). Gamma correction was meant to compensate for output signal loss though, so what I believe modern screens do is they simply simulate the behaviour of CRTs to cancel gamma correction out and display the scene just like it was captured by the camera - roughly speaking, mapping camera shades 1:1 to the screen ones. Well, I cannot see any compensation effect regarding human vision here, since the output signal is again linear.
Does it then mean that every shade in whatever RGB color space should have exactly the same RGB values in every other RGB space including linear RGB (e.g. #010A1F in sRGB translates exactly to #010A1F in linear RGB in terms of storage in a bitmap file with 8bpc) and it is only up to the screen and graphics adapter how they arrange the color transfer and whether either side has to perform any additional recomputations in order to convert the image to destination color space? In other words, changing color space in a graphics editor has in fact nothing to do with the RGB values themselves, only takes note of the new color space in image metadata? I believe this is not the case because color management as such would be rendered useless where digital graphics adapter/screen interface is used - the graphics adapter could simply send plain RGB data regardless of the color space used as no analog gain (gamma) would be applied to the values which go on a linear scale from 0 to 255. Also the gamut of different color profiles would be the same if no rounding errors were introduced, or?
My last bit of confusion comes possibly from the misunderstanding of color profile conversion and the table of exposure levels (the first one) in the article http://www.guillermoluijk.com/article/superhdr/index.htm (can be translated using Google Translate). Do I understand it correctly that the linear values are transformed using an exponential function (or inverse gamma), shrinking the tonal range towards shadows and thus darkening the image? Is this what happens if we save linear RGB and present it as a gamma-corrected image to the computer screen?
I apologise for asking such a complex question but it proves very hard to find a really good source of information explaining all the uncertainties that arise. Thank you in advance for any answer that may help correct my misunderstanding.