From e4fe18a6206560a3a562147d1033389ec977d607 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 20 Jun 2010 03:37:14 +0200 Subject: r300g: cleanup buffer_{from, get}_handle --- src/gallium/winsys/radeon/drm/radeon_drm_buffer.c | 6 ++---- src/gallium/winsys/radeon/drm/radeon_r300.c | 16 ++++------------ 2 files changed, 6 insertions(+), 16 deletions(-) (limited to 'src/gallium/winsys/radeon/drm') diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c index ee1b9ede25..a4b6cff33d 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c @@ -267,16 +267,14 @@ static struct radeon_drm_buffer *get_drm_buffer(struct pb_buffer *_buf) boolean radeon_drm_bufmgr_get_handle(struct pb_buffer *_buf, struct winsys_handle *whandle) { - int retval, fd; struct drm_gem_flink flink; struct radeon_drm_buffer *buf = get_drm_buffer(_buf); + if (whandle->type == DRM_API_HANDLE_TYPE_SHARED) { if (!buf->flinked) { - fd = buf->mgr->rws->fd; flink.handle = buf->bo->handle; - retval = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink); - if (retval) { + if (ioctl(buf->mgr->rws->fd, DRM_IOCTL_GEM_FLINK, &flink)) { return FALSE; } diff --git a/src/gallium/winsys/radeon/drm/radeon_r300.c b/src/gallium/winsys/radeon/drm/radeon_r300.c index dbf4d197dd..237fdc8bac 100644 --- a/src/gallium/winsys/radeon/drm/radeon_r300.c +++ b/src/gallium/winsys/radeon/drm/radeon_r300.c @@ -136,29 +136,21 @@ static boolean radeon_r300_winsys_is_buffer_referenced(struct r300_winsys_screen } static struct r300_winsys_buffer *radeon_r300_winsys_buffer_from_handle(struct r300_winsys_screen *rws, - struct pipe_screen *screen, - struct winsys_handle *whandle, - unsigned *stride) + unsigned handle) { struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws); struct pb_buffer *_buf; - _buf = radeon_drm_bufmgr_create_buffer_from_handle(ws->kman, whandle->handle); - *stride = whandle->stride; + _buf = radeon_drm_bufmgr_create_buffer_from_handle(ws->kman, handle); return radeon_libdrm_winsys_buffer(_buf); } static boolean radeon_r300_winsys_buffer_get_handle(struct r300_winsys_screen *rws, struct r300_winsys_buffer *buffer, - unsigned stride, - struct winsys_handle *whandle) + struct winsys_handle *whandle) { struct pb_buffer *_buf = radeon_pb_buffer(buffer); - boolean ret; - ret = radeon_drm_bufmgr_get_handle(_buf, whandle); - if (ret) - whandle->stride = stride; - return ret; + return radeon_drm_bufmgr_get_handle(_buf, whandle); } static void radeon_set_flush_cb(struct r300_winsys_screen *rws, -- cgit v1.2.3