summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/glx
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2013-04-04 14:06:51 -0600
committerBrian Paul <[email protected]>2013-04-04 17:00:42 -0600
commit5192262833c08903b0e27b991f4b9995c187a8ce (patch)
tree82f297343cb58c601504a68629446c0e0b440bbd /src/gallium/state_trackers/glx
parentf5071783c112d516ac3a130e86f689323208b143 (diff)
st/xlib: add HUD support for xlib/GLX
For the softpipe and llvmpipe drivers. Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/glx')
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.c15
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.h3
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_st.c12
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_st.h4
4 files changed, 34 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 021175c70c4..04960f30ef5 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -64,6 +64,8 @@
#include "util/u_atomic.h"
#include "util/u_inlines.h"
+#include "hud/hud_context.h"
+
#include "xm_public.h"
#include <GL/glx.h>
@@ -910,6 +912,8 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list,
c->st->st_manager_private = (void *) c;
+ c->hud = hud_create(c->st->pipe, c->st->cso_context);
+
return c;
fail:
@@ -925,6 +929,10 @@ fail:
PUBLIC
void XMesaDestroyContext( XMesaContext c )
{
+ if (c->hud) {
+ hud_destroy(c->hud);
+ }
+
c->st->destroy(c->st);
/* FIXME: We should destroy the screen here, but if we do so, surfaces may
@@ -1224,6 +1232,13 @@ void XMesaSwapBuffers( XMesaBuffer b )
{
XMesaContext xmctx = XMesaGetCurrentContext();
+ /* Need to draw HUD before flushing */
+ if (xmctx && xmctx->hud) {
+ struct pipe_resource *back =
+ xmesa_get_framebuffer_resource(b->stfb, ST_ATTACHMENT_BACK_LEFT);
+ hud_draw(xmctx->hud, back);
+ }
+
if (xmctx && xmctx->xm_buffer == b) {
xmctx->st->flush( xmctx->st, ST_FLUSH_FRONT, NULL);
}
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.h b/src/gallium/state_trackers/glx/xlib/xm_api.h
index 606bcf3dc81..6d37ed7cab9 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.h
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.h
@@ -67,6 +67,8 @@ and create a window, you must do the following to use the X/Mesa interface:
# include <X11/Xlibint.h>
# include <X11/Xutil.h>
+struct hud_context;
+
typedef struct xmesa_display *XMesaDisplay;
typedef struct xmesa_buffer *XMesaBuffer;
typedef struct xmesa_context *XMesaContext;
@@ -305,6 +307,7 @@ struct xmesa_context {
XMesaVisual xm_visual; /** pixel format info */
XMesaBuffer xm_buffer; /** current drawbuffer */
XMesaBuffer xm_read_buffer; /** current readbuffer */
+ struct hud_context *hud;
};
diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c
index a681e82fe01..1cfd89ee85f 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_st.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_st.c
@@ -317,6 +317,18 @@ xmesa_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi)
free(stfbi);
}
+/**
+ * Return the pipe_surface which corresponds to the given
+ * framebuffer attachment.
+ */
+struct pipe_resource *
+xmesa_get_framebuffer_resource(struct st_framebuffer_iface *stfbi,
+ enum st_attachment_type att)
+{
+ struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
+ return xstfb->textures[att];
+}
+
void
xmesa_swap_st_framebuffer(struct st_framebuffer_iface *stfbi)
{
diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.h b/src/gallium/state_trackers/glx/xlib/xm_st.h
index a2937281237..c939c1ee73c 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_st.h
+++ b/src/gallium/state_trackers/glx/xlib/xm_st.h
@@ -40,6 +40,10 @@ xmesa_create_st_framebuffer(XMesaDisplay xmdpy, XMesaBuffer b);
void
xmesa_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi);
+struct pipe_resource *
+xmesa_get_framebuffer_resource(struct st_framebuffer_iface *stfbi,
+ enum st_attachment_type att);
+
void
xmesa_swap_st_framebuffer(struct st_framebuffer_iface *stfbi);