[Mesa-dev] [PATCH 6/6] gallium: remove PIPE_CAP_BUFFER_SHARE cap and get_param sw_winsys hook

Giovanni Campagna gcampagna at src.gnome.org
Wed Jul 30 00:14:14 PDT 2014


On Jul 29, 2014 7:42 PM, "Emil Velikov" <emil.l.velikov at gmail.com> wrote:
>
> On 24/07/14 01:43, Emil Velikov wrote:
> > The kms_swrast driver has a separate InitScreen hook for its DriverAPI
> > from the rest of the DRI2 drivers, all of which capable of buffer
> > sharing. As such we no longer need to dive through the pipe-driver and
> > winsys layers in order to determine if the driver can share buffers or
> > not and we can explicitly set screen->can_share_buffer in InitScreen.
> >
> > XXX: Squash with the original commit ?
> >
> Hi Giovanni,
>
> With the current implementation of kms_dri + megadrivers the PIPE_CAP is
no
> longer required. Are you OK if we drop it ?

Yes, it's an implementation detail and I don't particularly care about it,
as long as we have a way not to expose the image egl extensions.
I did not answer immediately because I wanted to test this again and did
not find time yet, but this is now in use for gnome-continuous through the
egl-drm branch and it works, so it's good to go, I believe.

Giovanni

