There is one change that I forgot to mention:

The existing xmlconfig system can filter drirc settings by X screen number. After the series, this no longer works. Or rather, the system behaves as if we're always on screen 0.

I really don't think this is a big deal, since multiple X screens is not exactly a feature people use at all, let alone in this context. There's also no way it can possibly work reliably for radeonsi-specific options, because our pipe_screen is per-process/device, not per-X-screen.

But perhaps we should warn users explicitly that this screen-filtering is deprecated.

Cheers,
Nicolai


On 30.06.2017 14:45, Nicolai Hähnle wrote:
From: Nicolai Hähnle <nicolai.haeh...@amd.com>

Hi all,

This is a big change to the drirc/xmlconfig framework, mostly on the
Gallium side.

The non-Gallium changes are:
- xmlconfig is moved to src/util to better reflect how it is used going
   forward
- some glx/dri glue code


Problem Statement
-----------------
We want to allow Gallium drivers to define and use their own drirc
configuration options. This allows us to provide some more opportunities
for performance tuning.

This involves making the xmlconfig functions available to the Gallium
drivers, but also allowing them to specify their own option definitions.

There are two related types of XML in the drirc/xmlconfig framework:
- the driconf XML is stored in the drirc file and contains settings
- the driinfo XML describes available options and default values;
   it is used inside the driver during drirc parsing, and is also
   exported and used by the DriConf GUI (via the xdriinfo app)

