summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/x11
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/x11')
-rw-r--r--src/mesa/drivers/x11/xm_buffer.c13
-rw-r--r--src/mesa/drivers/x11/xm_surface.c42
-rw-r--r--src/mesa/drivers/x11/xmesaP.h2
3 files changed, 22 insertions, 35 deletions
diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c
index 8fbd9a783b0..5bba52da48a 100644
--- a/src/mesa/drivers/x11/xm_buffer.c
+++ b/src/mesa/drivers/x11/xm_buffer.c
@@ -269,7 +269,10 @@ xmesa_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
rb->Height = height;
rb->InternalFormat = internalFormat;
- rb->surface->resize(rb->surface, width, height);
+ if (!xrb->Base.surface)
+ xrb->Base.surface = xmesa_new_surface(ctx, xrb);
+ xrb->Base.surface->width = width;
+ xrb->Base.surface->height = height;
return GL_TRUE;
}
@@ -320,7 +323,10 @@ xmesa_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
xrb->origin4 = NULL;
}
- rb->surface->resize(rb->surface, width, height);
+ if (!xrb->Base.surface)
+ xrb->Base.surface = xmesa_new_surface(ctx, xrb);
+ xrb->Base.surface->width = width;
+ xrb->Base.surface->height = height;
return GL_TRUE;
}
@@ -357,9 +363,6 @@ xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual,
xrb->Base.IndexBits = visual->indexBits;
}
/* only need to set Red/Green/EtcBits fields for user-created RBs */
-
- xrb->Base.surface = xmesa_new_surface(xrb);
-
}
return xrb;
}
diff --git a/src/mesa/drivers/x11/xm_surface.c b/src/mesa/drivers/x11/xm_surface.c
index 17f5f28a9dd..e8e795c00f7 100644
--- a/src/mesa/drivers/x11/xm_surface.c
+++ b/src/mesa/drivers/x11/xm_surface.c
@@ -42,25 +42,11 @@
#include "framebuffer.h"
#include "renderbuffer.h"
-#include "pipe/p_state.h"
+#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/softpipe/sp_context.h"
#include "pipe/softpipe/sp_surface.h"
-
-
-static void *
-map_surface_buffer(struct pipe_buffer *pb, GLuint access_mode)
-{
- /* no-op */
- return NULL;
-}
-
-
-static void
-unmap_surface_buffer(struct pipe_buffer *pb)
-{
- /* no-op */
-}
+#include "state_tracker/st_context.h"
static INLINE struct xmesa_renderbuffer *
@@ -174,27 +160,22 @@ write_mono_row_ub(struct softpipe_surface *sps, GLuint count, GLint x, GLint y,
}
-static void
-resize_surface(struct pipe_surface *ps, GLuint width, GLuint height)
-{
- ps->width = width;
- ps->height = height;
-}
-
-
/**
* Called to create a pipe_surface for each X renderbuffer.
+ * Note: this is being used instead of pipe->surface_alloc() since we
+ * have special/unique quad read/write functions for X.
*/
struct pipe_surface *
-xmesa_new_surface(struct xmesa_renderbuffer *xrb)
+xmesa_new_surface(GLcontext *ctx, struct xmesa_renderbuffer *xrb)
{
+ struct pipe_context *pipe = ctx->st->pipe;
struct softpipe_surface *sps;
sps = CALLOC_STRUCT(softpipe_surface);
if (!sps)
return NULL;
- sps->surface.rb = xrb;
+ sps->surface.rb = xrb; /* XXX only needed for quad funcs above */
sps->surface.width = xrb->Base.Width;
sps->surface.height = xrb->Base.Height;
@@ -206,9 +187,12 @@ xmesa_new_surface(struct xmesa_renderbuffer *xrb)
sps->write_quad_ub = write_quad_ub;
sps->write_mono_row_ub = write_mono_row_ub;
- sps->surface.buffer.map = map_surface_buffer;
- sps->surface.buffer.unmap = unmap_surface_buffer;
- sps->surface.resize = resize_surface;
+ /* Note, the region we allocate doesn't actually have any storage
+ * since we're drawing into an XImage or Pixmap.
+ * The region's size will get set in the xmesa_alloc_front/back_storage()
+ * functions.
+ */
+ sps->surface.region = pipe->region_alloc(pipe, 0, 0, 0);
return &sps->surface;
}
diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h
index daf6a3f9424..098b9218ae5 100644
--- a/src/mesa/drivers/x11/xmesaP.h
+++ b/src/mesa/drivers/x11/xmesaP.h
@@ -589,7 +589,7 @@ extern void xmesa_register_swrast_functions( GLcontext *ctx );
struct pipe_surface;
struct pipe_surface *
-xmesa_new_surface(struct xmesa_renderbuffer *xrb);
+xmesa_new_surface(GLcontext *ctx, struct xmesa_renderbuffer *xrb);
#endif