Folks,
Any comments ? The linkage between AGP & DRI is somewhat
icky currently, and Rusty's proposal makes a lot of sense,
especially if the inter_module_* goo is going to go away
(It's already marked as deprecated in 2.5)
Dave
> On Tue, May 27, 2003 at 03:25:27PM +1000, Rusty Russell wrote:
>
> > > > You know I really want to get rid of inter_module_get etc.
> > > > How's progress on AGP? I am unfortunately lacking a machine with AGP
> > > > and DRM support (ancient Thinkpads, ewww...)
> > > It's still there unchanged. To be honest I've no idea how to
> > > get rid of it, unless we just force DRM to have a dependancy on
> > > AGPGART. (Which really sucks for people with PCI graphic cards
> > > with no interest in AGP).
> >
> > It's fairly simple: rather than inter_module_register/unregister,
> > simply EXPORT the symbol.
> > And rather than inter_module_get, do symbol_get() and instead of
> > inter_module_put, do symbol_put().
>
> Is that how you implement weak symbols now ? If I modprobe a DRM module
> without having AGPGART loaded, I don't want it to bitch about unresolved
> symbols. Which is what I think the inter_module junk is actually trying
> to do (if I'm wrong on this, I've *no idea* what it's doing).
You've got it exactly right. Which to me, makes sense. This bit is a
fairly trivial replacement (of course, symbol_get is typesafe, so you
need to have the definition of the symbol in a header somewhere, but
that's just common sense). See also "symbol_request" if you want to
probe for the symbol, too.
> > Now, my only problem is the code in drm_stub.h: stub_register (and
> > stub_putminor, its partner). Looks like this is trying to handle
> > multiple DRM modules? The first module in will succeed the
> > register_chrdev and register its stub_info, and future registrations
> > will then find that and use it?
> >
> > 1) Does this code even work? Can you have multiple DRM modules
> > loaded?
>
> AFAIK, yes. Not tried it. The whole DRM() macro stuff is there just to
> make sure that stuff gets unique symbols, so that it can be duplicated
> in each DRM module. We could just move that stuff to generic DRM code ?
> > 2) If so, we need to find a neater way. A simple but hackish one
> > would be a small drm_stub holder infrastructure in the mainstream
> > kernel. A slightly less hackish one would be a new drm_base
> > module.
>
> *nod*
OK, I'll start with a really minimal, tiny change to introduce this.
But first part first, how's the below patch? Compiles, untested. It
just does the agp <-> drm thing, not the internal drm_stub.h stuff...
Cheers!
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff
--minimal linux-2.5.70-bk1/drivers/char/agp/backend.c
working-2.5.70-bk1-drm/drivers/char/agp/backend.c
--- linux-2.5.70-bk1/drivers/char/agp/backend.c 2003-05-27 15:02:07.000000000 +1000
+++ working-2.5.70-bk1-drm/drivers/char/agp/backend.c 2003-05-28 11:03:13.000000000
+1000
@@ -210,7 +210,7 @@ static void agp_backend_cleanup(struct a
phys_to_virt(bridge->scratch_page_real));
}
-static const drm_agp_t drm_agp = {
+const drm_agp_t drm_agp_interface = {
&agp_free_memory,
&agp_allocate_memory,
&agp_bind_memory,
@@ -220,6 +220,7 @@ static const drm_agp_t drm_agp = {
&agp_backend_release,
&agp_copy_info
};
+EXPORT_SYMBOL(drm_agp_interface);
/* XXX Kludge alert: agpgart isn't ready for multiple bridges yet */
struct agp_bridge_data *agp_alloc_bridge(void)
@@ -270,9 +271,6 @@ int agp_add_bridge(struct agp_bridge_dat
goto frontend_err;
}
- /* FIXME: What to do with this? */
- inter_module_register("drm_agp", THIS_MODULE, &drm_agp);
-
agp_count++;
return 0;
@@ -291,7 +289,6 @@ void agp_remove_bridge(struct agp_bridge
bridge->type = NOT_SUPPORTED;
agp_frontend_cleanup();
agp_backend_cleanup(bridge);
- inter_module_unregister("drm_agp");
agp_count--;
module_put(bridge->driver->owner);
}
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff
--minimal linux-2.5.70-bk1/drivers/char/drm/drm_agpsupport.h
working-2.5.70-bk1-drm/drivers/char/drm/drm_agpsupport.h
--- linux-2.5.70-bk1/drivers/char/drm/drm_agpsupport.h 2003-05-27 15:02:07.000000000
+1000
+++ working-2.5.70-bk1-drm/drivers/char/drm/drm_agpsupport.h 2003-05-28
12:27:59.000000000 +1000
@@ -34,8 +34,8 @@
#if __REALLY_HAVE_AGP
-#define DRM_AGP_GET (drm_agp_t *)inter_module_get("drm_agp")
-#define DRM_AGP_PUT inter_module_put("drm_agp")
+#define DRM_AGP_GET symbol_get(drm_agp_interface)
+#define DRM_AGP_PUT symbol_put(drm_agp_interface)
static const drm_agp_t *drm_agp = NULL;
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff
--minimal linux-2.5.70-bk1/include/linux/agp_backend.h
working-2.5.70-bk1-drm/include/linux/agp_backend.h
--- linux-2.5.70-bk1/include/linux/agp_backend.h 2003-05-27 15:02:21.000000000
+1000
+++ working-2.5.70-bk1-drm/include/linux/agp_backend.h 2003-05-28 11:02:40.000000000
+1000
@@ -96,11 +96,7 @@ extern void agp_enable(u32);
extern int agp_backend_acquire(void);
extern void agp_backend_release(void);
-/*
- * Interface between drm and agp code. When agp initializes, it makes
- * the below structure available via inter_module_register(), drm might
- * use it. Keith Owens <[EMAIL PROTECTED]> 28 Oct 2000.
- */
+/* Interface between drm and agp code. */
typedef struct {
void (*free_memory)(struct agp_memory *);
struct agp_memory * (*allocate_memory)(size_t, u32);
@@ -112,7 +108,6 @@ typedef struct {
int (*copy_info)(struct agp_kern_info *);
} drm_agp_t;
-extern const drm_agp_t *drm_agp_p;
-
+extern const drm_agp_t drm_agp_interface;
#endif /* __KERNEL__ */
#endif /* _AGP_BACKEND_H */
-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel