vl: move winsys helper out of winsys directory
authorChristian König <deathsimple@vodafone.de>
Mon, 26 Mar 2012 17:40:42 +0000 (19:40 +0200)
committerChristian König <deathsimple@vodafone.de>
Wed, 28 Mar 2012 13:47:41 +0000 (15:47 +0200)
They aren't winsys of their own,
just help dealing with them.

v2: add some more comments in vl_winsys.h

Signed-off-by: Christian König <deathsimple@vodafone.de>
33 files changed:
configure.ac
src/gallium/auxiliary/vl/vl_winsys.h [new file with mode: 0644]
src/gallium/auxiliary/vl/vl_winsys_dri.c [new file with mode: 0644]
src/gallium/auxiliary/vl/vl_winsys_xsp.c [new file with mode: 0644]
src/gallium/state_trackers/va/Makefile
src/gallium/state_trackers/va/va_context.c
src/gallium/state_trackers/vdpau/Makefile
src/gallium/state_trackers/vdpau/device.c
src/gallium/state_trackers/vdpau/query.c
src/gallium/state_trackers/vdpau/vdpau_private.h
src/gallium/state_trackers/xvmc/Makefile
src/gallium/state_trackers/xvmc/context.c
src/gallium/state_trackers/xvmc/subpicture.c
src/gallium/state_trackers/xvmc/surface.c
src/gallium/targets/Makefile.va
src/gallium/targets/Makefile.vdpau
src/gallium/targets/Makefile.xvmc
src/gallium/targets/va-r300/Makefile
src/gallium/targets/va-r600/Makefile
src/gallium/targets/va-softpipe/Makefile
src/gallium/targets/vdpau-nouveau/Makefile
src/gallium/targets/vdpau-r300/Makefile
src/gallium/targets/vdpau-r600/Makefile
src/gallium/targets/vdpau-softpipe/Makefile
src/gallium/targets/xvmc-nouveau/Makefile
src/gallium/targets/xvmc-r300/Makefile
src/gallium/targets/xvmc-r600/Makefile
src/gallium/targets/xvmc-softpipe/Makefile
src/gallium/winsys/g3dvl/Makefile [deleted file]
src/gallium/winsys/g3dvl/dri/Makefile [deleted file]
src/gallium/winsys/g3dvl/dri/dri_winsys.c [deleted file]
src/gallium/winsys/g3dvl/vl_winsys.h [deleted file]
src/gallium/winsys/g3dvl/xlib/xsp_winsys.c [deleted file]

index ac7d49f1f60ffd568cc6b496d124134cf4a99ca3..1c437e7baafefa7ada6ea6a262346c4cae360e3d 100644 (file)
@@ -1844,15 +1844,12 @@ gallium_check_st() {
     fi
     if test "x$HAVE_ST_XVMC" = xyes && test "x$5" != x; then
          GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $5"
-         NEED_G3DVL_DRI="yes"
     fi
     if test "x$HAVE_ST_VDPAU" = xyes && test "x$6" != x; then
          GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $6"
-         NEED_G3DVL_DRI="yes"
     fi
     if test "x$HAVE_ST_VA" = xyes && test "x$7" != x; then
          GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $7"
-         NEED_G3DVL_DRI="yes"
     fi
 }
 
@@ -1932,10 +1929,6 @@ if test "x$with_gallium_drivers" != x; then
     done
 fi
 
-if test "x$NEED_G3DVL_DRI" = xyes; then
-    GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS g3dvl/dri"
-fi
-
 dnl Tell Automake which drivers to build
 for driver in $GALLIUM_DRIVERS_DIRS; do
     case "x$driver" in
diff --git a/src/gallium/auxiliary/vl/vl_winsys.h b/src/gallium/auxiliary/vl/vl_winsys.h
new file mode 100644 (file)
index 0000000..5f60d3e
--- /dev/null
@@ -0,0 +1,69 @@
+/**************************************************************************
+ *
+ * Copyright 2009 Younes Manton.
+ * 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 TUNGSTEN GRAPHICS 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.
+ *
+ **************************************************************************/
+
+/*
+ * vl targets use either a dri or sw based winsys backend, so their
+ * Makefiles directly refer to either vl_winsys_dri.c or vl_winsys_xsp.c.
+ * Both files implement the interface described in this header.
+ */
+
+#ifndef vl_winsys_h
+#define vl_winsys_h
+
+#include <X11/Xlib.h>
+#include "pipe/p_defines.h"
+#include "pipe/p_format.h"
+
+struct pipe_screen;
+struct pipe_surface;
+
+struct vl_screen
+{
+   struct pipe_screen *pscreen;
+};
+
+struct vl_screen*
+vl_screen_create(Display *display, int screen);
+
+void vl_screen_destroy(struct vl_screen *vscreen);
+
+struct pipe_resource*
+vl_screen_texture_from_drawable(struct vl_screen *vscreen, Drawable drawable);
+
+struct u_rect *
+vl_screen_get_dirty_area(struct vl_screen *vscreen);
+
+uint64_t
+vl_screen_get_timestamp(struct vl_screen *vscreen, Drawable drawable);
+
+void
+vl_screen_set_next_timestamp(struct vl_screen *vscreen, uint64_t stamp);
+
+void*
+vl_screen_get_private(struct vl_screen *vscreen);
+
+#endif
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c b/src/gallium/auxiliary/vl/vl_winsys_dri.c
new file mode 100644 (file)
index 0000000..8e4e026
--- /dev/null
@@ -0,0 +1,400 @@
+/**************************************************************************
+ *
+ * Copyright 2009 Younes Manton.
+ * 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 TUNGSTEN GRAPHICS 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.
+ *
+ **************************************************************************/
+
+/* directly referenced from target Makefile, because of X dependencies */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <X11/Xlib-xcb.h>
+#include <xcb/dri2.h>
+#include <xf86drm.h>
+
+#include "pipe/p_screen.h"
+#include "pipe/p_context.h"
+#include "pipe/p_state.h"
+#include "state_tracker/drm_driver.h"
+
+#include "util/u_memory.h"
+#include "util/u_hash.h"
+#include "util/u_hash_table.h"
+#include "util/u_inlines.h"
+
+#include "vl/vl_compositor.h"
+#include "vl/vl_winsys.h"
+
+struct vl_dri_screen
+{
+   struct vl_screen base;
+   xcb_connection_t *conn;
+   xcb_drawable_t drawable;
+
+   unsigned width, height;
+
+   bool current_buffer;
+   uint32_t buffer_names[2];
+   struct u_rect dirty_areas[2];
+
+   bool flushed;
+   xcb_dri2_swap_buffers_cookie_t swap_cookie;
+   xcb_dri2_wait_sbc_cookie_t wait_cookie;
+   xcb_dri2_get_buffers_cookie_t buffers_cookie;
+
+   int64_t last_ust, ns_frame, last_msc, next_msc, skew_msc;
+};
+
+static const unsigned int attachments[1] = { XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT };
+
+static void
+vl_dri2_handle_stamps(struct vl_dri_screen* scrn,
+                      uint32_t ust_hi, uint32_t ust_lo,
+                      uint32_t msc_hi, uint32_t msc_lo)
+{
+   int64_t ust = ((((uint64_t)ust_hi) << 32) | ust_lo) * 1000;
+   int64_t msc = (((uint64_t)msc_hi) << 32) | msc_lo;
+
+   if (scrn->last_ust && scrn->last_msc && (ust > scrn->last_ust) && (msc > scrn->last_msc))
+      scrn->ns_frame = (ust - scrn->last_ust) / (msc - scrn->last_msc);
+
+   if (scrn->next_msc && (scrn->next_msc < msc))
+      scrn->skew_msc++;
+
+   scrn->last_ust = ust;
+   scrn->last_msc = msc;
+}
+
+static xcb_dri2_get_buffers_reply_t*
+vl_dri2_get_flush_reply(struct vl_dri_screen *scrn)
+{
+   xcb_dri2_wait_sbc_reply_t *wait_sbc_reply;
+
+   assert(scrn);
+
+   if (!scrn->flushed)
+      return NULL;
+
+   scrn->flushed = false;
+
+   free(xcb_dri2_swap_buffers_reply(scrn->conn, scrn->swap_cookie, NULL));
+
+   wait_sbc_reply = xcb_dri2_wait_sbc_reply(scrn->conn, scrn->wait_cookie, NULL);
+   if (!wait_sbc_reply)
+      return NULL;
+   vl_dri2_handle_stamps(scrn, wait_sbc_reply->ust_hi, wait_sbc_reply->ust_lo,
+                         wait_sbc_reply->msc_hi, wait_sbc_reply->msc_lo);
+   free(wait_sbc_reply);
+
+   return xcb_dri2_get_buffers_reply(scrn->conn, scrn->buffers_cookie, NULL);
+}
+
+static void
+vl_dri2_flush_frontbuffer(struct pipe_screen *screen,
+                          struct pipe_resource *resource,
+                          unsigned level, unsigned layer,
+                          void *context_private)
+{
+   struct vl_dri_screen *scrn = (struct vl_dri_screen*)context_private;
+   uint32_t msc_hi, msc_lo;
+
+   assert(screen);
+   assert(resource);
+   assert(context_private);
+
+   free(vl_dri2_get_flush_reply(scrn));
+
+   msc_hi = scrn->next_msc >> 32;
+   msc_lo = scrn->next_msc & 0xFFFFFFFF;
+
+   scrn->swap_cookie = xcb_dri2_swap_buffers_unchecked(scrn->conn, scrn->drawable, msc_hi, msc_lo, 0, 0, 0, 0);
+   scrn->wait_cookie = xcb_dri2_wait_sbc_unchecked(scrn->conn, scrn->drawable, 0, 0);
+   scrn->buffers_cookie = xcb_dri2_get_buffers_unchecked(scrn->conn, scrn->drawable, 1, 1, attachments);
+
+   scrn->flushed = true;
+   scrn->current_buffer = !scrn->current_buffer;
+}
+
+static void
+vl_dri2_destroy_drawable(struct vl_dri_screen *scrn)
+{
+   xcb_void_cookie_t destroy_cookie;
+   if (scrn->drawable) {
+      free(vl_dri2_get_flush_reply(scrn));
+      destroy_cookie = xcb_dri2_destroy_drawable_checked(scrn->conn, scrn->drawable);
+      /* ignore any error here, since the drawable can be destroyed long ago */
+      free(xcb_request_check(scrn->conn, destroy_cookie));
+   }
+}
+
+static void
+vl_dri2_set_drawable(struct vl_dri_screen *scrn, Drawable drawable)
+{
+   assert(scrn);
+   assert(drawable);
+
+   if (scrn->drawable == drawable)
+      return;
+
+   vl_dri2_destroy_drawable(scrn);
+
+   xcb_dri2_create_drawable(scrn->conn, drawable);
+   scrn->current_buffer = false;
+   vl_compositor_reset_dirty_area(&scrn->dirty_areas[0]);
+   vl_compositor_reset_dirty_area(&scrn->dirty_areas[1]);
+   scrn->drawable = drawable;
+}
+
+struct pipe_resource*
+vl_screen_texture_from_drawable(struct vl_screen *vscreen, Drawable drawable)
+{
+   struct vl_dri_screen *scrn = (struct vl_dri_screen*)vscreen;
+
+   struct winsys_handle dri2_handle;
+   struct pipe_resource template, *tex;
+
+   xcb_dri2_get_buffers_reply_t *reply;
+   xcb_dri2_dri2_buffer_t *buffers, *back_left;
+
+   unsigned i;
+
+   assert(scrn);
+
+   vl_dri2_set_drawable(scrn, drawable);
+   reply = vl_dri2_get_flush_reply(scrn);
+   if (!reply) {
+      xcb_dri2_get_buffers_cookie_t cookie;
+      cookie = xcb_dri2_get_buffers_unchecked(scrn->conn, drawable, 1, 1, attachments);
+      reply = xcb_dri2_get_buffers_reply(scrn->conn, cookie, NULL);
+   }
+   if (!reply)
+      return NULL;
+
+   buffers = xcb_dri2_get_buffers_buffers(reply);
+   if (!buffers)  {
+      free(reply);
+      return NULL;
+   }
+
+   for (i = 0; i < reply->count; ++i) {
+      if (buffers[i].attachment == XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT) {
+         back_left = &buffers[i];
+         break;
+      }
+   }
+
+   if (i == reply->count) {
+      free(reply);
+      return NULL;
+   }
+
+   if (reply->width != scrn->width || reply->height != scrn->height) {
+      vl_compositor_reset_dirty_area(&scrn->dirty_areas[0]);
+      vl_compositor_reset_dirty_area(&scrn->dirty_areas[1]);
+      scrn->width = reply->width;
+      scrn->height = reply->height;
+
+   } else if (back_left->name != scrn->buffer_names[scrn->current_buffer]) {
+      vl_compositor_reset_dirty_area(&scrn->dirty_areas[scrn->current_buffer]);
+      scrn->buffer_names[scrn->current_buffer] = back_left->name;
+   }
+
+   memset(&dri2_handle, 0, sizeof(dri2_handle));
+   dri2_handle.type = DRM_API_HANDLE_TYPE_SHARED;
+   dri2_handle.handle = back_left->name;
+   dri2_handle.stride = back_left->pitch;
+
+   memset(&template, 0, sizeof(template));
+   template.target = PIPE_TEXTURE_2D;
+   template.format = PIPE_FORMAT_B8G8R8X8_UNORM;
+   template.last_level = 0;
+   template.width0 = reply->width;
+   template.height0 = reply->height;
+   template.depth0 = 1;
+   template.array_size = 1;
+   template.usage = PIPE_USAGE_STATIC;
+   template.bind = PIPE_BIND_RENDER_TARGET;
+   template.flags = 0;
+
+   tex = scrn->base.pscreen->resource_from_handle(scrn->base.pscreen, &template, &dri2_handle);
+   free(reply);
+
+   return tex;
+}
+
+struct u_rect *
+vl_screen_get_dirty_area(struct vl_screen *vscreen)
+{
+   struct vl_dri_screen *scrn = (struct vl_dri_screen*)vscreen;
+   assert(scrn);
+   return &scrn->dirty_areas[scrn->current_buffer];
+}
+
+uint64_t
+vl_screen_get_timestamp(struct vl_screen *vscreen, Drawable drawable)
+{
+   struct vl_dri_screen *scrn = (struct vl_dri_screen*)vscreen;
+   xcb_dri2_get_msc_cookie_t cookie;
+   xcb_dri2_get_msc_reply_t *reply;
+
+   assert(scrn);
+
+   vl_dri2_set_drawable(scrn, drawable);
+   if (!scrn->last_ust) {
+      cookie = xcb_dri2_get_msc_unchecked(scrn->conn, drawable);
+      reply = xcb_dri2_get_msc_reply(scrn->conn, cookie, NULL);
+
+      if (reply) {
+         vl_dri2_handle_stamps(scrn, reply->ust_hi, reply->ust_lo,
+                               reply->msc_hi, reply->msc_lo);
+         free(reply);
+      }
+   }
+   return scrn->last_ust;
+}
+
+void
+vl_screen_set_next_timestamp(struct vl_screen *vscreen, uint64_t stamp)
+{
+   struct vl_dri_screen *scrn = (struct vl_dri_screen*)vscreen;
+   assert(scrn);
+   if (stamp && scrn->last_ust && scrn->ns_frame && scrn->last_msc)
+      scrn->next_msc = ((int64_t)stamp - scrn->last_ust) / scrn->ns_frame + scrn->last_msc + scrn->skew_msc;
+   else
+      scrn->next_msc = 0;
+}
+
+void*
+vl_screen_get_private(struct vl_screen *vscreen)
+{
+   return vscreen;
+}
+
+struct vl_screen*
+vl_screen_create(Display *display, int screen)
+{
+   struct vl_dri_screen *scrn;
+   const xcb_query_extension_reply_t *extension;
+   xcb_dri2_query_version_cookie_t dri2_query_cookie;
+   xcb_dri2_query_version_reply_t *dri2_query = NULL;
+   xcb_dri2_connect_cookie_t connect_cookie;
+   xcb_dri2_connect_reply_t *connect = NULL;
+   xcb_dri2_authenticate_cookie_t authenticate_cookie;
+   xcb_dri2_authenticate_reply_t *authenticate = NULL;
+   xcb_screen_iterator_t s;
+   xcb_generic_error_t *error = NULL;
+   char *device_name;
+   int fd, device_name_length;
+
+   drm_magic_t magic;
+
+   assert(display);
+
+   scrn = CALLOC_STRUCT(vl_dri_screen);
+   if (!scrn)
+      return NULL;
+
+   scrn->conn = XGetXCBConnection(display);
+   if (!scrn->conn)
+      goto free_screen;
+
+   xcb_prefetch_extension_data(scrn->conn, &xcb_dri2_id);
+
+   extension = xcb_get_extension_data(scrn->conn, &xcb_dri2_id);
+   if (!(extension && extension->present))
+      goto free_screen;
+
+   dri2_query_cookie = xcb_dri2_query_version (scrn->conn, XCB_DRI2_MAJOR_VERSION, XCB_DRI2_MINOR_VERSION);
+   dri2_query = xcb_dri2_query_version_reply (scrn->conn, dri2_query_cookie, &error);
+   if (dri2_query == NULL || error != NULL || dri2_query->minor_version < 2)
+      goto free_screen;
+
+   s = xcb_setup_roots_iterator(xcb_get_setup(scrn->conn));
+   connect_cookie = xcb_dri2_connect_unchecked(scrn->conn, s.data->root, XCB_DRI2_DRIVER_TYPE_DRI);
+   connect = xcb_dri2_connect_reply(scrn->conn, connect_cookie, NULL);
+   if (connect == NULL || connect->driver_name_length + connect->device_name_length == 0)
+      goto free_screen;
+
+   device_name_length = xcb_dri2_connect_device_name_length(connect);
+   device_name = CALLOC(1, device_name_length);
+   memcpy(device_name, xcb_dri2_connect_device_name(connect), device_name_length);
+   device_name[device_name_length] = 0;
+   fd = open(device_name, O_RDWR);
+   free(device_name);
+
+   if (fd < 0)
+      goto free_screen;
+
+   if (drmGetMagic(fd, &magic))
+      goto free_screen;
+
+   authenticate_cookie = xcb_dri2_authenticate_unchecked(scrn->conn, s.data->root, magic);
+   authenticate = xcb_dri2_authenticate_reply(scrn->conn, authenticate_cookie, NULL);
+
+   if (authenticate == NULL || !authenticate->authenticated)
+      goto free_screen;
+
+   scrn->base.pscreen = driver_descriptor.create_screen(fd);
+   if (!scrn->base.pscreen)
+      goto free_screen;
+
+   scrn->base.pscreen->flush_frontbuffer = vl_dri2_flush_frontbuffer;
+   vl_compositor_reset_dirty_area(&scrn->dirty_areas[0]);
+   vl_compositor_reset_dirty_area(&scrn->dirty_areas[1]);
+
+   free(dri2_query);
+   free(connect);
+   free(authenticate);
+
+   return &scrn->base;
+
+free_screen:
+   FREE(scrn);
+
+   free(dri2_query);
+   free(connect);
+   free(authenticate);
+   free(error);
+
+   return NULL;
+}
+
+void vl_screen_destroy(struct vl_screen *vscreen)
+{
+   struct vl_dri_screen *scrn = (struct vl_dri_screen*)vscreen;
+
+   assert(vscreen);
+
+   if (scrn->flushed) {
+      free(xcb_dri2_swap_buffers_reply(scrn->conn, scrn->swap_cookie, NULL));
+      free(xcb_dri2_wait_sbc_reply(scrn->conn, scrn->wait_cookie, NULL));
+      free(xcb_dri2_get_buffers_reply(scrn->conn, scrn->buffers_cookie, NULL));
+   }
+
+   vl_dri2_destroy_drawable(scrn);
+   scrn->base.pscreen->destroy(scrn->base.pscreen);
+   FREE(scrn);
+}
diff --git a/src/gallium/auxiliary/vl/vl_winsys_xsp.c b/src/gallium/auxiliary/vl/vl_winsys_xsp.c
new file mode 100644 (file)
index 0000000..ce3a37f
--- /dev/null
@@ -0,0 +1,170 @@
+/**************************************************************************
+ *
+ * Copyright 2009 Younes Manton.
+ * 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 TUNGSTEN GRAPHICS 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.
+ *
+ **************************************************************************/
+
+/* directly referenced from target Makefile, because of X dependencies */
+
+#include <sys/time.h>
+
+#include "pipe/p_state.h"
+
+#include "util/u_memory.h"
+#include "util/u_format.h"
+#include "util/u_inlines.h"
+
+#include "state_tracker/xlib_sw_winsys.h"
+#include "softpipe/sp_public.h"
+
+#include "vl/vl_compositor.h"
+#include "vl/vl_winsys.h"
+
+struct vl_xsp_screen
+{
+   struct vl_screen base;
+   Display *display;
+   int screen;
+   Visual visual;
+   struct xlib_drawable xdraw;
+   struct pipe_resource *tex;
+   struct u_rect dirty_area;
+};
+
+struct pipe_resource*
+vl_screen_texture_from_drawable(struct vl_screen *vscreen, Drawable drawable)
+{
+   struct vl_xsp_screen *xsp_screen = (struct vl_xsp_screen*)vscreen;
+   Window root;
+   int x, y;
+   unsigned int width, height;
+   unsigned int border_width;
+   unsigned int depth;
+   struct pipe_resource templat;
+
+   assert(vscreen);
+   assert(drawable != None);
+
+   if (XGetGeometry(xsp_screen->display, drawable, &root, &x, &y, &width, &height, &border_width, &depth) == BadDrawable)
+      return NULL;
+
+   xsp_screen->xdraw.drawable = drawable;
+
+   if (xsp_screen->tex) {
+      if (xsp_screen->tex->width0 == width && xsp_screen->tex->height0 == height)
+         return xsp_screen->tex;
+      pipe_resource_reference(&xsp_screen->tex, NULL);
+      vl_compositor_reset_dirty_area(&xsp_screen->dirty_area);
+   }
+
+   memset(&templat, 0, sizeof(struct pipe_resource));
+   templat.target = PIPE_TEXTURE_2D;
+   /* XXX: Need to figure out drawable's format */
+   templat.format = PIPE_FORMAT_B8G8R8X8_UNORM;
+   templat.last_level = 0;
+   templat.width0 = width;
+   templat.height0 = height;
+   templat.depth0 = 1;
+   templat.usage = PIPE_USAGE_DEFAULT;
+   templat.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_DISPLAY_TARGET;
+   templat.flags = 0;
+
+   xsp_screen->xdraw.depth = 24/*util_format_get_blocksizebits(templat.format) /
+                             util_format_get_blockwidth(templat.format)*/;
+
+   pipe_resource_reference(&xsp_screen->tex, vscreen->pscreen->resource_create(vscreen->pscreen, &templat));
+   return xsp_screen->tex;
+}
+
+struct u_rect *
+vl_screen_get_dirty_area(struct vl_screen *vscreen)
+{
+   struct vl_xsp_screen *xsp_screen = (struct vl_xsp_screen*)vscreen;
+   return &xsp_screen->dirty_area;
+}
+
+uint64_t
+vl_screen_get_timestamp(struct vl_screen *vscreen, Drawable drawable)
+{
+   struct timeval tv;
+   gettimeofday(&tv, NULL);
+   return (uint64_t)tv.tv_sec * 1000000000LL + (uint64_t)tv.tv_usec * 1000LL;
+}
+
+void
+vl_screen_set_next_timestamp(struct vl_screen *vscreen, uint64_t stamp)
+{
+   /* not supported on softpipe and so only a dummy */
+}
+
+void*
+vl_screen_get_private(struct vl_screen *vscreen)
+{
+   struct vl_xsp_screen *xsp_screen = (struct vl_xsp_screen*)vscreen;
+   return &xsp_screen->xdraw;
+}
+
+struct vl_screen*
+vl_screen_create(Display *display, int screen)
+{
+   struct vl_xsp_screen *xsp_screen;
+   struct sw_winsys *winsys;
+
+   assert(display);
+
+   xsp_screen = CALLOC_STRUCT(vl_xsp_screen);
+   if (!xsp_screen)
+      return NULL;
+
+   winsys = xlib_create_sw_winsys(display);
+   if (!winsys) {
+      FREE(xsp_screen);
+      return NULL;
+   }
+
+   xsp_screen->base.pscreen = softpipe_create_screen(winsys);
+   if (!xsp_screen->base.pscreen) {
+      winsys->destroy(winsys);
+      FREE(xsp_screen);
+      return NULL;
+   }
+
+   xsp_screen->display = display;
+   xsp_screen->screen = screen;
+   xsp_screen->xdraw.visual = XDefaultVisual(display, screen);
+   vl_compositor_reset_dirty_area(&xsp_screen->dirty_area);
+
+   return &xsp_screen->base;
+}
+
+void vl_screen_destroy(struct vl_screen *vscreen)
+{
+   struct vl_xsp_screen *xsp_screen = (struct vl_xsp_screen*)vscreen;
+
+   assert(vscreen);
+
+   pipe_resource_reference(&xsp_screen->tex, NULL);
+   vscreen->pscreen->destroy(vscreen->pscreen);
+   FREE(vscreen);
+}
index 775e4db216d597fc22daa9c3dfed565989e4df9e..007d16ff1633423ea1c7f48e81a0fbf9827b7d64 100644 (file)
@@ -7,9 +7,7 @@ VA_MAJOR = 0
 VA_MINOR = 3
 LIBRARY_DEFINES = -DVER_MAJOR=$(VA_MAJOR) -DVER_MINOR=$(VA_MINOR) $(STATE_TRACKER_DEFINES)
 