> -Emil
>
> > Cc: Giovanni Campagna <gcampagna at src.gnome.org>
> > Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> > ---
> >  src/gallium/docs/source/screen.rst                |  4 ----
> >  src/gallium/drivers/freedreno/freedreno_screen.c  |  1 -
> >  src/gallium/drivers/i915/i915_screen.c            |  1 -
> >  src/gallium/drivers/ilo/ilo_screen.c              |  2 --
> >  src/gallium/drivers/llvmpipe/lp_screen.c          |  7 -------
> >  src/gallium/drivers/nouveau/nv30/nv30_screen.c    |  1 -
> >  src/gallium/drivers/nouveau/nv50/nv50_screen.c    |  1 -
> >  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c    |  1 -
> >  src/gallium/drivers/r300/r300_screen.c            |  1 -
> >  src/gallium/drivers/r600/r600_pipe.c              |  1 -
> >  src/gallium/drivers/radeonsi/si_pipe.c            |  1 -
> >  src/gallium/drivers/softpipe/sp_screen.c          |  7 -------
> >  src/gallium/drivers/svga/svga_screen.c            |  3 ---
> >  src/gallium/include/pipe/p_defines.h              |  1 -
> >  src/gallium/include/state_tracker/sw_winsys.h     |  5 -----
> >  src/gallium/state_trackers/dri/dri2.c             |  3 ++-
> >  src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c | 14 --------------
> >  17 files changed, 2 insertions(+), 52 deletions(-)
> >
> > diff --git a/src/gallium/docs/source/screen.rst
b/src/gallium/docs/source/screen.rst
> > index b09f18bd..ba583fe 100644
> > --- a/src/gallium/docs/source/screen.rst
> > +++ b/src/gallium/docs/source/screen.rst
> > @@ -213,10 +213,6 @@ The integer capabilities:
> >  * ``PIPE_CAP_DRAW_INDIRECT``: Whether the driver supports taking draw
arguments
> >    { count, instance_count, start, index_bias } from a PIPE_BUFFER
resource.
> >    See pipe_draw_info.
> > -* ``PIPE_CAP_BUFFER_SHARE``: Whether it is possible to share buffers
between
> > -  processes using the native window system. If this is 0, the buffers
and
> > -  display targets available are only valid for in-process rendering and
> > -  scanout. This will be 1 for most HW drivers.
> >
> >
> >  .. _pipe_capf:
> > diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c
b/src/gallium/drivers/freedreno/freedreno_screen.c
> > index 05426dc..c574cb8 100644
> > --- a/src/gallium/drivers/freedreno/freedreno_screen.c
> > +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
> > @@ -175,7 +175,6 @@ fd_screen_get_param(struct pipe_screen *pscreen,
enum pipe_cap param)
> >       case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
> >       case PIPE_CAP_USER_CONSTANT_BUFFERS:
> >       case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
> > -     case PIPE_CAP_BUFFER_SHARE:
> >               return 1;
> >
> >       case PIPE_CAP_SHADER_STENCIL_EXPORT:
> > diff --git a/src/gallium/drivers/i915/i915_screen.c
b/src/gallium/drivers/i915/i915_screen.c
> > index 437f4bd..86a7a67 100644
> > --- a/src/gallium/drivers/i915/i915_screen.c
> > +++ b/src/gallium/drivers/i915/i915_screen.c
> > @@ -186,7 +186,6 @@ i915_get_param(struct pipe_screen *screen, enum
pipe_cap cap)
> >     case PIPE_CAP_USER_VERTEX_BUFFERS:
> >     case PIPE_CAP_USER_INDEX_BUFFERS:
> >     case PIPE_CAP_USER_CONSTANT_BUFFERS:
> > -   case PIPE_CAP_BUFFER_SHARE:
> >        return 1;
> >
> >     /* Unsupported features (boolean caps). */
> > diff --git a/src/gallium/drivers/ilo/ilo_screen.c
b/src/gallium/drivers/ilo/ilo_screen.c
> > index 6b96e5b..e2a0e23 100644
> > --- a/src/gallium/drivers/ilo/ilo_screen.c
> > +++ b/src/gallium/drivers/ilo/ilo_screen.c
> > @@ -433,8 +433,6 @@ ilo_get_param(struct pipe_screen *screen, enum
pipe_cap param)
> >     case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
> >     case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
> >        return 0;
> > -   case PIPE_CAP_BUFFER_SHARE:
> > -      return 1;
> >
> >     default:
> >        return 0;
> > diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c
b/src/gallium/drivers/llvmpipe/lp_screen.c
> > index a7659c7..e25d14e 100644
> > --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> > +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> > @@ -105,8 +105,6 @@ llvmpipe_get_name(struct pipe_screen *screen)
> >  static int
> >  llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
> >  {
> > -   struct llvmpipe_screen *lp_screen = llvmpipe_screen(screen);
> > -
> >     switch (param) {
> >     case PIPE_CAP_NPOT_TEXTURES:
> >     case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
> > @@ -253,11 +251,6 @@ llvmpipe_get_param(struct pipe_screen *screen,
enum pipe_cap param)
> >        return 0;
> >     case PIPE_CAP_FAKE_SW_MSAA:
> >        return 1;
> > -   case PIPE_CAP_BUFFER_SHARE:
> > -      if (lp_screen->winsys->get_param != NULL)
> > -         return lp_screen->winsys->get_param(lp_screen->winsys, param);
> > -      else
> > -         return 1;
> >     }
> >     /* should only get here on unhandled cases */
> >     debug_printf("Unexpected PIPE_CAP %d query\n", param);
> > diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> > index 41ccc10..32f5523 100644
> > --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> > +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> > @@ -90,7 +90,6 @@ nv30_screen_get_param(struct pipe_screen *pscreen,
enum pipe_cap param)
> >     case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
> >     case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
> >     case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
> > -   case PIPE_CAP_BUFFER_SHARE:
> >        return 1;
> >     /* nv4x capabilities */
> >     case PIPE_CAP_BLEND_EQUATION_SEPARATE:
> > diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> > index 68437b3..fd63819 100644
> > --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> > +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> > @@ -169,7 +169,6 @@ nv50_screen_get_param(struct pipe_screen *pscreen,
enum pipe_cap param)
> >     case PIPE_CAP_USER_VERTEX_BUFFERS:
> >     case PIPE_CAP_TEXTURE_MULTISAMPLE:
> >     case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
> > -   case PIPE_CAP_BUFFER_SHARE:
> >        return 1;
> >     case PIPE_CAP_SEAMLESS_CUBE_MAP:
> >        return 1; /* class_3d >= NVA0_3D_CLASS; */
> > diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> > index b9d9ebf..3f444a4 100644
> > --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> > +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> > @@ -167,7 +167,6 @@ nvc0_screen_get_param(struct pipe_screen *pscreen,
enum pipe_cap param)
> >     case PIPE_CAP_SAMPLE_SHADING:
> >     case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
> >     case PIPE_CAP_TEXTURE_GATHER_SM5:
> > -   case PIPE_CAP_BUFFER_SHARE:
> >        return 1;
> >     case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
> >        return (class_3d >= NVE4_3D_CLASS) ? 1 : 0;
> > diff --git a/src/gallium/drivers/r300/r300_screen.c
b/src/gallium/drivers/r300/r300_screen.c
> > index 17e4b10..efa69d3 100644
> > --- a/src/gallium/drivers/r300/r300_screen.c
> > +++ b/src/gallium/drivers/r300/r300_screen.c
> > @@ -107,7 +107,6 @@ static int r300_get_param(struct pipe_screen*
pscreen, enum pipe_cap param)
> >          case PIPE_CAP_USER_CONSTANT_BUFFERS:
> >          case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
> >          case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
> > -        case PIPE_CAP_BUFFER_SHARE:
> >              return 1;
> >
> >          case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
> > diff --git a/src/gallium/drivers/r600/r600_pipe.c
b/src/gallium/drivers/r600/r600_pipe.c
> > index 7b8e3eb..ee6a416 100644
> > --- a/src/gallium/drivers/r600/r600_pipe.c
> > +++ b/src/gallium/drivers/r600/r600_pipe.c
> > @@ -262,7 +262,6 @@ static int r600_get_param(struct pipe_screen*
pscreen, enum pipe_cap param)
> >       case PIPE_CAP_TEXTURE_MULTISAMPLE:
> >       case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
> >       case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
> > -     case PIPE_CAP_BUFFER_SHARE:
> >               return 1;
> >
> >       case PIPE_CAP_COMPUTE:
> > diff --git a/src/gallium/drivers/radeonsi/si_pipe.c
b/src/gallium/drivers/radeonsi/si_pipe.c
> > index 3978d4b..4f19268 100644
> > --- a/src/gallium/drivers/radeonsi/si_pipe.c
> > +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> > @@ -215,7 +215,6 @@ static int si_get_param(struct pipe_screen*
pscreen, enum pipe_cap param)
> >       case PIPE_CAP_CUBE_MAP_ARRAY:
> >       case PIPE_CAP_SAMPLE_SHADING:
> >       case PIPE_CAP_DRAW_INDIRECT:
> > -     case PIPE_CAP_BUFFER_SHARE:
> >               return 1;
> >
> >       case PIPE_CAP_TEXTURE_MULTISAMPLE:
> > diff --git a/src/gallium/drivers/softpipe/sp_screen.c
b/src/gallium/drivers/softpipe/sp_screen.c
> > index 338a2dd..13f4723 100644
> > --- a/src/gallium/drivers/softpipe/sp_screen.c
> > +++ b/src/gallium/drivers/softpipe/sp_screen.c
> > @@ -63,8 +63,6 @@ softpipe_get_name(struct pipe_screen *screen)
> >  static int
> >  softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
> >  {
> > -   struct softpipe_screen *sp_screen = softpipe_screen(screen);
> > -
> >     switch (param) {
> >     case PIPE_CAP_NPOT_TEXTURES:
> >     case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
> > @@ -204,11 +202,6 @@ softpipe_get_param(struct pipe_screen *screen,
enum pipe_cap param)
> >        return 0;
> >     case PIPE_CAP_DRAW_INDIRECT:
> >        return 1;
> > -   case PIPE_CAP_BUFFER_SHARE:
> > -      if (sp_screen->winsys->get_param != NULL)
> > -         return sp_screen->winsys->get_param(sp_screen->winsys, param);
> > -      else
> > -         return 1;
> >     }
> >     /* should only get here on unhandled cases */
> >     debug_printf("Unexpected PIPE_CAP %d query\n", param);
> > diff --git a/src/gallium/drivers/svga/svga_screen.c
b/src/gallium/drivers/svga/svga_screen.c
> > index fb641c1..b213b04 100644
> > --- a/src/gallium/drivers/svga/svga_screen.c
> > +++ b/src/gallium/drivers/svga/svga_screen.c
> > @@ -230,9 +230,6 @@ svga_get_param(struct pipe_screen *screen, enum
pipe_cap param)
> >     case PIPE_CAP_SM3:
> >        return 1;
> >
> > -   case PIPE_CAP_BUFFER_SHARE:
> > -      return 1;
> > -
> >     /* Unsupported features */
> >     case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
> >     case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
> > diff --git a/src/gallium/include/pipe/p_defines.h
b/src/gallium/include/pipe/p_defines.h
> > index eac7f0b..d9b6e5a 100644
> > --- a/src/gallium/include/pipe/p_defines.h
> > +++ b/src/gallium/include/pipe/p_defines.h
> > @@ -562,7 +562,6 @@ enum pipe_cap {
> >     PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION = 99,
> >     PIPE_CAP_MAX_VERTEX_STREAMS = 100,
> >     PIPE_CAP_DRAW_INDIRECT = 101,
> > -   PIPE_CAP_BUFFER_SHARE = 102,
> >  };
> >
> >  #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
> > diff --git a/src/gallium/include/state_tracker/sw_winsys.h
b/src/gallium/include/state_tracker/sw_winsys.h
> > index 21250ff..a3479eb 100644
> > --- a/src/gallium/include/state_tracker/sw_winsys.h
> > +++ b/src/gallium/include/state_tracker/sw_winsys.h
> > @@ -37,7 +37,6 @@
> >
> >  #include "pipe/p_compiler.h" /* for boolean */
> >  #include "pipe/p_format.h"
> > -#include "pipe/p_defines.h" /* for pipe_cap */
> >
> >
> >  #ifdef __cplusplus
> > @@ -136,10 +135,6 @@ struct sw_winsys
> >     void
> >     (*displaytarget_destroy)( struct sw_winsys *ws,
> >                               struct sw_displaytarget *dt );
> > -
> > -   int
> > -   (*get_param)( struct sw_winsys *ws,
> > -                 enum pipe_cap param );
> >  };
> >
> >
> > diff --git a/src/gallium/state_trackers/dri/dri2.c
b/src/gallium/state_trackers/dri/dri2.c
> > index 5c028b5..ef192e3 100644
> > --- a/src/gallium/state_trackers/dri/dri2.c
> > +++ b/src/gallium/state_trackers/dri/dri2.c
> > @@ -1297,7 +1297,7 @@ dri2_init_screen(__DRIscreen * sPriv)
> >     if (!configs)
> >        goto fail;
> >
> > -   screen->can_share_buffer = pscreen->get_param(pscreen,
PIPE_CAP_BUFFER_SHARE);
> > +   screen->can_share_buffer = true;
> >     screen->auto_fake_front = dri_with_format(sPriv);
> >     screen->broken_invalidate = !sPriv->dri2.useInvalidate;
> >     screen->lookup_egl_image = dri2_lookup_egl_image;
> > @@ -1343,6 +1343,7 @@ dri_kms_init_screen(__DRIscreen * sPriv)
> >     if (!configs)
> >        goto fail;
> >
> > +   screen->can_share_buffer = false;
> >     screen->auto_fake_front = dri_with_format(sPriv);
> >     screen->broken_invalidate = !sPriv->dri2.useInvalidate;
> >     screen->lookup_egl_image = dri2_lookup_egl_image;
> > diff --git a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
b/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
> > index a5ac1db..c9934bb 100644
> > --- a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
> > +++ b/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
> > @@ -277,18 +277,6 @@ kms_sw_displaytarget_display(struct sw_winsys *ws,
> >     assert(0);
> >  }
> >
> > -static int
> > -kms_sw_get_param(struct sw_winsys *ws,
> > -                 enum pipe_cap     param)
> > -{
> > -   switch (param) {
> > -   case PIPE_CAP_BUFFER_SHARE:
> > -      return 0;
> > -
> > -   default:
> > -      return 0;
> > -   }
> > -}
> >
> >  static void
> >  kms_destroy_sw_winsys(struct sw_winsys *winsys)
> > @@ -324,8 +312,6 @@ kms_dri_create_winsys(int fd)
> >
> >     ws->base.displaytarget_display = kms_sw_displaytarget_display;
> >
> > -   ws->base.get_param = kms_sw_get_param;
> > -
> >     return &ws->base;
> >  }
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140730/56362557/attachment-0001.html>


More information about the mesa-dev mailing list