r3/4/5 drm cleanup

 UPDATE: I’ve pushed this to drm master.

The radeon drm did not do the right thing in all cases for r3xx based chips since it was initially reverse engineered.  I’ve gone through and started fixing up the deltas between r1/2xx and r3/4/5xx.  Users with IGP chips should test as well (especially RS4xx XPRESS chips).  If you had an XPRESS chip that used to lock immediately when the DRI was enabled, please test.  Note that some XPRESS chips default to DRI=false for just this reason.  If you have one of these chips, please try this branch and set: Option "DRI" "TRUE" in the device section of your xorg.conf.

The code is on the r345-cleanup branch of my drm tree:

http://gitweb.freedesktop.org/?p=users/agd5f/drm.git;a=summary

11 Responses to “r3/4/5 drm cleanup”

  1. sebos69 Says:

    I’ve just tested this branch, and I still have lockups such as:

    http://bugs.freedesktop.org/show_bug.cgi?id=14892

  2. a_villacis Says:

    I have partial success with XPRESS 200M (RC410). Screen comes up normally, and glxgears works, but compiz does not work (white screen until compiz manually killed, then xserver keeps working normally).

    glxinfo reports the following:

    [alex@srv64 ~]$ glxinfo
    name of display: :0.0
    Warning, xpress200 detected.
    display: :0 screen: 0
    direct rendering: Yes
    server glx vendor string: SGI
    server glx version string: 1.2
    server glx extensions:
    GLX_ARB_multisample, GLX_EXT_visual_info, GLX_EXT_visual_rating,
    GLX_EXT_import_context, GLX_EXT_texture_from_pixmap, GLX_OML_swap_method,
    GLX_SGI_make_current_read, GLX_SGIS_multisample, GLX_SGIX_hyperpipe,
    GLX_SGIX_swap_barrier, GLX_SGIX_fbconfig, GLX_MESA_copy_sub_buffer
    client glx vendor string: SGI
    client glx version string: 1.4
    client glx extensions:
    GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context,
    GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_allocate_memory,
    GLX_MESA_copy_sub_buffer, GLX_MESA_swap_control,
    GLX_MESA_swap_frame_usage, GLX_OML_swap_method, GLX_OML_sync_control,
    GLX_SGI_make_current_read, GLX_SGI_swap_control, GLX_SGI_video_sync,
    GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer,
    GLX_SGIX_visual_select_group, GLX_EXT_texture_from_pixmap
    GLX version: 1.2
    GLX extensions:
    GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_import_context,
    GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_swap_control,
    GLX_MESA_swap_frame_usage, GLX_OML_swap_method, GLX_SGI_make_current_read,
    GLX_SGI_video_sync, GLX_SGIS_multisample, GLX_SGIX_fbconfig
    OpenGL vendor string: DRI R300 Project
    OpenGL renderer string: Mesa DRI R300 20060815 x86/MMX/SSE2 NO-TCL
    OpenGL version string: 1.3 Mesa 7.1
    OpenGL extensions:
    GL_ARB_depth_texture, GL_ARB_fragment_program, GL_ARB_imaging,
    GL_ARB_multisample, GL_ARB_multitexture, GL_ARB_texture_border_clamp,
    GL_ARB_texture_compression, GL_ARB_texture_cube_map,
    GL_ARB_texture_env_add, GL_ARB_texture_env_combine,
    GL_ARB_texture_env_crossbar, GL_ARB_texture_env_dot3,
    GL_MESAX_texture_float, GL_ARB_texture_mirrored_repeat,
    GL_ARB_texture_rectangle, GL_ARB_transpose_matrix,
    GL_ARB_vertex_buffer_object, GL_ARB_vertex_program, GL_ARB_window_pos,
    GL_EXT_abgr, GL_EXT_bgra, GL_EXT_blend_color,
    GL_EXT_blend_equation_separate, GL_EXT_blend_func_separate,
    GL_EXT_blend_logic_op, GL_EXT_blend_minmax, GL_EXT_blend_subtract,
    GL_EXT_clip_volume_hint, GL_EXT_compiled_vertex_array, GL_EXT_convolution,
    GL_EXT_copy_texture, GL_EXT_draw_range_elements,
    GL_EXT_gpu_program_parameters, GL_EXT_histogram, GL_EXT_multi_draw_arrays,
    GL_EXT_packed_pixels, GL_EXT_polygon_offset, GL_EXT_rescale_normal,
    GL_EXT_secondary_color, GL_EXT_separate_specular_color,
    GL_EXT_stencil_two_side, GL_EXT_stencil_wrap, GL_EXT_subtexture,
    GL_EXT_texture, GL_EXT_texture3D, GL_EXT_texture_edge_clamp,
    GL_EXT_texture_env_add, GL_EXT_texture_env_combine,
    GL_EXT_texture_env_dot3, GL_EXT_texture_filter_anisotropic,
    GL_EXT_texture_lod_bias, GL_EXT_texture_mirror_clamp,
    GL_EXT_texture_object, GL_EXT_texture_rectangle, GL_EXT_vertex_array,
    GL_APPLE_packed_pixels, GL_ATI_blend_equation_separate,
    GL_ATI_texture_env_combine3, GL_ATI_texture_mirror_once,
    GL_IBM_rasterpos_clip, GL_IBM_texture_mirrored_repeat,
    GL_INGR_blend_func_separate, GL_MESA_pack_invert, GL_MESA_ycbcr_texture,
    GL_MESA_window_pos, GL_NV_blend_square, GL_NV_light_max_exponent,
    GL_NV_texture_rectangle, GL_NV_texgen_reflection, GL_NV_vertex_program,
    GL_OES_read_format, GL_SGI_color_matrix, GL_SGI_color_table,
    GL_SGIS_generate_mipmap, GL_SGIS_texture_border_clamp,
    GL_SGIS_texture_edge_clamp, GL_SGIS_texture_lod, GL_SGIX_depth_texture,
    GL_SUN_multi_draw_arrays

    Messages seen on Xorg.0.log:

    (–) RADEON(0): Chipset: “ATI Radeon XPRESS 200 5A61 (PCIE)” (ChipID = 0×5a61)
    (–) RADEON(0): Linear framebuffer at 0×00000000d8000000
    (II) RADEON(0): PCI card detected
    (II) RADEON(0): Legacy BIOS detected
    (WW) RADEON(0): Direct rendering for RN50/RC410/RS485/R600 forced on — This is NOT officially supported at the hardware leve
    l and may cause instability or lockups
    drmOpenDevice: node name is /dev/dri/card0
    drmOpenDevice: open result is 10, (OK)
    drmOpenByBusid: Searching for BusID pci:0000:01:05.0
    drmOpenDevice: node name is /dev/dri/card0
    drmOpenDevice: open result is 10, (OK)
    drmOpenByBusid: drmOpenMinor returns 10
    drmOpenByBusid: drmGetBusid reports pci:0000:01:05.0
    (II) RADEON(0): [dri] Found DRI library version 1.3.0 and kernel module version 1.28.0
    (II) RADEON(0): Direct rendering experimental on RS400/Xpress 200 enabled
    (==) RADEON(0): Page Flipping disabled

    Later on:

    (==) RADEON(0): Using 24 bit depth buffer
    (II) RADEON(0): RADEONInitMemoryMap() :
    (II) RADEON(0): mem_size : 0×04000000
    (II) RADEON(0): MC_FB_LOCATION : 0×3fff3e00
    (II) RADEON(0): MC_AGP_LOCATION : 0xffffffc0
    (II) RADEON(0): Depth moves disabled by default
    (II) RADEON(0): CP in BM mode
    (II) RADEON(0): Using 8 MB GART aperture
    (II) RADEON(0): Using 1 MB for the ring buffer
    (II) RADEON(0): Using 2 MB for vertex/indirect buffers
    (II) RADEON(0): Using 5 MB for GART textures
    (II) RADEON(0): Memory manager initialized to (0,0) (1920,4369)
    (II) RADEON(0): Reserved area from (0,1200) to (1920,1202)
    (II) RADEON(0): Largest offscreen area available: 1920 x 3167
    (II) RADEON(0): Will use front buffer at offset 0×0
    (II) RADEON(0): Will use back buffer at offset 0×8e8000
    (II) RADEON(0): Will use depth buffer at offset 0×11b2000
    (II) RADEON(0): Will use 5632 kb for textures at offset 0×1a7c000
    drmOpenDevice: node name is /dev/dri/card0
    drmOpenDevice: open result is 10, (OK)
    drmOpenDevice: node name is /dev/dri/card0
    drmOpenDevice: open result is 10, (OK)
    drmOpenByBusid: Searching for BusID pci:0000:01:05.0
    drmOpenDevice: node name is /dev/dri/card0
    drmOpenDevice: open result is 10, (OK)
    drmOpenByBusid: drmOpenMinor returns 10
    drmOpenByBusid: drmGetBusid reports pci:0000:01:05.0
    (II) [drm] DRM interface version 1.3
    (II) [drm] DRM open master succeeded.
    (II) RADEON(0): [drm] Using the DRM lock SAREA also for drawables.
    (II) RADEON(0): [drm] framebuffer handle = 0xd8000000
    (II) RADEON(0): [drm] added 1 reserved context for kernel
    (II) RADEON(0): X context handle = 0×1
    (II) RADEON(0): [drm] installed DRM signal handler
    (II) RADEON(0): [pci] 8192 kB allocated with handle 0×00000000
    (II) RADEON(0): [pci] ring handle = 0xf8e13000
    (II) RADEON(0): [pci] Ring mapped at 0xb7eb9000
    (II) RADEON(0): [pci] Ring contents 0×00000000
    (II) RADEON(0): [pci] ring read ptr handle = 0xf8f14000
    (II) RADEON(0): [pci] Ring read ptr mapped at 0xb7fc4000
    (II) RADEON(0): [pci] Ring read ptr contents 0×00000000
    (II) RADEON(0): [pci] vertex/indirect buffers handle = 0xf8f15000
    (II) RADEON(0): [pci] Vertex/indirect buffers mapped at 0xb5c69000
    (II) RADEON(0): [pci] Vertex/indirect buffers contents 0×00000000
    (II) RADEON(0): [pci] GART texture map handle = 0xf9115000
    (II) RADEON(0): [pci] GART Texture map mapped at 0xb5789000
    (II) RADEON(0): [drm] register handle = 0xfdef0000
    (II) RADEON(0): [dri] Visual configs initialized

    Still later on:

    (==) RADEON(0): Backing store disabled
    (II) RADEON(0): [DRI] installation complete
    (II) RADEON(0): [drm] Added 32 65536 byte vertex/indirect buffers
    (II) RADEON(0): [drm] Mapped 32 vertex/indirect buffers
    (II) RADEON(0): [drm] dma control initialized, using IRQ 21
    (II) RADEON(0): [drm] Initialized kernel GART heap manager, 5111808
    (WW) RADEON(0): DRI init changed memory map, adjusting …
    (WW) RADEON(0): MC_FB_LOCATION was: 0×3fff3e00 is: 0×3fff3e00
    (WW) RADEON(0): MC_AGP_LOCATION was: 0xffffffc0 is: 0×41ff4000
    (II) RADEON(0): RADEONRestoreMemMapRegisters() :
    (II) RADEON(0): MC_FB_LOCATION : 0×3fff3e00 0×3fff3e00
    (II) RADEON(0): MC_AGP_LOCATION : 0×41ff4000
    (II) RADEON(0): Direct rendering enabled
    (II) RADEON(0): XAA Render acceleration unsupported on Radeon 9500/9700 and newer. Please use EXA instead.
    (II) RADEON(0): Render acceleration disabled
    (II) RADEON(0): RADEONEngineInit: num pipes is 3
    (II) RADEON(0): Using XFree86 Acceleration Architecture (XAA)

    And then (but I think it is my fault):

    drmOpenDevice: node name is /dev/dri/card0
    drmOpenDevice: open result is 11, (OK)
    drmOpenByBusid: Searching for BusID pci:0000:01:05.0
    drmOpenDevice: node name is /dev/dri/card0
    drmOpenDevice: open result is 11, (OK)
    drmOpenByBusid: drmOpenMinor returns 11
    drmOpenByBusid: drmGetBusid reports pci:0000:01:05.0
    (EE) AIGLX error: dlsym for __driCreateNewScreen_20050727 failed (/usr/lib/dri/r300_dri.so: undefined symbol: __driCreateNewScreen_20050727)
    (EE) AIGLX: reverting to software rendering

    I have recompiled mesa, drm (with kernel drivers copied over) and xf86-video-ati, but I am still using the Fedora 8 xorg server. Newer mesa required installing dri2proto. Is there a way to test AIGLX (and therefore Compiz/Beryl) without having to recompile the entire X X server?

  3. agd5f Says:

    compiz doesn’t work on XPRESS chip at the moment anyway (due to mesa issues). You’ll need a newer xserver to use mesa from git master.

  4. agd5f » Blog Archive » R500 DRI support Says:

    […] agd5f xorg stuff « r3/4/5 drm cleanup […]

  5. givemesugar Says:

    @a_villacis: try out pushing on mesa again. david airlie has found and fixed a bug that has stopped compiz from working on x200 (rs480 and rs690). this wasn’t really targeted for your board, but you could try to see if this bug has been affecting your board as well. the patch has been pushed into mesa-git and into mesa-7.0.x and now about all distros should have build a package to enable compiz for these boards.

  6. a_villacis Says:

    @givemesugar: I have just tried that. Checked out branch “origin/mesa_7_0_branch” with the latest commit at 52fe7ea3d15d525efa0c89d0a8be8cd9067a74b7 (”mesa: free shader program data before deleting shader objects.”). I had to disable i965tex driver, but should not matter. According to the X log, the AIGLX support works correctly. However, when I try to run compiz, I get the following:
    —————————
    freedesktop.NetworkManager was not provided by any .service files
    in RADEONProbeOutputModes
    X: r300_emit.c:403: r300EmitArrays: Assertion `((inputs_bitset)[((_TNL_ATTRIB_COLOR0) / (sizeof (GLuint) * 8))] & (1 << ((_TNL_ATTRIB_COLOR0) % (sizeof (GLuint) * 8))))’ failed.
    gnome-session: Fatal IO error 104 (Conexión reinicializada por la máquina remota) on X server :0.0.
    gnome-panel: Fatal IO error 11 (Recurso no disponible temporalmente) on X server :0.0.
    gtk-window-decorator: Fatal IO error 104 (Conexión reinicializada por la máquina remota) on X server :0.0.
    nautilus: Fatal IO error 11 (Recurso no disponible temporalmente) on X server :0.0.
    nm-applet: Fatal IO error 104 (Conexión reinicializada por la máquina remota) on X server :0.0.
    —————————

    I then get a frozen screen (if init 3) or get bounced back to the login screen (if init 5). Apparently compiz makes the mesa branch trigger a failed assertion:

    src/mesa/drivers/dri/r300/r300_emit.c:403 int r300EmitArrays(GLcontext * ctx):
    assert(RENDERINPUTS_TEST(inputs_bitset, _TNL_ATTRIB_COLOR0));
    InputsRead |= 1 << VERT_ATTRIB_COLOR0;
    OutputsWritten |= 1 << VERT_RESULT_COL0;

  7. olo Says:

    Seems this r3xx got some lockups fixed, at least the one I’ve been experiencing. On my Radeon 9000PRO it was enough to leave a GL screensaver running for half an hour to get a lockup - now it’s all OK.

    Also, on a laptop (Radeon Mobility-based) I couldn’t run GLQuake for longer than half an hour - it eventually locked up. Seems that it’s gone now hopefully.

    Of course, those lockups being quite random, I cannot be completely sure…

    BTW, a there’s a small typo in the README:

    diff –git a/README b/README
    index 40f7e11..b5885ff 100644
    — a/README
    +++ b/README
    @@ -24,7 +24,7 @@ To build the device-specific kernel modules:
    cd linux-core/
    make
    cp *.ko /lib/modules/VERSION/kernel/drivers/char/drm/
    - (where VERSION is your kernel version: uname -f)
    + (where VERSION is your kernel version: uname -r)

    Or,
    cd bsd-core/

  8. olo Says:

    Indeed I’ve thoroughly tested on my laptop and desktop, and the lockups are gone.

    GL screensavers that practically guaranteed lockup after half an hour (sometimes after a couple minutes) now run smooth over long periods of couple hours.

    Good work!

  9. givemesugar Says:

    @a_villacis
    if you’re using this drm rework you’ll need to use the latest mesa drm and for that you’ll need the mesa-git version branch and not the 7.0 one. for that you’ll also need the dri2proto from git.
    so you’ll need to install
    1. dri2proto - git
    2. mesa + mesa drm - git
    3. drm rework - git
    4. xf86-video-ati - git (just to be sure that you have all the new stuff)
    after that try out compiz after setting this env variable:
    LIBGL_ALWAYS_INDIRECT=1

  10. a_villacis Says:

    @givemesugar:

    Remember, I get this when using the latest mesa git:
    (EE) AIGLX error: dlsym for __driCreateNewScreen_20050727 failed (/usr/lib/dri/r300_dri.so: undefined symbol: __driCreateNewScreen_20050727)
    (EE) AIGLX: reverting to software rendering

    So I need to rebuilt the entire X stack in order to use the latest changes.

  11. olo Says:

    Posting here since agd5f mentioned it only on the forums (http://www.phoronix.com/forums/showthread.php?t=9908):

    “The r345-cleanup branch was missing a bunch of r500 stuff that was in master. I merged the r345-cleanup branch into master earlier this week so just use drm git master. the r345-cleanup branch should be considered dead at this point”

    So the cleanup has been merged on the master drm branch (git://anongit.freedesktop.org/git/mesa/drm), no need to use r345-cleanup anymore.