My code for Graphics Memory & Screen Size for Virtual Desktop

Discussion in 'PlayOnLinux' started by walkfar60, May 5, 2016.

  1. walkfar60

    walkfar60 New Member

    Joined:
    May 4, 2016
    Messages:
    25
    Likes Received:
    4
    Trophy Points:
    3
    Hey folks,

    Heres some useful code you can insert in your scripts for Graphics Memory & Virtual Desktop settings.

    # Set up a virtual desktop routine (not tested on any other computer!)
    read RES_X RES_Y <<<$(xdpyinfo | awk -F'[ x]+' '/dimensions:/{print $3, $4}')

    # Set Virtual Desktop to computers screen resolution
    Set_Desktop "On" "$RES_X" "$RES_Y"
    POL_Wine_X11Drv "GrabFullscreen" "Y"

    # Graphic Card Memory Routine (not tested on any other computer!)

    VARVMS=$(lspci -v -s `lspci | awk '/VGA/{print $1}'` | sed -n '/Memory.*, prefetchable/s/.*\[size=\([^]]\+\)\]/\1/p')

    VARVMS=${VARVMS//[!0-9]/}

    POL_Wine_Direct3D "VideoMemorySize" "$VARVMS"
  2. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    Where do I put this code in PlayOnLinux?
    Or is it a script?
  3. walkfar60

    walkfar60 New Member

    Joined:
    May 4, 2016
    Messages:
    25
    Likes Received:
    4
    Trophy Points:
    3
    They are code snippets to be added into a script.

    The VARVMS=$(lspci -v -s `lspci | awk '/VGA/{print $1}'` | sed -n '/Memory.*, prefetchable/s/.*\[size=\([^]]\+\)\]/\1/p')
    can also be typed into a bash terminal as is, then type into the terminal:

    echo $VARVMS

    This will print the result to the terminal in Linux (not sure about MAC)

    See this page which will explain how I obtained the info. for video card memory:
    http://www.cyberciti.biz/faq/howto-find-linux-vga-video-card-ram/
  4. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    So you run this script once, or do you have to run it each time you launch PlayOnLinux?
    What else can this memory fix affect in Linux?

    Thanks for posting this by the way
  5. walkfar60

    walkfar60 New Member

    Joined:
    May 4, 2016
    Messages:
    25
    Likes Received:
    4
    Trophy Points:
    3
    This is'nt a memory fix. It's just a way of obtaining information on your video card memory. When I was given this computer I had no information about it's specifications and all the hardware utilities I have used in linux fail to supply this information for some reason. After hours of searching I found this site on the web (see above) which gave me the information on how to get the information. This gave me the info I required for putting some code which I discovered on yet another site and bringing it all together in the code snippet above. I had to add a final line of code to remove the 'M' from the number so that the variable I named VARVMS could properly be set in the windows registry. Phew!
  6. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    Are you willing to do a step-by-step guide? I can post it in our Guides (Other) forum
  7. walkfar60

    walkfar60 New Member

    Joined:
    May 4, 2016
    Messages:
    25
    Likes Received:
    4
    Trophy Points:
    3
    Okay this is a long-winded way of obtaining the information about your video graphics card memory in Linux (not sure about unix in Mac)

    1. The command 'lspci' should work for obtaining the hardware of your computer type this into your consul/terminal.


    2. The command 'lspci' is a utility for displaying information about all PCI buses in the system and all devices connected to them.

    3. Below is an example output from the terminal/consul:
    Output:
    00:00.0 Host bridge: Intel Corporation 82845G/GL[Brookdale-G]/GE/PE DRAM Controller/Host-Hub Interface (rev 03)
    00:02.0 VGA compatible controller: Intel Corporation 82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device (rev 03)
    00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 02)
    00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 02)
    00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 02)
    00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 02)
    00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 82)
    00:1f.0 ISA bridge: Intel Corporation 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge (rev 02)
    00:1f.1 IDE interface: Intel Corporation 82801DB (ICH4) IDE Controller (rev 02)
    00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 02)
    00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 02)
    01:00.0 Network controller: RaLink RT2561/RT61 rev B 802.11g
    01:02.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
    01:02.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
    01:05.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)

    what we are looking for is marked in bold VGA if you see what I mean.

    4. This is the crucial part make a note of the number here for example I have '00:02.0'

    5. If you cannot find devices in the specified domain use following command and look for your display card name and memory field:

    lspci -v | less


    7. Now we need to use string called devices in the specified domain – 00:02.0 VGA ):

    lspci -v -s 00:02.0
    booman likes this.
  8. walkfar60

    walkfar60 New Member

    Joined:
    May 4, 2016
    Messages:
    25
    Likes Received:
    4
    Trophy Points:
    3
    Sorry called away now look at the line 'Memory at c0000000 (32-bit, prefetchable) [size=256M' this gives your graphics memory.

    e.g. 256M

    So we use VARVMS=$(lspci -v -s `lspci | awk '/VGA/{print $1}'` | sed -n '/Memory.*, prefetchable/s/.*\[size=\([^]]\+\)\]/\1/p')

    to essentialy look for the word 'prefetchable' and take as our variable what follows after that word to the end of line which we assign as the variable VARVMS.

    8. We now need from the variable I assigned as VARVMS to trim it to a number using the next line of code:


    VARVMS=${VARVMS//[!0-9]/}
    which strips out any non-numeric from this variable to remove the 'M' which was the last alpha-numeric letter at the end of the line in the log file which stores PCI information.

    9. Now we have only the number we can assign it to the windows registry editor for video memory:

    POL_Wine_Direct3D "VideoMemorySize" "$VARVMS"

    I not going to explain all the code '#"%^&laugh)**^&out*^"^^(loud!

    But it should provide those who don't know how much Video RAM they have with an answer.

    Test out the code like so and press return at the end of each line in a terminal/console:


    VARVMS=$(lspci -v -s `lspci | awk '/VGA/{print $1}'` | sed -n '/Memory.*, prefetchable/s/.*\[size=\([^]]\+\)\]/\1/p')

    VARVMS=${VARVMS//[!0-9]/}

    echo $VARVMS

    This should display a number which is your Video Grahic Memory.
    booman likes this.
  9. walkfar60

    walkfar60 New Member

    Joined:
    May 4, 2016
    Messages:
    25
    Likes Received:
    4
    Trophy Points:
    3
    BTW this was written in the local ale house and there may be 'Hic!..ups' here.
  10. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    Awesome! Thanks for contributing!
  11. Daerandin

    Daerandin Well-Known Member

    Joined:
    Oct 18, 2013
    Messages:
    1,157
    Likes Received:
    258
    Trophy Points:
    83
    Location:
    Northern Norway
    Home page:
    There is one problem with this method. Most nvidia gpu's (as well as AMD gpu's according to my googling) do not display correct memory size in lspci. I can use my card as an example here. My gpu is an nvidia GTX 980M. Total memory according to nvidia-settings is 4096 MB, or just 4 GB. This is also correct to the vendor where I purchased my card.

    However, lspci displays the following:

    Code:
    01:00.0 VGA compatible controller: NVIDIA Corporation GM204M [GeForce GTX 980M] (rev a1) (prog-if 00 [VGA controller])
       Subsystem: ASUSTeK Computer Inc. Device 22da
       Flags: bus master, fast devsel, latency 0, IRQ 26
       Memory at ec000000 (32-bit, non-prefetchable) [size=16M]
       Memory at c0000000 (64-bit, prefetchable) [size=256M]
       Memory at d0000000 (64-bit, prefetchable) [size=32M]
       I/O ports at e000 [size=128]
       [virtual] Expansion ROM at ed000000 [disabled] [size=512K]
       Capabilities: <access denied>
       Kernel driver in use: nvidia
       Kernel modules: nouveau, nvidia_drm, nvidia
    
    So I am afraid that parsing lspci output will not yield correct results for nvidia and amd gpu's.
    booman likes this.
  12. walkfar60

    walkfar60 New Member

    Joined:
    May 4, 2016
    Messages:
    25
    Likes Received:
    4
    Trophy Points:
    3
    booman likes this.

Share This Page