gallium: Remove dri1_api.h and winsys support for DRI1
authorJakob Bornecrantz <jakob@vmware.com>
Tue, 25 May 2010 17:47:21 +0000 (18:47 +0100)
committerJakob Bornecrantz <jakob@vmware.com>
Tue, 25 May 2010 18:04:11 +0000 (19:04 +0100)
Since DRI1 support was dropped from st/dri it
makes no sense to keep this code around.

src/gallium/include/state_tracker/dri1_api.h [deleted file]
src/gallium/winsys/nouveau/drm/nouveau_drm_api.c
src/gallium/winsys/nouveau/drm/nouveau_drm_api.h
src/gallium/winsys/svga/drm/vmw_screen_dri.c

diff --git a/src/gallium/include/state_tracker/dri1_api.h b/src/gallium/include/state_tracker/dri1_api.h
deleted file mode 100644 (file)
index 0d702d9..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-#ifndef _DRI1_API_H_
-#define _DRI1_API_H_
-
-#include "pipe/p_compiler.h"
-#include "pipe/p_screen.h"
-#include "pipe/p_format.h"
-
-#include "state_tracker/drm_api.h"
-
-struct pipe_screen;
-struct pipe_winsys;
-struct pipe_context;
-struct pipe_resource;
-
-struct drm_clip_rect;
-
-struct dri1_api_version
-{
-   int major;
-   int minor;
-   int patch_level;
-};
-
-/**
- * This callback struct is intended for drivers that need to take
- * the hardware lock on command submission.
- */
-
-struct dri1_api_lock_funcs
-{
-   void (*lock) (struct pipe_context * pipe);
-   void (*unlock) (struct pipe_context * locked_pipe);
-   boolean(*is_locked) (struct pipe_context * locked_pipe);
-   boolean(*is_lock_lost) (struct pipe_context * locked_pipe);
-   void (*clear_lost_lock) (struct pipe_context * locked_pipe);
-};
-
-struct dri1_api
-{
-   /**
-    * For flushing to the front buffer. A driver should implement one and only
-    * one of the functions below. The present_locked functions allows a dri1
-    * driver to pageflip.
-    */
-
-   /*@{ */
-
-   struct pipe_surface *(*front_srf_locked) (struct pipe_context *
-                                            locked_pipe);
-
-   void (*present_locked) (struct pipe_context * locked_pipe,
-                          struct pipe_surface * surf,
-                          const struct drm_clip_rect * rect,
-                          unsigned int num_clip,
-                          int x_draw, int y_draw,
-                          const struct drm_clip_rect * src_bbox,
-                          struct pipe_fence_handle ** fence);
-   /*@} */
-};
-
-struct dri1_create_screen_arg
-{
-   struct drm_create_screen_arg base;
-
-   struct dri1_api_lock_funcs *lf;
-   void *ddx_info;
-   int ddx_info_size;
-   void *sarea;
-
-   struct dri1_api_version ddx_version;
-   struct dri1_api_version dri_version;
-   struct dri1_api_version drm_version;
-
-   /*
-    * out parameters;
-    */
-
-   struct dri1_api *api;
-};
-
-#endif
index c0047859b18b1b01eb5813d6c93692df4aa56837..6d3255678f9908ce939e3f02db1e0a3c556e5dd6 100644 (file)
 #include "nouveau/nouveau_winsys.h"
 #include "nouveau/nouveau_screen.h"
 
