Graphics card memory usage in linux - linux

What tools are available to monitor graphics card memory usage in linux?

NVIDIA PerfKit has a linux version which allows real-time monitoring of various graphics card properties, including graphics card memory usage. Obviously, this only works for NVIDIA graphics cards, and it also requires the use of a special instrumented driver.

If you just need to know it for 3D graphics development purposes, you may want to look into something like gDEBugger or, if you only care about NVIDIA cards, you can try NVIDIA PerfHUD. I have not used them myself, but I would expect them to track such information.

Related

How can VBE be implemented as bios function agnostic to graphics card?

I'm currently learning about low level computing like bootloader and kernel, and stumbled on vesa bios extension, the standard for graphics display controller.
But after reading some documents about it, I'm not sure how BIOS, developed by motherboard manufacturer, can configure / utilize graphics card which is completely independant from them.
I'm aware about VGA which also turned out to graphics standard available with BIOS function, but it has specific IO ports dedicated for certain functions that every VGA compatible graphics card also have. I'm not really sure about this, but I think that BIOS functions for VGA actually utilize these ports to provide functions like switching modes, etc.
However Super-VGA, which kinda is reason VBE was created, as far as I know, does not have any standarlized port or MMIO for extended features. And so does VBE (At least I couldn't find any documentation about IO port or MMIO).
Since video card nowadays came up with even more proprietary ways to communicate with CPU and usually offers graphics driver binary hiding implementation details, I can't imagine how BIOS extension can offer unified way of utilizing video card.
Thanks for reading.
The VBE standard isn't really agnostic to graphics cards. It is a BIOS interface so it doesn't give much details about how the firmware implementing the BIOS needs to access the graphics card. You can find a link to the VBE 3.0 standard on the Wikipedia page for VBE. In the standard, it states:
The VBE standard defines a set of extensions to the VGA ROM BIOS services. These functions can be accessed under DOS through interrupt 10h, or be called directly by high performance 32-bit applications and operating systems other than DOS.
These extensions also provide a hardware-independent mechanism to obtain vendor information, and serve as an extensible foundation for OEMs and VESA to facilitate rapid software support of emerging hardware technology without sacrificing backwards compatibility.
What I understand here is that it isn't the way to interact with the card from software that is standardized. Instead, VBE standardizes how to find the information to know how to interact with the card. Then, the mobo manufacturer writes code that uses this information to implement the standardized BIOS interface that your OS uses to show graphics on your screen.
Most of the time, your OS doesn't use the discrete GPU for graphics. Instead, it uses the integrated GPU in the CPU to kickstard the OS until it can detect the proprietary driver to use the more powerful discrete GPU.
During installation, it can use the integrated GPU and automatically use vendor web APIs to search for the proper driver for your discrete GPU and install it in the background while you are using the computer. It might ask you to reboot after its installation if it is needed.
More recent discrete GPUs are PCI-Express so their mechanism to detect the type of card and the vendor is standardized and a list of vendors and type of devices is maintained by PCI-SIG group a non-profit organization maintaining PCI. This mechanism is MMIO like you mentionned so you read some standard registers mapped in main memory and they return IDs that you can compare to the public device/vendor lists from PCI-SIG. After this, it comes down to the driver model of the OS and its mechanisms to support generic drivers (drivers that you can use even though you don't know how they work). The most common type on Linux for graphics is the character device but, AFAIK there are others. The integrated CPU graphics cards are often very open because their interface are available for download free of charge from corresponding vendors like Intel or AMD.
You can read my answer at https://cs.stackexchange.com/questions/149203/how-bits-translated-into-text-on-the-screen/149215#149215 for some more information. You can also read some of my other answers. The information I give is probably not 100% accurate but it is a good starting point to gather more precise/accurate information from actual standards and documentation (some of them might not be free or even quite costly like PCI which can cost thousands). Anyway, don't be scared to dig in the actual standards. They are not as hard to read as people think especially if you are only looking for a general knowledge about how it works. You can probably just skim the documents and get a proper high-level overview.

How to debug graphics driver in linux?

I am new to linux kernel debugging. I have a radeon graphics card and I am doing some graphics driver development for my embedded system. Before making a custom driver for another radeon card, I want to know how the graphics driver behaves in linux. I have studied a bit on DRM, GEM/TTM, KMS, Framebuffers; but I want to see them actually happening on linux systems. I have Ubuntu system with kernel 3.10.x
I want to debug the driver and see the following. Please help how to do it.
How to access framebuffer and see what is currently being drawn. (This is more of a curiosity)
Wish to see how TTM and GART tables are maintained and interpret them(any link would also help) and KMS as my display is DVI-D
How DMA is playing role here. Can I begin without DMA (over PCI for time being etc..)
Minimal device driver requirement to draw some raw pixels on screen
Unlike linux, devices in my embedded system are not treated as files. So need to understand them and reinterpret them for my system.
Plan is to make Mesa over it. Just I am in the beginning stage. So any help would be appreciated.
Thanks

Is JavaFX 2.2 going to support GPU acceleration in Linux?

I've been experimenting with JavaFX, and I've found out that as of 2.2.0.b15, it uses GPU to provide improved font rendering. This makes a big difference for me. I intend to use it for visualization and animated UI features, so I'd like to know if GPU support will be provided in Linux.
I have come accross many statements that say that JavaFX will use my GPU if it is supported, and it does, but only under Windows. I have not seen anything about hardware acceleration for graphics under Linux, so I'm curious, can I expect to have this with 2.2 release?
I believe JavaFX for Linux already supports hardware acceleration for some features based on this statement from the JavaFX 2.1 Linux Develop Preview Release Notes:
3D features are supported for Nvidia cards (proprietary drivers only).
Not entirely conclusive, as it does not explicitly mention hardware acceleration, but I think use of hardware acceleration is likely if you have the appropriate Nvidia card and driver installed. Potentially, over time, hardware acceleration support under Linux for other hardware and driver configurations may be added.

Can I run CUDA on Intel's integrated graphics processor?

I have a very simple Toshiba Laptop with i3 processor. Also, I do not have any expensive graphics card. In the display settings, I see Intel(HD) Graphics as display adapter. I am planning to learn some cuda programming. But, I am not sure, if I can do that on my laptop as it does not have any nvidia's cuda enabled GPU.
In fact, I doubt, if I even have a GPU o_o
So, I would appreciate if someone can tell me if I can do CUDA programming with the current configuration and if possible also let me know what does Intel(HD) Graphics mean?
At the present time, Intel graphics chips do not support CUDA. It is possible that, in the nearest future, these chips will support OpenCL (which is a standard that is very similar to CUDA), but this is not guaranteed and their current drivers do not support OpenCL either. (There is an Intel OpenCL SDK available, but, at the present time, it does not give you access to the GPU.)
Newest Intel processors (Sandy Bridge) have a GPU integrated into the CPU core. Your processor may be a previous-generation version, in which case "Intel(HD) graphics" is an independent chip.
Portland group have a commercial product called CUDA x86, it is hybrid compiler which creates CUDA C/ C++ code which can either run on GPU or use SIMD on CPU, this is done fully automated without any intervention for the developer. Hope this helps.
Link: http://www.pgroup.com/products/pgiworkstation.htm
If you're interested in learning a language which supports massive parallelism better go for OpenCL since you don't have an NVIDIA GPU. You can run OpenCL on Intel CPUs, but at best you can learn to program SIMDs.
Optimization on CPU and GPU are different. I really don't think you can use Intel card for GPGPU.
Intel HD Graphics is usually the on-CPU graphics chip in newer Core i3/i5/i7 processors.
As far as I know it doesn't support CUDA (which is a proprietary NVidia technology), but OpenCL is supported by NVidia, ATi and Intel.
in 2020 ZLUDA was created which provides CUDA API for Intel GPUs. It is not production ready yet though.

Need suggestions for system wide profiler for an embedded linux device

I would like to profile my embedded linux device for various actions (e.g. touch input on screen, flip a page in a news reading app etc). But the requirement is that the profiler should generate information for the entire software stack on the device both user space and kernel space. It would be best if the profiler does not include a significant overhead for logging purposes as memory and resources are very limited on the embedded linux device.
Any suggestions ?
Have you tried OProfile?
It supports several hardware architectures and I believe that it is included in the latest mainline kernels. It can also profile both the userspace and the kernel itself.

Resources