From 0532cc0c86d36f98ae33291847fbd9f2564cbed2 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 6 Nov 2009 16:41:58 +0000 Subject: [PATCH] i965g: trivial/clear can now send stuff to hardware Added a flag if we should send commands to hardware as what we send isn't all that correct. --- src/gallium/winsys/drm/i965/gem/i965_drm_api.c | 6 +++++- .../winsys/drm/i965/gem/i965_drm_buffer.c | 18 +++++++++++++++--- .../winsys/drm/i965/gem/i965_drm_winsys.h | 1 + 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/gallium/winsys/drm/i965/gem/i965_drm_api.c b/src/gallium/winsys/drm/i965/gem/i965_drm_api.c index 2399835d798..191a733c368 100644 --- a/src/gallium/winsys/drm/i965/gem/i965_drm_api.c +++ b/src/gallium/winsys/drm/i965/gem/i965_drm_api.c @@ -46,11 +46,14 @@ i965_libdrm_buffer_from_handle(struct i965_libdrm_winsys *idws, if (!buf) return NULL; - + pipe_reference_init(&buf->base.reference, 1); buf->bo = drm_intel_bo_gem_create_from_name(idws->gem, name, handle); + buf->base.size = buf->bo->size; + buf->base.sws = &idws->base; buf->flinked = TRUE; buf->flink = handle; + if (!buf->bo) goto err; @@ -177,6 +180,7 @@ i965_libdrm_create_screen(struct drm_api *api, int drmFD, drm_intel_bufmgr_gem_enable_reuse(idws->gem); idws->dump_cmd = debug_get_bool_option("I965_DUMP_CMD", FALSE); + idws->send_cmd = debug_get_bool_option("I965_SEND_CMD", FALSE); return brw_create_screen(&idws->base, deviceID); } diff --git a/src/gallium/winsys/drm/i965/gem/i965_drm_buffer.c b/src/gallium/winsys/drm/i965/gem/i965_drm_buffer.c index 339354059fd..725140fbabe 100644 --- a/src/gallium/winsys/drm/i965/gem/i965_drm_buffer.c +++ b/src/gallium/winsys/drm/i965/gem/i965_drm_buffer.c @@ -53,6 +53,7 @@ i965_libdrm_bo_alloc(struct brw_winsys_screen *sws, goto err; buf->base.size = size; + buf->base.sws = sws; *bo_out = &buf->base; return PIPE_OK; @@ -93,6 +94,14 @@ i965_libdrm_bo_emit_reloc(struct brw_winsys_buffer *buffer, read = I915_GEM_DOMAIN_INSTRUCTION; write = I915_GEM_DOMAIN_INSTRUCTION; break; + case BRW_USAGE_BLIT_DEST: + read = I915_GEM_DOMAIN_RENDER; + write = I915_GEM_DOMAIN_RENDER; + break; + case BRW_USAGE_BLIT_SOURCE: + read = 0; + write = I915_GEM_DOMAIN_RENDER; + break; case BRW_USAGE_RENDER_TARGET: read = I915_GEM_DOMAIN_RENDER; write = 0; @@ -130,11 +139,14 @@ i965_libdrm_bo_exec(struct brw_winsys_buffer *buffer, unsigned bytes_used) { struct i965_libdrm_buffer *buf = i965_libdrm_buffer(buffer); + struct i965_libdrm_winsys *idws = i965_libdrm_winsys(buffer->sws); int ret; - ret = dri_bo_exec(buf->bo, bytes_used, NULL, 0, 0); - if (ret) - return PIPE_ERROR; + if (idws->send_cmd) { + ret = dri_bo_exec(buf->bo, bytes_used, NULL, 0, 0); + if (ret) + return PIPE_ERROR; + } return PIPE_OK; } diff --git a/src/gallium/winsys/drm/i965/gem/i965_drm_winsys.h b/src/gallium/winsys/drm/i965/gem/i965_drm_winsys.h index bfcd512cef1..79457112636 100644 --- a/src/gallium/winsys/drm/i965/gem/i965_drm_winsys.h +++ b/src/gallium/winsys/drm/i965/gem/i965_drm_winsys.h @@ -20,6 +20,7 @@ struct i965_libdrm_winsys drm_intel_bufmgr *gem; boolean dump_cmd; + boolean send_cmd; int fd; /**< Drm file discriptor */ -- 2.30.2