1. GetFrontBufferData does not recommended to use as it slow.
2. You are getting screen into system memory and what for you copy it back to the texture?
3. You copy via Locking which is not good.
To solve your issues see:
This API
D3DXLoadSurfaceFromSurface usd to copy from one surface to another at any surface loacation and colorspace conversion due that it maybe slow. In case if the surfaces are both on GPU memory used
StretchRect method - but see the remarks to that method they are important. If you need update surface on texture from system memory and the texture on GPU used
UpdateSurface. To get surface of the texture used
GetSurfaceLevel method of the texture.
Related to the screen capture see my answer here:
Taking Screenshot using DirectX9[
^]
Regards,
Maxim.