Bug 4797 - [mga] DRM for MGA broken since 2005-Aug-04.
Summary: [mga] DRM for MGA broken since 2005-Aug-04.
Status: RESOLVED FIXED
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/other (show other bugs)
Version: DRI git
Hardware: All Linux (All)
: high normal
Assignee: Ian Romanick
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 4508
  Show dependency treegraph
 
Reported: 2005-10-17 22:14 UTC by Ian Romanick
Modified: 2005-11-01 21:40 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Almost fix AGP problems in MGA DRM. (14.10 KB, patch)
2005-10-17 23:01 UTC, Ian Romanick
no flags Details | Splinter Review
Almost fix AGP problems in MGA DRM, take 2. (15.10 KB, patch)
2005-10-18 15:18 UTC, Ian Romanick
no flags Details | Splinter Review
/var/log/messages with attachment #3586 (65.70 KB, text/plain)
2005-10-18 15:19 UTC, Ian Romanick
no flags Details
Acquire AGP and allocate AGP memory, take 3 (16.46 KB, patch)
2005-11-02 14:57 UTC, Ian Romanick
no flags Details | Splinter Review

Description Ian Romanick 2005-10-17 22:14:29 UTC
Unbeknownst to me, the MGA DRM has been broken since August 4th (yes, over two
months).  The MGA is the only driver that allocates the AGP region from within
the DRM instead of from user space (via a DRM ioctl).  The net result is that
dev->agp->memory doesn't get initialized.  Changes made to drm_addmap on August
4th make this an error condition.

A fix is in progress.
Comment 1 Ian Romanick 2005-10-17 22:14:55 UTC
Reassigning to myself.
Comment 2 Ian Romanick 2005-10-17 23:01:16 UTC
Created attachment 3573 [details] [review]
Almost fix AGP problems in MGA DRM.

Converts the remaining drm_agp_foo functions to be a drm_agp_foo and
drm_agp_foo_ioctl pair.  Modifies the MGA DRM to use the drm_agp_foo functions
instead of the drm_foo_agp functions.  The drm_foo_agp functions are no longer
exported by drm.ko.

The bsd-core side of things will also need these (or similar) changes applied.

When this patch was applied (with some conflicts) to a '-D "20050804 23:59
GMT"' DRM check out, everything worked correctly.  However, against current
CVS, everything seems to work fine in the kernel, but I get the following error
message in Xorg.0.log:

(EE) MGA(0): [drm] Failed to map DMA buffers list
Comment 3 Ian Romanick 2005-10-17 23:05:06 UTC
Adding 'Option "ForcePciDma" "TRUE"' to xorg.conf with attachment #3573 [details] [review] causes
direct render to be enabled.  However, the glxgears window is all black.  There
are obviously still some problems.
Comment 4 Ian Romanick 2005-10-18 15:18:51 UTC
Created attachment 3586 [details] [review]
Almost fix AGP problems in MGA DRM, take 2.

This patch includes everything of the previous patch, but it also makes sure
that dma->seg_count and dma->page_count are properly set in
drm_addbufs_{agp,sg,fb}.  drm_addbufs_pci was already correct.

Direct rendering is now enabled in the AGP case, but it's still not right.  The
Linux VM *kills* any direct rendering apps that run.
Comment 5 Ian Romanick 2005-10-18 15:19:59 UTC
Created attachment 3587 [details]
/var/log/messages with attachment #3586 [details] [review]

