On 23 December 2016 at 17:49, Thierry Reding <thierry.reding@xxxxxxxxx> wrote: > From: Thierry Reding <treding@xxxxxxxxxx> > > ARM SoCs usually have their DRM/KMS devices on the platform bus, so add > support for that to enable these devices to be used with the drmDevice > infrastructure. > > NVIDIA Tegra SoCs have an additional level in the hierarchy and DRM/KMS > devices can also be on the host1x bus. This is mostly equivalent to the > platform bus. > > Signed-off-by: Thierry Reding <treding@xxxxxxxxxx> > --- > Note that we could probably get away with treating host1x as platform > bus. However, they are technically two different busses in the kernel > and hence we may want to make use of that differentiation later on. > Admittedly there's no clear cut either way, but I'm inclined to have host1x as platform. I'm leaning towards that since there is no /sys/bus/host1x (afaict), plus otherwise devices (like imx-vpu/vc4) will end with their own bus type. > +static int drmParsePlatformBusInfo(int maj, int min, drmPlatformBusInfoPtr info) > +{ > + char path[PATH_MAX + 1], *name; > + > + snprintf(path, PATH_MAX, "/sys/dev/char/%d:%d/device", maj, min); > + > + name = sysfs_uevent_get(path, "OF_FULLNAME"); > + strcpy(info->fullname, name); > + free(name); > + Let's be extra careful and ensure that we don't overrun (and properly terminate) the fixed size fullname[]. > + return 0; > +} > + > +static int drmParsePlatformDeviceInfo(int maj, int min, > + drmPlatformDeviceInfoPtr info) > +{ > + /* XXX fill in platform device info */ > + Not 100% sure what exactly we should consider bus and what device info, either way an empty struct is not going to go well. As a food for thought, here is some info for imx/etna and vc4. cat /sys/dev/char/226\:*/device/uevent DRIVER=etnaviv OF_NAME=gpu-subsystem OF_FULLNAME=/gpu-subsystem OF_COMPATIBLE_0=fsl,imx-gpu-subsystem OF_COMPATIBLE_N=1 MODALIAS=of:Ngpu-subsystemT<NULL>Cfsl,imx-gpu-subsystem DRIVER=imx-drm OF_NAME=display-subsystem OF_FULLNAME=/display-subsystem OF_COMPATIBLE_0=fsl,imx-display-subsystem OF_COMPATIBLE_N=1 DRIVER=vc4-drm OF_NAME=gpu OF_FULLNAME=/soc/gpu OF_COMPATIBLE_0=brcm,bcm2835-vc4 OF_COMPATIBLE_N=1 MODALIAS=of:NgpuT<NULL>Cbrcm,bcm2835-vc4 Thanks Emil _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel