[Mesa-dev] [PATCH v5 00/12] Common pipe screen ref counting

Rob Herring robh at kernel.org
Mon Aug 7 22:57:59 UTC 2017


I finally got around to updating this series since I have another driver 
to add reference counting to (kms_swrast). Reference counting of the pipe
screen is necessary for Android support (and VDPAU AIUI), but each driver
has so far implemented there own private ref counting. This series creates
a common implementation. The previous version is here[1].

Please help test! I've tested with virgl and freedreno on Android and 
don't have other h/w. A branch with this series is available here[2].

Changes in v5:
- Rebased to current master.
- Moved the pipe loader changes from pipe_loader_drm.c to pipe_loader.c 
  to also support software rendering.
- Export pipe_loader_create_screen and pipe_loader_release.
- Removed the fd hash table mutex. It is not needed because the loader 
  mutex is sufficient.
- Combined radeon and amdgpu patch due to common dependence on 
  radeon_winsys.h and amdgpu fallback path.
- Fixed bug in radeon_drm_winsys_create returning the pipe_screen instead
  of the struct radeon_winsys.
- Support the case when the pipe_screen->fd is -1 (AMDGPU).
- Reworked SVGA driver to avoid dup/fcntl in svga_screen.c as that's not 
  available on Windows.
- Fixed support of debug wrappers 
- Added etnaviv support

Rob

[1] http://comments.gmane.org/gmane.comp.video.mesa3d.devel/142722
[2] https://github.com/robherring/mesa.git screen-refcnt-v5

Rob Herring (12):
  gallium: move pipe_screen destroy into pipe-loader
  pipe-loader: serialize create_screen() calls with a mutex
  gallium: add common pipe_screen reference counting functions
  gallium: use pipe_screen_unreference to destroy screen in debug
    wrappers
  pipe-loader: use pipe_screen_unreference to destroy screen
  etnaviv: use common pipe_screen ref counting
  freedreno: use common pipe_screen ref counting
  nouveau: use common pipe_screen ref counting
  radeon: use common pipe_screen ref counting
  vmwgfx: use common pipe_screen ref counting
  virgl: use common pipe_screen ref counting
  vc4: add pipe_screen ref counting

 src/gallium/auxiliary/Makefile.sources             |   2 +
 src/gallium/auxiliary/pipe-loader/pipe_loader.c    |  28 +++++-
 src/gallium/auxiliary/pipe-loader/pipe_loader.h    |   1 +
 src/gallium/auxiliary/target-helpers/drm_helper.h  |  21 ++--
 src/gallium/auxiliary/util/u_screen.c              | 112 +++++++++++++++++++++
 src/gallium/auxiliary/util/u_screen.h              |  32 ++++++
 src/gallium/auxiliary/vl/vl_winsys_dri.c           |   1 -
 src/gallium/auxiliary/vl/vl_winsys_dri3.c          |   1 -
 src/gallium/auxiliary/vl/vl_winsys_drm.c           |   1 -
 src/gallium/drivers/ddebug/dd_screen.c             |   3 +-
 src/gallium/drivers/etnaviv/etnaviv_screen.c       |   1 -
 src/gallium/drivers/etnaviv/etnaviv_screen.h       |   4 -
 src/gallium/drivers/freedreno/freedreno_screen.c   |   1 -
 src/gallium/drivers/freedreno/freedreno_screen.h   |  10 --
 src/gallium/drivers/noop/noop_pipe.c               |   3 +-
 src/gallium/drivers/nouveau/nouveau_screen.c       |   6 --
 src/gallium/drivers/nouveau/nouveau_screen.h       |   4 -
 src/gallium/drivers/nouveau/nv30/nv30_screen.c     |   3 -
 src/gallium/drivers/nouveau/nv50/nv50_screen.c     |   3 -
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c     |   3 -
 src/gallium/drivers/r300/r300_screen.c             |   3 -
 src/gallium/drivers/r600/r600_pipe.c               |   6 --
 src/gallium/drivers/radeon/radeon_winsys.h         |   8 --
 src/gallium/drivers/radeonsi/si_pipe.c             |   3 -
 src/gallium/drivers/rbug/rbug_screen.c             |   3 +-
 src/gallium/drivers/trace/tr_screen.c              |   3 +-
 src/gallium/include/pipe/p_screen.h                |   5 +
 src/gallium/state_trackers/clover/core/device.cpp  |   4 +-
 src/gallium/state_trackers/dri/dri_screen.c        |   3 -
 src/gallium/state_trackers/xa/xa_tracker.c         |   2 -
 src/gallium/targets/dri-vdpau.dyn                  |   2 +
 src/gallium/targets/dri/dri.sym                    |   2 +
 src/gallium/targets/pipe-loader/pipe_vmwgfx.c      |  24 +++--
 src/gallium/targets/vdpau/vdpau.sym                |   2 +
 src/gallium/tests/trivial/compute.c                |   1 -
 src/gallium/tests/trivial/quad-tex.c               |   1 -
 src/gallium/tests/trivial/tri.c                    |   1 -
 src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c      |  44 +-------
 src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h      |   1 -
 .../winsys/etnaviv/drm/etnaviv_drm_winsys.c        |  81 ++-------------
 .../winsys/freedreno/drm/freedreno_drm_winsys.c    |  98 ++----------------
 .../winsys/nouveau/drm/nouveau_drm_winsys.c        |  69 +------------
 src/gallium/winsys/radeon/drm/radeon_drm_winsys.c  |  79 ++-------------
 src/gallium/winsys/radeon/drm/radeon_drm_winsys.h  |   1 -
 src/gallium/winsys/svga/drm/vmw_screen.c           |  55 ++--------
 src/gallium/winsys/svga/drm/vmw_screen.h           |   6 --
 src/gallium/winsys/vc4/drm/vc4_drm_winsys.c        |  21 +++-
 src/gallium/winsys/virgl/drm/virgl_drm_winsys.c    |  88 ++--------------
 48 files changed, 290 insertions(+), 566 deletions(-)
 create mode 100644 src/gallium/auxiliary/util/u_screen.c
 create mode 100644 src/gallium/auxiliary/util/u_screen.h

-- 
2.11.0



More information about the mesa-dev mailing list