[Mesa-dev] [PATCH 01/14] vl: add DRI3 support infrastructure

Leo Liu leo.liu at amd.com
Wed May 11 15:06:23 UTC 2016


Required functions into place for implementation later

Signed-off-by: Leo Liu <leo.liu at amd.com>
---
 src/gallium/auxiliary/Makefile.sources    |   5 ++
 src/gallium/auxiliary/vl/vl_winsys.h      |   5 ++
 src/gallium/auxiliary/vl/vl_winsys_dri3.c | 109 ++++++++++++++++++++++++++++++
 3 files changed, 119 insertions(+)
 create mode 100644 src/gallium/auxiliary/vl/vl_winsys_dri3.c

diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources
index 84da85c..44b3fec 100644
--- a/src/gallium/auxiliary/Makefile.sources
+++ b/src/gallium/auxiliary/Makefile.sources
@@ -354,6 +354,11 @@ VL_WINSYS_SOURCES := \
 	vl/vl_winsys_dri.c \
 	vl/vl_winsys_drm.c
 
+if HAVE_DRI3
+VL_WINSYS_SOURCES += \
+	vl/vl_winsys_dri3.c
+endif
+
 VL_STUB_SOURCES := \
 	vl/vl_stubs.c
 
diff --git a/src/gallium/auxiliary/vl/vl_winsys.h b/src/gallium/auxiliary/vl/vl_winsys.h
index 1af7653..26db9f2 100644
--- a/src/gallium/auxiliary/vl/vl_winsys.h
+++ b/src/gallium/auxiliary/vl/vl_winsys.h
@@ -69,4 +69,9 @@ vl_dri2_screen_create(Display *display, int screen);
 struct vl_screen *
 vl_drm_screen_create(int fd);
 
+#if defined(HAVE_DRI3)
+struct vl_screen *
+vl_dri3_screen_create(Display *display, int screen);
+#endif
+
 #endif
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
new file mode 100644
index 0000000..2c3d3ae
--- /dev/null
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
@@ -0,0 +1,109 @@
+/**************************************************************************
+ *
+ * Copyright 2016 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include "pipe/p_screen.h"
+
+#include "util/u_memory.h"
+#include "vl/vl_winsys.h"
+
+struct vl_dri3_screen
+{
+   struct vl_screen base;
+};
+
+static void
+vl_dri3_flush_frontbuffer(struct pipe_screen *screen,
+                          struct pipe_resource *resource,
+                          unsigned level, unsigned layer,
+                          void *context_private, struct pipe_box *sub_box)
+{
+   /* TODO */
+   return;
+}
+
+static struct pipe_resource *
+vl_dri3_screen_texture_from_drawable(struct vl_screen *vscreen, void *drawable)
+{
+   /* TODO */
+   return NULL;
+}
+
+static struct u_rect *
+vl_dri3_screen_get_dirty_area(struct vl_screen *vscreen)
+{
+   /* TODO */
+   return NULL;
+}
+
+static uint64_t
+vl_dri3_screen_get_timestamp(struct vl_screen *vscreen, void *drawable)
+{
+   /* TODO */
+   return 0;
+}
+
+static void
+vl_dri3_screen_set_next_timestamp(struct vl_screen *vscreen, uint64_t stamp)
+{
+   /* TODO */
+   return;
+}
+
+static void *
+vl_dri3_screen_get_private(struct vl_screen *vscreen)
+{
+   return vscreen;
+}
+
+static void
+vl_dri3_screen_destroy(struct vl_screen *vscreen)
+{
+   /* TODO */
+   return;
+}
+
+struct vl_screen *
+vl_dri3_screen_create(Display *display, int screen)
+{
+   struct vl_dri3_screen *scrn;
+
+   assert(display);
+
+   scrn = CALLOC_STRUCT(vl_dri3_screen);
+   if (!scrn)
+      return NULL;
+
+   scrn->base.destroy = vl_dri3_screen_destroy;
+   scrn->base.texture_from_drawable = vl_dri3_screen_texture_from_drawable;
+   scrn->base.get_dirty_area = vl_dri3_screen_get_dirty_area;
+   scrn->base.get_timestamp = vl_dri3_screen_get_timestamp;
+   scrn->base.set_next_timestamp = vl_dri3_screen_set_next_timestamp;
+   scrn->base.get_private = vl_dri3_screen_get_private;
+   scrn->base.pscreen->flush_frontbuffer = vl_dri3_flush_frontbuffer;
+
+   return &scrn->base;
+}
-- 
2.7.4



More information about the mesa-dev mailing list