(The DriConf GUI tool has issues, but the fundamental principle of how it
interacts with Mesa is sound, so this series doesn't change that.)


Additional Goals
----------------
1. Allow non-OpenGL state trackers to define their own config options.
    In particular, Nine should be easy to hook up after this series.
2. The full driinfo XML for the driver and all supported state trackers
    should be provided by glXGetDriverConfig (and hence xdriinfo).
3. Ensure consistent initialization of driver options in radeonsi. Since
    radeonsi has only a single pipe_screen per process and device, this
    means that the config must be loaded e.g. when some video state tracker
    initializes before OpenGL.
4. Make adding new options painless both for the state tracker and for the
    driver.
5. Parse the drirc XML only once per process in the normal case.
6. Store only one copy of the driinfo XML per driver.


Solution
--------
1. The driinfo XML is optionally specified by the pipe driver, by means
    of the drm_driver_descriptor, via a DRM_CONF_XML_OPTIONS query.
    If the pipe driver doesn't specify it, the pipe loader provides the
    default.
2. Parse the drirc XML in the pipe_loader and make the result available to
    both the driver and the state tracker.
3. Add a tool that merges DRI_CONF_xxx macro definition groups at build time,
    so that we don't have redundant definitions of state-tracker options.
4. Define a v2 of the DRI_ConfigOptions extension that allows us to forward
    the driver-specific driinfo XML.

Patches 1-5 are the non-Gallium parts.

Patches 6-14 prepare the pipe loader and related infrastructure.

Patches 15-16 setup the custom driinfo XML for radeonsi and add a first
driver-specific config option.

I iterated over the design a couple of times and am now fairly happy with
it. One thing that's bound to be messy is the build system changes.
The Android.mk and SCons changes are basically best guesses. If anybody
wants to try the series, especially for build failures, please do. You can
get it here: https://cgit.freedesktop.org/~nh/mesa/log/?h=driconf

Please review!
Thanks,
Nicolai
--
  configure.ac                                       |   2 +-
  include/GL/internal/dri_interface.h                |  20 +-
  src/gallium/Automake.inc                           |   2 +
  src/gallium/auxiliary/pipe-loader/Makefile.am      |   1 +
  src/gallium/auxiliary/pipe-loader/Makefile.sources |   3 +-
  .../auxiliary/pipe-loader/driinfo_gallium.h        |  34 ++++
  src/gallium/auxiliary/pipe-loader/pipe_loader.c    |  61 +++++-
  src/gallium/auxiliary/pipe-loader/pipe_loader.h    |  37 +++-
  .../auxiliary/pipe-loader/pipe_loader_drm.c        | 130 ++++++------
  .../auxiliary/pipe-loader/pipe_loader_priv.h       |  17 +-
  src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c |   5 +-
  src/gallium/auxiliary/target-helpers/drm_helper.h  | 106 +++++++---
  .../auxiliary/target-helpers/drm_helper_public.h   |  34 ++--
  src/gallium/auxiliary/vl/vl_winsys_dri.c           |   2 +-
  src/gallium/auxiliary/vl/vl_winsys_dri3.c          |   2 +-
  src/gallium/auxiliary/vl/vl_winsys_drm.c           |   2 +-
  src/gallium/drivers/r300/r300_public.h             |   4 +-
  src/gallium/drivers/r300/r300_screen.c             |   3 +-
  src/gallium/drivers/r600/r600_pipe.c               |   5 +-
  src/gallium/drivers/r600/r600_public.h             |   4 +-
  src/gallium/drivers/radeonsi/Makefile.am           |  13 ++
  src/gallium/drivers/radeonsi/Makefile.sources      |   4 +
  src/gallium/drivers/radeonsi/driinfo_radeonsi.h    |   4 +
  src/gallium/drivers/radeonsi/si_pipe.c             |   8 +-
  src/gallium/drivers/radeonsi/si_public.h           |   2 +-
  src/gallium/include/pipe/p_screen.h                |  10 +
  src/gallium/include/state_tracker/drm_driver.h     |   6 +-
  src/gallium/state_trackers/clover/core/device.cpp  |   2 +-
  src/gallium/state_trackers/dri/Makefile.am         |   2 +-
  src/gallium/state_trackers/dri/dri2.c              |  28 +--
  src/gallium/state_trackers/dri/dri_context.c       |   3 +-
  src/gallium/state_trackers/dri/dri_screen.c        |  83 +-------
  src/gallium/state_trackers/dri/dri_screen.h        |  10 +-
  src/gallium/state_trackers/dri/drisw.c             |   6 +-
  src/gallium/state_trackers/xa/xa_tracker.c         |   2 +-
  src/gallium/targets/d3dadapter9/Makefile.am        |   1 -
  src/gallium/targets/d3dadapter9/drm.c              |   8 +-
  src/gallium/targets/pipe-loader/Makefile.am        |   1 +
  src/gallium/targets/pipe-loader/pipe_i915.c        |   2 +-
  src/gallium/targets/pipe-loader/pipe_msm.c         |   2 +-
  src/gallium/targets/pipe-loader/pipe_nouveau.c     |   2 +-
  src/gallium/targets/pipe-loader/pipe_r300.c        |   2 +-
  src/gallium/targets/pipe-loader/pipe_r600.c        |   2 +-
  src/gallium/targets/pipe-loader/pipe_radeonsi.c    |  11 +-
  src/gallium/targets/pipe-loader/pipe_vmwgfx.c      |   2 +-
  src/gallium/tests/trivial/compute.c                |   2 +-
  src/gallium/tests/trivial/quad-tex.c               |   2 +-
  src/gallium/tests/trivial/tri.c                    |   2 +-
  src/gallium/winsys/amdgpu/drm/amdgpu_public.h      |   5 +-
  src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c      |   4 +-
  src/gallium/winsys/radeon/drm/radeon_drm_public.h  |   5 +-
  src/gallium/winsys/radeon/drm/radeon_drm_winsys.c  |   4 +-
  src/glx/dri_glx.c                                  | 113 +++++++++--
  src/loader/Makefile.am                             |   4 +-
  src/loader/loader.c                                |   4 +-
  src/mesa/drivers/SConscript                        |   1 -
  src/mesa/drivers/dri/Makefile.am                   |   2 +-
  src/mesa/drivers/dri/common/Android.mk             |  48 +----
  src/mesa/drivers/dri/common/Makefile.am            |  12 +-
  src/mesa/drivers/dri/common/Makefile.sources       |   4 -
  src/mesa/drivers/dri/common/SConscript             |   7 +-
  src/mesa/drivers/dri/common/dri_util.c             |   2 +-
  src/mesa/drivers/dri/common/dri_util.h             |   2 +-
  src/mesa/drivers/dri/i915/Makefile.am              |   2 +-
  src/mesa/drivers/dri/i915/intel_screen.c           |   2 +-
  src/mesa/drivers/dri/i915/intel_screen.h           |   2 +-
  src/mesa/drivers/dri/i965/Makefile.am              |   2 +-
  src/mesa/drivers/dri/i965/intel_screen.c           |   2 +-
  src/mesa/drivers/dri/i965/intel_screen.h           |   2 +-
  src/mesa/drivers/dri/r200/Makefile.am              |   2 +-
  src/mesa/drivers/dri/r200/r200_context.c           |   2 +-
  src/mesa/drivers/dri/r200/r200_state_init.c        |   2 +-
  src/mesa/drivers/dri/r200/r200_tex.c               |   2 +-
  src/mesa/drivers/dri/radeon/Makefile.am            |   2 +-
  .../drivers/dri/radeon/radeon_common_context.c     |   2 +-
  src/mesa/drivers/dri/radeon/radeon_context.c       |   2 +-
  src/mesa/drivers/dri/radeon/radeon_screen.c        |   2 +-
  src/mesa/drivers/dri/radeon/radeon_screen.h        |   2 +-
  src/mesa/drivers/dri/radeon/radeon_state_init.c    |   2 +-
  src/mesa/drivers/dri/radeon/radeon_tex.c           |   2 +-
  src/mesa/drivers/dri/radeon/radeon_texture.c       |   2 +-
  src/mesa/drivers/dri/swrast/Makefile.am            |   2 +-
  src/util/Android.mk                                |  47 ++++-
  src/util/Makefile.am                               |  20 +-
  src/util/Makefile.sources                          |   4 +
  src/util/SConscript                                |  16 +-
  src/{mesa/drivers/dri/common => util}/drirc        |   0
  src/util/merge_driinfo.py                          | 222 +++++++++++++++++++++
  src/{mesa/drivers/dri/common => util}/xmlconfig.c  |  10 +-
  src/{mesa/drivers/dri/common => util}/xmlconfig.h  |   0
  src/{mesa/drivers/dri/common => util}/xmlpool.h    |   0
  .../drivers/dri/common => util}/xmlpool/.gitignore |   0
  .../dri/common => util}/xmlpool/Makefile.am        |   0
  .../drivers/dri/common => util}/xmlpool/SConscript |   0
  .../drivers/dri/common => util}/xmlpool/ca.po      |   0
  .../drivers/dri/common => util}/xmlpool/de.po      |   0
  .../drivers/dri/common => util}/xmlpool/es.po      |   0
  .../drivers/dri/common => util}/xmlpool/fr.po      |   0
  .../dri/common => util}/xmlpool/gen_xmlpool.py     |   0
  .../drivers/dri/common => util}/xmlpool/nl.po      |   0
  .../drivers/dri/common => util}/xmlpool/sv.po      |   0
  .../dri/common => util}/xmlpool/t_options.h        |   9 +
  102 files changed, 907 insertions(+), 372 deletions(-)
  create mode 100644 src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
  create mode 100644 src/gallium/drivers/radeonsi/driinfo_radeonsi.h
  rename src/{mesa/drivers/dri/common => util}/drirc (100%)
  create mode 100644 src/util/merge_driinfo.py
  rename src/{mesa/drivers/dri/common => util}/xmlconfig.c (99%)
  rename src/{mesa/drivers/dri/common => util}/xmlconfig.h (100%)
  rename src/{mesa/drivers/dri/common => util}/xmlpool.h (100%)
  rename src/{mesa/drivers/dri/common => util}/xmlpool/.gitignore (100%)
  rename src/{mesa/drivers/dri/common => util}/xmlpool/Makefile.am (100%)
  rename src/{mesa/drivers/dri/common => util}/xmlpool/SConscript (100%)
  rename src/{mesa/drivers/dri/common => util}/xmlpool/ca.po (100%)
  rename src/{mesa/drivers/dri/common => util}/xmlpool/de.po (100%)
  rename src/{mesa/drivers/dri/common => util}/xmlpool/es.po (100%)
  rename src/{mesa/drivers/dri/common => util}/xmlpool/fr.po (100%)
  rename src/{mesa/drivers/dri/common => util}/xmlpool/gen_xmlpool.py (100%)
  rename src/{mesa/drivers/dri/common => util}/xmlpool/nl.po (100%)
  rename src/{mesa/drivers/dri/common => util}/xmlpool/sv.po (100%)
  rename src/{mesa/drivers/dri/common => util}/xmlpool/t_options.h (98%)



--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to