summaryrefslogtreecommitdiff
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@vmware.com>2009-06-30 11:49:43 +0200
committerJakob Bornecrantz <jakob@vmware.com>2009-06-30 12:20:39 +0200
commit303cbb45b558a2b94e6922252cf57d115ba60b82 (patch)
treed56f9e58b8a3944ed7885bc1a72b1f786c98338e /src/gallium/winsys
parentefe9faf0612778db2423a4f8835b318b95d9efd7 (diff)
drm/st: Return drm_api struct from a function
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_be_api.c18
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_be_api.h7
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_be_context.c2
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_be_device.c17
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_be_device.h11
5 files changed, 37 insertions, 18 deletions
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_api.c b/src/gallium/winsys/drm/intel/gem/intel_be_api.c
index a74be13bf7..4a1768a599 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_api.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_api.c
@@ -2,13 +2,12 @@
#include "intel_be_api.h"
#include "i915simple/i915_winsys.h"
-#ifdef DEBUG
-#include "trace/trace_drm.h"
+static void destroy(struct drm_api *api)
+{
+
+}
-struct drm_api hooks =
-#else
-struct drm_api drm_api_hooks =
-#endif
+struct drm_api intel_be_drm_api =
{
/* intel_be_context.c */
.create_context = intel_be_create_context,
@@ -18,4 +17,11 @@ struct drm_api drm_api_hooks =
.buffer_from_handle = intel_be_buffer_from_handle,
.handle_from_buffer = intel_be_handle_from_buffer,
.global_handle_from_buffer = intel_be_global_handle_from_buffer,
+ .destroy = destroy,
};
+
+struct drm_api *
+drm_api_create()
+{
+ return &intel_be_drm_api;
+}
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_api.h b/src/gallium/winsys/drm/intel/gem/intel_be_api.h
index 1c622f3b97..f286b62eb8 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_api.h
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_api.h
@@ -8,8 +8,11 @@
#include "intel_be_device.h"
-struct pipe_screen *intel_be_create_screen(int drmFD,
+extern struct drm_api intel_be_drm_api;
+
+struct pipe_screen *intel_be_create_screen(struct drm_api *api, int drmFD,
struct drm_create_screen_arg *arg);
-struct pipe_context *intel_be_create_context(struct pipe_screen *screen);
+struct pipe_context *intel_be_create_context(struct drm_api *api,
+ struct pipe_screen *screen);
#endif
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_context.c b/src/gallium/winsys/drm/intel/gem/intel_be_context.c
index fe0b138fbe..db84f9af51 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_context.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_context.c
@@ -97,7 +97,7 @@ intel_be_init_context(struct intel_be_context *intel, struct intel_be_device *de
}
struct pipe_context *
-intel_be_create_context(struct pipe_screen *screen)
+intel_be_create_context(struct drm_api *api, struct pipe_screen *screen)
{
struct intel_be_context *intel;
struct pipe_context *pipe;
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.c b/src/gallium/winsys/drm/intel/gem/intel_be_device.c
index 907ac86637..2d531279f7 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_device.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.c
@@ -143,7 +143,8 @@ err:
}
struct pipe_buffer *
-intel_be_buffer_from_handle(struct pipe_screen *screen,
+intel_be_buffer_from_handle(struct drm_api *api,
+ struct pipe_screen *screen,
const char* name, unsigned handle)
{
struct intel_be_device *dev = intel_be_device(screen->winsys);
@@ -174,7 +175,8 @@ err:
}
boolean
-intel_be_handle_from_buffer(struct pipe_screen *screen,
+intel_be_handle_from_buffer(struct drm_api *api,
+ struct pipe_screen *screen,
struct pipe_buffer *buffer,
unsigned *handle)
{
@@ -186,7 +188,8 @@ intel_be_handle_from_buffer(struct pipe_screen *screen,
}
boolean
-intel_be_global_handle_from_buffer(struct pipe_screen *screen,
+intel_be_global_handle_from_buffer(struct drm_api *api,
+ struct pipe_screen *screen,
struct pipe_buffer *buffer,
unsigned *handle)
{
@@ -296,6 +299,7 @@ intel_be_get_device_id(unsigned int *device_id)
{
char path[512];
FILE *file;
+ void *shutup_gcc;
/*
* FIXME: Fix this up to use a drm ioctl or whatever.
@@ -307,13 +311,14 @@ intel_be_get_device_id(unsigned int *device_id)
return;
}
- fgets(path, sizeof(path), file);
+ shutup_gcc = fgets(path, sizeof(path), file);
sscanf(path, "%x", device_id);
fclose(file);
}
struct pipe_screen *
-intel_be_create_screen(int drmFD, struct drm_create_screen_arg *arg)
+intel_be_create_screen(struct drm_api *api, int drmFD,
+ struct drm_create_screen_arg *arg)
{
struct intel_be_device *dev;
struct pipe_screen *screen;
@@ -339,7 +344,7 @@ intel_be_create_screen(int drmFD, struct drm_create_screen_arg *arg)
if (dev->softpipe) {
screen = softpipe_create_screen(&dev->base);
- drm_api_hooks.buffer_from_texture = softpipe_get_texture_buffer;
+ intel_be_drm_api.buffer_from_texture = softpipe_get_texture_buffer;
} else
screen = i915_create_screen(&dev->base, deviceID);
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.h b/src/gallium/winsys/drm/intel/gem/intel_be_device.h
index b32637ece2..777161daca 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_device.h
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.h
@@ -8,6 +8,8 @@
#include "drm.h"
#include "intel_bufmgr.h"
+struct drm_api;
+
/*
* Device
*/
@@ -56,7 +58,8 @@ struct intel_be_buffer {
* Takes a reference.
*/
struct pipe_buffer *
-intel_be_buffer_from_handle(struct pipe_screen *screen,
+intel_be_buffer_from_handle(struct drm_api *api,
+ struct pipe_screen *screen,
const char* name, unsigned handle);
/**
@@ -65,7 +68,8 @@ intel_be_buffer_from_handle(struct pipe_screen *screen,
* If buffer is destroyed handle may become invalid.
*/
boolean
-intel_be_handle_from_buffer(struct pipe_screen *screen,
+intel_be_handle_from_buffer(struct drm_api *api,
+ struct pipe_screen *screen,
struct pipe_buffer *buffer,
unsigned *handle);
@@ -75,7 +79,8 @@ intel_be_handle_from_buffer(struct pipe_screen *screen,
* If buffer is destroyed handle may become invalid.
*/
boolean
-intel_be_global_handle_from_buffer(struct pipe_screen *screen,
+intel_be_global_handle_from_buffer(struct drm_api *api,
+ struct pipe_screen *screen,
struct pipe_buffer *buffer,
unsigned *handle);