summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/drm/nouveau/dri
diff options
context:
space:
mode:
authorBen Skeggs <[email protected]>2009-03-18 08:22:35 +1000
committerBen Skeggs <[email protected]>2009-03-18 09:44:40 +1000
commite00ae524e236afba1305150cacd634eaa1f5460b (patch)
treee6173fc3a85b6f6b66691e4a880257a39764fd6e /src/gallium/winsys/drm/nouveau/dri
parentb46fcf25be4d1d5a5d072fbce03c2490bf41203f (diff)
nouveau: rewrite winsys in terms of drm_api, support dri2 state tracker
drm_api is a set of hooks used by the dri2 state tracker, this wraps our dri1 code around the same set of hooks. Currently the dri2 build will produce nouveau_dri2.so which you'll need to install as nouveau_dri.so if you wish to try it. The dri2 state tracker doesn't make it easy for a driver to support both paths in the same binary.
Diffstat (limited to 'src/gallium/winsys/drm/nouveau/dri')
-rw-r--r--src/gallium/winsys/drm/nouveau/dri/Makefile8
-rw-r--r--src/gallium/winsys/drm/nouveau/dri/nouveau_context.c (renamed from src/gallium/winsys/drm/nouveau/dri/nouveau_context_dri.c)62
-rw-r--r--src/gallium/winsys/drm/nouveau/dri/nouveau_context.h (renamed from src/gallium/winsys/drm/nouveau/dri/nouveau_context_dri.h)14
-rw-r--r--src/gallium/winsys/drm/nouveau/dri/nouveau_dri.h28
-rw-r--r--src/gallium/winsys/drm/nouveau/dri/nouveau_lock.c73
-rw-r--r--src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c (renamed from src/gallium/winsys/drm/nouveau/dri/nouveau_screen_dri.c)94
-rw-r--r--src/gallium/winsys/drm/nouveau/dri/nouveau_screen.h (renamed from src/gallium/winsys/drm/nouveau/dri/nouveau_screen_dri.h)9
-rw-r--r--src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.c32
-rw-r--r--src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.h11
9 files changed, 254 insertions, 77 deletions
diff --git a/src/gallium/winsys/drm/nouveau/dri/Makefile b/src/gallium/winsys/drm/nouveau/dri/Makefile
index a73e8d5cb4b..f7db6201fea 100644
--- a/src/gallium/winsys/drm/nouveau/dri/Makefile
+++ b/src/gallium/winsys/drm/nouveau/dri/Makefile
@@ -6,7 +6,7 @@ LIBNAME = nouveau_dri.so
MINIGLX_SOURCES =
PIPE_DRIVERS = \
- $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+ $(TOP)/src/gallium/winsys/drm/nouveau/drm/libnouveaudrm.a \
$(TOP)/src/gallium/drivers/nv04/libnv04.a \
$(TOP)/src/gallium/drivers/nv10/libnv10.a \
$(TOP)/src/gallium/drivers/nv20/libnv20.a \
@@ -15,10 +15,10 @@ PIPE_DRIVERS = \
$(TOP)/src/gallium/drivers/nv50/libnv50.a
DRIVER_SOURCES = \
- nouveau_context_dri.c \
- nouveau_screen_dri.c \
+ nouveau_context.c \
+ nouveau_screen.c \
nouveau_swapbuffers.c \
- ../common/libnouveaudrm.a
+ nouveau_lock.c
C_SOURCES = \
$(COMMON_GALLIUM_SOURCES) \
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_context_dri.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_context.c
index aacfe984d18..deb6ffcff1c 100644
--- a/src/gallium/winsys/drm/nouveau/dri/nouveau_context_dri.c
+++ b/src/gallium/winsys/drm/nouveau/dri/nouveau_context.c
@@ -5,23 +5,15 @@
#include <state_tracker/st_public.h>
#include <state_tracker/st_context.h>
+#include <state_tracker/drm_api.h>
#include <pipe/p_defines.h>
#include <pipe/p_context.h>
#include <pipe/p_screen.h>
-#include "../common/nouveau_winsys_pipe.h"
-#include "../common/nouveau_dri.h"
-#include "../common/nouveau_local.h"
-#include "nouveau_context_dri.h"
-#include "nouveau_screen_dri.h"
+#include "nouveau_context.h"
+#include "nouveau_screen.h"
-#ifdef DEBUG
-static const struct dri_debug_control debug_control[] = {
- { "bo", DEBUG_BO },
- { NULL, 0 }
-};
-int __nouveau_debug = 0;
-#endif
+#include "nouveau_drmif.h"
GLboolean
nouveau_context_create(const __GLcontextModes *glVis,
@@ -29,34 +21,38 @@ nouveau_context_create(const __GLcontextModes *glVis,
void *sharedContextPrivate)
{
__DRIscreenPrivate *driScrnPriv = driContextPriv->driScreenPriv;
- struct nouveau_screen_dri *nv_screen = driScrnPriv->private;
- struct nouveau_context_dri *nv = CALLOC_STRUCT(nouveau_context_dri);
- struct st_context *st_share = NULL;
- struct nouveau_context_dri *nv_share = NULL;
+ struct nouveau_screen *nv_screen = driScrnPriv->private;
+ struct nouveau_context *nv;
struct pipe_context *pipe;
+ struct st_context *st_share = NULL;
- if (sharedContextPrivate) {
- st_share = ((struct nouveau_context_dri *)sharedContextPrivate)->st;
- nv_share = st_share->pipe->priv;
+ if (sharedContextPrivate)
+ st_share = ((struct nouveau_context *)sharedContextPrivate)->st;
+
+ nv = CALLOC_STRUCT(nouveau_context);
+ if (!nv)
+ return GL_FALSE;
+
+ {
+ struct nouveau_device_priv *nvdev =
+ nouveau_device(nv_screen->device);
+
+ nvdev->ctx = driContextPriv->hHWContext;
+ nvdev->lock = (drmLock *)&driScrnPriv->pSAREA->lock;
}
- if (nouveau_context_init(&nv_screen->base, driContextPriv->hHWContext,
- (drmLock *)&driScrnPriv->pSAREA->lock,
- &nv_share->base, &nv->base)) {
+ pipe = drm_api_hooks.create_context(nv_screen->pscreen);
+ if (!pipe) {
+ FREE(nv);
return GL_FALSE;
}
+ pipe->priv = nv;
- pipe = nv->base.nvc->pctx[nv->base.pctx_id];
- driContextPriv->driverPrivate = (void *)nv;
- //nv->nv_screen = nv_screen;
+ driContextPriv->driverPrivate = nv;
nv->dri_screen = driScrnPriv;
driParseConfigFiles(&nv->dri_option_cache, &nv_screen->option_cache,
nv->dri_screen->myNum, "nouveau");
-#ifdef DEBUG
- __nouveau_debug = driParseDebugString(getenv("NOUVEAU_DEBUG"),
- debug_control);
-#endif
nv->st = st_create_context(pipe, glVis, st_share);
return GL_TRUE;
@@ -65,15 +61,13 @@ nouveau_context_create(const __GLcontextModes *glVis,
void
nouveau_context_destroy(__DRIcontextPrivate *driContextPriv)
{
- struct nouveau_context_dri *nv = driContextPriv->driverPrivate;
+ struct nouveau_context *nv = driContextPriv->driverPrivate;
assert(nv);
st_finish(nv->st);
st_destroy_context(nv->st);
- nouveau_context_cleanup(&nv->base);
-
FREE(nv);
}
@@ -82,7 +76,7 @@ nouveau_context_bind(__DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawPriv,
__DRIdrawablePrivate *driReadPriv)
{
- struct nouveau_context_dri *nv;
+ struct nouveau_context *nv;
struct nouveau_framebuffer *draw, *read;
if (!driContextPriv) {
@@ -115,7 +109,7 @@ nouveau_context_bind(__DRIcontextPrivate *driContextPriv,
GLboolean
nouveau_context_unbind(__DRIcontextPrivate *driContextPriv)
{
- struct nouveau_context_dri *nv = driContextPriv->driverPrivate;
+ struct nouveau_context *nv = driContextPriv->driverPrivate;
(void)nv;
st_flush(nv->st, 0, NULL);
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_context_dri.h b/src/gallium/winsys/drm/nouveau/dri/nouveau_context.h
index 64cf326411c..2779b092e64 100644
--- a/src/gallium/winsys/drm/nouveau/dri/nouveau_context_dri.h
+++ b/src/gallium/winsys/drm/nouveau/dri/nouveau_context.h
@@ -3,15 +3,16 @@
#include <dri_util.h>
#include <xmlconfig.h>
-#include <nouveau/nouveau_winsys.h>
-#include "../common/nouveau_context.h"
+
+#include "nouveau/nouveau_winsys.h"
+
+#define NOUVEAU_ERR(fmt, args...) debug_printf("%s: "fmt, __func__, ##args)
struct nouveau_framebuffer {
struct st_framebuffer *stfb;
};
-struct nouveau_context_dri {
- struct nouveau_context base;
+struct nouveau_context {
struct st_context *st;
/* DRI stuff */
@@ -21,6 +22,7 @@ struct nouveau_context_dri {
driOptionCache dri_option_cache;
drm_context_t drm_context;
drmLock drm_lock;
+ int locked;
};
extern GLboolean nouveau_context_create(const __GLcontextModes *,
@@ -31,6 +33,10 @@ extern GLboolean nouveau_context_bind(__DRIcontextPrivate *,
__DRIdrawablePrivate *read);
extern GLboolean nouveau_context_unbind(__DRIcontextPrivate *);
+extern void nouveau_contended_lock(struct nouveau_context *nv);
+extern void LOCK_HARDWARE(struct nouveau_context *nv);
+extern void UNLOCK_HARDWARE(struct nouveau_context *nv);
+
#ifdef DEBUG
extern int __nouveau_debug;
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_dri.h b/src/gallium/winsys/drm/nouveau/dri/nouveau_dri.h
new file mode 100644
index 00000000000..1207c2d609c
--- /dev/null
+++ b/src/gallium/winsys/drm/nouveau/dri/nouveau_dri.h
@@ -0,0 +1,28 @@
+#ifndef _NOUVEAU_DRI_
+#define _NOUVEAU_DRI_
+
+#include "xf86drm.h"
+#include "drm.h"
+#include "nouveau_drm.h"
+
+struct nouveau_dri {
+ uint32_t device_id; /**< \brief PCI device ID */
+ uint32_t width; /**< \brief width in pixels of display */
+ uint32_t height; /**< \brief height in scanlines of display */
+ uint32_t depth; /**< \brief depth of display (8, 15, 16, 24) */
+ uint32_t bpp; /**< \brief bit depth of display (8, 16, 24, 32) */
+
+ uint32_t bus_type; /**< \brief ths bus type */
+ uint32_t bus_mode; /**< \brief bus mode (used for AGP, maybe also for PCI-E ?) */
+
+ uint32_t front_offset; /**< \brief front buffer offset */
+ uint32_t front_pitch; /**< \brief front buffer pitch */
+ uint32_t back_offset; /**< \brief private back buffer offset */
+ uint32_t back_pitch; /**< \brief private back buffer pitch */
+ uint32_t depth_offset; /**< \brief private depth buffer offset */
+ uint32_t depth_pitch; /**< \brief private depth buffer pitch */
+
+};
+
+#endif
+
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_lock.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_lock.c
new file mode 100644
index 00000000000..92f5bd09c9d
--- /dev/null
+++ b/src/gallium/winsys/drm/nouveau/dri/nouveau_lock.c
@@ -0,0 +1,73 @@
+/**************************************************************************
+ *
+ * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * 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 <pipe/p_thread.h>
+#include "nouveau_context.h"
+#include "nouveau_screen.h"
+#include "nouveau_drmif.h"
+
+pipe_static_mutex(lockMutex);
+
+/* Lock the hardware and validate our state.
+ */
+void
+LOCK_HARDWARE(struct nouveau_context *nv)
+{
+ struct nouveau_screen *nv_screen = nv->dri_screen->private;
+ struct nouveau_device *dev = nv_screen->device;
+ struct nouveau_device_priv *nvdev = nouveau_device(dev);
+ char __ret=0;
+
+ assert(!nv->locked);
+ pipe_mutex_lock(lockMutex);
+
+ DRM_CAS(nvdev->lock, nvdev->ctx,
+ (DRM_LOCK_HELD | nvdev->ctx), __ret);
+
+ if (__ret) {
+ drmGetLock(nvdev->fd, nvdev->ctx, 0);
+ nouveau_contended_lock(nv);
+ }
+ nv->locked = 1;
+}
+
+/* Unlock the hardware using the global current context
+ */
+void
+UNLOCK_HARDWARE(struct nouveau_context *nv)
+{
+ struct nouveau_screen *nv_screen = nv->dri_screen->private;
+ struct nouveau_device *dev = nv_screen->device;
+ struct nouveau_device_priv *nvdev = nouveau_device(dev);
+
+ assert(nv->locked);
+ nv->locked = 0;
+
+ DRM_UNLOCK(nvdev->fd, nvdev->lock, nvdev->ctx);
+
+ pipe_mutex_unlock(lockMutex);
+}
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen_dri.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c
index 964a9028aac..c4cbbc21248 100644
--- a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen_dri.c
+++ b/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c
@@ -5,12 +5,15 @@
#include <pipe/p_context.h>
#include <state_tracker/st_public.h>
#include <state_tracker/st_cb_fbo.h>
-#include <nouveau_drm.h>
-#include "../common/nouveau_dri.h"
-#include "../common/nouveau_local.h"
-#include "nouveau_context_dri.h"
-#include "nouveau_screen_dri.h"
+#include <state_tracker/drm_api.h>
+
+#include "nouveau_context.h"
+#include "nouveau_screen.h"
#include "nouveau_swapbuffers.h"
+#include "nouveau_dri.h"
+
+#include "nouveau_drm.h"
+#include "nouveau_drmif.h"
#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 12
#error nouveau_drm.h version does not match expected version
@@ -178,11 +181,58 @@ nouveau_fill_in_modes(__DRIscreenPrivate *psp,
return configs;
}
+static struct pipe_surface *
+dri_surface_from_handle(struct pipe_screen *screen,
+ unsigned handle,
+ enum pipe_format format,
+ unsigned width,
+ unsigned height,
+ unsigned pitch)
+{
+ struct pipe_surface *surface = NULL;
+ struct pipe_texture *texture = NULL;
+ struct pipe_texture templat;
+ struct pipe_buffer *buf = NULL;
+
+ buf = drm_api_hooks.buffer_from_handle(screen, "front buffer", handle);
+ if (!buf)
+ return NULL;
+
+ memset(&templat, 0, sizeof(templat));
+ templat.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;
+ templat.target = PIPE_TEXTURE_2D;
+ templat.last_level = 0;
+ templat.depth[0] = 1;
+ templat.format = format;
+ templat.width[0] = width;
+ templat.height[0] = height;
+ pf_get_block(templat.format, &templat.block);
+
+ texture = screen->texture_blanket(screen,
+ &templat,
+ &pitch,
+ buf);
+
+ /* we don't need the buffer from this point on */
+ pipe_buffer_reference(&buf, NULL);
+
+ if (!texture)
+ return NULL;
+
+ surface = screen->get_tex_surface(screen, texture, 0, 0, 0,
+ PIPE_BUFFER_USAGE_GPU_READ |
+ PIPE_BUFFER_USAGE_GPU_WRITE);
+
+ /* we don't need the texture from this point on */
+ pipe_texture_reference(&texture, NULL);
+ return surface;
+}
+
static const __DRIconfig **
nouveau_screen_create(__DRIscreenPrivate *psp)
{
struct nouveau_dri *nv_dri = psp->pDevPriv;
- struct nouveau_screen_dri *nv_screen;
+ struct nouveau_screen *nv_screen;
static const __DRIversion ddx_expected =
{ 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL };
static const __DRIversion dri_expected = { 4, 0, 0 };
@@ -210,17 +260,38 @@ nouveau_screen_create(__DRIscreenPrivate *psp)
return NULL;
}
- nv_screen = CALLOC_STRUCT(nouveau_screen_dri);
+ nv_screen = CALLOC_STRUCT(nouveau_screen);
if (!nv_screen)
return NULL;
- driParseOptionInfo(&nv_screen->option_cache,
- __driConfigOptions, __driNConfigOptions);
+ nouveau_device_open_existing(&nv_screen->device, 0, psp->fd, 0);
- if (nouveau_screen_init(nv_dri, psp->fd, &nv_screen->base)) {
+ nv_screen->pscreen = drm_api_hooks.create_screen(psp->fd, 0);
+ if (!nv_screen->pscreen) {
FREE(nv_screen);
return NULL;
}
+ nv_screen->pscreen->flush_frontbuffer = nouveau_flush_frontbuffer;
+
+ {
+ enum pipe_format format;
+
+ if (nv_dri->bpp == 16)
+ format = PIPE_FORMAT_R5G6B5_UNORM;
+ else
+ format = PIPE_FORMAT_A8R8G8B8_UNORM;
+
+ nv_screen->fb = dri_surface_from_handle(nv_screen->pscreen,
+ nv_dri->front_offset,
+ format,
+ nv_dri->width,
+ nv_dri->height,
+ nv_dri->front_pitch *
+ nv_dri->bpp / 8);
+ }
+
+ driParseOptionInfo(&nv_screen->option_cache,
+ __driConfigOptions, __driNConfigOptions);
nv_screen->driScrnPriv = psp;
psp->private = (void *)nv_screen;
@@ -234,10 +305,9 @@ nouveau_screen_create(__DRIscreenPrivate *psp)
static void
nouveau_screen_destroy(__DRIscreenPrivate *driScrnPriv)
{
- struct nouveau_screen_dri *nv_screen = driScrnPriv->private;
+ struct nouveau_screen *nv_screen = driScrnPriv->private;
driScrnPriv->private = NULL;
- nouveau_screen_cleanup(&nv_screen->base);
FREE(nv_screen);
}
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen_dri.h b/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.h
index 1498087819c..ac078f3c638 100644
--- a/src/gallium/winsys/drm/nouveau/dri/nouveau_screen_dri.h
+++ b/src/gallium/winsys/drm/nouveau/dri/nouveau_screen.h
@@ -1,13 +1,16 @@
#ifndef __NOUVEAU_SCREEN_DRI_H__
#define __NOUVEAU_SCREEN_DRI_H__
-#include "../common/nouveau_screen.h"
#include "xmlconfig.h"
-struct nouveau_screen_dri {
- struct nouveau_screen base;
+struct nouveau_screen {
__DRIscreenPrivate *driScrnPriv;
driOptionCache option_cache;
+
+ struct nouveau_device *device;
+
+ struct pipe_screen *pscreen;
+ struct pipe_surface *fb;
};
#endif
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.c b/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.c
index 3cac722b4a8..9c841a0b2d0 100644
--- a/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.c
+++ b/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.c
@@ -7,23 +7,25 @@
#include <state_tracker/st_context.h>
#include <state_tracker/st_cb_fbo.h>
-#include "../common/nouveau_local.h"
-#include "nouveau_context_dri.h"
-#include "nouveau_screen_dri.h"
+#include "nouveau_context.h"
+#include "nouveau_screen.h"
#include "nouveau_swapbuffers.h"
+#include "nouveau_pushbuf.h"
+
void
nouveau_copy_buffer(__DRIdrawablePrivate *dPriv, struct pipe_surface *surf,
const drm_clip_rect_t *rect)
{
- struct nouveau_context_dri *nv = dPriv->driContextPriv->driverPrivate;
- struct pipe_context *pipe = nv->base.nvc->pctx[nv->base.pctx_id];
+ struct nouveau_context *nv = dPriv->driContextPriv->driverPrivate;
+ struct nouveau_screen *nv_screen = nv->dri_screen->private;
+ struct pipe_context *pipe = nv->st->pipe;
drm_clip_rect_t *pbox;
int nbox, i;
- LOCK_HARDWARE(&nv->base);
+ LOCK_HARDWARE(nv);
if (!dPriv->numClipRects) {
- UNLOCK_HARDWARE(&nv->base);
+ UNLOCK_HARDWARE(nv);
return;
}
pbox = dPriv->pClipRects;
@@ -39,12 +41,12 @@ nouveau_copy_buffer(__DRIdrawablePrivate *dPriv, struct pipe_surface *surf,
w = pbox->x2 - pbox->x1;
h = pbox->y2 - pbox->y1;
- pipe->surface_copy(pipe, nv->base.frontbuffer,
- dx, dy, surf, sx, sy, w, h);
+ pipe->surface_copy(pipe, nv_screen->fb, dx, dy, surf,
+ sx, sy, w, h);
}
- FIRE_RING(nv->base.nvc->channel);
- UNLOCK_HARDWARE(&nv->base);
+ pipe->flush(pipe, 0, NULL);
+ UNLOCK_HARDWARE(nv);
if (nv->last_stamp != dPriv->lastStamp) {
struct nouveau_framebuffer *nvfb = dPriv->driverPrivate;
@@ -86,19 +88,19 @@ nouveau_swap_buffers(__DRIdrawablePrivate *dPriv)
}
void
-nouveau_flush_frontbuffer(struct pipe_winsys *pws, struct pipe_surface *surf,
+nouveau_flush_frontbuffer(struct pipe_screen *pscreen, struct pipe_surface *ps,
void *context_private)
{
- struct nouveau_context_dri *nv = context_private;
+ struct nouveau_context *nv = context_private;
__DRIdrawablePrivate *dPriv = nv->dri_drawable;
- nouveau_copy_buffer(dPriv, surf, NULL);
+ nouveau_copy_buffer(dPriv, ps, NULL);
}
void
nouveau_contended_lock(struct nouveau_context *nv)
{
- struct nouveau_context_dri *nv_sub = (struct nouveau_context_dri*)nv;
+ struct nouveau_context *nv_sub = (struct nouveau_context*)nv;
__DRIdrawablePrivate *dPriv = nv_sub->dri_drawable;
__DRIscreenPrivate *sPriv = nv_sub->dri_screen;
diff --git a/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.h b/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.h
index 825d3da6da5..4ca9cc22831 100644
--- a/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.h
+++ b/src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.h
@@ -1,10 +1,11 @@
#ifndef __NOUVEAU_SWAPBUFFERS_H__
#define __NOUVEAU_SWAPBUFFERS_H__
-extern void nouveau_copy_buffer(__DRIdrawablePrivate *, struct pipe_surface *,
- const drm_clip_rect_t *);
-extern void nouveau_copy_sub_buffer(__DRIdrawablePrivate *,
- int x, int y, int w, int h);
-extern void nouveau_swap_buffers(__DRIdrawablePrivate *);
+void nouveau_copy_buffer(__DRIdrawablePrivate *, struct pipe_surface *,
+ const drm_clip_rect_t *);
+void nouveau_copy_sub_buffer(__DRIdrawablePrivate *, int x, int y, int w, int h);
+void nouveau_swap_buffers(__DRIdrawablePrivate *);
+void nouveau_flush_frontbuffer(struct pipe_screen *, struct pipe_surface *,
+ void *context_private);
#endif