radeon-gallium: Adapt to drm_api changes.

Note that trace debugging is temporarily gone. I'll rework it later.
This commit is contained in:
Corbin Simpson 2009-07-01 22:33:17 -07:00
parent 5e6b593d35
commit 338db0af61
2 changed files with 33 additions and 23 deletions

View File

@ -30,12 +30,9 @@
#include "radeon_drm.h" #include "radeon_drm.h"
#ifdef DEBUG
#include "trace/trace_drm.h"
#endif
/* Create a pipe_screen. */ /* Create a pipe_screen. */
struct pipe_screen* radeon_create_screen(int drmFB, struct pipe_screen* radeon_create_screen(struct drm_api* api,
int drmFB,
struct drm_create_screen_arg *arg) struct drm_create_screen_arg *arg)
{ {
struct radeon_winsys* winsys = radeon_pipe_winsys(drmFB); struct radeon_winsys* winsys = radeon_pipe_winsys(drmFB);
@ -50,7 +47,8 @@ struct pipe_screen* radeon_create_screen(int drmFB,
} }
/* Create a pipe_context. */ /* Create a pipe_context. */
struct pipe_context* radeon_create_context(struct pipe_screen* screen) struct pipe_context* radeon_create_context(struct drm_api* api,
struct pipe_screen* screen)
{ {
if (getenv("RADEON_SOFTPIPE")) { if (getenv("RADEON_SOFTPIPE")) {
return radeon_create_softpipe(screen->winsys); return radeon_create_softpipe(screen->winsys);
@ -59,16 +57,19 @@ struct pipe_context* radeon_create_context(struct pipe_screen* screen)
} }
} }
boolean radeon_buffer_from_texture(struct pipe_texture* texture, boolean radeon_buffer_from_texture(struct drm_api* api,
struct pipe_texture* texture,
struct pipe_buffer** buffer, struct pipe_buffer** buffer,
unsigned* stride) unsigned* stride)
{ {
return FALSE; /* XXX fix this */
return r300_get_texture_buffer(texture, buffer, stride);
} }
/* Create a buffer from a handle. */ /* Create a buffer from a handle. */
/* XXX what's up with name? */ /* XXX what's up with name? */
struct pipe_buffer* radeon_buffer_from_handle(struct pipe_screen* screen, struct pipe_buffer* radeon_buffer_from_handle(struct drm_api* api,
struct pipe_screen* screen,
const char* name, const char* name,
unsigned handle) unsigned handle)
{ {
@ -95,7 +96,8 @@ struct pipe_buffer* radeon_buffer_from_handle(struct pipe_screen* screen,
return &radeon_buffer->base; return &radeon_buffer->base;
} }
boolean radeon_handle_from_buffer(struct pipe_screen* screen, boolean radeon_handle_from_buffer(struct drm_api* api,
struct pipe_screen* screen,
struct pipe_buffer* buffer, struct pipe_buffer* buffer,
unsigned* handle) unsigned* handle)
{ {
@ -105,7 +107,8 @@ boolean radeon_handle_from_buffer(struct pipe_screen* screen,
return TRUE; return TRUE;
} }
boolean radeon_global_handle_from_buffer(struct pipe_screen* screen, boolean radeon_global_handle_from_buffer(struct drm_api* api,
struct pipe_screen* screen,
struct pipe_buffer* buffer, struct pipe_buffer* buffer,
unsigned* handle) unsigned* handle)
{ {
@ -116,16 +119,16 @@ boolean radeon_global_handle_from_buffer(struct pipe_screen* screen,
return TRUE; return TRUE;
} }
#ifdef DEBUG
struct drm_api hooks = {
#else
struct drm_api drm_api_hooks = { struct drm_api drm_api_hooks = {
#endif
.create_screen = radeon_create_screen, .create_screen = radeon_create_screen,
.create_context = radeon_create_context, .create_context = radeon_create_context,
/* XXX fix this */ .buffer_from_texture = radeon_buffer_from_texture,
.buffer_from_texture = r300_get_texture_buffer,
.buffer_from_handle = radeon_buffer_from_handle, .buffer_from_handle = radeon_buffer_from_handle,
.handle_from_buffer = radeon_handle_from_buffer, .handle_from_buffer = radeon_handle_from_buffer,
.global_handle_from_buffer = radeon_global_handle_from_buffer, .global_handle_from_buffer = radeon_global_handle_from_buffer,
}; };
struct drm_api* drm_api_create()
{
return &drm_api_hooks;
}

View File

@ -40,25 +40,32 @@
#include "radeon_r300.h" #include "radeon_r300.h"
#include "radeon_winsys_softpipe.h" #include "radeon_winsys_softpipe.h"
struct pipe_screen* radeon_create_screen(int drmFB, struct pipe_screen* radeon_create_screen(struct drm_api* api,
int drmFB,
struct drm_create_screen_arg *arg); struct drm_create_screen_arg *arg);
struct pipe_context* radeon_create_context(struct pipe_screen* screen); struct pipe_context* radeon_create_context(struct drm_api* api,
struct pipe_screen* screen);
boolean radeon_buffer_from_texture(struct pipe_texture* texture, boolean radeon_buffer_from_texture(struct drm_api* api,
struct pipe_texture* texture,
struct pipe_buffer** buffer, struct pipe_buffer** buffer,
unsigned* stride); unsigned* stride);
struct pipe_buffer* radeon_buffer_from_handle(struct pipe_screen* screen, struct pipe_buffer* radeon_buffer_from_handle(struct drm_api* api,
struct pipe_screen* screen,
const char* name, const char* name,
unsigned handle); unsigned handle);
boolean radeon_handle_from_buffer(struct pipe_screen* screen, boolean radeon_handle_from_buffer(struct drm_api* api,
struct pipe_screen* screen,
struct pipe_buffer* buffer, struct pipe_buffer* buffer,
unsigned* handle); unsigned* handle);
boolean radeon_global_handle_from_buffer(struct pipe_screen* screen, boolean radeon_global_handle_from_buffer(struct drm_api* api,
struct pipe_screen* screen,
struct pipe_buffer* buffer, struct pipe_buffer* buffer,
unsigned* handle); unsigned* handle);
void radeon_destroy_drm_api(struct drm_api* api);
#endif #endif