Output of /var/log/messages of starting X and running glxgears when attachment
#3586 [details] [review] is applied.
Comment 6 Matthias Haase 2005-11-01 06:52:10 UTC
(In reply to comment #0)
> Unbeknownst to me, the MGA DRM has been broken since August 4th (yes, over two
> months).

Vanilla kernels > 2.6.12 crashes here xorg (6.8.2) and Matrox G400 always: "EE
MGA(0): [dri] Idle timed out, resetting engine...". The crash occurs if glxgears
is executed. Exec of glxinfo doesn't crash xorg and shows direct rendering as
enabled.

Currently I have to switch back to kernel 2.6.11.12, this one works with the
same kernel config/xorg combination without any problem. Is there any patch on
top of 2.6.14?

Regards from Germany
                   Matthias


Comment 7 Ian Romanick 2005-11-01 14:07:20 UTC
It looks like the commit of version 1.65 of linux-core/drm_bufs.c is responsible
for breaking PCI MGA.
Comment 8 Dave Airlie 2005-11-01 18:42:00 UTC
(In reply to comment #6)
> (In reply to comment #0)
> > Unbeknownst to me, the MGA DRM has been broken since August 4th (yes, over two
> > months).
> 
> Vanilla kernels > 2.6.12 crashes here xorg (6.8.2) and Matrox G400 always: "EE
> MGA(0): [dri] Idle timed out, resetting engine...". The crash occurs if glxgears
> is executed. Exec of glxinfo doesn't crash xorg and shows direct rendering as
> enabled.
> 
> Currently I have to switch back to kernel 2.6.11.12, this one works with the
> same kernel config/xorg combination without any problem. Is there any patch on
> top of 2.6.14?

Can you try 2.6.14? I fixed a number of issues with MGA before 2.6.14 went out..
but not with MGA PCI.

Dave.
Comment 9 Matthias Haase 2005-11-02 00:24:13 UTC
(In reply to comment #8)
> (In reply to comment #6)
> > (In reply to comment #0)
> > > Unbeknownst to me, the MGA DRM has been broken since August 4th (yes, over two
> > > months).
> > 
> > Vanilla kernels > 2.6.12 crashes here xorg (6.8.2) and Matrox G400 always: "EE
> > MGA(0): [dri] Idle timed out, resetting engine...". The crash occurs if glxgears
> > is executed. Exec of glxinfo doesn't crash xorg and shows direct rendering as
> > enabled.
> > 
> > Currently I have to switch back to kernel 2.6.11.12, this one works with the
> > same kernel config/xorg combination without any problem. Is there any patch on
> > top of 2.6.14?
> 
> Can you try 2.6.14? I fixed a number of issues with MGA before 2.6.14 went out..
> but not with MGA PCI.

Dave...

...yes, because I have seen these changes in the Changelog I've tried 2.6.14
last week: Without distinction :-( The G400 card resides in an AGP-Slot, using
IRQ 11, the kernel is compiled for SMP always, the server comes with two PIII
CPU's at 1,00 gHz per CPU. IO-APIC is used.

$ cat /proc/interrupts says on kernel 2.6.11.12 (as I said, no probs there with
DRI):
           CPU0       CPU1
  0:     773469     751432    IO-APIC-edge  timer
  1:       1411       1115    IO-APIC-edge  i8042
  2:          0          0          XT-PIC  cascade
  8:          1          0    IO-APIC-edge  rtc
  9:          0          0    IO-APIC-edge  acpi
 10:        732         84   IO-APIC-level  EMU10K1
 11:     149525          1   IO-APIC-level  eth0, mga@pci:0000:01:00.0
 12:      21780      18458    IO-APIC-edge  i8042
 14:     101359      96633   IO-APIC-level  aic7xxx, uhci_hcd, uhci_hcd, uhci_hcd
 15:          6          1   IO-APIC-level  tmscsim
NMI:          0          0
LOC:    1524674    1524700
ERR:          0
MIS:          0

Regards
      Matthias
Comment 10 Ian Romanick 2005-11-02 11:52:52 UTC
(In reply to comment #4)

> Direct rendering is now enabled in the AGP case, but it's still not right.  The
> Linux VM *kills* any direct rendering apps that run.

I've tracked this down to mga_draw_triangle (in
src/mesa/drivers/dri/mga/mgatris.c).  After calling mgaAllocDmaLow, the pointer
returned is not accessable by the process.

After I discovered that, I verified that each of
mmesa->mgaScreen->bufs->list[].address was not accessable.  I thought the whole
point of calling drmMapBufs was to get accessable pointers.

This *only* happens if the buffers are in AGP memory.  If I put back the
virt_to_bus call in the kernel, PCI mode works perfectly.

So now I'm not sure whether the problem lies in the MGA DRM or in the
client-side driver (or the DDX?).  My guess is that DRM isn't doing something
that it should do.  Suggestions?
Comment 11 Ian Romanick 2005-11-02 12:18:30 UTC
(In reply to comment #10)

> So now I'm not sure whether the problem lies in the MGA DRM or in the
> client-side driver (or the DDX?).  My guess is that DRM isn't doing something
> that it should do.  Suggestions?

The problem is definitely in the kernel somewhere.  If I add 'Option
"OldDmaInit" "TRUE"' to my xorg.conf everything works correctly.  There's
obviously a step being missed in the kernel that used to be done by the DDX.  Ugh...
Comment 12 Ian Romanick 2005-11-02 14:57:08 UTC
Created attachment 3685 [details] [review]
Acquire AGP and allocate AGP memory, take 3

This patch does everything that patch #3586 does, but it also makes sure that
mga_do_agp_dma_bootstrap correctly sets agp_buffer_token.  This seems to fix
all the problems with the MGA DRM on AGP cards on Linux.

Are similar changes needed for BSD?
Comment 13 Ian Romanick 2005-11-02 16:40:40 UTC
I have committed attachment #3685 [details] [review], and I am closing this bug.  I will submit
another bug for the PCI DMA issue.


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.