I have a Liquid Crystal on Silicon Spatial Light Modulator (LCOS SLM) by Hamamatsu Photonics, which is basically a 1280 x 1024 pixel screen with a DVI connection to my graphics card. It can display 8bit grayscale images, i.e. with pixel values from 0 to 255.
I am using the WINAPI function SetDIBitsToDevice() to draw a pre-calculated 1280 x 1024 8bit device-independent bitmap (DIB) on the SLM (with the correct header and everything). My implementation in python using ctypes goes like this:
def draw(data: numpy.array): # data has dtype=numpy.uint8 and lies in memory like a standard C-array in 8bit format, row-major order
data_p = data.ctypes.data_as(ctypes.c_void_p) # pointer to data of C-type void*
SetDIBitsToDevice(SLM_HDC, # display context of screen
0, 0, 1280, 1024, # fill whole screen
0, 0, 0, 1024, # draw whole data-array
data_p, pbmi, 0) # pbmi is a ctypes.POINTER(BITMAPINFO), i.e. of C-type BITMAPINFO*
More implementation details can be found in my answer to this question, if you are interested. For an example you can run on any computer with 2 screens, download from my dropbox, adjust screen resolution in display test file and run it. The point is that it works, both on regular LCD monitors in the office and on the SLM.
But: On the SLM, I have measured a delay of > 70 msec before the screen even starts updating. The expected maximum delay due to 60Hz DVI frequency and 120Hz SLM frequency is 1/(60Hz) + 1/(120Hz) = 25 msec. All I am doing in python are the two lines of code in the above function; everything else is precalculated and static. Can you see any programming reason that would cause more than 40 msec delay? I am hoping that I am making some stupid mistake and someone can point it out.
P.S. I have had difficulty reaching Hamamatsu's tech support, so I haven't been able to ask a specialist.