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