Click to See Complete Forum and Search --> : Accessing VRAM from User application
svs123
April 8th, 2003, 09:25 AM
Hello,
I have some queries
1. Is it possible to directly access Video RAM from User Application?
2. If not, How to read/write data directly to Video RAM ?
When searched, I found that certain IOCTLs ( like IOCTL_VIDEO_MAP_VIDEO_MEMORY ) available for Video RAM access. But It seems that these IOCTL are being used by the video driver. Can we have access to these IOCTLs and How?
Can you provide some clue as to how we can go ahead.
Regards
Sandeep
willchop
April 8th, 2003, 12:53 PM
DirectDraw API will give you a pointer to a display surface which
is not far removed from the actual vram memory (if not the same
thing entirely).
regards, willchop
edit: not sure about the ioctrl stuff. I wouldn't be suprised if it
is ring0 level code.
svs123
April 9th, 2003, 02:26 AM
Hello!!
Thank you for your reply.
I have one more question.
Does DirectDraw allow the application to get the whole of the VRAM or just a part of it? Can the full VRAM be tested by writing data to it and then reading it back?
Sandeep
Gabriel Fleseriu
April 9th, 2003, 02:59 AM
Originally posted by svs123
Does DirectDraw allow the application to get the whole of the VRAM or just a part of it? Can the full VRAM be tested by writing data to it and then reading it back?
DirectDraw is not meant to be used like that. DD can allocate "surfaces" and place them into VRAM -- if there is enough VRAM. And supposing that you manage to fill the entire VRAM with test values: do you realize how your screen is going to look like?
svs123
April 9th, 2003, 03:38 AM
hello!!
My actual requirement is to test the VRAM by witing and reading data on it.. The data is text and I do not care about how it looks on screen..
I got a suggestion that DirectX alows you to access the VRAM directly (from user application).
If anyone has any other option could you please let me know. If anyone has any sample code with which I can start off, please provide teh link..
Any help would be highly appreciated.
regards,
Sandeep
willchop
April 9th, 2003, 07:37 AM
If you go to the MS website you can download the DirectX SDK
and/or the docs. The docs have plenty of code examples and I
recall that the SDK does come with some actual example
programs.
Also, keep in mind that VRAM doesn't represent just on-screen
memory. DirectDraw (as well as OGL) has the concept of off-
screen VRAM buffer(s). This type of VRAM can be used by your
code for bench marking tests without any visual side-effects
(as long as you don't blit/flip it to the on-screen buffer).
regards, willchop
svs123
April 18th, 2003, 07:11 AM
Thank you for your answer.
I am now able to get the total video memory which is free and total video memory in the system by using function IDirectDraw::GetCaps().
I am now able to get the pointer of the surface by using DDSURFACEDESC2 structure and IDirectDrawSurface::Lock(). I have locked the surface using the function IDirectDrawSurface::Lock(), and then went on to write data in the surface till total memory. i.e. I am filling the total video memory with my data. The data is also seen on the screen. But after the screen is completely filled, the screen can be refreshed again by pressing alt+tab and again ALT+TAB (or if the screen is refreshed by some other event). My question is if I have locked the surface how does the screen get refreshed?
I have written the data in blocks of 4 KB.
I am reading the data back and then comparing it. If I increase the size of data to be written from 4K to 5K then my compare fails. Even if I increase the data size to 8k (to see if it has to do something with page size) then too, the compare fails..
Can anyone tell me why 4096 so special?
I also need advise on feasibility of following:
While writing data on whole of VRAM can I show the data written on anypart of VRAM on the screen in a window?
Can anyone help me out?
Regards,
Sandeep
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.