-static struct pipe_surface *
-dri_surface_from_handle(struct drm_api *api, struct pipe_screen *pscreen,
-                        unsigned handle, enum pipe_format format,
-                        unsigned width, unsigned height, unsigned pitch)
-{
-       struct pipe_surface *ps = NULL;
-       struct pipe_resource *pt = NULL;
-       struct pipe_resource tmpl;
-       struct winsys_handle whandle;
-       unsigned bind = (PIPE_BIND_SCANOUT |
-                        PIPE_BIND_RENDER_TARGET);
-
-       memset(&tmpl, 0, sizeof(tmpl));
-       tmpl.bind = bind;
-       tmpl.target = PIPE_TEXTURE_2D;
-       tmpl.last_level = 0;
-       tmpl.depth0 = 1;
-       tmpl.format = format;
-       tmpl.width0 = width;
-       tmpl.height0 = height;
-
-       memset(&whandle, 0, sizeof(whandle));
-       whandle.stride = pitch;
-       whandle.handle = handle;
-
-       pt = pscreen->resource_from_handle(pscreen, &tmpl, &whandle);
-       if (!pt)
-               return NULL;
-
-       ps = pscreen->get_tex_surface(pscreen, pt, 0, 0, 0, bind);
-
-       /* we don't need the texture from this point on */
-       pipe_resource_reference(&pt, NULL);
-       return ps;
-}
-
-static struct pipe_surface *
-nouveau_dri1_front_surface(struct pipe_context *pipe)
-{
-       return nouveau_winsys_screen(pipe->screen)->front;
-}
-
-static struct dri1_api nouveau_dri1_api = {
-       nouveau_dri1_front_surface,
-};
-
 static void
 nouveau_drm_destroy_winsys(struct pipe_winsys *s)
 {
@@ -72,7 +26,6 @@ static struct pipe_screen *
 nouveau_drm_create_screen(struct drm_api *api, int fd,
                          struct drm_create_screen_arg *arg)
 {
-       struct dri1_create_screen_arg *dri1 = (void *)arg;
        struct nouveau_winsys *nvws;
        struct pipe_winsys *ws;
        struct nouveau_device *dev = NULL;
@@ -116,31 +69,6 @@ nouveau_drm_create_screen(struct drm_api *api, int fd,
                return NULL;
        }
 
-       if (arg && arg->mode == DRM_CREATE_DRI1) {
-               struct nouveau_dri *nvdri = dri1->ddx_info;
-               enum pipe_format format;
-
-               if (nvdri->bpp == 16)
-                       format = PIPE_FORMAT_B5G6R5_UNORM;
-               else
-                       format = PIPE_FORMAT_B8G8R8A8_UNORM;
-
-               nvws->front = dri_surface_from_handle(api, nvws->pscreen,
-                                                     nvdri->front_offset,
-                                                     format, nvdri->width,
-                                                     nvdri->height,
-                                                     nvdri->front_pitch *
-                                                     (nvdri->bpp / 8));
-               if (!nvws->front) {
-                       debug_printf("%s: error referencing front buffer\n",
-                                    __func__);
-                       ws->destroy(ws);
-                       return NULL;
-               }
-
-               dri1->api = &nouveau_dri1_api;
-       }
-
        return nvws->pscreen;
 }
 
index a91aad7df8e8bdb4a8ae115f7d9e4930665b0399..ba6305c17e72f2089b5d38050941fe363ca1cba6 100644 (file)
@@ -2,7 +2,6 @@
 #define __NOUVEAU_DRM_API_H__
 
 #include "state_tracker/drm_api.h"
-#include "state_tracker/dri1_api.h"
 
 #include "util/u_simple_screen.h"
 
index f4c1642f2d430079c954cfddb5369fe8d67eacab..4a710564b435c39dc2c065bfcf911751c8258d59 100644 (file)
 #include "vmw_fence.h"
 #include "vmw_context.h"
 
-#include <state_tracker/dri1_api.h>
 #include <state_tracker/drm_api.h>
 #include "vmwgfx_drm.h"
 #include <xf86drm.h>
 
 #include <stdio.h>
 
+struct dri1_api_version {
+   int major;
+   int minor;
+   int patch_level;
+};
+
 static struct svga_winsys_surface *
 vmw_drm_surface_from_handle(struct svga_winsys_screen *sws,
                            struct winsys_handle *whandle,
@@ -54,11 +59,6 @@ vmw_drm_surface_get_handle(struct svga_winsys_screen *sws,
                           unsigned stride,
                           struct winsys_handle *whandle);
 
-static struct dri1_api dri1_api_hooks;
-static struct dri1_api_version ddx_required = { 0, 1, 0 };
-static struct dri1_api_version ddx_compat = { 0, 0, 0 };
-static struct dri1_api_version dri_required = { 4, 0, 0 };
-static struct dri1_api_version dri_compat = { 4, 0, 0 };
 static struct dri1_api_version drm_required = { 1, 0, 0 };
 static struct dri1_api_version drm_compat = { 1, 0, 0 };
 static struct dri1_api_version drm_scanout = { 0, 9, 0 };
@@ -95,7 +95,6 @@ vmw_drm_create_screen(struct drm_api *drm_api,
 {
    struct vmw_winsys_screen *vws;
    struct pipe_screen *screen;
-   struct dri1_create_screen_arg *dri1;
    boolean use_old_scanout_flag = FALSE;
 
    if (!arg || arg->mode == DRM_CREATE_NORMAL) {
@@ -124,27 +123,6 @@ vmw_drm_create_screen(struct drm_api *drm_api,
       switch (arg->mode) {
       case DRM_CREATE_NORMAL:
         break;
-      case DRM_CREATE_DRI1:
-        dri1 = (struct dri1_create_screen_arg *)arg;
-        if (!vmw_dri1_check_version(&dri1->ddx_version, &ddx_required,
-                                    &ddx_compat, "ddx - driver api"))
-           return NULL;
-        if (!vmw_dri1_check_version(&dri1->dri_version, &dri_required,
-                                    &dri_compat, "dri info"))
-           return NULL;
-        if (!vmw_dri1_check_version(&dri1->drm_version, &drm_required,
-                                    &drm_compat, "vmwgfx drm driver"))
-           return NULL;
-        if (!vmw_dri1_check_version(&dri1->drm_version, &drm_scanout,
-                                    &drm_compat, "use old scanout field (not a error)"))
-           use_old_scanout_flag = TRUE;
-        dri1->api = &dri1_api_hooks;
-#if 0
-        break;
-#else
-        assert(!"No dri 1 support for now\n");
-        return NULL;
-#endif
       default:
         return NULL;
       }
@@ -205,72 +183,6 @@ vmw_dri1_intersect_src_bbox(struct drm_clip_rect *dst,
    return TRUE;
 }
 
-/**
- * No fancy get-surface-from-sarea stuff here.
- * Just use the present blit.
- */
-
-static void
-vmw_dri1_present_locked(struct pipe_context *locked_pipe,
-                       struct pipe_surface *surf,
-                       const struct drm_clip_rect *rect,
-                       unsigned int num_clip,
-                       int x_draw, int y_draw,
-                       const struct drm_clip_rect *bbox,
-                       struct pipe_fence_handle **p_fence)
-{
-#if 0
-   struct svga_winsys_surface *srf =
-      svga_screen_texture_get_winsys_surface(surf->texture);
-   struct vmw_svga_winsys_surface *vsrf = vmw_svga_winsys_surface(srf);
-   struct vmw_winsys_screen *vws =
-      vmw_winsys_screen(svga_winsys_screen(locked_pipe->screen));
-   struct drm_clip_rect clip;
-   int i;
-   struct
-   {
-      SVGA3dCmdHeader header;
-      SVGA3dCmdPresent body;
-      SVGA3dCopyRect rect;
-   } cmd;
-   boolean visible = FALSE;
-   uint32_t fence_seq = 0;
-
-   VMW_FUNC;
-   cmd.header.id = SVGA_3D_CMD_PRESENT;
-   cmd.header.size = sizeof cmd.body + sizeof cmd.rect;
-   cmd.body.sid = vsrf->sid;
-
-   for (i = 0; i < num_clip; ++i) {
-      if (!vmw_dri1_intersect_src_bbox(&clip, x_draw, y_draw, rect++, bbox))
-        continue;
-
-      cmd.rect.x = clip.x1;
-      cmd.rect.y = clip.y1;
-      cmd.rect.w = clip.x2 - clip.x1;
-      cmd.rect.h = clip.y2 - clip.y1;
-      cmd.rect.srcx = (int)clip.x1 - x_draw;
-      cmd.rect.srcy = (int)clip.y1 - y_draw;
-
-      vmw_printf("%s: Clip %d x %d y %d w %d h %d srcx %d srcy %d\n",
-                  __FUNCTION__,
-                  i,
-                  cmd.rect.x,
-                  cmd.rect.y,
-                  cmd.rect.w, cmd.rect.h, cmd.rect.srcx, cmd.rect.srcy);
-
-      vmw_ioctl_command(vws, &cmd, sizeof cmd.header + cmd.header.size,
-                        &fence_seq);
-      visible = TRUE;
-   }
-
-   *p_fence = (visible) ? vmw_pipe_fence(fence_seq) : NULL;
-   vmw_svga_winsys_surface_reference(&vsrf, NULL);
-#else
-   assert(!"No dri 1 support for now\n");
-#endif
-}
-
 static struct svga_winsys_surface *
 vmw_drm_surface_from_handle(struct svga_winsys_screen *sws,
                            struct winsys_handle *whandle,
@@ -317,7 +229,7 @@ vmw_drm_surface_from_handle(struct svga_winsys_screen *sws,
                    whandle->handle, i);
            goto out_mip;
        }
-    }
+   }
 
     vsrf = CALLOC_STRUCT(vmw_svga_winsys_surface);
     if (!vsrf)
@@ -355,12 +267,6 @@ vmw_drm_surface_get_handle(struct svga_winsys_screen *sws,
     return TRUE;
 }
 
-
-static struct dri1_api dri1_api_hooks = {
-   .front_srf_locked = NULL,
-   .present_locked = vmw_dri1_present_locked
-};
-
 static struct drm_api vmw_drm_api_hooks = {
    .name = "vmwgfx",
    .driver_name = "vmwgfx",