diff options
author | José Fonseca <jfonseca@vmware.com> | 2009-03-02 13:27:46 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2009-03-02 13:27:46 +0000 |
commit | 97a1fd158c9acfaa3a8deda7eb5bf0b253e85c15 (patch) | |
tree | 37e6c11507c1ef044aa8f0ee009136bb1d8b5bbc /src/gallium/winsys | |
parent | 60e5fe65067da76dea816535bec1e9073adc0ba7 (diff) | |
parent | b70f344e223fc10df8df08a6d82a813505225712 (diff) |
Merge commit 'origin/master' into gallium-map-range
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r-- | src/gallium/winsys/drm/intel/gem/intel_be_api.c | 5 | ||||
-rw-r--r-- | src/gallium/winsys/drm/intel/gem/intel_be_device.c | 43 | ||||
-rw-r--r-- | src/gallium/winsys/drm/intel/gem/intel_be_device.h | 21 | ||||
-rw-r--r-- | src/gallium/winsys/drm/radeon/Makefile | 1 | ||||
-rw-r--r-- | src/gallium/winsys/drm/radeon/radeon_drm.c | 30 | ||||
-rw-r--r-- | src/gallium/winsys/drm/radeon/radeon_drm.h | 35 | ||||
-rw-r--r-- | src/gallium/winsys/g3dvl/xsp_winsys.c | 17 | ||||
-rw-r--r-- | src/gallium/winsys/xlib/xlib_cell.c | 3 |
8 files changed, 130 insertions, 25 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 6cffed5134..3f71c25441 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_api.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_api.c @@ -1,12 +1,15 @@ #include "intel_be_api.h" +#include "i915simple/i915_winsys.h" struct drm_api drm_api_hocks = { /* intel_be_context.c */ .create_context = intel_be_create_context, - /* intel_be_screen.c */ + /* intel_be_device.c */ .create_screen = intel_be_create_screen, + .buffer_from_texture = i915_get_texture_buffer, .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, }; 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 a2163a1e6d..595de44726 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_device.c +++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.c @@ -9,7 +9,7 @@ #include "intel_be_fence.h" -#include "i915simple/i915_screen.h" +#include "i915simple/i915_winsys.h" #include "intel_be_api.h" @@ -70,6 +70,8 @@ intel_be_buffer_create(struct pipe_winsys *winsys, buffer->base.alignment = alignment; buffer->base.usage = usage; buffer->base.size = size; + buffer->flinked = FALSE; + buffer->flink = 0; if (usage & (PIPE_BUFFER_USAGE_VERTEX | PIPE_BUFFER_USAGE_CONSTANT)) { /* Local buffer */ @@ -133,10 +135,10 @@ err: } struct pipe_buffer * -intel_be_buffer_from_handle(struct pipe_winsys *winsys, +intel_be_buffer_from_handle(struct pipe_screen *screen, const char* name, unsigned handle) { - struct intel_be_device *dev = intel_be_device(winsys); + struct intel_be_device *dev = intel_be_device(screen->winsys); struct intel_be_buffer *buffer = CALLOC_STRUCT(intel_be_buffer); if (!buffer) @@ -162,14 +164,39 @@ err: return NULL; } -unsigned -intel_be_handle_from_buffer(struct pipe_winsys *winsys, - struct pipe_buffer *buf) +boolean +intel_be_handle_from_buffer(struct pipe_screen *screen, + struct pipe_buffer *buffer, + unsigned *handle) { - drm_intel_bo *bo = intel_bo(buf); - return bo->handle; + drm_intel_bo *bo; + + if (!buffer) + return FALSE; + + *handle = intel_bo(buffer)->handle; + return TRUE; } +boolean +intel_be_global_handle_from_buffer(struct pipe_screen *screen, + struct pipe_buffer *buffer, + unsigned *handle) +{ + struct intel_be_buffer *buf = intel_be_buffer(buffer); + + if (!buffer) + return FALSE; + + if (!buf->flinked) { + if (drm_intel_bo_flink(intel_bo(buffer), &buf->flink)) + return FALSE; + buf->flinked = TRUE; + } + + *handle = buf->flink; + return TRUE; +} /* * Fence */ 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 c4837e65fa..47d2176cb4 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_be_device.h +++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.h @@ -44,6 +44,8 @@ intel_be_init_device(struct intel_be_device *device, int fd, unsigned id); struct intel_be_buffer { struct pipe_buffer base; drm_intel_bo *bo; + boolean flinked; + unsigned flink; }; /** @@ -52,7 +54,7 @@ struct intel_be_buffer { * Takes a reference. */ struct pipe_buffer * -intel_be_buffer_from_handle(struct pipe_winsys *winsys, +intel_be_buffer_from_handle(struct pipe_screen *screen, const char* name, unsigned handle); /** @@ -60,9 +62,20 @@ intel_be_buffer_from_handle(struct pipe_winsys *winsys, * * If buffer is destroyed handle may become invalid. */ -unsigned -intel_be_handle_from_buffer(struct pipe_winsys *winsys, - struct pipe_buffer *buffer); +boolean +intel_be_handle_from_buffer(struct pipe_screen *screen, + struct pipe_buffer *buffer, + unsigned *handle); + +/** + * Gets the global handle from a buffer. + * + * If buffer is destroyed handle may become invalid. + */ +boolean +intel_be_global_handle_from_buffer(struct pipe_screen *screen, + struct pipe_buffer *buffer, + unsigned *handle); static INLINE struct intel_be_buffer * intel_be_buffer(struct pipe_buffer *buf) diff --git a/src/gallium/winsys/drm/radeon/Makefile b/src/gallium/winsys/drm/radeon/Makefile index dca1e3233a..784686ffb6 100644 --- a/src/gallium/winsys/drm/radeon/Makefile +++ b/src/gallium/winsys/drm/radeon/Makefile @@ -13,6 +13,7 @@ PIPE_DRIVERS = \ DRIVER_SOURCES = \ radeon_buffer.c \ radeon_context.c \ + radeon_drm.c \ radeon_r300.c \ radeon_screen.c \ radeon_winsys_softpipe.c diff --git a/src/gallium/winsys/drm/radeon/radeon_drm.c b/src/gallium/winsys/drm/radeon/radeon_drm.c new file mode 100644 index 0000000000..839b0bf0bd --- /dev/null +++ b/src/gallium/winsys/drm/radeon/radeon_drm.c @@ -0,0 +1,30 @@ +/* + * Copyright © 2009 Corbin Simpson + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS + * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + */ +/* + * Authors: + * Corbin Simpson <MostAwesomeDude@gmail.com> + */ +#include "radeon_drm.h" diff --git a/src/gallium/winsys/drm/radeon/radeon_drm.h b/src/gallium/winsys/drm/radeon/radeon_drm.h new file mode 100644 index 0000000000..8ccbc81895 --- /dev/null +++ b/src/gallium/winsys/drm/radeon/radeon_drm.h @@ -0,0 +1,35 @@ +/* + * Copyright © 2009 Corbin Simpson + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS + * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + */ +/* + * Authors: + * Corbin Simpson <MostAwesomeDude@gmail.com> + */ +#ifndef RADEON_DRM_H +#define RADEON_DRM_H + +#include "state_tracker/drm_api.h" + +#endif diff --git a/src/gallium/winsys/g3dvl/xsp_winsys.c b/src/gallium/winsys/g3dvl/xsp_winsys.c index 40d683234f..acfb8ec4ea 100644 --- a/src/gallium/winsys/g3dvl/xsp_winsys.c +++ b/src/gallium/winsys/g3dvl/xsp_winsys.c @@ -1,9 +1,10 @@ #include "vl_winsys.h" #include <X11/Xutil.h> -#include <pipe/p_winsys.h> +#include <pipe/internal/p_winsys_screen.h> #include <pipe/p_state.h> #include <pipe/p_inlines.h> #include <util/u_memory.h> +#include <util/u_math.h> #include <softpipe/sp_winsys.h> /* pipe_winsys implementation */ @@ -96,12 +97,6 @@ static void xsp_buffer_destroy(struct pipe_winsys *pws, struct pipe_buffer *buff free(xsp_buf); } -/* Borrowed from Mesa's xm_winsys */ -static unsigned int round_up(unsigned n, unsigned multiple) -{ - return (n + multiple - 1) & ~(multiple - 1); -} - static struct pipe_buffer* xsp_surface_buffer_create ( struct pipe_winsys *pws, @@ -119,11 +114,11 @@ static struct pipe_buffer* xsp_surface_buffer_create pf_get_block(format, &block); nblocksx = pf_get_nblocksx(&block, width); nblocksy = pf_get_nblocksy(&block, height); - *stride = round_up(nblocksx * block.size, ALIGNMENT); + *stride = align(nblocksx * block.size, ALIGNMENT); - return winsys->buffer_create(winsys, ALIGNMENT, - usage, - *stride * nblocksy); + 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) diff --git a/src/gallium/winsys/xlib/xlib_cell.c b/src/gallium/winsys/xlib/xlib_cell.c index c87564f4dc..40bcdfe42a 100644 --- a/src/gallium/winsys/xlib/xlib_cell.c +++ b/src/gallium/winsys/xlib/xlib_cell.c @@ -222,7 +222,8 @@ xm_flush_frontbuffer(struct pipe_winsys *pws, * This function copies that XImage to the actual X Window. */ XMesaContext xmctx = (XMesaContext) context_private; - xlib_cell_display_surface(xmctx->xm_buffer, surf); + if (xmctx) + xlib_cell_display_surface(xmctx->xm_buffer, surf); } |