-LIBRARY_INCLUDES = \
-       $(shell $(PKG_CONFIG) --cflags-only-I libva) \
-       -I$(TOP)/src/gallium/winsys/g3dvl
+LIBRARY_INCLUDES = $(shell $(PKG_CONFIG) --cflags-only-I libva)
 
 C_SOURCES = htab.c \
            ftab.c \
index ea0782f8de14086d4b49b160cd4bca79d221f524..218677f477c43a920e1cc9a2ab9964baf41d7146 100644 (file)
@@ -34,8 +34,7 @@
 
 #include "util/u_debug.h"
 #include "util/u_memory.h"
-
-#include "vl_winsys.h"
+#include "vl/vl_winsys.h"
 
 #include "va_private.h"
 
index 0aeadc0b5b061ebc50ee8629e6b745fd967e5ccc..e9cfc4c0e8581c5f3928fcfe26dfe9a8f3f4c6ad 100644 (file)
@@ -7,9 +7,7 @@ VDPAU_MAJOR = 1
 VDPAU_MINOR = 0
 LIBRARY_DEFINES = -DVER_MAJOR=$(VDPAU_MAJOR) -DVER_MINOR=$(VDPAU_MINOR) $(STATE_TRACKER_DEFINES)
 
-LIBRARY_INCLUDES = \
-       $(shell $(PKG_CONFIG) --cflags-only-I vdpau) \
-       -I$(TOP)/src/gallium/winsys/g3dvl
+LIBRARY_INCLUDES = $(shell $(PKG_CONFIG) --cflags-only-I vdpau)
 
 C_SOURCES = htab.c \
            ftab.c \
