On 02/05/2010 11:01 AM, Keith Whitwell wrote:
> We've had a couple of cleanups that we've wanted to do in gallium for
> as long as I can remember. One of which is to remove all the random
> context-creation calls and funnel them through something sensible like
> a context_create() call in pipe_screen.
>
> The gallium-screen-context branch does exactly that.
>
> The trouble is this change touches every driver and state-tracker in
> every combination. I can't even build half the drivers (what do I
> need to install to build nouveau?), let alone test them in any
> meaningful way.
>
Hi.
For building nouveau you'll need libdrm_nouveau.
Here's a patch that makes nv30,40,50 compile again; nv50 seems to work,
can't test the others.
Christoph
> So, I really need people to take a look at this branch and make sure
> you can still at least build the driver, run some simple apps, etc.
>
> Keith
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Mesa3d-dev mailing list
> Mesa3d-dev@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
>From 4aea3df06bb7d366bea76b7173c19419f0d20630 Mon Sep 17 00:00:00 2001
From: Christoph Bumiller <e0425...@student.tuwien.ac.at>
Date: Sat, 6 Feb 2010 17:03:43 +0100
Subject: [PATCH] nouveau: fix gallium-screen-context branch fallout
---
src/gallium/drivers/nouveau/nouveau_winsys.h | 9 --------
src/gallium/drivers/nv30/nv30_context.c | 1 +
src/gallium/drivers/nv30/nv30_context.h | 1 +
src/gallium/drivers/nv30/nv30_screen.c | 1 -
src/gallium/drivers/nv30/nv30_screen.h | 5 +--
src/gallium/drivers/nv30/nv30_transfer.c | 21 +++++++++---------
src/gallium/drivers/nv40/nv40_context.c | 1 +
src/gallium/drivers/nv40/nv40_context.h | 3 +-
src/gallium/drivers/nv40/nv40_screen.c | 1 -
src/gallium/drivers/nv40/nv40_screen.h | 5 +--
src/gallium/drivers/nv40/nv40_transfer.c | 20 +++++++++--------
src/gallium/drivers/nv50/nv50_context.c | 1 +
src/gallium/drivers/nv50/nv50_context.h | 3 +-
src/gallium/drivers/nv50/nv50_screen.c | 1 -
src/gallium/drivers/nv50/nv50_screen.h | 2 -
src/gallium/drivers/nv50/nv50_transfer.c | 29 +++++++++++++------------
16 files changed, 49 insertions(+), 55 deletions(-)
diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h
b/src/gallium/drivers/nouveau/nouveau_winsys.h
index 4c5d2f8..af9ddd5 100644
--- a/src/gallium/drivers/nouveau/nouveau_winsys.h
+++ b/src/gallium/drivers/nouveau/nouveau_winsys.h
@@ -29,19 +29,10 @@
extern struct pipe_screen *
nv30_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
-extern struct pipe_context *
-nv30_create(struct pipe_screen *, unsigned pctx_id);
-
extern struct pipe_screen *
nv40_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
-extern struct pipe_context *
-nv40_create(struct pipe_screen *, unsigned pctx_id);
-
extern struct pipe_screen *
nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
-extern struct pipe_context *
-nv50_create(struct pipe_screen *, unsigned pctx_id);
-
#endif
diff --git a/src/gallium/drivers/nv30/nv30_context.c
b/src/gallium/drivers/nv30/nv30_context.c
index 8bfd7b2..12932c1 100644
--- a/src/gallium/drivers/nv30/nv30_context.c
+++ b/src/gallium/drivers/nv30/nv30_context.c
@@ -75,6 +75,7 @@ nv30_create(struct pipe_screen *pscreen, void *priv)
nv30_init_query_functions(nv30);
nv30_init_surface_functions(nv30);
nv30_init_state_functions(nv30);
+ nv30_init_transfer_functions(nv30);
/* Create, configure, and install fallback swtnl path */
nv30->draw = draw_create();
diff --git a/src/gallium/drivers/nv30/nv30_context.h
b/src/gallium/drivers/nv30/nv30_context.h
index b3b26f7..419d9a5 100644
--- a/src/gallium/drivers/nv30/nv30_context.h
+++ b/src/gallium/drivers/nv30/nv30_context.h
@@ -161,6 +161,7 @@ struct nv30_state_entry {
extern void nv30_init_state_functions(struct nv30_context *nv30);
extern void nv30_init_surface_functions(struct nv30_context *nv30);
extern void nv30_init_query_functions(struct nv30_context *nv30);
+extern void nv30_init_transfer_functions(struct nv30_context *nv30);
extern void nv30_screen_init_miptree_functions(struct pipe_screen *pscreen);
diff --git a/src/gallium/drivers/nv30/nv30_screen.c
b/src/gallium/drivers/nv30/nv30_screen.c
index 8f9b26e..66ff17c 100644
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nv30/nv30_screen.c
@@ -212,7 +212,6 @@ nv30_screen_create(struct pipe_winsys *ws, struct
nouveau_device *dev)
pscreen->context_create = nv30_create;
nv30_screen_init_miptree_functions(pscreen);
- nv30_screen_init_transfer_functions(pscreen);
/* 3D object */
switch (dev->chipset & 0xf0) {
diff --git a/src/gallium/drivers/nv30/nv30_screen.h
b/src/gallium/drivers/nv30/nv30_screen.h
index b1ac939..b7856cd 100644
--- a/src/gallium/drivers/nv30/nv30_screen.h
+++ b/src/gallium/drivers/nv30/nv30_screen.h
@@ -10,6 +10,8 @@ struct nv30_screen {
struct nouveau_winsys *nvws;
+ struct nv30_context *cur_ctx;
+
/* HW graphics objects */
struct nv04_surface_2d *eng2d;
struct nouveau_grobj *rankine;
@@ -33,7 +35,4 @@ nv30_screen(struct pipe_screen *screen)
return (struct nv30_screen *)screen;
}
-void
-nv30_screen_init_transfer_functions(struct pipe_screen *pscreen);
-
#endif
diff --git a/src/gallium/drivers/nv30/nv30_transfer.c
b/src/gallium/drivers/nv30/nv30_transfer.c
index 554bcbb..75530cb 100644
--- a/src/gallium/drivers/nv30/nv30_transfer.c
+++ b/src/gallium/drivers/nv30/nv30_transfer.c
@@ -33,11 +33,12 @@ nv30_compatible_transfer_tex(struct pipe_texture *pt,
unsigned width, unsigned h
}
static struct pipe_transfer *
-nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+nv30_transfer_new(struct pipe_context *pipe, struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage,
unsigned x, unsigned y, unsigned w, unsigned h)
{
+ struct pipe_screen *pscreen = pipe->screen;
struct nv30_miptree *mt = (struct nv30_miptree *)pt;
struct nv30_transfer *tx;
struct pipe_texture tx_tex_template, *tx_tex;
@@ -145,12 +146,12 @@ nv30_transfer_del(struct pipe_transfer *ptx)
}
static void *
-nv30_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+nv30_transfer_map(struct pipe_context *pipe, struct pipe_transfer *ptx)
{
struct nv30_transfer *tx = (struct nv30_transfer *)ptx;
struct nv04_surface *ns = (struct nv04_surface *)tx->surface;
struct nv30_miptree *mt = (struct nv30_miptree *)tx->surface->texture;
- void *map = pipe_buffer_map(pscreen, mt->buffer,
+ void *map = pipe_buffer_map(pipe->screen, mt->buffer,
pipe_transfer_buffer_flags(ptx));
if(!tx->direct)
@@ -160,19 +161,19 @@ nv30_transfer_map(struct pipe_screen *pscreen, struct
pipe_transfer *ptx)
}
static void
-nv30_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+nv30_transfer_unmap(struct pipe_context *pipe, struct pipe_transfer *ptx)
{
struct nv30_transfer *tx = (struct nv30_transfer *)ptx;
struct nv30_miptree *mt = (struct nv30_miptree *)tx->surface->texture;
- pipe_buffer_unmap(pscreen, mt->buffer);
+ pipe_buffer_unmap(pipe->screen, mt->buffer);
}
void
-nv30_screen_init_transfer_functions(struct pipe_screen *pscreen)
+nv30_init_transfer_functions(struct nv30_context *nv30)
{
- pscreen->get_tex_transfer = nv30_transfer_new;
- pscreen->tex_transfer_destroy = nv30_transfer_del;
- pscreen->transfer_map = nv30_transfer_map;
- pscreen->transfer_unmap = nv30_transfer_unmap;
+ nv30->pipe.get_tex_transfer = nv30_transfer_new;
+ nv30->pipe.tex_transfer_destroy = nv30_transfer_del;
+ nv30->pipe.transfer_map = nv30_transfer_map;
+ nv30->pipe.transfer_unmap = nv30_transfer_unmap;
}
diff --git a/src/gallium/drivers/nv40/nv40_context.c
b/src/gallium/drivers/nv40/nv40_context.c
index b0b9003..37f54c1 100644
--- a/src/gallium/drivers/nv40/nv40_context.c
+++ b/src/gallium/drivers/nv40/nv40_context.c
@@ -75,6 +75,7 @@ nv40_create(struct pipe_screen *pscreen, void *priv)
nv40_init_query_functions(nv40);
nv40_init_surface_functions(nv40);
nv40_init_state_functions(nv40);
+ nv40_init_transfer_functions(nv40);
/* Create, configure, and install fallback swtnl path */
nv40->draw = draw_create();
diff --git a/src/gallium/drivers/nv40/nv40_context.h
b/src/gallium/drivers/nv40/nv40_context.h
index 71936c2..6f6f2e4 100644
--- a/src/gallium/drivers/nv40/nv40_context.h
+++ b/src/gallium/drivers/nv40/nv40_context.h
@@ -176,6 +176,7 @@ struct nv40_state_entry {
extern void nv40_init_state_functions(struct nv40_context *nv40);
extern void nv40_init_surface_functions(struct nv40_context *nv40);
extern void nv40_init_query_functions(struct nv40_context *nv40);
+extern void nv40_init_transfer_functions(struct nv40_context *nv40);
extern void nv40_screen_init_miptree_functions(struct pipe_screen *pscreen);
@@ -231,6 +232,6 @@ extern void nv40_clear(struct pipe_context *pipe, unsigned
buffers,
/* nv40_context.c */
struct pipe_context *
-nv40_create(struct pipe_screen *pscreen, void *priv)
+nv40_create(struct pipe_screen *pscreen, void *priv);
#endif
diff --git a/src/gallium/drivers/nv40/nv40_screen.c
b/src/gallium/drivers/nv40/nv40_screen.c
index 001147e..c2ffb37 100644
--- a/src/gallium/drivers/nv40/nv40_screen.c
+++ b/src/gallium/drivers/nv40/nv40_screen.c
@@ -199,7 +199,6 @@ nv40_screen_create(struct pipe_winsys *ws, struct
nouveau_device *dev)
pscreen->context_create = nv40_create;
nv40_screen_init_miptree_functions(pscreen);
- nv40_screen_init_transfer_functions(pscreen);
/* 3D object */
switch (dev->chipset & 0xf0) {
diff --git a/src/gallium/drivers/nv40/nv40_screen.h
b/src/gallium/drivers/nv40/nv40_screen.h
index 9de98b2..2765ab7 100644
--- a/src/gallium/drivers/nv40/nv40_screen.h
+++ b/src/gallium/drivers/nv40/nv40_screen.h
@@ -9,6 +9,8 @@ struct nv40_screen {
struct nouveau_winsys *nvws;
+ struct nv40_context *cur_ctx;
+
/* HW graphics objects */
struct nv04_surface_2d *eng2d;
struct nouveau_grobj *curie;
@@ -32,7 +34,4 @@ nv40_screen(struct pipe_screen *screen)
return (struct nv40_screen *)screen;
}
-void
-nv40_screen_init_transfer_functions(struct pipe_screen *pscreen);
-
#endif
diff --git a/src/gallium/drivers/nv40/nv40_transfer.c
b/src/gallium/drivers/nv40/nv40_transfer.c
index ee266c6..635f8da 100644
--- a/src/gallium/drivers/nv40/nv40_transfer.c
+++ b/src/gallium/drivers/nv40/nv40_transfer.c
@@ -33,11 +33,12 @@ nv40_compatible_transfer_tex(struct pipe_texture *pt,
unsigned width, unsigned h
}
static struct pipe_transfer *
-nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+nv40_transfer_new(struct pipe_context *pipe, struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage,
unsigned x, unsigned y, unsigned w, unsigned h)
{
+ struct pipe_screen *pscreen = pipe->screen;
struct nv40_miptree *mt = (struct nv40_miptree *)pt;
struct nv40_transfer *tx;
struct pipe_texture tx_tex_template, *tx_tex;
@@ -145,8 +146,9 @@ nv40_transfer_del(struct pipe_transfer *ptx)
}
static void *
-nv40_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+nv40_transfer_map(struct pipe_context *pipe, struct pipe_transfer *ptx)
{
+ struct pipe_screen *pscreen = pipe->screen;
struct nv40_transfer *tx = (struct nv40_transfer *)ptx;
struct nv04_surface *ns = (struct nv04_surface *)tx->surface;
struct nv40_miptree *mt = (struct nv40_miptree *)tx->surface->texture;
@@ -160,19 +162,19 @@ nv40_transfer_map(struct pipe_screen *pscreen, struct
pipe_transfer *ptx)
}
static void
-nv40_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+nv40_transfer_unmap(struct pipe_context *pipe, struct pipe_transfer *ptx)
{
struct nv40_transfer *tx = (struct nv40_transfer *)ptx;
struct nv40_miptree *mt = (struct nv40_miptree *)tx->surface->texture;
- pipe_buffer_unmap(pscreen, mt->buffer);
+ pipe_buffer_unmap(pipe->screen, mt->buffer);
}
void
-nv40_screen_init_transfer_functions(struct pipe_screen *pscreen)
+nv40_init_transfer_functions(struct nv40_context *nv40)
{
- pscreen->get_tex_transfer = nv40_transfer_new;
- pscreen->tex_transfer_destroy = nv40_transfer_del;
- pscreen->transfer_map = nv40_transfer_map;
- pscreen->transfer_unmap = nv40_transfer_unmap;
+ nv40->pipe.get_tex_transfer = nv40_transfer_new;
+ nv40->pipe.tex_transfer_destroy = nv40_transfer_del;
+ nv40->pipe.transfer_map = nv40_transfer_map;
+ nv40->pipe.transfer_unmap = nv40_transfer_unmap;
}
diff --git a/src/gallium/drivers/nv50/nv50_context.c
b/src/gallium/drivers/nv50/nv50_context.c
index 867bd03..b5c8bfb 100644
--- a/src/gallium/drivers/nv50/nv50_context.c
+++ b/src/gallium/drivers/nv50/nv50_context.c
@@ -129,6 +129,7 @@ nv50_create(struct pipe_screen *pscreen, void *priv)
nv50_init_surface_functions(nv50);
nv50_init_state_functions(nv50);
nv50_init_query_functions(nv50);
+ nv50_init_transfer_functions(nv50);
nv50->draw = draw_create();
assert(nv50->draw);
diff --git a/src/gallium/drivers/nv50/nv50_context.h
b/src/gallium/drivers/nv50/nv50_context.h
index f2b3172..297151e 100644
--- a/src/gallium/drivers/nv50/nv50_context.h
+++ b/src/gallium/drivers/nv50/nv50_context.h
@@ -184,6 +184,7 @@ nv50_context(struct pipe_context *pipe)
extern void nv50_init_surface_functions(struct nv50_context *nv50);
extern void nv50_init_state_functions(struct nv50_context *nv50);
extern void nv50_init_query_functions(struct nv50_context *nv50);
+extern void nv50_init_transfer_functions(struct nv50_context *nv50);
extern void nv50_screen_init_miptree_functions(struct pipe_screen *pscreen);
@@ -251,6 +252,6 @@ nv50_upload_sifc(struct nv50_context *nv50,
/* nv50_context.c */
struct pipe_context *
-nv50_create(struct pipe_screen *pscreen, void *priv)
+nv50_create(struct pipe_screen *pscreen, void *priv);
#endif
diff --git a/src/gallium/drivers/nv50/nv50_screen.c
b/src/gallium/drivers/nv50/nv50_screen.c
index 8c4478e..ff754f1 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -255,7 +255,6 @@ nv50_screen_create(struct pipe_winsys *ws, struct
nouveau_device *dev)
screen->base.pre_pipebuffer_map_callback = nv50_pre_pipebuffer_map;
nv50_screen_init_miptree_functions(pscreen);
- nv50_transfer_init_screen_functions(pscreen);
/* DMA engine object */
ret = nouveau_grobj_alloc(chan, 0xbeef5039,
diff --git a/src/gallium/drivers/nv50/nv50_screen.h
b/src/gallium/drivers/nv50/nv50_screen.h
index 2687b72..e66b444 100644
--- a/src/gallium/drivers/nv50/nv50_screen.h
+++ b/src/gallium/drivers/nv50/nv50_screen.h
@@ -36,6 +36,4 @@ nv50_screen(struct pipe_screen *screen)
return (struct nv50_screen *)screen;
}
-void nv50_transfer_init_screen_functions(struct pipe_screen *);
-
#endif
diff --git a/src/gallium/drivers/nv50/nv50_transfer.c
b/src/gallium/drivers/nv50/nv50_transfer.c
index d08b4d7..fe6bf9c 100644
--- a/src/gallium/drivers/nv50/nv50_transfer.c
+++ b/src/gallium/drivers/nv50/nv50_transfer.c
@@ -23,7 +23,7 @@ struct nv50_transfer {
};
static void
-nv50_transfer_rect_m2mf(struct pipe_screen *pscreen,
+nv50_transfer_rect_m2mf(struct nv50_screen *screen,
struct nouveau_bo *src_bo, unsigned src_offset,
int src_pitch, unsigned src_tile_mode,
int sx, int sy, int sz, int sw, int sh, int sd,
@@ -33,7 +33,6 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen,
int cpp, int width, int height,
unsigned src_reloc, unsigned dst_reloc)
{
- struct nv50_screen *screen = nv50_screen(pscreen);
struct nouveau_channel *chan = screen->m2mf->channel;
struct nouveau_grobj *m2mf = screen->m2mf;
@@ -121,12 +120,13 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen,
}
static struct pipe_transfer *
-nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+nv50_transfer_new(struct pipe_context *pipe, struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage,
unsigned x, unsigned y, unsigned w, unsigned h)
{
- struct nouveau_device *dev = nouveau_screen(pscreen)->device;
+ struct nv50_screen *screen = nv50_context(pipe)->screen;
+ struct nouveau_device *dev = screen->base.device;
struct nv50_miptree *mt = nv50_miptree(pt);
struct nv50_miptree_level *lvl = &mt->level[level];
struct nv50_transfer *tx;
@@ -168,7 +168,8 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct
pipe_texture *pt,
nx = util_format_get_nblocksx(pt->format, tx->base.width);
ny = util_format_get_nblocksy(pt->format, tx->base.height);
- nv50_transfer_rect_m2mf(pscreen, mt->base.bo, tx->level_offset,
+ nv50_transfer_rect_m2mf(screen,
+ mt->base.bo, tx->level_offset,
tx->level_pitch, tx->level_tiling,
x, y, zslice,
tx->nblocksx, tx->nblocksy,
@@ -196,9 +197,9 @@ nv50_transfer_del(struct pipe_transfer *ptx)
unsigned ny = util_format_get_nblocksy(pt->format, tx->base.height);
if (ptx->usage & PIPE_TRANSFER_WRITE) {
- struct pipe_screen *pscreen = pt->screen;
+ struct nv50_screen *screen = nv50_screen(pt->screen);
- nv50_transfer_rect_m2mf(pscreen, tx->bo, 0,
+ nv50_transfer_rect_m2mf(screen, tx->bo, 0,
tx->base.stride, tx->bo->tile_mode,
0, 0, 0,
tx->nblocksx, tx->nblocksy, 1,
@@ -218,7 +219,7 @@ nv50_transfer_del(struct pipe_transfer *ptx)
}
static void *
-nv50_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+nv50_transfer_map(struct pipe_context *pipe, struct pipe_transfer *ptx)
{
struct nv50_transfer *tx = (struct nv50_transfer *)ptx;
unsigned flags = 0;
@@ -236,7 +237,7 @@ nv50_transfer_map(struct pipe_screen *pscreen, struct
pipe_transfer *ptx)
}
static void
-nv50_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+nv50_transfer_unmap(struct pipe_context *pipe, struct pipe_transfer *ptx)
{
struct nv50_transfer *tx = (struct nv50_transfer *)ptx;
@@ -244,12 +245,12 @@ nv50_transfer_unmap(struct pipe_screen *pscreen, struct
pipe_transfer *ptx)
}
void
-nv50_transfer_init_screen_functions(struct pipe_screen *pscreen)
+nv50_init_transfer_functions(struct nv50_context *nv50)
{
- pscreen->get_tex_transfer = nv50_transfer_new;
- pscreen->tex_transfer_destroy = nv50_transfer_del;
- pscreen->transfer_map = nv50_transfer_map;
- pscreen->transfer_unmap = nv50_transfer_unmap;
+ nv50->pipe.get_tex_transfer = nv50_transfer_new;
+ nv50->pipe.tex_transfer_destroy = nv50_transfer_del;
+ nv50->pipe.transfer_map = nv50_transfer_map;
+ nv50->pipe.transfer_unmap = nv50_transfer_unmap;
}
void
--
1.6.4.4
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev