You are not logged in.

#1 2017-09-25 16:51:52

lnxsurf
Member
Registered: 2014-05-28
Posts: 68

Vulkan and my graphicscard

Hello,
I have a ultrabook where I have a Intel as integrated GPU and a Nvidia as discrete GPU.
When I enumerate my devices, I expected to see two devices listed but it was only one.

#include <vulkan/vulkan.h>
#include <iostream>
#include <stdexcept>
#include <string>
#include <vector>

VkApplicationInfo infoAboutApplication() {
  VkApplicationInfo appInfo{};

  appInfo.pApplicationName = "Devices in Vulkan";
  appInfo.applicationVersion = 1;
  appInfo.apiVersion = VK_MAKE_VERSION(1, 0, 0);

  appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
  return appInfo;
}

VkInstance establishNewVulkanApp() {
  VkApplicationInfo appInfo = infoAboutApplication();
  VkInstanceCreateInfo createInfo{};
  createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
  createInfo.pApplicationInfo = &appInfo;

  VkInstance instance;
  VkResult created = vkCreateInstance(&createInfo, nullptr, &instance);
  if (created != VK_SUCCESS) {
    throw std::runtime_error("Could not establish a Vulkan Instance.");
  }
  return instance;
}

std::vector<VkPhysicalDevice> enumeratePhysicalDevices(VkInstance vulkan) {
  uint32_t numberOfDevices;
  VkResult result = vkEnumeratePhysicalDevices(vulkan, &numberOfDevices, nullptr);
  if (result != VK_SUCCESS) {
    throw std::runtime_error("Could not enumerate Physical Devices.");
  }
  std::vector<VkPhysicalDevice> devices(numberOfDevices);
  vkEnumeratePhysicalDevices(vulkan, &numberOfDevices, devices.data());
  return devices;
}

VkPhysicalDeviceProperties getPhysicalDeviceProperties(VkPhysicalDevice device) {
  VkPhysicalDeviceProperties properties{};
  vkGetPhysicalDeviceProperties(device, &properties);
  return properties;
}

std::ostream& operator<< (std::ostream &os, VkPhysicalDeviceProperties &properties) {
  os << "Physical Properties of: " << properties.deviceName << ", " 
     << properties.deviceID << ", " << properties.vendorID << std::endl;
  os << "API version: " << properties.apiVersion << std::endl;
  os << "Device type: ";
  if (properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_OTHER) {
    os << "Other";
  } else if (properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU) {
    os << "Integrated GPU";
  } else if (properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) {
    os << "Discrete GPU";
  } else if (properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU) {
    os << "Virtual GPU";
  } else { // VK_PHYSICAL_DEVICE_TYPE_CPU
    os << "CPU";
  }
  return os;
}

int main(int argc, char **argv) {
  auto vulkan = establishNewVulkanApp();
  auto devices = enumeratePhysicalDevices(vulkan);
  for (auto &dev : devices) {
    auto properties = getPhysicalDeviceProperties(dev);
    std::cout << properties << std::endl;
  }

  return 0;
}

The output is

Xlib:  extension "NV-GLX" missing on display ":0".
WARNING: Ivy Bridge Vulkan support is incomplete
Physical Properties of: Intel(R) Ivybridge Mobile, 358, 32902
API version: 4194358
Device type: Integrated GPU

Do I need to reinstall a nvidia driver or a special one?

Edit:
I have installed the package intel-vulkan

Last edited by lnxsurf (2017-09-25 17:35:18)

Offline

#2 2017-09-27 11:56:34

unixman
Member
Registered: 2015-03-12
Posts: 64

Re: Vulkan and my graphicscard

hi. Maybe your nVidia is not vulkan capable or you forget to install its vulkan-driver.

Offline

#3 2017-09-27 18:22:22

lnxsurf
Member
Registered: 2014-05-28
Posts: 68

Re: Vulkan and my graphicscard

Hi,
On my ultrabook that is a hybrid card.

lspci | grep -i nvidia
01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GT 640M LE] (rev a1)

