[Mesa-dev] [PATCH] loader: Get driver name from udev hwdb when available

Eric Anholt eric at anholt.net
Tue Jan 21 12:26:14 PST 2014


Kristian Høgsberg <krh at bitplanet.net> writes:

> The udev hwdb is a mechanism for applying udev properties to devices at
> hotplug time.  The hwdb text files are compiled into a binary database
> that lets udev efficiently look up and apply properties to devices that
> match a given modalias.
>
> This patch exports the mesa PCI ID tables as hwdb files and extends the
> loader code to try to look up the driver name from the DRI_DRIVER udev
> property.  The benefits to this approach are:
>
>  - No longer PCI specific, any device udev can match with a modalias can
>    be assigned a DRI driver.
>
>  - Available outside mesa; writing a DRI2 compatible generic DDX with
>    glamor needs to know the DRI driver name to send to the client.
>
>  - Can be overridden by custom udev rules.

Looks really good.  Just a couple little bugs I see.

> diff --git a/src/loader/Makefile.am b/src/loader/Makefile.am
> index 371dd57..bf3918b 100644
> --- a/src/loader/Makefile.am
> +++ b/src/loader/Makefile.am
> @@ -44,3 +44,18 @@ libloader_la_LIBADD += \
>  endif
>  
>  libloader_la_SOURCES = $(LOADER_C_FILES)
> +
> +
> +noinst_PROGRAMS = dump-hwdb
> +dump_hwdb_SOURCES = dump-hwdb.c
> +dump_hwdb_CPPFLAGS = -I$(top_srcdir)/include

Looks like this is being built for the target, not the host (where it
will be executed).

> +dist_udevhwdb_DATA = 20-dri-driver.hwdb
> +
> +# Update hwdb on installation. Do not bother if installing
> +# in DESTDIR, since this is likely for packaging purposes.
> +install-data-hook:
> +	-test -n "$(DESTDIR)" || udevadm hwdb --update

It looks like this will error out your build if not installing as root.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140121/f4a9acad/attachment.pgp>


More information about the mesa-dev mailing list