index 2e38f6cdadb51da486c67b127c37200fc570f66d..dd586f52856174bbedbf8e96a5fbe6fcbfc74eff 100644 (file)
@@ -31,8 +31,6 @@
 #include "util/u_debug.h"
 #include "util/u_sampler.h"
 
-#include "vl_winsys.h"
-
 #include "vdpau_private.h"
 
 /**
index 2b13ce15487d4f900bba4c265db79649f039c2cb..2281dcfd60f96460956b77d52bb82e76a974f815 100644 (file)
@@ -29,7 +29,6 @@
 #include <math.h>
 
 #include "vdpau_private.h"
-#include "vl_winsys.h"
 #include "pipe/p_screen.h"
 #include "pipe/p_defines.h"
 #include "util/u_debug.h"
index a54fcdcf2ae28e08a8c621232e3caf440bad1e15..918a6c20a09294a9ccd42a9e02ab5103bcedd7f9 100644 (file)
@@ -44,8 +44,7 @@
 #include "vl/vl_csc.h"
 #include "vl/vl_matrix_filter.h"
 #include "vl/vl_median_filter.h"
-
-#include "vl_winsys.h"
+#include "vl/vl_winsys.h"
 
 /* Full VDPAU API documentation available at :
  * ftp://download.nvidia.com/XFree86/vdpau/doxygen/html/index.html */
index 179446f5ad5aafe49f912adfa470731ab2c73ce3..c54bd7a8433afbd2b8c85048d1ea158b186b2445 100644 (file)
@@ -3,9 +3,7 @@ include $(TOP)/configs/current
 
 LIBNAME = xvmctracker
 
-LIBRARY_INCLUDES = \
-       $(shell $(PKG_CONFIG) --cflags-only-I xvmc) \
-       -I$(TOP)/src/gallium/winsys/g3dvl
+LIBRARY_INCLUDES = $(shell $(PKG_CONFIG) --cflags-only-I xvmc)
 
 C_SOURCES = block.c \
             surface.c \
index 7b97a67d6627bae7a2b28acde3b0c0c876da6b7a..366f29bcdfa742a1a274a99139d19b3ff510465e 100644 (file)
@@ -38,7 +38,7 @@
 #include "util/u_memory.h"
 
 #include "vl/vl_csc.h"
-#include "vl_winsys.h"
+#include "vl/vl_winsys.h"
 
 #include "xvmc_private.h"
 
index 058c56816ac41742fef17520ae504d61d8406b60..b33f16e6a311061d4fdf72c965ad662e58bfa2cc 100644 (file)
@@ -39,8 +39,7 @@
 #include "util/u_format.h"
 #include "util/u_sampler.h"
 #include "util/u_rect.h"
-
-#include "vl_winsys.h"
+#include "vl/vl_winsys.h"
 
 #include "xvmc_private.h"
 
index 615fd08d2a1e565f619d5842ba5647f30ff273ba..bec23a4a1be2b722eec671fb1f2d76df0ebd1860 100644 (file)
@@ -37,8 +37,7 @@
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "util/u_math.h"
-
-#include "vl_winsys.h"
+#include "vl/vl_winsys.h"
 
 #include "xvmc_private.h"
 
index 7215fc3a504dc6dcc37f37232ecd7e49ffa86988..884b59d224e7b55e278d7da3f510b48883f6641c 100644 (file)
@@ -8,7 +8,6 @@ INCLUDES = -I$(TOP)/src/gallium/include \
           -I$(TOP)/src/gallium/drivers \
           -I$(TOP)/src/gallium/auxiliary \
           -I$(TOP)/src/gallium/winsys \
-          -I$(TOP)/src/gallium/winsys/g3dvl \
           $(DRIVER_INCLUDES)
 DEFINES = -DGALLIUM_TRACE -DVER_MAJOR=$(VA_MAJOR) -DVER_MINOR=$(VA_MINOR) $(DRIVER_DEFINES)
 LIBS = $(EXTRA_LIB_PATH) $(DRIVER_LIBS) -lva -lXext -lX11 -lm
index 2c2385c4f1f76432b6a8f6ad966c1fb7cf54361f..a9e7a9c95490ce23bcb48c039ecb19a4973e4a45 100644 (file)
@@ -8,7 +8,6 @@ INCLUDES = -I$(TOP)/src/gallium/include \
           -I$(TOP)/src/gallium/drivers \
           -I$(TOP)/src/gallium/auxiliary \
           -I$(TOP)/src/gallium/winsys \
-          -I$(TOP)/src/gallium/winsys/g3dvl \
           $(DRIVER_INCLUDES)
 DEFINES = -DGALLIUM_TRACE -DVER_MAJOR=$(VDPAU_MAJOR) -DVER_MINOR=$(VDPAU_MINOR) $(DRIVER_DEFINES)
 LIBS = $(EXTRA_LIB_PATH) $(DRIVER_LIBS) -lvdpau -lX11-xcb -lxcb-dri2 -lm -lrt
