diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/softpipe/Makefile | 5 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/SConscript | 1 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_video_context.c | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xvmc/surface.c | 2 | ||||
-rw-r--r-- | src/gallium/winsys/Makefile | 2 | ||||
-rw-r--r-- | src/gallium/winsys/g3dvl/xlib/xsp_winsys.c | 260 |
6 files changed, 34 insertions, 238 deletions
diff --git a/src/gallium/drivers/softpipe/Makefile b/src/gallium/drivers/softpipe/Makefile index 83f3e4a19b6..3111c49a2c2 100644 --- a/src/gallium/drivers/softpipe/Makefile +++ b/src/gallium/drivers/softpipe/Makefile @@ -19,7 +19,7 @@ C_SOURCES = \ sp_quad_fs.c \ sp_quad_blend.c \ sp_screen.c \ - sp_setup.c \ + sp_setup.c \ sp_state_blend.c \ sp_state_clip.c \ sp_state_derived.c \ @@ -32,6 +32,7 @@ C_SOURCES = \ sp_tex_sample.c \ sp_tex_tile_cache.c \ sp_tile_cache.c \ - sp_surface.c + sp_surface.c \ + sp_video_context.c include ../../Makefile.template diff --git a/src/gallium/drivers/softpipe/SConscript b/src/gallium/drivers/softpipe/SConscript index b80c6dea93a..c51f449c638 100644 --- a/src/gallium/drivers/softpipe/SConscript +++ b/src/gallium/drivers/softpipe/SConscript @@ -34,6 +34,7 @@ softpipe = env.ConvenienceLibrary( 'sp_tex_tile_cache.c', 'sp_texture.c', 'sp_tile_cache.c', + 'sp_video_context.c', ]) Export('softpipe') diff --git a/src/gallium/drivers/softpipe/sp_video_context.c b/src/gallium/drivers/softpipe/sp_video_context.c index 9d75a1e508f..7024e653e3b 100644 --- a/src/gallium/drivers/softpipe/sp_video_context.c +++ b/src/gallium/drivers/softpipe/sp_video_context.c @@ -33,7 +33,7 @@ #include <util/u_memory.h> #include <util/u_rect.h> #include <util/u_video.h> -#include "sp_winsys.h" +#include "sp_public.h" #include "sp_texture.h" static void diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c index decb2e896cd..9340744fa36 100644 --- a/src/gallium/state_trackers/xorg/xvmc/surface.c +++ b/src/gallium/state_trackers/xorg/xvmc/surface.c @@ -437,12 +437,14 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable, vl_video_bind_drawable(context_priv->vctx, drawable); +#if 0 vpipe->screen->flush_frontbuffer ( vpipe->screen, context_priv->backbuffer, vpipe->priv ); +#endif XVMC_MSG(XVMC_TRACE, "[XvMC] Pushed surface %p to front buffer.\n", surface); diff --git a/src/gallium/winsys/Makefile b/src/gallium/winsys/Makefile index e7cb154b84b..bce5b3f9e0d 100644 --- a/src/gallium/winsys/Makefile +++ b/src/gallium/winsys/Makefile @@ -2,7 +2,7 @@ TOP = ../../.. include $(TOP)/configs/current -SUBDIRS = $(GALLIUM_WINSYS_DIRS) g3dvl +SUBDIRS = $(GALLIUM_WINSYS_DIRS) default install clean: @for dir in $(SUBDIRS) ; do \ diff --git a/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c b/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c index 0d183b8d661..1df78e986d6 100644 --- a/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c +++ b/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c @@ -26,16 +26,17 @@ **************************************************************************/ #include <vl_winsys.h> -#include <X11/Xutil.h> -#include <util/u_simple_screen.h> -#include <pipe/p_state.h> -#include <util/u_inlines.h> -#include <util/u_format.h> +#include <state_tracker/xlib_sw_winsys.h> +//#include <X11/Xutil.h> +//#include <util/u_simple_screen.h> +//#include <pipe/p_state.h> +//#include <util/u_inlines.h> +//#include <util/u_format.h> #include <util/u_memory.h> -#include <util/u_math.h> -#include <softpipe/sp_winsys.h> +//#include <util/u_math.h> +#include <softpipe/sp_public.h> #include <softpipe/sp_video_context.h> -#include <softpipe/sp_texture.h> +//#include <softpipe/sp_texture.h> /* TODO: Find a good way to calculate this */ static enum pipe_format VisualToPipe(Visual *visual) @@ -44,186 +45,10 @@ static enum pipe_format VisualToPipe(Visual *visual) return PIPE_FORMAT_B8G8R8X8_UNORM; } -struct xsp_pipe_winsys -{ - struct pipe_winsys base; - Display *display; - int screen; - XImage *fbimage; -}; - -struct xsp_context -{ - struct vl_context base; - - Drawable drawable; -}; - -struct xsp_buffer -{ - struct pipe_buffer base; - boolean is_user_buffer; - void *data; - void *mapped_data; -}; - -static struct pipe_buffer* xsp_buffer_create(struct pipe_winsys *pws, unsigned alignment, unsigned usage, unsigned size) -{ - struct xsp_buffer *buffer; - - assert(pws); - - buffer = calloc(1, sizeof(struct xsp_buffer)); - pipe_reference_init(&buffer->base.reference, 1); - buffer->base.alignment = alignment; - buffer->base.usage = usage; - buffer->base.size = size; - buffer->data = align_malloc(size, alignment); - - return (struct pipe_buffer*)buffer; -} - -static struct pipe_buffer* xsp_user_buffer_create(struct pipe_winsys *pws, void *data, unsigned size) -{ - struct xsp_buffer *buffer; - - assert(pws); - - buffer = calloc(1, sizeof(struct xsp_buffer)); - pipe_reference_init(&buffer->base.reference, 1); - buffer->base.size = size; - buffer->is_user_buffer = TRUE; - buffer->data = data; - - return (struct pipe_buffer*)buffer; -} - -static void* xsp_buffer_map(struct pipe_winsys *pws, struct pipe_buffer *buffer, unsigned flags) -{ - struct xsp_buffer *xsp_buf = (struct xsp_buffer*)buffer; - - assert(pws); - assert(buffer); - - xsp_buf->mapped_data = xsp_buf->data; - - return xsp_buf->mapped_data; -} - -static void xsp_buffer_unmap(struct pipe_winsys *pws, struct pipe_buffer *buffer) -{ - struct xsp_buffer *xsp_buf = (struct xsp_buffer*)buffer; - - assert(pws); - assert(buffer); - - xsp_buf->mapped_data = NULL; -} - -static void xsp_buffer_destroy(struct pipe_buffer *buffer) -{ - struct xsp_buffer *xsp_buf = (struct xsp_buffer*)buffer; - - assert(buffer); - - if (!xsp_buf->is_user_buffer) - align_free(xsp_buf->data); - - free(xsp_buf); -} - -static struct pipe_buffer* xsp_surface_buffer_create -( - struct pipe_winsys *pws, - unsigned width, - unsigned height, - enum pipe_format format, - unsigned usage, - unsigned tex_usage, - unsigned *stride -) -{ - const unsigned int ALIGNMENT = 1; - unsigned nblocksy; - - nblocksy = util_format_get_nblocksy(format, height); - *stride = align(util_format_get_stride(format, width), ALIGNMENT); - - return pws->buffer_create(pws, ALIGNMENT, usage, - *stride * nblocksy); -} - -static void xsp_fence_reference(struct pipe_winsys *pws, struct pipe_fence_handle **ptr, struct pipe_fence_handle *fence) -{ - assert(pws); - assert(ptr); - assert(fence); -} - -static int xsp_fence_signalled(struct pipe_winsys *pws, struct pipe_fence_handle *fence, unsigned flag) -{ - assert(pws); - assert(fence); - - return 0; -} - -static int xsp_fence_finish(struct pipe_winsys *pws, struct pipe_fence_handle *fence, unsigned flag) -{ - assert(pws); - assert(fence); - - return 0; -} - -static void xsp_flush_frontbuffer(struct pipe_winsys *pws, struct pipe_surface *surface, void *context_private) -{ - struct xsp_pipe_winsys *xsp_winsys; - struct xsp_context *xsp_context; - - assert(pws); - assert(surface); - assert(context_private); - - xsp_winsys = (struct xsp_pipe_winsys*)pws; - xsp_context = (struct xsp_context*)context_private; - xsp_winsys->fbimage->width = surface->width; - xsp_winsys->fbimage->height = surface->height; - xsp_winsys->fbimage->bytes_per_line = surface->width * (xsp_winsys->fbimage->bits_per_pixel >> 3); - xsp_winsys->fbimage->data = (char*)((struct xsp_buffer *)softpipe_texture(surface->texture)->buffer)->data + surface->offset; - - XPutImage - ( - xsp_winsys->display, xsp_context->drawable, - XDefaultGC(xsp_winsys->display, xsp_winsys->screen), - xsp_winsys->fbimage, 0, 0, 0, 0, - surface->width, surface->height - ); - XFlush(xsp_winsys->display); -} - -static const char* xsp_get_name(struct pipe_winsys *pws) -{ - assert(pws); - return "X11 SoftPipe"; -} - -static void xsp_destroy(struct pipe_winsys *pws) -{ - struct xsp_pipe_winsys *xsp_winsys = (struct xsp_pipe_winsys*)pws; - - assert(pws); - - /* XDestroyImage() wants to free the data as well */ - xsp_winsys->fbimage->data = NULL; - - XDestroyImage(xsp_winsys->fbimage); - FREE(xsp_winsys); -} - Drawable vl_video_bind_drawable(struct vl_context *vctx, Drawable drawable) { +#if 0 struct xsp_context *xsp_context = (struct xsp_context*)vctx; Drawable old_drawable; @@ -233,13 +58,15 @@ vl_video_bind_drawable(struct vl_context *vctx, Drawable drawable) xsp_context->drawable = drawable; return old_drawable; +#endif + return None; } struct vl_screen* vl_screen_create(Display *display, int screen) { struct vl_screen *vscreen; - struct xsp_pipe_winsys *xsp_winsys; + struct sw_winsys *winsys; assert(display); @@ -247,54 +74,17 @@ vl_screen_create(Display *display, int screen) if (!vscreen) return NULL; - xsp_winsys = CALLOC_STRUCT(xsp_pipe_winsys); - if (!xsp_winsys) { + winsys = xlib_create_sw_winsys(display); + if (!winsys) { FREE(vscreen); return NULL; } - xsp_winsys->base.buffer_create = xsp_buffer_create; - xsp_winsys->base.user_buffer_create = xsp_user_buffer_create; - xsp_winsys->base.buffer_map = xsp_buffer_map; - xsp_winsys->base.buffer_unmap = xsp_buffer_unmap; - xsp_winsys->base.buffer_destroy = xsp_buffer_destroy; - xsp_winsys->base.surface_buffer_create = xsp_surface_buffer_create; - xsp_winsys->base.fence_reference = xsp_fence_reference; - xsp_winsys->base.fence_signalled = xsp_fence_signalled; - xsp_winsys->base.fence_finish = xsp_fence_finish; - xsp_winsys->base.flush_frontbuffer = xsp_flush_frontbuffer; - xsp_winsys->base.get_name = xsp_get_name; - xsp_winsys->base.destroy = xsp_destroy; - xsp_winsys->display = display; - xsp_winsys->screen = screen; - xsp_winsys->fbimage = XCreateImage - ( - display, - XDefaultVisual(display, screen), - XDefaultDepth(display, screen), - ZPixmap, - 0, - NULL, - 0, /* Don't know the width and height until flush_frontbuffer */ - 0, - 32, - 0 - ); - - if (!xsp_winsys->fbimage) { - FREE(xsp_winsys); - FREE(vscreen); - return NULL; - } - - XInitImage(xsp_winsys->fbimage); - - vscreen->pscreen = softpipe_create_screen(&xsp_winsys->base); + vscreen->pscreen = softpipe_create_screen(winsys); if (!vscreen->pscreen) { + winsys->destroy(winsys); FREE(vscreen); - XDestroyImage(xsp_winsys->fbimage); - FREE(xsp_winsys); return NULL; } @@ -318,7 +108,7 @@ vl_video_create(struct vl_screen *vscreen, unsigned width, unsigned height) { struct pipe_video_context *vpipe; - struct xsp_context *xsp_context; + struct vl_context *vctx; assert(vscreen); assert(width && height); @@ -327,23 +117,25 @@ vl_video_create(struct vl_screen *vscreen, if (!vpipe) return NULL; - xsp_context = CALLOC_STRUCT(xsp_context); - if (!xsp_context) { + vctx = CALLOC_STRUCT(vl_context); + if (!vctx) { vpipe->destroy(vpipe); return NULL; } - vpipe->priv = xsp_context; - xsp_context->base.vpipe = vpipe; - xsp_context->base.vscreen = vscreen; + vpipe->priv = vctx; + vctx->vpipe = vpipe; + vctx->vscreen = vscreen; - return &xsp_context->base; + return vctx; } void vl_video_destroy(struct vl_context *vctx) { assert(vctx); +#if 0 vctx->vpipe->destroy(vctx->vpipe); +#endif FREE(vctx); } |