pwd && ls
/usr/share/vulkan/icd.d
intel_icd.x86_64.json  nvidia_icd.json

and here the content of nvidia_icd.json

{
    "file_format_version" : "1.0.0",
    "ICD": {
        "library_path": "libGLX_nvidia.so.0",
        "api_version" : "1.0.49"
    }
}

Offline

#4 2017-09-28 09:20:53

unixman
Member
Registered: 2015-03-12
Posts: 64

Re: Vulkan and my graphicscard

Just a wild guess;  it shows only about the card which is currently IN USE. (an implementation bug?)

Try to disable intel one(like as unload its kernel module etc.) and put nvidia one in use then try again.

Offline

#5 2017-10-15 11:58:16

lnxsurf
Member
Registered: 2014-05-28
Posts: 68

Re: Vulkan and my graphicscard

Sorry, I hadn't much time in the past...

I tried this URL (but without success):
https://wiki.archlinux.org/index.php/Vulkan

lspci -k | grep -A 2 -E "(VGA|3D)"
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
	Subsystem: Acer Incorporated [ALI] 3rd Gen Core processor Graphics Controller
	Kernel driver in use: i915
--
01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GT 640M LE] (rev a1)
	Subsystem: Acer Incorporated [ALI] GK107M [GeForce GT 640M LE]
	Kernel driver in use: nvidia

Which module should I unload?

lsmod | grep -i intel
btintel                16384  1 btusb
bluetooth             479232  6 btrtl,btintel,btbcm,ath3k,btusb
intel_rapl             20480  0
intel_powerclamp       16384  0
kvm_intel             192512  0
kvm                   516096  1 kvm_intel
crc32c_intel           24576  0
ghash_clmulni_intel    16384  0
aesni_intel           184320  6
aes_x86_64             20480  1 aesni_intel
crypto_simd            16384  1 aesni_intel
glue_helper            16384  1 aesni_intel
cryptd                 20480  3 crypto_simd,ghash_clmulni_intel,aesni_intel
snd_hda_intel          36864  6
snd_hda_codec         106496  4 snd_hda_intel,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_codec_realtek
snd_hda_core           65536  5 snd_hda_intel,snd_hda_codec,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_codec_realtek
intel_cstate           16384  0
intel_rapl_perf        16384  0
snd_pcm                86016  4 snd_hda_intel,snd_hda_codec,snd_hda_core,snd_hda_codec_hdmi
snd                    73728  20 snd_hda_intel,snd_hwdep,snd_hda_codec,snd_timer,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_codec_realtek,snd_pcm
intel_gtt              20480  1 i915
agpgart                36864  2 intel_gtt,drm

I have bumblebee installed... So should I remove it to get vulkan applications run?

Offline

#6 2017-10-16 08:04:25

unixman
Member
Registered: 2015-03-12
Posts: 64

Re: Vulkan and my graphicscard

	Kernel driver in use: i915

                             ^
                             ^

lnxsurf wrote:

Which module should I unload?

lnxsurf wrote:

I have bumblebee installed... So should I remove it to get vulkan applications run?

Wiki says bumblebee not supported yet.  So it seems yes, but not sure. maybe a workaround exists.

are you try below from wiki?

export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json

Last edited by unixman (2017-10-16 08:07:43)

Offline

#7 2017-10-16 20:23:36

lnxsurf
Member
Registered: 2014-05-28
Posts: 68

Re: Vulkan and my graphicscard

are you try below from wiki?

export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json

Yes I tried but the application crashed with segmentation fault.

Here I have some config. I guess nvidia is disabled because bumblebee is installed?

$systemctl list-unit-files | grep nvidia
nvidia-persistenced.service 

$modprobe -c
blacklist nvidia
blacklist nvidia_drm
blacklist nvidia_modeset
blacklist nvidia_uvm
blacklist nouveau
blacklist nouveau
options btusb reset=1
options bonding max_bonds=0
options rcutree rcu_idle_gp_delay=1

Offline

Board footer

Powered by FluxBB