From owner-freebsd-x11@freebsd.org Thu Apr 13 01:44:40 2017 Return-Path: Delivered-To: freebsd-x11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD33BD3A423 for ; Thu, 13 Apr 2017 01:44:40 +0000 (UTC) (envelope-from davshao@gmail.com) Received: from mail-qk0-x22b.google.com (mail-qk0-x22b.google.com [IPv6:2607:f8b0:400d:c09::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 925F0B23 for ; Thu, 13 Apr 2017 01:44:40 +0000 (UTC) (envelope-from davshao@gmail.com) Received: by mail-qk0-x22b.google.com with SMTP id f133so37838034qke.2 for ; Wed, 12 Apr 2017 18:44:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=gYa5aIyNOP9a1Mrg5yRChLaClNkBWMlahKK0qUJl6pA=; b=dGYhOvxTwI/O6dPsjBRvum3TVxqHI6hgmqGGO4QLuh3zLiP0/JizgDXEOkKQq0iwwB nJp398ukBj6ASJytcgbihkkZ0M8uFgjQSdoS/fH88dLFnYIjKGKGfpSIu8lzBedQIn0Z +7ergA2nj1z0mSHMmq2jXqPsIebDxR9sHghLPH8HSogWafN5/Krd3bZ3TGbSN54eaPuy epuW/pfrdh0NQSyw0wcZ4Pm6ExlRwnjsw1qBUTapV9VWIMchaSf+uA5kxugeJNJghfk2 qnD3kuYbH0zfsW6Jy6RXj3lF9WwjYAB+t9LCNusORd/20yvHqcyPGI9XNbr31N5l0G3g IeNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=gYa5aIyNOP9a1Mrg5yRChLaClNkBWMlahKK0qUJl6pA=; b=HlfdTs7ieZvspmcLbYEp2i0uklJ67qQ3Du9Ni/j+FPxXT2TTu9DXqs3SX6GcEp8lk+ VmPiwj9LUgGEU52UIrolw8Etf9ZNLuv6JFdN1v8sZmKc4MWN42m+H/avjOuj1TaMUb63 nsBN5bTsYeHtn9hDk3sDup9cmHTzPSluDBDzxtV9bdzFaiFsoXEbTDjKtFlCsQvyXrX0 sbcE6GIIYbPYDQhXzeR/esWHTQcZtRhad9zH7uu7F4dA9em6rnIxJj9vCGxliylPxXWc OkR9AQ6LDL2stw5kUuWMmZh0OeiqQpOmmCaiZ2xeKD4lJRyuN3NKsCg63ZhyPYeQUSA9 WxXA== X-Gm-Message-State: AN3rC/4Q2Z27nLEuN4B2pAM9K416gkOFBLrv1VvSdyVWQUYsoeXQ0trb SjfuCmkgdtPjRFss3cPn9RPQ5pq572I4 X-Received: by 10.55.142.69 with SMTP id q66mr490423qkd.13.1492047879358; Wed, 12 Apr 2017 18:44:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.146.80 with HTTP; Wed, 12 Apr 2017 18:44:39 -0700 (PDT) From: David Shao Date: Wed, 12 Apr 2017 18:44:39 -0700 Message-ID: Subject: Might want to test whether HDMI audio works for Radeon video cards To: freebsd-x11@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-x11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: X11 on FreeBSD -- maintaining and support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Apr 2017 01:44:41 -0000 drm-next users at least with Radeon cards with HDMI out should see if HDMI audio works. Several years ago there was a mailing list discussion amd64 panic snd_hda - hdac_get_capabilities: Invalid corb size (0) https://lists.freebsd.org/pipermail/freebsd-current/2010-July/018764.html At the time the original poster was not able to get the HDMI audio device to completely attach. But using a custom DragonFly kernel with Linux 4.7.10 radeon audio patches (radeon_audio.c, radeon_audio.h and anything relevant updated) and an updated userland including mesa 7 and xorg server 1.19.3, I am able to get HDMI audio to work with a Gigabyte Radeon R7 240 video card. DragonFly does not load sound drivers by default so it might be best to turn off default loading. startx with xfce4 # kldload snd_hda dmesg ends with something like: [drm] Initialized radeon 2.40.0 20080528 hdac0: mem 0xf7f10000-0xf7f13fff irq 22 at device 27.0 on pci0 hdac0: link ctrl 0x800 hdac0: disable nosnoop hdac1: mem 0xf7e60000-0xf7e63fff irq 17 at device 0.1 on pci2 hdac1: link ctrl 0x2800 hdac1: disable nosnoop hdacc0: at cad 0 on hdac0 hdaa0: at nid 1 on hdacc0 hdacc1: at cad 0 on hdac1 hdaa1: at nid 1 on hdacc1 pcm0: at nid 28,34,25,35,29 and 26,30,27 on hdaa0 pcm1: at nid 32 on hdaa0 pcm2: at nid 33 on hdaa0 pcm3: at nid 3 on hdaa1 # sysctl hw.snd.default_unit=3 hw.snd.default_unit: 0 -> 3 fire up firefox, go to youtube and listen to whatever. So someone should check for FreeBSD drm-next whether the following patches are necessary for Radeon HDMI audio to work, because it SHOULD now work, and if it doesn't it needs to and can be fixed. diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c index d63843a10f..2178243f88 100644 --- a/sys/dev/sound/pci/hda/hdac.c +++ b/sys/dev/sound/pci/hda/hdac.c @@ -488,7 +488,15 @@ hdac_get_capabilities(struct hdac_softc *sc) else { device_printf(sc->dev, "%s: Invalid corb size (%x)\n", __func__, corbsize); - return (ENXIO); + if (1) { + device_printf(sc->dev, "Resetting corb size to 256\n"); + sc->corb_size = 256; + corbsize = + HDAC_CORBSIZE_CORBSIZE(HDAC_CORBSIZE_CORBSIZE_256); + HDAC_WRITE_1(&sc->mem, HDAC_CORBSIZE, corbsize); + } + else + return (ENXIO); } rirbsize = HDAC_READ_1(&sc->mem, HDAC_RIRBSIZE); @@ -504,7 +512,15 @@ hdac_get_capabilities(struct hdac_softc *sc) else { device_printf(sc->dev, "%s: Invalid rirb size (%x)\n", __func__, rirbsize); - return (ENXIO); + if (1) { + device_printf(sc->dev, "Resetting rirb size to 256\n"); + sc->rirb_size = 256; + rirbsize = + HDAC_RIRBSIZE_RIRBSIZE(HDAC_RIRBSIZE_RIRBSIZE_256); + HDAC_WRITE_1(&sc->mem, HDAC_RIRBSIZE, rirbsize); + } + else + return (ENXIO); } HDA_BOOTVERBOSE( @@ -1211,6 +1227,8 @@ hdac_attach(device_t dev) if (result != 0) goto hdac_attach_fail; + hdac_reset(sc, 1); + /* Get Capabilities */ result = hdac_get_capabilities(sc); if (result != 0)