[Mesa-dev] [PATCH RFC 1/9] loader: Add dri3 helper
Emil Velikov
emil.l.velikov at gmail.com
Tue Jul 28 05:15:23 PDT 2015
On 21 July 2015 at 16:43, Boyan Ding <boyan.j.ding at gmail.com> wrote:
> Signed-off-by: Boyan Ding <boyan.j.ding at gmail.com>
> ---
> configure.ac | 8 +-
> src/loader/Makefile.am | 9 +
> src/loader/loader_dri3_helper.c | 1397 +++++++++++++++++++++++++++++++++++++++
> src/loader/loader_dri3_helper.h | 226 +++++++
> 4 files changed, 1639 insertions(+), 1 deletion(-)
> create mode 100644 src/loader/loader_dri3_helper.c
> create mode 100644 src/loader/loader_dri3_helper.h
>
> diff --git a/configure.ac b/configure.ac
> index bb6d4f6..a91bbd4 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1195,7 +1195,8 @@ xyesno)
>
> if test x"$enable_dri3" = xyes; then
> PKG_CHECK_EXISTS([xcb >= $XCB_REQUIRED], [], AC_MSG_ERROR([DRI3 requires xcb >= $XCB_REQUIRED]))
> - dri_modules="$dri_modules xcb-dri3 xcb-present xcb-sync xshmfence >= $XSHMFENCE_REQUIRED"
> + dri3_modules="xcb-dri3 xcb-present xcb-sync xshmfence >= $XSHMFENCE_REQUIRED"
> + PKG_CHECK_MODULES([XCB_DRI3], [$dri3_modules])
> fi
> fi
> if test x"$dri_platform" = xapple ; then
> @@ -1214,6 +1215,10 @@ xyesno)
> X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
> GL_LIB_DEPS="$DRIGL_LIBS"
>
> + if test x"$enable_dri3" = xyes; then
> + GL_LIB_DEPS="$GL_LIB_DEPS $XCB_DRI3_LIBS"
> + fi
> +
> # need DRM libs, $PTHREAD_LIBS, etc.
> GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
> GL_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
> @@ -1252,6 +1257,7 @@ AC_SUBST([GLESv2_LIB_DEPS])
> AC_SUBST([GLESv2_PC_LIB_PRIV])
>
> AC_SUBST([HAVE_XF86VIDMODE])
> +AC_SUBST([XCB_DRI3_LIBS])
>
This line isn't needed.
> dnl
> dnl More GLX setup
> diff --git a/src/loader/Makefile.am b/src/loader/Makefile.am
> index aef1bd6..c072728 100644
> --- a/src/loader/Makefile.am
> +++ b/src/loader/Makefile.am
> @@ -58,3 +58,12 @@ libloader_la_CPPFLAGS += \
> libloader_la_LIBADD += \
> $(LIBDRM_LIBS)
> endif
> +
> +if HAVE_DRI3
> +libloader_la_SOURCES += \
> + loader_dri3_helper.c \
> + loader_dri3_helper.h
> +
> +libloader_la_LIBADD += \
> + $(XCB_DRI3_LIBS)
Can you get into a separate static library. As-is the xcb+other
dependencies will end up in places were we don't want/need them.
> --- /dev/null
> +++ b/src/loader/loader_dri3_helper.c
[snip]
> +static inline void
> +dri3_fence_trigger(xcb_connection_t *c, struct loader_dri3_buffer *buffer)
> +{
> + xcb_sync_trigger_fence(c, buffer->sync_fence);
> +}
> +
> +static inline void
> +dri3_fence_await(xcb_connection_t *c, struct loader_dri3_buffer *buffer)
> +{
> + xcb_flush(c);
> + xshmfence_await(buffer->shm_fence);
> +}
> +
> +static void
> +loader_dri3_update_num_back(struct loader_dri3_drawable *draw)
Bikeshed: you can keep static functions with the dri3 prefix, and
mandate loader_dri3_ for everything else.
> --- /dev/null
> +++ b/src/loader/loader_dri3_helper.h
[snip]
> +void
> +loader_dri3_flush(struct loader_dri3_drawable *draw,
> + unsigned flags,
> + enum __DRI2throttleReason throttle_reason);
> +
> +void
> +loader_dri3_copy_sub_buffer(struct loader_dri3_drawable *draw,
> + int x, int y,
> + int width, int height,
> + bool flush);
> +
> +void
> +loader_dri3_copy_drawable(struct loader_dri3_drawable *draw,
> + xcb_drawable_t dest,
> + xcb_drawable_t src);
> +
> +void loader_dri3_wait_x(struct loader_dri3_drawable *draw);
> +void loader_dri3_wait_gl(struct loader_dri3_drawable *draw);
> +
> +int loader_dri3_open(xcb_connection_t *conn,
Bikeshed: I realise that things are a bit funny currently but can you
use a consistent way to declare the functions. Something like the
following is more widely used.
return_type
function_name(function arguments)
More information about the mesa-dev
mailing list