[Mesa-dev] [PATCH 12/17] gallium/r300, r600, radeonsi: add automake target 'templates'

Emil Velikov emil.l.velikov at gmail.com
Mon Sep 22 05:41:31 PDT 2014


On 22/09/14 09:29, Christian König wrote:
> Am 22.09.2014 um 01:44 schrieb Emil Velikov:
>> Rather than duplicating the libdeps, extra define... all over the
>> targets, define them only once and use when applicable.
>>
>> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> 
> Do I get it right that this also allows for relatively easy definition
> of specialized targets? E.g. what we might want to do is providing
> Ubuntu/Debian packages with only the AMD drivers compiled into a
> specialized dri_radeon.so etc...
> 
This patch makes adding/removing driver support for a target a single
liner, rather than 15+ lines of boilerplate.

Ex. Want to add radeonsi support for xvmc ? Add the following line:
include $(top_srcdir)/src/gallium/drivers/radeonsi/Automake.inc

If you're wondering on a custom/updated dri_radeon, this series may be
irrelevant as I assume that you'll enable only the relevant gallium
drivers at configure time.

Let me know if you're looking for something more elaborate and I'll see
what can be done :)

Thanks
Emil

> The patch itself looks good to be, but I'm not an expert on automake. So
> it is Acked-by: Christian König <christian.koenig at amd.com>
> 
>> ---
>>   src/gallium/drivers/r300/Automake.inc      | 18 +++++++++++++
>>   src/gallium/drivers/r600/Automake.inc      | 16 ++++++++++++
>>   src/gallium/drivers/radeonsi/Automake.inc  | 16 ++++++++++++
>>   src/gallium/targets/dri/Makefile.am        | 39
>> ++++-----------------------
>>   src/gallium/targets/egl-static/Makefile.am | 42
>> +++++-------------------------
>>   src/gallium/targets/gbm/Makefile.am        | 37
>> ++++----------------------
>>   src/gallium/targets/omx/Makefile.am        | 34
>> +++---------------------
>>   src/gallium/targets/vdpau/Makefile.am      | 36
>> +++----------------------
>>   src/gallium/targets/xvmc/Makefile.am       | 13 +++------
>>   9 files changed, 77 insertions(+), 174 deletions(-)
>>   create mode 100644 src/gallium/drivers/r300/Automake.inc
>>   create mode 100644 src/gallium/drivers/r600/Automake.inc
>>   create mode 100644 src/gallium/drivers/radeonsi/Automake.inc
>>
>> diff --git a/src/gallium/drivers/r300/Automake.inc
>> b/src/gallium/drivers/r300/Automake.inc
>> new file mode 100644
>> index 0000000..6a8d4a7
>> --- /dev/null
>> +++ b/src/gallium/drivers/r300/Automake.inc
>> @@ -0,0 +1,18 @@
>> +if HAVE_GALLIUM_R300
>> +
>> +TARGET_DRIVERS += r300
>> +TARGET_CPPFLAGS += -DGALLIUM_R300
>> +TARGET_LIB_DEPS += \
>> +    $(top_builddir)/src/gallium/drivers/r300/libr300.la \
>> +    $(RADEON_LIBS) \
>> +    $(INTEL_LIBS)
>> +
>> +if !HAVE_OPENGL
>> +TARGET_LIB_DEPS += \
>> +    $(top_builddir)/src/gallium/drivers/r300/libr300-helper.la
>> +endif
>> +
>> +TARGET_RADEON_WINSYS ?= \
>> +    $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la
>> +
>> +endif
>> diff --git a/src/gallium/drivers/r600/Automake.inc
>> b/src/gallium/drivers/r600/Automake.inc
>> new file mode 100644
>> index 0000000..014f415
>> --- /dev/null
>> +++ b/src/gallium/drivers/r600/Automake.inc
>> @@ -0,0 +1,16 @@
>> +if HAVE_GALLIUM_R600
>> +
>> +TARGET_DRIVERS += r600
>> +TARGET_CPPFLAGS += -DGALLIUM_R600
>> +TARGET_LIB_DEPS += \
>> +    $(top_builddir)/src/gallium/drivers/r600/libr600.la \
>> +    $(RADEON_LIBS) \
>> +    $(LIBDRM_LIBS)
>> +
>> +TARGET_RADEON_WINSYS ?= \
>> +    $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la
>> +
>> +TARGET_RADEON_COMMON ?= \
>> +    $(top_builddir)/src/gallium/drivers/radeon/libradeon.la
>> +
>> +endif
>> diff --git a/src/gallium/drivers/radeonsi/Automake.inc
>> b/src/gallium/drivers/radeonsi/Automake.inc
>> new file mode 100644
>> index 0000000..3f212b3
>> --- /dev/null
>> +++ b/src/gallium/drivers/radeonsi/Automake.inc
>> @@ -0,0 +1,16 @@
>> +if HAVE_GALLIUM_RADEONSI
>> +
>> +TARGET_DRIVERS += radeonsi
>> +TARGET_CPPFLAGS += -DGALLIUM_RADEONSI
>> +TARGET_LIB_DEPS += \
>> +    $(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \
>> +    $(RADEON_LIBS) \
>> +    $(LIBDRM_LIBS)
>> +
>> +TARGET_RADEON_WINSYS ?= \
>> +    $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la
>> +
>> +TARGET_RADEON_COMMON ?= \
>> +    $(top_builddir)/src/gallium/drivers/radeon/libradeon.la
>> +
>> +endif
>> diff --git a/src/gallium/targets/dri/Makefile.am
>> b/src/gallium/targets/dri/Makefile.am
>> index cf4a025..0143694 100644
>> --- a/src/gallium/targets/dri/Makefile.am
>> +++ b/src/gallium/targets/dri/Makefile.am
>> @@ -74,39 +74,9 @@ include
>> $(top_srcdir)/src/gallium/drivers/ilo/Automake.inc
>>     include $(top_srcdir)/src/gallium/drivers/nouveau/Automake.inc
>>   -if NEED_RADEON_DRM_WINSYS
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la
>> -endif
>> -
>> -if HAVE_GALLIUM_RADEON_COMMON
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/drivers/radeon/libradeon.la
>> -endif
>> -
>> -if HAVE_GALLIUM_R300
>> -MEGADRIVERS += r300
>> -STATIC_TARGET_CPPFLAGS += -DGALLIUM_R300
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/drivers/r300/libr300.la \
>> -    $(RADEON_LIBS)
>> -endif
>> -
>> -if HAVE_GALLIUM_R600
>> -MEGADRIVERS += r600
>> -STATIC_TARGET_CPPFLAGS += -DGALLIUM_R600
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/drivers/r600/libr600.la \
>> -    $(RADEON_LIBS)
>> -endif
>> -
>> -if HAVE_GALLIUM_RADEONSI
>> -MEGADRIVERS += radeonsi
>> -STATIC_TARGET_CPPFLAGS += -DGALLIUM_RADEONSI
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \
>> -    $(RADEON_LIBS)
>> -endif
>> +include $(top_srcdir)/src/gallium/drivers/r300/Automake.inc
>> +include $(top_srcdir)/src/gallium/drivers/r600/Automake.inc
>> +include $(top_srcdir)/src/gallium/drivers/radeonsi/Automake.inc
>>     include $(top_srcdir)/src/gallium/drivers/svga/Automake.inc
>>   @@ -148,7 +118,8 @@ if HAVE_GALLIUM_STATIC_TARGETS
>>     gallium_dri_la_SOURCES += target.c
>>   AM_CPPFLAGS += $(STATIC_TARGET_CPPFLAGS) $(TARGET_CPPFLAGS)
>> -gallium_dri_la_LIBADD += $(STATIC_TARGET_LIB_DEPS) $(TARGET_LIB_DEPS)
>> +gallium_dri_la_LIBADD += $(STATIC_TARGET_LIB_DEPS) $(TARGET_LIB_DEPS) \
>> +    $(TARGET_RADEON_WINSYS) $(TARGET_RADEON_COMMON)
>>     else # HAVE_GALLIUM_STATIC_TARGETS
>>   diff --git a/src/gallium/targets/egl-static/Makefile.am
>> b/src/gallium/targets/egl-static/Makefile.am
>> index 788d3fd..472eea7 100644
>> --- a/src/gallium/targets/egl-static/Makefile.am
>> +++ b/src/gallium/targets/egl-static/Makefile.am
>> @@ -167,41 +167,9 @@ include
>> $(top_srcdir)/src/gallium/drivers/ilo/Automake.inc
>>     include $(top_srcdir)/src/gallium/drivers/nouveau/Automake.inc
>>   -if NEED_RADEON_DRM_WINSYS
>> -egl_gallium_la_LIBADD += \
>> -    $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la
>> -endif
>> -
>> -if HAVE_GALLIUM_RADEON_COMMON
>> -egl_gallium_la_LIBADD += \
>> -    $(top_builddir)/src/gallium/drivers/radeon/libradeon.la
>> -endif
>> -
>> -if HAVE_GALLIUM_R300
>> -egl_gallium_la_CPPFLAGS += -DGALLIUM_R300
>> -egl_gallium_la_LIBADD += \
>> -    $(top_builddir)/src/gallium/drivers/r300/libr300.la \
>> -    $(RADEON_LIBS)
>> -
>> -if !HAVE_OPENGL
>> -egl_gallium_la_LIBADD += \
>> -    $(top_builddir)/src/gallium/drivers/r300/libr300-helper.la
>> -endif
>> -endif
>> -
>> -if HAVE_GALLIUM_R600
>> -egl_gallium_la_CPPFLAGS += -DGALLIUM_R600
>> -egl_gallium_la_LIBADD += \
>> -    $(top_builddir)/src/gallium/drivers/r600/libr600.la \
>> -    $(RADEON_LIBS)
>> -endif
>> -
>> -if HAVE_GALLIUM_RADEONSI
>> -egl_gallium_la_CPPFLAGS += -DGALLIUM_RADEONSI
>> -egl_gallium_la_LIBADD += \
>> -    $(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \
>> -    $(RADEON_LIBS)
>> -endif
>> +include $(top_srcdir)/src/gallium/drivers/r300/Automake.inc
>> +include $(top_srcdir)/src/gallium/drivers/r600/Automake.inc
>> +include $(top_srcdir)/src/gallium/drivers/radeonsi/Automake.inc
>>     include $(top_srcdir)/src/gallium/drivers/svga/Automake.inc
>>   @@ -220,7 +188,9 @@ egl_gallium_la_LIBADD += \
>>   endif
>>     egl_gallium_la_CPPFLAGS += $(TARGET_CPPFLAGS)
>> -egl_gallium_la_LIBADD += $(TARGET_LIB_DEPS)
>> +egl_gallium_la_LIBADD += $(TARGET_LIB_DEPS) \
>> +    $(TARGET_RADEON_WINSYS) $(TARGET_RADEON_COMMON)
>> +
>>     #else # HAVE_GALLIUM_STATIC_TARGETS
>>   diff --git a/src/gallium/targets/gbm/Makefile.am
>> b/src/gallium/targets/gbm/Makefile.am
>> index 2b05265..ddd558e 100644
>> --- a/src/gallium/targets/gbm/Makefile.am
>> +++ b/src/gallium/targets/gbm/Makefile.am
>> @@ -66,37 +66,9 @@ include
>> $(top_srcdir)/src/gallium/drivers/ilo/Automake.inc
>>     include $(top_srcdir)/src/gallium/drivers/nouveau/Automake.inc
>>   -if NEED_RADEON_DRM_WINSYS
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la
>> -endif
>> -
>> -if HAVE_GALLIUM_RADEON_COMMON
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/drivers/radeon/libradeon.la
>> -endif
>> -
>> -if HAVE_GALLIUM_R300
>> -STATIC_TARGET_CPPFLAGS += -DGALLIUM_R300
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/drivers/r300/libr300.la \
>> -    $(top_builddir)/src/gallium/drivers/r300/libr300-helper.la \
>> -    $(RADEON_LIBS)
>> -endif
>> -
>> -if HAVE_GALLIUM_R600
>> -STATIC_TARGET_CPPFLAGS += -DGALLIUM_R600
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/drivers/r600/libr600.la \
>> -    $(RADEON_LIBS)
>> -endif
>> -
>> -if HAVE_GALLIUM_RADEONSI
>> -STATIC_TARGET_CPPFLAGS += -DGALLIUM_RADEONSI
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \
>> -    $(RADEON_LIBS)
>> -endif
>> +include $(top_srcdir)/src/gallium/drivers/r300/Automake.inc
>> +include $(top_srcdir)/src/gallium/drivers/r600/Automake.inc
>> +include $(top_srcdir)/src/gallium/drivers/radeonsi/Automake.inc
>>     include $(top_srcdir)/src/gallium/drivers/svga/Automake.inc
>>   @@ -104,7 +76,8 @@ include
>> $(top_srcdir)/src/gallium/drivers/freedreno/Automake.inc
>>     gbm_gallium_drm_la_SOURCES += target.c
>>   gbm_gallium_drm_la_CPPFLAGS = $(STATIC_TARGET_CPPFLAGS)
>> $(TARGET_CPPFLAGS)
>> -gbm_gallium_drm_la_LIBADD += $(STATIC_TARGET_LIB_DEPS)
>> $(TARGET_LIB_DEPS)
>> +gbm_gallium_drm_la_LIBADD += $(STATIC_TARGET_LIB_DEPS)
>> $(TARGET_LIB_DEPS) \
>> +    $(TARGET_RADEON_WINSYS) $(TARGET_RADEON_COMMON)
>>     else # HAVE_GALLIUM_STATIC_TARGETS
>>   gbm_gallium_drm_la_LIBADD += \
>> diff --git a/src/gallium/targets/omx/Makefile.am
>> b/src/gallium/targets/omx/Makefile.am
>> index e906ce1..17a44e9 100644
>> --- a/src/gallium/targets/omx/Makefile.am
>> +++ b/src/gallium/targets/omx/Makefile.am
>> @@ -44,39 +44,13 @@ TARGET_LIB_DEPS =
>>     include $(top_srcdir)/src/gallium/drivers/nouveau/Automake.inc
>>   -# Radeon winsys chaos
>> -if HAVE_GALLIUM_R600
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la
>> -else
>> -if HAVE_GALLIUM_RADEONSI
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la
>> -endif
>> -endif
>> -
>> -if HAVE_GALLIUM_RADEON_COMMON
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/drivers/radeon/libradeon.la
>> -endif
>> -
>> -if HAVE_GALLIUM_R600
>> -STATIC_TARGET_CPPFLAGS += -DGALLIUM_R600
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/drivers/r600/libr600.la \
>> -    $(RADEON_LIBS)
>> -endif
>> -
>> -if HAVE_GALLIUM_RADEONSI
>> -STATIC_TARGET_CPPFLAGS += -DGALLIUM_RADEONSI
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \
>> -    $(RADEON_LIBS)
>> -endif
>> +include $(top_srcdir)/src/gallium/drivers/r600/Automake.inc
>> +include $(top_srcdir)/src/gallium/drivers/radeonsi/Automake.inc
>>     libomx_mesa_la_SOURCES += target.c
>>   libomx_mesa_la_CPPFLAGS = $(STATIC_TARGET_CPPFLAGS) $(TARGET_CPPFLAGS)
>> -libomx_mesa_la_LIBADD += $(STATIC_TARGET_LIB_DEPS) $(TARGET_LIB_DEPS)
>> +libomx_mesa_la_LIBADD += $(STATIC_TARGET_LIB_DEPS) $(TARGET_LIB_DEPS) \
>> +    $(TARGET_RADEON_WINSYS) $(TARGET_RADEON_COMMON)
>>     else # HAVE_GALLIUM_STATIC_TARGETS
>>   diff --git a/src/gallium/targets/vdpau/Makefile.am
>> b/src/gallium/targets/vdpau/Makefile.am
>> index 3b39108..43cecc4 100644
>> --- a/src/gallium/targets/vdpau/Makefile.am
>> +++ b/src/gallium/targets/vdpau/Makefile.am
>> @@ -49,43 +49,15 @@ TARGET_LIB_DEPS =
>>     include $(top_srcdir)/src/gallium/drivers/nouveau/Automake.inc
>>   -# Radeon winsys chaos
>> -if HAVE_GALLIUM_R600
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la
>> -else
>> -if HAVE_GALLIUM_RADEONSI
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la
>> -endif
>> -endif
>> -
>> -if HAVE_GALLIUM_RADEON_COMMON
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/drivers/radeon/libradeon.la
>> -endif
>> -
>> -if HAVE_GALLIUM_R600
>> -MEGADRIVERS += r600
>> -STATIC_TARGET_CPPFLAGS += -DGALLIUM_R600
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/drivers/r600/libr600.la \
>> -    $(RADEON_LIBS)
>> -endif
>> -
>> -if HAVE_GALLIUM_RADEONSI
>> -MEGADRIVERS += radeonsi
>> -STATIC_TARGET_CPPFLAGS += -DGALLIUM_RADEONSI
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \
>> -    $(RADEON_LIBS)
>> -endif
>> +include $(top_srcdir)/src/gallium/drivers/r600/Automake.inc
>> +include $(top_srcdir)/src/gallium/drivers/radeonsi/Automake.inc
>>     if HAVE_GALLIUM_STATIC_TARGETS
>>     libvdpau_gallium_la_SOURCES += target.c
>>   libvdpau_gallium_la_CPPFLAGS = $(STATIC_TARGET_CPPFLAGS)
>> $(TARGET_CPPFLAGS)
>> -libvdpau_gallium_la_LIBADD += $(STATIC_TARGET_LIB_DEPS)
>> $(TARGET_LIB_DEPS)
>> +libvdpau_gallium_la_LIBADD += $(STATIC_TARGET_LIB_DEPS)
>> $(TARGET_LIB_DEPS) \
>> +    $(TARGET_RADEON_WINSYS) $(TARGET_RADEON_COMMON)
>>     else # HAVE_GALLIUM_STATIC_TARGETS
>>   diff --git a/src/gallium/targets/xvmc/Makefile.am
>> b/src/gallium/targets/xvmc/Makefile.am
>> index e8bf6c4..7b4b4b9 100644
>> --- a/src/gallium/targets/xvmc/Makefile.am
>> +++ b/src/gallium/targets/xvmc/Makefile.am
>> @@ -44,21 +44,14 @@ TARGET_LIB_DEPS =
>>     include $(top_srcdir)/src/gallium/drivers/nouveau/Automake.inc
>>   -if HAVE_GALLIUM_R600
>> -MEGADRIVERS += r600
>> -STATIC_TARGET_CPPFLAGS += -DGALLIUM_R600
>> -STATIC_TARGET_LIB_DEPS += \
>> -    $(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \
>> -    $(top_builddir)/src/gallium/drivers/radeon/libradeon.la \
>> -    $(top_builddir)/src/gallium/drivers/r600/libr600.la \
>> -    $(RADEON_LIBS)
>> -endif
>> +include $(top_srcdir)/src/gallium/drivers/r600/Automake.inc
>>     if HAVE_GALLIUM_STATIC_TARGETS
>>     libXvMCgallium_la_SOURCES += target.c
>>   libXvMCgallium_la_CPPFLAGS = $(STATIC_TARGET_CPPFLAGS)
>> $(TARGET_CPPFLAGS)
>> -libXvMCgallium_la_LIBADD += $(STATIC_TARGET_LIB_DEPS) $(TARGET_LIB_DEPS)
>> +libXvMCgallium_la_LIBADD += $(STATIC_TARGET_LIB_DEPS)
>> $(TARGET_LIB_DEPS) \
>> +    $(TARGET_RADEON_WINSYS) $(TARGET_RADEON_COMMON)
>>     else # HAVE_GALLIUM_STATIC_TARGETS
>>   
> 



More information about the mesa-dev mailing list