PowerVR SDK setup for Native code compiling

Hi!

I’m trying to setup PowerVR on my windows PC so that I can compile Native Code. But I’m facing issues. I have tried following:

  1. Downloaded .exe SDK installer for PowerVR from official website on Windows.
  2. Built Native_SDK from source(github repo) on Ubuntu 20.04.

Bot the methods seemed to be succesful to me, but I couldn’t compile the code(pasted below) by any of the 2 setups.

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/pvr.h>

int main(int argc, char** argv) {

    int fd = open("/dev/pvrsrvkm", O_RDWR);

    // Query the number of cores on the GPU
    unsigned int num_cores;
    int ret = ioctl(fd, PVR_GET_NUM_CORES, &num_cores);

    printf("Number of cores: %u\n", num_cores);

    // Query the GPU clock frequency
    unsigned int gpu_freq;
    ret = ioctl(fd, PVR_GET_GPU_FREQ, &gpu_freq);

    printf("GPU frequency: %u MHz\n", gpu_freq);

    // Close the file descriptor
    close(fd);

    return 0;
}

Also,

  1. I couldn’t find this file /dev/pvrsrvkm on my device.
  2. Couldn’t find linux/pvr.h either in any of my header definitions.
  3. Couldn’t find PVR_GET_NUM_CORES or PVR_GET_GPU_FREQ either in the downloaded/built_From_source files on either machines(Windows and Ubuntu).

Can someone help me out please, what did I miss. Maybe if there is some blog or something that describes setting the SDK step by step.
Thanks!

Hi bloodhound,

Thanks for your message. You can find the latest SDK samples release in our git hub repository GitHub - powervr-graphics/Native_SDK: C++ cross-platform 3D graphics SDK. Includes demos & helper code (resource loading etc.) to speed up development of Vulkan, OpenGL ES 2.0 & 3.x applications

Regarding your questions:

  • 1. I couldn’t find this file /dev/pvrsrvkm on my device.
    That folder is usually present in /sys/module on devices that have a PowerVR GPU.

  • 2. Couldn’t find linux/pvr.h either in any of my header definitions.
    I am not aware of that header, what OS, device and GPU are you targeting?

  • 3. Couldn’t find PVR_GET_NUM_CORES or PVR_GET_GPU_FREQ either in the downloaded/built_From_source files on either machines(Windows and Ubuntu).
    I am not aware PVR_GET_NUM_CORES nor PVR_GET_GPU_FREQ. Usually developers query through a graphics API like OpenGL ES or Vulkan the GPU model and its supported features and plan their application and workloads based on that information.

Best regards,
Alejandro

Hi Alejandro!
Thanks for replying.

I’m actually trying to get the setup for my Android device. I want to setup the SDK either on Windows(preferred) or Ubuntu, whatever works.
Plus the code shown was from ChatGPT actually, I forgot to mention it there. In some of the codes, ChaptGPT said, that I would find the driver at /dev/dri/card0, and this file is present too, but I don’t know how I can interact with that either. Where can I find any header files/definitions that I can use to compile the code and later run on my device?

Regards

Hi bloodhound,

The SDK comes with instructions on how to build for Windows, Linux and Android. It is self included so you do not need any extra resources.

Please follow the instructions under Native_SDK/BUILD.md at master · powervr-graphics/Native_SDK · GitHub and remember you need to clone the repository in order to have all the submodules with the dependencies needed cloned as well. If you just download the project as a .zip file it won’t work as the submodules will be missing.

Best regards,
Alejandro