index 5eafe9836e132e1bd8e0fbdbf6095a095cc1603b..217481e48e8123fcbdefec03079f96cfa6d69e5b 100644 (file)
@@ -8,7 +8,6 @@ INCLUDES = -I$(TOP)/src/gallium/include \
           -I$(TOP)/src/gallium/drivers \
           -I$(TOP)/src/gallium/auxiliary \
           -I$(TOP)/src/gallium/winsys \
-          -I$(TOP)/src/gallium/winsys/g3dvl \
           $(DRIVER_INCLUDES)
 DEFINES = -DGALLIUM_TRACE $(DRIVER_DEFINES)
 LIBS = $(EXTRA_LIB_PATH) $(DRIVER_LIBS) -lXv -lX11-xcb -lxcb-dri2 -lm
index a270dfa7c995d8c4a5e6153063f16dae20ec47d0..7c89c79b5ccc0998d89a316aa6bf83bb32f2c988 100644 (file)
@@ -4,11 +4,10 @@ include $(TOP)/configs/current
 LIBBASENAME = r300_drv_video
 
 DRIVER_DEFINES = -DGALLIUM_SOFTPIPE
-DRIVER_INCLUDES =
+DRIVER_INCLUDES = $(shell $(PKG_CONFIG) libdrm --cflags-only-I)
 
 PIPE_DRIVERS = \
        $(TOP)/src/gallium/drivers/r300/libr300.a \
-       $(TOP)/src/gallium/winsys/g3dvl/dri/libvldri.a \
         $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
        $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
         $(TOP)/src/gallium/drivers/trace/libtrace.a \
@@ -16,6 +15,7 @@ PIPE_DRIVERS = \
 
 C_SOURCES = \
        target.c \
+       $(TOP)/src/gallium/auxiliary/vl/vl_winsys_dri.c \
        $(COMMON_GALLIUM_SOURCES) \
        $(DRIVER_SOURCES)
 
index afead84391b10be8cebd1324bc75409b6664712a..50e7fa5e56063342078e39ea1db378018b907a2d 100644 (file)
@@ -4,18 +4,18 @@ include $(TOP)/configs/current
 LIBBASENAME = r600_drv_video
 
 DRIVER_DEFINES = -DGALLIUM_SOFTPIPE
-DRIVER_INCLUDES =
+DRIVER_INCLUDES = $(shell $(PKG_CONFIG) libdrm --cflags-only-I)
 
 PIPE_DRIVERS = \
        $(TOP)/src/gallium/drivers/r600/libr600.a \
-       $(TOP)/src/gallium/winsys/g3dvl/dri/libvldri.a \
        $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
        $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
-        $(TOP)/src/gallium/drivers/trace/libtrace.a \
+       $(TOP)/src/gallium/drivers/trace/libtrace.a \
        $(TOP)/src/gallium/auxiliary/libgallium.a
 
 C_SOURCES = \
        target.c \
+       $(TOP)/src/gallium/auxiliary/vl/vl_winsys_dri.c \
        $(COMMON_GALLIUM_SOURCES) \
        $(DRIVER_SOURCES)
 
index a58df36a9660df54ad39530be575b3918f6187bb..536cb7b29035cb59b03027643efdf516de5a5921 100644 (file)
@@ -12,7 +12,7 @@ PIPE_DRIVERS = \
        $(TOP)/src/gallium/auxiliary/libgallium.a
 
 C_SOURCES = \
-       $(TOP)/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c
+       $(TOP)/src/gallium/auxiliary/vl/vl_winsys_xsp.c
 
 DRIVER_LIBS =
 
index 55f990749cfd419225c27a03dfbde68ffde5d2b3..d3f1c7df8db0b434e963b1f86f8657f781b3ab7e 100644 (file)
@@ -3,8 +3,9 @@ include $(TOP)/configs/current
 
 LIBBASENAME = vdpau_nouveau
 
+DRIVER_INCLUDES = $(shell $(PKG_CONFIG) libdrm --cflags-only-I)
+
 PIPE_DRIVERS = \
