CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2001
    Posts
    45

    Accessing VRAM from User application

    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

  2. #2
    Join Date
    Aug 2002
    Location
    VA, USA
    Posts
    137
    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.
    Last edited by willchop; April 8th, 2003 at 12:56 PM.

  3. #3
    Join Date
    Jun 2001
    Posts
    45

    Can DirectDraw test the whole of VRAM by readuing and writing data into it?

    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

  4. #4
    Join Date
    Jun 2001
    Location
    Switzerland
    Posts
    4,443

    Re: Can DirectDraw test the whole of VRAM by readuing and writing data into it?

    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?
    Gabriel, CodeGuru moderator

    Forever trusting who we are
    And nothing else matters
    - Metallica

    Learn about the advantages of std::vector.

  5. #5
    Join Date
    Jun 2001
    Posts
    45
    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

  6. #6
    Join Date
    Aug 2002
    Location
    VA, USA
    Posts
    137
    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

  7. #7
    Join Date
    Jun 2001
    Posts
    45
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured