Bug 110855 - gbm_bo_map fails on i915 when *map_data is not NULL before call
Summary: gbm_bo_map fails on i915 when *map_data is not NULL before call
Status: RESOLVED MOVED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: 19.0
Hardware: x86-64 (AMD64) Linux (All)
: lowest trivial
Assignee: Intel 3D Bugs Mailing List
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-07 15:09 UTC by M Stoeckl
Modified: 2019-09-25 20:33 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Test case, compile with gcc -lgbm (1.37 KB, text/plain)
2019-06-07 15:09 UTC, M Stoeckl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description M Stoeckl 2019-06-07 15:09:25 UTC
Created attachment 144477 [details]
Test case, compile with gcc -lgbm

The documentation for the function gbm_bo_map in src/gbm/main/gbm.c states that the argument void** map_data is a "Returned opaque ptr for the mapped region". Contrary to convention for a return value, if *map_data is not NULL, and the DRI i965 driver is used, then gbm_bo_map fails. 

The value of *map_data is checked by intel_map_image in src/mesa/drivers/dri/i965/intel_screen.c (line 823 in today's git master).

Debugging this (see attached test program) was made slightly more complicated by the fact that errno was set to ENODEV, after the syscall DRM_IOCTL_I915_GEM_CONTEXT_CREATE failed on the first call to gbm_bo_map .
Reading kernel sources implies that this probably only happens for <gen6 intel GPUs.
Comment 1 Tapani Pälli 2019-06-10 07:52:42 UTC
(In reply to M Stoeckl from comment #0)
> Created attachment 144477 [details]
> Test case, compile with gcc -lgbm
> 
> The documentation for the function gbm_bo_map in src/gbm/main/gbm.c states
> that the argument void** map_data is a "Returned opaque ptr for the mapped
> region". Contrary to convention for a return value, if *map_data is not
> NULL, and the DRI i965 driver is used, then gbm_bo_map fails. 
> 
> The value of *map_data is checked by intel_map_image in
> src/mesa/drivers/dri/i965/intel_screen.c (line 823 in today's git master).

Notably this happens with gallium drivers as well as the same check is done in dri2_map_image (src/gallium/state_trackers/dri/dri2.c) so the bug is against all drivers. I'm not sure why the check is there, AFAICT dri interface does not document anything special on such case.
Comment 2 GitLab Migration User 2019-09-25 20:33:38 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/1817.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.