Clearly a good idea to move this into common code, but there is just one important thing you are missing here.

We intentional export the *_winsys_create() in the created libraries to have only one global file descriptor for all libraries. See the following files as well:
src/gallium/targets/vdpau/vdpau.sym
src/gallium/targets/dri-vdpau.dyn
src/gallium/targets/dri/dri.sym

I'm not sure if that is needed any more or will keep working if you change the code like this.

Regards,
Christian.

Am 17.06.2016 um 19:45 schrieb Rob Herring:
I needed to add screen ref counting to vc4 driver, so rather than yet
another copy of the same fd hashing and ref counting code, I implemented
it in the pipe-loader. AFAICT, the pipe-loader is the only place the
winsys create screen functions are called and seemed to be the best
location to put this. The tricky part is the destroy path and not
freeing the screen before reference counting. I think I found all the
callers of pipe_screen->destroy.

This is tested on virgl and freedreno on Android and radeon is build
tested only.

Rob

Rob Herring (7):
   gallium: move pipe_screen destroy into pipe-loader
   pipe-loader-drm: Add common pipe_screen refcounting
   Revert "virgl: reuse screen when fd is already open"
   Revert "virgl: mark function as static"
   nouveau: remove screen ref counting
   freedreno: remove screen ref counting
   radeon: remove screen ref counting

  src/gallium/auxiliary/pipe-loader/pipe_loader.h    |  1 +
  .../auxiliary/pipe-loader/pipe_loader_drm.c        | 71 ++++++++++++++++-
  src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c |  6 ++
  src/gallium/auxiliary/target-helpers/drm_helper.h  |  7 +-
  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/freedreno/freedreno_screen.c   |  1 -
  src/gallium/drivers/freedreno/freedreno_screen.h   | 10 ---
  src/gallium/drivers/nouveau/nouveau_screen.h       |  2 -
  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             |  6 --
  src/gallium/drivers/virgl/virgl_screen.c           |  1 -
  src/gallium/drivers/virgl/virgl_screen.h           |  6 --
  src/gallium/include/pipe/p_screen.h                |  1 +
  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/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      | 66 +---------------
  src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h      |  1 -
  .../winsys/freedreno/drm/freedreno_drm_winsys.c    | 89 +---------------------
  .../winsys/nouveau/drm/nouveau_drm_winsys.c        | 84 +-------------------
  src/gallium/winsys/radeon/drm/radeon_drm_winsys.c  | 80 +------------------
  src/gallium/winsys/virgl/drm/virgl_drm_public.h    |  4 +-
  src/gallium/winsys/virgl/drm/virgl_drm_winsys.c    | 89 +---------------------
  30 files changed, 95 insertions(+), 462 deletions(-)


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to