Bug 23626 - On 64bit kernel 32bit OpenGL application doesn't work
On 64bit kernel 32bit OpenGL application doesn't work
Status: RESOLVED FIXED
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/r300
git
x86-64 (AMD64) Linux (All)
: medium normal
Assigned To: Default DRI bug account
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-09-01 06:30 UTC by Krzysztof A. Sobiecki
Modified: 2009-09-14 18:12 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Output of 32bit glxinfo (15.49 KB, text/x-log)
2009-09-01 06:30 UTC, Krzysztof A. Sobiecki
Details
Output of RADEON_DEBUG=ioctl with fbotexture (2.09 KB, text/x-log)
2009-09-01 06:37 UTC, Krzysztof A. Sobiecki
Details
Output of RADEON_DEBUG=all with fbotexture (368.42 KB, text/x-log)
2009-09-01 06:38 UTC, Krzysztof A. Sobiecki
Details
Output of RADEON_DEBUG=ioctl with progs/samples/stencil (168 bytes, text/x-log)
2009-09-01 06:40 UTC, Krzysztof A. Sobiecki
Details
Output of RADEON_DEBUG=all with progs/samples/stencil (26.60 KB, text/x-log)
2009-09-01 06:40 UTC, Krzysztof A. Sobiecki
Details
Output of RADEON_DEBUG=all with 64bit version progs/samples/stencil (24.67 KB, text/x-log)
2009-09-05 07:58 UTC, Krzysztof A. Sobiecki
Details
output of glxgears32 to messages with drm.debug=1 (2.25 KB, application/x-bzip)
2009-09-14 03:55 UTC, Marc Dietrich
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Krzysztof A. Sobiecki 2009-09-01 06:30:17 UTC
Created attachment 29068 [details]
Output of 32bit glxinfo

While running 64bit kernel with enabled Radeon KMS(patched to even enable compat ioctls like michel wrote: https://bugs.freedesktop.org/show_bug.cgi?id=22271#c5 ) I'm unable tu run any 32bit OpenGL program.
All I got is "drmRadeonCmdBuffer: -14"

./fbo_firecube 
Allocating 512 x 512 radeon RBO (pitch 512)
Depth renderbuffer size = 16 bits
drmRadeonCmdBuffer: -14

Kernel:adda766193ea1cf3137484a9521972d080d0b7af
Mesa:836a9f0ae6e03d2f92dc024703015c25a5b3c353
If needed I'm willing to provide drm debug=1 log.
Comment 1 Krzysztof A. Sobiecki 2009-09-01 06:37:11 UTC
Created attachment 29069 [details]
Output of RADEON_DEBUG=ioctl with fbotexture
Comment 2 Krzysztof A. Sobiecki 2009-09-01 06:38:36 UTC
Created attachment 29070 [details]
Output of RADEON_DEBUG=all with fbotexture
Comment 3 Krzysztof A. Sobiecki 2009-09-01 06:40:10 UTC
Created attachment 29071 [details]
Output of RADEON_DEBUG=ioctl with progs/samples/stencil
Comment 4 Krzysztof A. Sobiecki 2009-09-01 06:40:39 UTC
Created attachment 29072 [details]
Output of RADEON_DEBUG=all with progs/samples/stencil
Comment 5 Krzysztof A. Sobiecki 2009-09-01 10:46:08 UTC
In dmesg I have this:
[21491.327145] [drm:radeon_cs_ioctl] *ERROR* Failed to initialize parser !
[21493.161548] [drm:radeon_cs_ioctl] *ERROR* Failed to initialize parser !
[21494.806706] [drm:radeon_cs_ioctl] *ERROR* Failed to initialize parser !
[21496.105809] [drm:radeon_cs_ioctl] *ERROR* Failed to initialize parser !
[21497.345617] [drm:radeon_cs_ioctl] *ERROR* Failed to initialize parser !
Comment 6 Krzysztof A. Sobiecki 2009-09-05 07:58:44 UTC
Created attachment 29251 [details]
Output of RADEON_DEBUG=all with 64bit version progs/samples/stencil

Only real difference I was able to spot between 32bit and 64bit version is size of drm_radeon_cmd_buffer_t. In 32bit it have 16 and 64bit have 32.
Comment 7 Marc Dietrich 2009-09-14 03:55:09 UTC
Created attachment 29511 [details]
output of glxgears32 to messages with drm.debug=1

This is the output of running glxgears (32bit) to syslog with drm.debug=1 set
Comment 8 Kevin DeKorte 2009-09-14 10:37:39 UTC
suokko on #radeon had me add a patch that basically isolated the problem down to 

drivers/gpu/drm/radeon/radeon_cs.c around line 108

 	chunk_array_ptr = (uint64_t *)(unsigned long)(cs->chunks);
 	if (DRM_COPY_FROM_USER(p->chunks_array, chunk_array_ptr,
 			       sizeof(uint64_t)*cs->num_chunks)) {
 		return -EFAULT;
 	}

he believes the ptr from userspace is invalid since that memory allocation is failing.
Comment 9 Pauli 2009-09-14 11:17:06 UTC
Problem is that user space pointers are invalid in kernel space so we have to copy and convert the data before entering kernel memory space. That is required for all pointers passed to drm.

http://www.cs.helsinki.fi/linux/linux-kernel/2002-06/1512.html has explanation about possible fails in copy.

Which means we need compat ioctl layer to handle the copy. Another option probably would be converting the user-space pointer to kernel address space but I could find how to do that.
Comment 10 Kevin DeKorte 2009-09-14 15:32:13 UTC
Airlied pushed a patch to correct this into libdrm. I believe this problem is now fixed. 
Comment 11 Krzysztof A. Sobiecki 2009-09-14 18:12:32 UTC
Yes I agree, drm commit cdd325b59a17a614b90fc2f8b388175e6d79e3cf fixed this bug.
I'm closing this bug.