-       $(TOP)/src/gallium/winsys/g3dvl/dri/libvldri.a \
        $(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
        $(TOP)/src/gallium/drivers/nvfx/libnvfx.a \
        $(TOP)/src/gallium/drivers/nv50/libnv50.a \
@@ -16,6 +17,7 @@ PIPE_DRIVERS = \
 
 C_SOURCES = \
        target.c \
+       $(TOP)/src/gallium/auxiliary/vl/vl_winsys_dri.c \
        $(COMMON_GALLIUM_SOURCES) \
        $(DRIVER_SOURCES)
 
index 849f72e03e8253d1410cf7ea4983a1025107089d..1ada550af15a729650dc45089dd1e8fd6f8daed1 100644 (file)
@@ -3,10 +3,10 @@ include $(TOP)/configs/current
 
 LIBBASENAME = vdpau_r300
 
+DRIVER_INCLUDES = $(shell $(PKG_CONFIG) libdrm --cflags-only-I)
 
 PIPE_DRIVERS = \
         $(TOP)/src/gallium/drivers/r300/libr300.a \
-       $(TOP)/src/gallium/winsys/g3dvl/dri/libvldri.a \
         $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
         $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
         $(TOP)/src/gallium/drivers/rbug/librbug.a \
@@ -17,6 +17,7 @@ PIPE_DRIVERS = \
 
 C_SOURCES = \
        target.c \
+       $(TOP)/src/gallium/auxiliary/vl/vl_winsys_dri.c \
        $(COMMON_GALLIUM_SOURCES) \
        $(DRIVER_SOURCES)
 
index ef27b6572c2ff090e7a430e8a0604f6f8e7e7284..05e0b4f45f1ed9f9f1f9a9dabb7eef1eb3999c1a 100644 (file)
@@ -3,15 +3,17 @@ include $(TOP)/configs/current
 
 LIBBASENAME = vdpau_r600
 
+DRIVER_INCLUDES = $(shell $(PKG_CONFIG) libdrm --cflags-only-I)
+
 PIPE_DRIVERS = \
-        $(TOP)/src/gallium/drivers/r600/libr600.a \
-       $(TOP)/src/gallium/winsys/g3dvl/dri/libvldri.a \
+       $(TOP)/src/gallium/drivers/r600/libr600.a \
        $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
-        $(TOP)/src/gallium/drivers/trace/libtrace.a \
+       $(TOP)/src/gallium/drivers/trace/libtrace.a \
        $(TOP)/src/gallium/auxiliary/libgallium.a
 
 C_SOURCES = \
        target.c \
+       $(TOP)/src/gallium/auxiliary/vl/vl_winsys_dri.c \
        $(COMMON_GALLIUM_SOURCES) \
        $(DRIVER_SOURCES)
 
index 139b01b982ade7d245a658ed57acb10c2a402f5a..41cc514929c248f61a5f38df86d90869f3356dca 100644 (file)
@@ -12,7 +12,7 @@ PIPE_DRIVERS = \
        $(TOP)/src/gallium/auxiliary/libgallium.a
 
 C_SOURCES = \
-       $(TOP)/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c
+       $(TOP)/src/gallium/auxiliary/vl/vl_winsys_xsp.c
 
 DRIVER_LIBS =
 
index 67036ee509069eaddc540030cd54bde6b76e1d7e..06727f1c9f810e57c15a6ca0f5d52519e6106f42 100644 (file)
@@ -4,7 +4,6 @@ include $(TOP)/configs/current
 LIBBASENAME = XvMCnouveau
 
 PIPE_DRIVERS = \
-       $(TOP)/src/gallium/winsys/g3dvl/dri/libvldri.a \
        $(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
        $(TOP)/src/gallium/drivers/nvfx/libnvfx.a \
        $(TOP)/src/gallium/drivers/nv50/libnv50.a \
@@ -16,6 +15,7 @@ PIPE_DRIVERS = \
 
 C_SOURCES = \
        target.c \
+       $(TOP)/src/gallium/auxiliary/vl/vl_winsys_dri.c \
        $(COMMON_GALLIUM_SOURCES) \
        $(DRIVER_SOURCES)
 
index 221335aae7267f2fa134420e78f65f29dbb6bb71..800f8d5254c3b5f81c31fb391da0b43b377aa0ff 100644 (file)
@@ -3,15 +3,17 @@ include $(TOP)/configs/current
 
 LIBBASENAME = XvMCr300
 
+DRIVER_INCLUDES = $(shell $(PKG_CONFIG) libdrm --cflags-only-I)
+
 PIPE_DRIVERS = \
         $(TOP)/src/gallium/drivers/r300/libr300.a \
-       $(TOP)/src/gallium/winsys/g3dvl/dri/libvldri.a \
         $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
         $(TOP)/src/gallium/drivers/trace/libtrace.a \
        $(TOP)/src/gallium/auxiliary/libgallium.a
 
 C_SOURCES = \
        target.c \
+       $(TOP)/src/gallium/auxiliary/vl/vl_winsys_dri.c \
        $(COMMON_GALLIUM_SOURCES) \
        $(DRIVER_SOURCES)
 
index 666712015d5511a25a9c8c1d991b5eaf897093ab..d9ce72f11dfbeb29e3d037e7720387b9da9a2e81 100644 (file)
@@ -3,15 +3,17 @@ include $(TOP)/configs/current
 
 LIBBASENAME = XvMCr600
 
+DRIVER_INCLUDES = $(shell $(PKG_CONFIG) libdrm --cflags-only-I)
+
 PIPE_DRIVERS = \
-        $(TOP)/src/gallium/drivers/r600/libr600.a \
-       $(TOP)/src/gallium/winsys/g3dvl/dri/libvldri.a \
+       $(TOP)/src/gallium/drivers/r600/libr600.a \
        $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
-        $(TOP)/src/gallium/drivers/trace/libtrace.a \
+       $(TOP)/src/gallium/drivers/trace/libtrace.a \
        $(TOP)/src/gallium/auxiliary/libgallium.a
 
 C_SOURCES = \
        target.c \
+       $(TOP)/src/gallium/auxiliary/vl/vl_winsys_dri.c \
        $(COMMON_GALLIUM_SOURCES) \
        $(DRIVER_SOURCES)
 
index 5b60bede5890f59535d7848462deca71ea1d3d67..35db16f08e4b45255fa8350ee005f6be6f6b4b97 100644 (file)
@@ -12,7 +12,7 @@ PIPE_DRIVERS = \
        $(TOP)/src/gallium/auxiliary/libgallium.a
 
 C_SOURCES = \
-       $(TOP)/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c
+       $(TOP)/src/gallium/auxiliary/vl/vl_winsys_xsp.c
 
 DRIVER_LIBS =
 
diff --git a/src/gallium/winsys/g3dvl/Makefile b/src/gallium/winsys/g3dvl/Makefile
deleted file mode 100644 (file)
index 6c793e0..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# src/gallium/winsys/Makefile
-TOP = ../../../..
-include $(TOP)/configs/current
-
-SUBDIRS = $(GALLIUM_STATE_TRACKERS_DIRS) $(GALLIUM_WINSYS_DIRS)
-
-default install clean:
-       @for dir in $(SUBDIRS) ; do \
-               if [ -d $$dir ] ; then \
-                       (cd $$dir && $(MAKE) $@) || exit 1; \
-               fi \
-       done
diff --git a/src/gallium/winsys/g3dvl/dri/Makefile b/src/gallium/winsys/g3dvl/dri/Makefile
deleted file mode 100644 (file)
index 43abcd9..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = vldri
-
-LIBRARY_INCLUDES = -I$(TOP)/src/gallium/winsys/g3dvl \
-                   $(shell $(PKG_CONFIG) libdrm --cflags-only-I)
-
-C_SOURCES = \
-       dri_winsys.c
-
-include ../../../Makefile.template
diff --git a/src/gallium/winsys/g3dvl/dri/dri_winsys.c b/src/gallium/winsys/g3dvl/dri/dri_winsys.c
deleted file mode 100644 (file)
index afaabaa..0000000
+++ /dev/null
@@ -1,396 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009 Younes Manton.
- * 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 TUNGSTEN GRAPHICS 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 <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include <X11/Xlib-xcb.h>
-#include <xcb/dri2.h>
-#include <xf86drm.h>
-
-#include "pipe/p_screen.h"
-#include "pipe/p_context.h"
-#include "pipe/p_state.h"
-#include "state_tracker/drm_driver.h"
-
-#include "util/u_memory.h"
-#include "util/u_hash.h"
-#include "util/u_hash_table.h"
-#include "util/u_inlines.h"
-
-#include "vl/vl_compositor.h"
-#include "vl_winsys.h"
-
-struct vl_dri_screen
-{
-   struct vl_screen base;
-   xcb_connection_t *conn;
-   xcb_drawable_t drawable;
-
-   unsigned width, height;
-
-   bool current_buffer;
-   uint32_t buffer_names[2];
-   struct u_rect dirty_areas[2];
-
-   bool flushed;
-   xcb_dri2_swap_buffers_cookie_t swap_cookie;
-   xcb_dri2_wait_sbc_cookie_t wait_cookie;
-   xcb_dri2_get_buffers_cookie_t buffers_cookie;
-
-   int64_t last_ust, ns_frame, last_msc, next_msc, skew_msc;
-};
-
-static const unsigned int attachments[1] = { XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT };
-
-static void
-vl_dri2_handle_stamps(struct vl_dri_screen* scrn,
-                      uint32_t ust_hi, uint32_t ust_lo,
-                      uint32_t msc_hi, uint32_t msc_lo)
-{
-   int64_t ust = ((((uint64_t)ust_hi) << 32) | ust_lo) * 1000;
-   int64_t msc = (((uint64_t)msc_hi) << 32) | msc_lo;
-
-   if (scrn->last_ust && scrn->last_msc && (ust > scrn->last_ust) && (msc > scrn->last_msc))
-      scrn->ns_frame = (ust - scrn->last_ust) / (msc - scrn->last_msc);
-
-   if (scrn->next_msc && (scrn->next_msc < msc))
-      scrn->skew_msc++;
-
-   scrn->last_ust = ust;
-   scrn->last_msc = msc;
-}
-
-static xcb_dri2_get_buffers_reply_t*
-vl_dri2_get_flush_reply(struct vl_dri_screen *scrn)
-{
-   xcb_dri2_wait_sbc_reply_t *wait_sbc_reply;
-
-   assert(scrn);
-
-   if (!scrn->flushed)
-      return NULL;
-
-   scrn->flushed = false;
-
-   free(xcb_dri2_swap_buffers_reply(scrn->conn, scrn->swap_cookie, NULL));
-
-   wait_sbc_reply = xcb_dri2_wait_sbc_reply(scrn->conn, scrn->wait_cookie, NULL);
-   if (!wait_sbc_reply)
-      return NULL;
-   vl_dri2_handle_stamps(scrn, wait_sbc_reply->ust_hi, wait_sbc_reply->ust_lo,
-                         wait_sbc_reply->msc_hi, wait_sbc_reply->msc_lo);
-   free(wait_sbc_reply);
-
-   return xcb_dri2_get_buffers_reply(scrn->conn, scrn->buffers_cookie, NULL);
-}
-
-static void
-vl_dri2_flush_frontbuffer(struct pipe_screen *screen,
-                          struct pipe_resource *resource,
-                          unsigned level, unsigned layer,
-                          void *context_private)
-{
-   struct vl_dri_screen *scrn = (struct vl_dri_screen*)context_private;
-   uint32_t msc_hi, msc_lo;
-
-   assert(screen);
-   assert(resource);
-   assert(context_private);
-
-   free(vl_dri2_get_flush_reply(scrn));
-
-   msc_hi = scrn->next_msc >> 32;
-   msc_lo = scrn->next_msc & 0xFFFFFFFF;
-
-   scrn->swap_cookie = xcb_dri2_swap_buffers_unchecked(scrn->conn, scrn->drawable, msc_hi, msc_lo, 0, 0, 0, 0);
-   scrn->wait_cookie = xcb_dri2_wait_sbc_unchecked(scrn->conn, scrn->drawable, 0, 0);
-   scrn->buffers_cookie = xcb_dri2_get_buffers_unchecked(scrn->conn, scrn->drawable, 1, 1, attachments);
-
-   scrn->flushed = true;
-   scrn->current_buffer = !scrn->current_buffer;
-}
-
-static void
-vl_dri2_destroy_drawable(struct vl_dri_screen *scrn)
-{
-   xcb_void_cookie_t destroy_cookie;
-   if (scrn->drawable) {
-      free(vl_dri2_get_flush_reply(scrn));
-      destroy_cookie = xcb_dri2_destroy_drawable_checked(scrn->conn, scrn->drawable);
-      /* ignore any error here, since the drawable can be destroyed long ago */
-      free(xcb_request_check(scrn->conn, destroy_cookie));
-   }
-}
-
-static void
-vl_dri2_set_drawable(struct vl_dri_screen *scrn, Drawable drawable)
-{
-   assert(scrn);
-   assert(drawable);
-
-   if (scrn->drawable == drawable)
-      return;
-
-   vl_dri2_destroy_drawable(scrn);
-
-   xcb_dri2_create_drawable(scrn->conn, drawable);
-   scrn->current_buffer = false;
-   vl_compositor_reset_dirty_area(&scrn->dirty_areas[0]);
-   vl_compositor_reset_dirty_area(&scrn->dirty_areas[1]);
-   scrn->drawable = drawable;
-}
-
-struct pipe_resource*
-vl_screen_texture_from_drawable(struct vl_screen *vscreen, Drawable drawable)
-{
-   struct vl_dri_screen *scrn = (struct vl_dri_screen*)vscreen;
-
-   struct winsys_handle dri2_handle;
-   struct pipe_resource template, *tex;
-
-   xcb_dri2_get_buffers_reply_t *reply;
-   xcb_dri2_dri2_buffer_t *buffers, *back_left;
-
-   unsigned i;
-
-   assert(scrn);
-
-   vl_dri2_set_drawable(scrn, drawable);
-   reply = vl_dri2_get_flush_reply(scrn);
-   if (!reply) {
-      xcb_dri2_get_buffers_cookie_t cookie;
-      cookie = xcb_dri2_get_buffers_unchecked(scrn->conn, drawable, 1, 1, attachments);
-      reply = xcb_dri2_get_buffers_reply(scrn->conn, cookie, NULL);
-   }
-   if (!reply)
-      return NULL;
-
-   buffers = xcb_dri2_get_buffers_buffers(reply);
-   if (!buffers)  {
-      free(reply);
-      return NULL;
-   }
-
-   for (i = 0; i < reply->count; ++i) {
-      if (buffers[i].attachment == XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT) {
-         back_left = &buffers[i];
-         break;
-      }
-   }
-
-   if (i == reply->count) {
-      free(reply);
-      return NULL;
-   }
-
-   if (reply->width != scrn->width || reply->height != scrn->height) {
-      vl_compositor_reset_dirty_area(&scrn->dirty_areas[0]);
-      vl_compositor_reset_dirty_area(&scrn->dirty_areas[1]);
-      scrn->width = reply->width;
-      scrn->height = reply->height;
-
-   } else if (back_left->name != scrn->buffer_names[scrn->current_buffer]) {
-      vl_compositor_reset_dirty_area(&scrn->dirty_areas[scrn->current_buffer]);
-      scrn->buffer_names[scrn->current_buffer] = back_left->name;
-   }
-
-   memset(&dri2_handle, 0, sizeof(dri2_handle));
-   dri2_handle.type = DRM_API_HANDLE_TYPE_SHARED;
-   dri2_handle.handle = back_left->name;
-   dri2_handle.stride = back_left->pitch;
-
-   memset(&template, 0, sizeof(template));
-   template.target = PIPE_TEXTURE_2D;
-   template.format = PIPE_FORMAT_B8G8R8X8_UNORM;
-   template.last_level = 0;
-   template.width0 = reply->width;
-   template.height0 = reply->height;
-   template.depth0 = 1;
-   template.array_size = 1;
-   template.usage = PIPE_USAGE_STATIC;
-   template.bind = PIPE_BIND_RENDER_TARGET;
-   template.flags = 0;
-
-   tex = scrn->base.pscreen->resource_from_handle(scrn->base.pscreen, &template, &dri2_handle);
-   free(reply);
-
-   return tex;
-}
-
-struct u_rect *
-vl_screen_get_dirty_area(struct vl_screen *vscreen)
-{
-   struct vl_dri_screen *scrn = (struct vl_dri_screen*)vscreen;
-   assert(scrn);
-   return &scrn->dirty_areas[scrn->current_buffer];
-}
-
-uint64_t
-vl_screen_get_timestamp(struct vl_screen *vscreen, Drawable drawable)
-{
-   struct vl_dri_screen *scrn = (struct vl_dri_screen*)vscreen;
-   xcb_dri2_get_msc_cookie_t cookie;
-   xcb_dri2_get_msc_reply_t *reply;
-
-   assert(scrn);
-
-   vl_dri2_set_drawable(scrn, drawable);
-   if (!scrn->last_ust) {
-      cookie = xcb_dri2_get_msc_unchecked(scrn->conn, drawable);
-      reply = xcb_dri2_get_msc_reply(scrn->conn, cookie, NULL);
-
-      if (reply) {
-         vl_dri2_handle_stamps(scrn, reply->ust_hi, reply->ust_lo,
-                               reply->msc_hi, reply->msc_lo);
-         free(reply);
-      }
-   }
-   return scrn->last_ust;
-}
-
-void
-vl_screen_set_next_timestamp(struct vl_screen *vscreen, uint64_t stamp)
-{
-   struct vl_dri_screen *scrn = (struct vl_dri_screen*)vscreen;
-   assert(scrn);
-   if (stamp && scrn->last_ust && scrn->ns_frame && scrn->last_msc)
-      scrn->next_msc = ((int64_t)stamp - scrn->last_ust) / scrn->ns_frame + scrn->last_msc + scrn->skew_msc;
-   else
-      scrn->next_msc = 0;
-}
-
-void*
-vl_screen_get_private(struct vl_screen *vscreen)
-{
-   return vscreen;
-}
-
-struct vl_screen*
-vl_screen_create(Display *display, int screen)
-{
-   struct vl_dri_screen *scrn;
-   const xcb_query_extension_reply_t *extension;
-   xcb_dri2_query_version_cookie_t dri2_query_cookie;
-   xcb_dri2_query_version_reply_t *dri2_query = NULL;
-   xcb_dri2_connect_cookie_t connect_cookie;
-   xcb_dri2_connect_reply_t *connect = NULL;
-   xcb_dri2_authenticate_cookie_t authenticate_cookie;
-   xcb_dri2_authenticate_reply_t *authenticate = NULL;
-   xcb_screen_iterator_t s;
-   xcb_generic_error_t *error = NULL;
-   char *device_name;
-   int fd;
-
-   drm_magic_t magic;
-
-   assert(display);
-
-   scrn = CALLOC_STRUCT(vl_dri_screen);
-   if (!scrn)
-      return NULL;
-
-   scrn->conn = XGetXCBConnection(display);
-   if (!scrn->conn)
-      goto free_screen;
-
-   xcb_prefetch_extension_data(scrn->conn, &xcb_dri2_id);
-
-   extension = xcb_get_extension_data(scrn->conn, &xcb_dri2_id);
-   if (!(extension && extension->present))
-      goto free_screen;
-
-   dri2_query_cookie = xcb_dri2_query_version (scrn->conn, XCB_DRI2_MAJOR_VERSION, XCB_DRI2_MINOR_VERSION);
-   dri2_query = xcb_dri2_query_version_reply (scrn->conn, dri2_query_cookie, &error);
-   if (dri2_query == NULL || error != NULL || dri2_query->minor_version < 2)
-      goto free_screen;
-
-   s = xcb_setup_roots_iterator(xcb_get_setup(scrn->conn));
-   connect_cookie = xcb_dri2_connect_unchecked(scrn->conn, s.data->root, XCB_DRI2_DRIVER_TYPE_DRI);
-   connect = xcb_dri2_connect_reply(scrn->conn, connect_cookie, NULL);
-   if (connect == NULL || connect->driver_name_length + connect->device_name_length == 0)
-      goto free_screen;
-
-   device_name = xcb_dri2_connect_device_name(connect);
-   device_name = strndup(device_name, xcb_dri2_connect_device_name_length(connect));
-   fd = open(device_name, O_RDWR);
-   free(device_name);
-
-   if (fd < 0)
-      goto free_screen;
-
-   if (drmGetMagic(fd, &magic))
-      goto free_screen;
-
-   authenticate_cookie = xcb_dri2_authenticate_unchecked(scrn->conn, s.data->root, magic);
-   authenticate = xcb_dri2_authenticate_reply(scrn->conn, authenticate_cookie, NULL);
-
-   if (authenticate == NULL || !authenticate->authenticated)
-      goto free_screen;
-
-   scrn->base.pscreen = driver_descriptor.create_screen(fd);
-   if (!scrn->base.pscreen)
-      goto free_screen;
-
-   scrn->base.pscreen->flush_frontbuffer = vl_dri2_flush_frontbuffer;
-   vl_compositor_reset_dirty_area(&scrn->dirty_areas[0]);
-   vl_compositor_reset_dirty_area(&scrn->dirty_areas[1]);
-
-   free(dri2_query);
-   free(connect);
-   free(authenticate);
-
-   return &scrn->base;
-
-free_screen:
-   FREE(scrn);
-
-   free(dri2_query);
-   free(connect);
-   free(authenticate);
-   free(error);
-
-   return NULL;
-}
-
-void vl_screen_destroy(struct vl_screen *vscreen)
-{
-   struct vl_dri_screen *scrn = (struct vl_dri_screen*)vscreen;
-
-   assert(vscreen);
-
-   if (scrn->flushed) {
-      free(xcb_dri2_swap_buffers_reply(scrn->conn, scrn->swap_cookie, NULL));
-      free(xcb_dri2_wait_sbc_reply(scrn->conn, scrn->wait_cookie, NULL));
-      free(xcb_dri2_get_buffers_reply(scrn->conn, scrn->buffers_cookie, NULL));
-   }
-
-   vl_dri2_destroy_drawable(scrn);
-   scrn->base.pscreen->destroy(scrn->base.pscreen);
-   FREE(scrn);
-}
diff --git a/src/gallium/winsys/g3dvl/vl_winsys.h b/src/gallium/winsys/g3dvl/vl_winsys.h
deleted file mode 100644 (file)
index 174f780..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009 Younes Manton.
- * 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 TUNGSTEN GRAPHICS 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.
- *
- **************************************************************************/
-
-#ifndef vl_winsys_h
-#define vl_winsys_h
-
-#include <X11/Xlib.h>
-#include "pipe/p_defines.h"
-#include "pipe/p_format.h"
-
-struct pipe_screen;
-struct pipe_surface;
-
-struct vl_screen
-{
-   struct pipe_screen *pscreen;
-};
-
-struct vl_screen*
-vl_screen_create(Display *display, int screen);
-
-void vl_screen_destroy(struct vl_screen *vscreen);
-
-struct pipe_resource*
-vl_screen_texture_from_drawable(struct vl_screen *vscreen, Drawable drawable);
-
-struct u_rect *
-vl_screen_get_dirty_area(struct vl_screen *vscreen);
-
-uint64_t
-vl_screen_get_timestamp(struct vl_screen *vscreen, Drawable drawable);
-
-void
-vl_screen_set_next_timestamp(struct vl_screen *vscreen, uint64_t stamp);
-
-void*
-vl_screen_get_private(struct vl_screen *vscreen);
-
-#endif
diff --git a/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c b/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c
deleted file mode 100644 (file)
index 1d5d1ea..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009 Younes Manton.
- * 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 TUNGSTEN GRAPHICS 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 <sys/time.h>
-
-#include "pipe/p_state.h"
-
-#include "util/u_memory.h"
-#include "util/u_format.h"
-#include "util/u_inlines.h"
-
-#include "state_tracker/xlib_sw_winsys.h"
-#include "softpipe/sp_public.h"
-
-#include "vl/vl_compositor.h"
-#include "vl_winsys.h"
-
-struct vl_xsp_screen
-{
-   struct vl_screen base;
-   Display *display;
-   int screen;
-   Visual visual;
-   struct xlib_drawable xdraw;
-   struct pipe_resource *tex;
-   struct u_rect dirty_area;
-};
-
-struct pipe_resource*
-vl_screen_texture_from_drawable(struct vl_screen *vscreen, Drawable drawable)
-{
-   struct vl_xsp_screen *xsp_screen = (struct vl_xsp_screen*)vscreen;
-   Window root;
-   int x, y;
-   unsigned int width, height;
-   unsigned int border_width;
-   unsigned int depth;
-   struct pipe_resource templat;
-
-   assert(vscreen);
-   assert(drawable != None);
-
-   if (XGetGeometry(xsp_screen->display, drawable, &root, &x, &y, &width, &height, &border_width, &depth) == BadDrawable)
-      return NULL;
-
-   xsp_screen->xdraw.drawable = drawable;
-
-   if (xsp_screen->tex) {
-      if (xsp_screen->tex->width0 == width && xsp_screen->tex->height0 == height)
-         return xsp_screen->tex;
-      pipe_resource_reference(&xsp_screen->tex, NULL);
-      vl_compositor_reset_dirty_area(&xsp_screen->dirty_area);
-   }
-
-   memset(&templat, 0, sizeof(struct pipe_resource));
-   templat.target = PIPE_TEXTURE_2D;
-   /* XXX: Need to figure out drawable's format */
-   templat.format = PIPE_FORMAT_B8G8R8X8_UNORM;
-   templat.last_level = 0;
-   templat.width0 = width;
-   templat.height0 = height;
-   templat.depth0 = 1;
-   templat.usage = PIPE_USAGE_DEFAULT;
-   templat.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_DISPLAY_TARGET;
-   templat.flags = 0;
-
-   xsp_screen->xdraw.depth = 24/*util_format_get_blocksizebits(templat.format) /
-                             util_format_get_blockwidth(templat.format)*/;
-
-   pipe_resource_reference(&xsp_screen->tex, vscreen->pscreen->resource_create(vscreen->pscreen, &templat));
-   return xsp_screen->tex;
-}
-
-struct u_rect *
-vl_screen_get_dirty_area(struct vl_screen *vscreen)
-{
-   struct vl_xsp_screen *xsp_screen = (struct vl_xsp_screen*)vscreen;
-   return &xsp_screen->dirty_area;
-}
-
-uint64_t
-vl_screen_get_timestamp(struct vl_screen *vscreen, Drawable drawable)
-{
-   struct timeval tv;
-   gettimeofday(&tv, NULL);
-   return (uint64_t)tv.tv_sec * 1000000000LL + (uint64_t)tv.tv_usec * 1000LL;
-}
-
-void
-vl_screen_set_next_timestamp(struct vl_screen *vscreen, uint64_t stamp)
-{
-   /* not supported on softpipe and so only a dummy */
-}
-
-void*
-vl_screen_get_private(struct vl_screen *vscreen)
-{
-   struct vl_xsp_screen *xsp_screen = (struct vl_xsp_screen*)vscreen;
-   return &xsp_screen->xdraw;
-}
-
-struct vl_screen*
-vl_screen_create(Display *display, int screen)
-{
-   struct vl_xsp_screen *xsp_screen;
-   struct sw_winsys *winsys;
-
-   assert(display);
-
-   xsp_screen = CALLOC_STRUCT(vl_xsp_screen);
-   if (!xsp_screen)
-      return NULL;
-
-   winsys = xlib_create_sw_winsys(display);
-   if (!winsys) {
-      FREE(xsp_screen);
-      return NULL;
-   }
-
-   xsp_screen->base.pscreen = softpipe_create_screen(winsys);
-   if (!xsp_screen->base.pscreen) {
-      winsys->destroy(winsys);
-      FREE(xsp_screen);
-      return NULL;
-   }
-
-   xsp_screen->display = display;
-   xsp_screen->screen = screen;
-   xsp_screen->xdraw.visual = XDefaultVisual(display, screen);
-   vl_compositor_reset_dirty_area(&xsp_screen->dirty_area);
-
-   return &xsp_screen->base;
-}
-
-void vl_screen_destroy(struct vl_screen *vscreen)
-{
-   struct vl_xsp_screen *xsp_screen = (struct vl_xsp_screen*)vscreen;
-
-   assert(vscreen);
-
-   pipe_resource_reference(&xsp_screen->tex, NULL);
-   vscreen->pscreen->destroy(vscreen->pscreen);
-   FREE(vscreen);
-}