diff options
Diffstat (limited to 'src/gallium/winsys/radeon')
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_drm_buffer.c | 6 | ||||
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_r300.c | 50 |
2 files changed, 17 insertions, 39 deletions
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 a9b36578ef..cb26447606 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, @@ -192,25 +184,23 @@ static boolean radeon_validate(struct r300_winsys_screen *rws) return TRUE; } -static void radeon_get_cs_info(struct r300_winsys_screen *rws, - struct r300_cs_info *info) +static unsigned radeon_get_cs_free_dwords(struct r300_winsys_screen *rws) { struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws); struct radeon_cs *cs = ws->cs; - info->capacity = cs->ndw; - info->used = cs->cdw; - info->free = cs->ndw - cs->cdw; + return cs->ndw - cs->cdw; } -static void radeon_begin_cs(struct r300_winsys_screen *rws, - int size, - const char* file, - const char* function, - int line) +static uint32_t *radeon_get_cs_pointer(struct r300_winsys_screen *rws, + unsigned count) { struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws); - radeon_cs_begin(ws->cs, size, file, function, line); + struct radeon_cs *cs = ws->cs; + uint32_t *ptr = cs->packets + cs->cdw; + + cs->cdw += count; + return ptr; } static void radeon_write_cs_dword(struct r300_winsys_screen *rws, @@ -243,15 +233,6 @@ static void radeon_reset_bos(struct r300_winsys_screen *rws) radeon_cs_space_reset_bos(ws->cs); } -static void radeon_end_cs(struct r300_winsys_screen *rws, - const char* file, - const char* function, - int line) -{ - struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws); - radeon_cs_end(ws->cs, file, function, line); -} - static void radeon_flush_cs(struct r300_winsys_screen *rws) { struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws); @@ -345,12 +326,11 @@ radeon_setup_winsys(int fd, struct radeon_libdrm_winsys* ws) ws->base.add_buffer = radeon_add_buffer; ws->base.validate = radeon_validate; ws->base.destroy = radeon_winsys_destroy; - ws->base.get_cs_info = radeon_get_cs_info; - ws->base.begin_cs = radeon_begin_cs; + ws->base.get_cs_free_dwords = radeon_get_cs_free_dwords; + ws->base.get_cs_pointer = radeon_get_cs_pointer; ws->base.write_cs_dword = radeon_write_cs_dword; ws->base.write_cs_table = radeon_write_cs_table; ws->base.write_cs_reloc = radeon_write_cs_reloc; - ws->base.end_cs = radeon_end_cs; ws->base.flush_cs = radeon_flush_cs; ws->base.reset_bos = radeon_reset_bos; ws->base.set_flush_cb = radeon_set_flush_cb; |