[Mesa-dev] [PATCH 2/2] pipe-loader: Add support for render nodes v2

Jan Vesely jan.vesely at rutgers.edu
Thu Jan 30 10:55:40 PST 2014


Hi,

are these patches the last thing necessary to get CL programs running
without needing X permission? 
I tried to test them, but got:
pci id for fd 3: 1002:675d, driver r600
pci id for fd 3: 1002:675d, driver r600
radeon: Failed to get PCI ID, error number -13

which is kind of funny combination of messages.

regards,
Jan

PS: $ ls /dev/dri/
card0  controlD64  renderD128

On Thu, 2014-01-30 at 11:34 -0500, Tom Stellard wrote:
> On Tue, Jan 28, 2014 at 03:04:00PM +0100, David Herrmann wrote:
> > Hi Tom
> > 
> > On Mon, Jan 27, 2014 at 5:13 PM, Tom Stellard <tom at stellard.net> wrote:
> > > From: Tom Stellard <thomas.stellard at amd.com>
> > >
> > > v2:
> > >    - Add missing call to pipe_loader_drm_release()
> > >    - Fix render node macros
> > >    - Drop render-node configure option
> > 
> > Patch looks fine to me, but I lack mesa-insights to really comment on
> > it. But I'd like to get a feedback whether there's still any open
> > issues with render-nodes. If not, I will fix the minor-allocation-race
> > and then try to make rnodes the default in 3.15.
> >
> 
> I am in favor of enabling rnodes by default for 3.15.  I haven't notice
> any problems with them so far.
> 
> -Tom
> 
> > Thanks
> > David
> > 
> > > ---
> > >
> > > For reference, version 1 of this patch:
> > > http://lists.freedesktop.org/archives/mesa-dev/2013-October/047296.html
> > >
> > >  .../auxiliary/pipe-loader/pipe_loader_drm.c        | 80 +++++++++++++++++++++-
> > >  1 file changed, 77 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
> > > index 9484db8..7a1af91 100644
> > > --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
> > > +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
> > > @@ -49,6 +49,11 @@
> > >  #include "util/u_dl.h"
> > >  #include "util/u_debug.h"
> > >
> > > +#define DRM_RENDER_NODE_DEV_NAME_FORMAT "%s/renderD%d"
> > > +#define DRM_RENDER_NODE_MAX_NODES 63
> > > +#define DRM_RENDER_NODE_MIN_MINOR 128
> > > +#define DRM_RENDER_NODE_MAX_MINOR (DRM_RENDER_NODE_MIN_MINOR + DRM_RENDER_NODE_MAX_NODES)
> > > +
> > >  struct pipe_loader_drm_device {
> > >     struct pipe_loader_device base;
> > >     struct util_dl_library *lib;
> > > @@ -152,18 +157,87 @@ open_drm_minor(int minor)
> > >     return open(path, O_RDWR, 0);
> > >  }
> > >
> > > +static int
> > > +open_drm_render_node_minor(int minor)
> > > +{
> > > +   char path[PATH_MAX];
> > > +   snprintf(path, sizeof(path), DRM_RENDER_NODE_DEV_NAME_FORMAT, DRM_DIR_NAME,
> > > +            minor);
> > > +   return open(path, O_RDWR, 0);
> > > +}
> > > +
> > >  int
> > >  pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev)
> > >  {
> > > -   int i, j, fd;
> > > +   int i, k, fd, num_render_node_devs;
> > > +   int j = 0;
> > > +
> > > +   struct {
> > > +      unsigned vendor_id;
> > > +      unsigned chip_id;
> > > +   } render_node_devs[DRM_RENDER_NODE_MAX_NODES];
> > > +
> > > +   /* Look for render nodes first */
> > > +   for (i = DRM_RENDER_NODE_MIN_MINOR, j = 0;
> > > +        i <= DRM_RENDER_NODE_MAX_MINOR; i++) {
> > > +      fd = open_drm_render_node_minor(i);
> > > +      struct pipe_loader_device *dev;
> > > +      if (fd < 0)
> > > +         continue;
> > >
> > > -   for (i = 0, j = 0; i < DRM_MAX_MINOR; i++) {
> > > +      if (!pipe_loader_drm_probe_fd(&dev, fd, false)) {
> > > +         close(fd);
> > > +         continue;
> > > +      }
> > > +
> > > +      render_node_devs[j].vendor_id = dev->u.pci.vendor_id;
> > > +      render_node_devs[j].chip_id = dev->u.pci.chip_id;
> > > +
> > > +      if (j < ndev) {
> > > +         devs[j] = dev;
> > > +      } else {
> > > +         close(fd);
> > > +         dev->ops->release(&dev);
> > > +      }
> > > +      j++;
> > > +   }
> > > +
> > > +   num_render_node_devs = j;
> > > +
> > > +   /* Next look for drm devices. */
> > > +   for (i = 0; i < DRM_MAX_MINOR; i++) {
> > > +      struct pipe_loader_device *dev;
> > > +      boolean duplicate = FALSE;
> > >        fd = open_drm_minor(i);
> > >        if (fd < 0)
> > >           continue;
> > >
> > > -      if (j >= ndev || !pipe_loader_drm_probe_fd(&devs[j], fd, true))
> > > +      if (!pipe_loader_drm_probe_fd(&dev, fd, true)) {
> > >           close(fd);
> > > +         continue;
> > > +      }
> > > +
> > > +      /* Check to make sure we aren't already accessing this device via
> > > +       * render nodes.
> > > +       */
> > > +      for (k = 0; k < num_render_node_devs; k++) {
> > > +         if (dev->u.pci.vendor_id == render_node_devs[k].vendor_id &&
> > > +             dev->u.pci.chip_id == render_node_devs[k].chip_id) {
> > > +            close(fd);
> > > +            dev->ops->release(&dev);
> > > +            duplicate = TRUE;
> > > +            break;
> > > +         }
> > > +      }
> > > +
> > > +      if (duplicate)
> > > +         continue;
> > > +
> > > +      if (j < ndev) {
> > > +         devs[j] = dev;
> > > +      } else {
> > > +         dev->ops->release(&dev);
> > > +      }
> > >
> > >        j++;
> > >     }
> > > --
> > > 1.8.1.5
> > >
> > > _______________________________________________
> > > mesa-dev mailing list
> > > mesa-dev at lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

-- 
Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140130/91326a38/attachment.pgp>


More information about the mesa-dev mailing list