@@ -239,7 +239,20 @@ static bool nv0_register_fd(const int nv0_fd, int nvctl_fd) {
239239static bool get_device_info (const int fd , NVDriverContext * context ) {
240240 //NVIDIA driver v545.29.02 changed the devInfo struct, and partly broke it in the process
241241 //...who adds a field to the middle of an existing struct....
242- if (context -> driverMajorVersion >= 545 && context -> driverMinorVersion >= 29 ) {
242+ if (context -> driverMajorVersion >= 575 ) {
243+ struct drm_nvidia_get_dev_info_params_575 devInfo575 ;
244+ const int ret = ioctl (fd , DRM_IOCTL_NVIDIA_GET_DEV_INFO_575 , & devInfo575 );
245+
246+ if (ret != 0 ) {
247+ LOG ("get_device_info failed: %d %d" , ret , errno )
248+ return false;
249+ }
250+
251+ context -> gpu_id = devInfo575 .gpu_id ;
252+ context -> sector_layout = devInfo575 .sector_layout ;
253+ context -> page_kind_generation = devInfo575 .page_kind_generation ;
254+ context -> generic_page_kind = devInfo575 .generic_page_kind ;
255+ } else if (context -> driverMajorVersion >= 545 && context -> driverMinorVersion >= 29 ) {
243256 struct drm_nvidia_get_dev_info_params_545 devInfo545 ;
244257 const int ret = ioctl (fd , DRM_IOCTL_NVIDIA_GET_DEV_INFO_545 , & devInfo545 );
245258
@@ -534,6 +547,9 @@ bool alloc_memory(const NVDriverContext *context, const uint32_t size, int *fd)
534547 }
535548 };
536549
550+ //TODO find the proper page size
551+ imageSizeInBytes = ROUND_UP (imageSizeInBytes , 65536 );
552+
537553 struct drm_nvidia_gem_import_nvkms_memory_params params = {
538554 .mem_size = imageSizeInBytes ,
539555 .nvkms_params_ptr = (uint64_t ) & nvkmsParams ,
0 commit comments