summaryrefslogtreecommitdiff
path: root/src/driclient/include/driclient.h
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-02-10 16:44:02 -0700
committerBrian Paul <brianp@vmware.com>2009-02-10 16:44:02 -0700
commit5340b6dff73a0a23531ce2a5f28fba8303adab6e (patch)
treeb141fc3648568dd8b941c966059e6ed32a8bd0ad /src/driclient/include/driclient.h
parent9fd26daec24f21dbe17afcb2e2ab272667ee9a69 (diff)
parentee4c921b65fb76998711f3c40330505cbc49a0e0 (diff)
Merge commit 'origin/gallium-master-merge'
This is the big merge of the gallium-0.2 branch into master. gallium-master-merge was just the staging area for it. Both gallium-0.2 and gallium-master-merge are considered closed now. Conflicts: progs/demos/Makefile src/mesa/main/state.c src/mesa/main/texenvprogram.c
Diffstat (limited to 'src/driclient/include/driclient.h')
-rw-r--r--src/driclient/include/driclient.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/src/driclient/include/driclient.h b/src/driclient/include/driclient.h
new file mode 100644
index 0000000000..d391525039
--- /dev/null
+++ b/src/driclient/include/driclient.h
@@ -0,0 +1,97 @@
+#ifndef driclient_h
+#define driclient_h
+
+#include <stdint.h>
+#include <X11/Xlib.h>
+#include <drm_sarea.h>
+#include "xf86dri.h"
+
+/* TODO: Bring in DRI XML options */
+
+typedef struct dri_version
+{
+ int major;
+ int minor;
+ int patch;
+} dri_version_t;
+
+typedef struct dri_screen
+{
+ Display *display;
+ unsigned int num;
+ dri_version_t ddx, dri, drm;
+ int draw_lock_id;
+ int fd;
+ drm_sarea_t *sarea;
+ void *drawable_hash;
+ void *private;
+} dri_screen_t;
+
+struct dri_context;
+
+typedef struct dri_drawable
+{
+ drm_drawable_t drm_drawable;
+ Drawable x_drawable;
+ unsigned int sarea_index;
+ unsigned int *sarea_stamp;
+ unsigned int last_sarea_stamp;
+ int x, y, w, h;
+ int back_x, back_y;
+ int num_cliprects, num_back_cliprects;
+ drm_clip_rect_t *cliprects, *back_cliprects;
+ dri_screen_t *dri_screen;
+ unsigned int refcount;
+ void *private;
+} dri_drawable_t;
+
+typedef struct dri_context
+{
+ XID id;
+ drm_context_t drm_context;
+ dri_screen_t *dri_screen;
+ void *private;
+} dri_context_t;
+
+typedef struct dri_framebuffer
+{
+ drm_handle_t drm_handle;
+ int base, size, stride;
+ int private_size;
+ void *private;
+} dri_framebuffer_t;
+
+int driCreateScreen(Display *display, int screen, dri_screen_t **dri_screen, dri_framebuffer_t *dri_framebuf);
+int driDestroyScreen(dri_screen_t *dri_screen);
+int driCreateDrawable(dri_screen_t *dri_screen, Drawable drawable, dri_drawable_t **dri_drawable);
+int driUpdateDrawableInfo(dri_drawable_t *dri_drawable);
+int driDestroyDrawable(dri_drawable_t *dri_drawable);
+int driCreateContext(dri_screen_t *dri_screen, Visual *visual, dri_context_t **dri_context);
+int driDestroyContext(dri_context_t *dri_context);
+
+#define DRI_VALIDATE_DRAWABLE_INFO_ONCE(dri_drawable) \
+do \
+{ \
+ if (*(dri_drawable->sarea_stamp) != dri_drawable->last_sarea_stamp) \
+ driUpdateDrawableInfo(dri_drawable); \
+} while (0)
+
+#define DRI_VALIDATE_DRAWABLE_INFO(dri_screen, dri_drawable) \
+do \
+{ \
+ while (*(dri_drawable->sarea_stamp) != dri_drawable->last_sarea_stamp) \
+ { \
+ register unsigned int hwContext = dri_screen->sarea->lock.lock & \
+ ~(DRM_LOCK_HELD | DRM_LOCK_CONT); \
+ DRM_UNLOCK(dri_screen->fd, &dri_screen->sarea->lock, hwContext); \
+ \
+ DRM_SPINLOCK(&dri_screen->sarea->drawable_lock, dri_screen->draw_lock_id); \
+ DRI_VALIDATE_DRAWABLE_INFO_ONCE(dri_drawable); \
+ DRM_SPINUNLOCK(&dri_screen->sarea->drawable_lock, dri_screen->draw_lock_id); \
+ \
+ DRM_LIGHT_LOCK(dri_screen->fd, &dri_screen->sarea->lock, hwContext); \
+ } \
+} while (0)
+
+#endif
+