i965g: trivial/clear can now send stuff to hardware
authorJakob Bornecrantz <jakob@vmware.com>
Fri, 6 Nov 2009 16:41:58 +0000 (16:41 +0000)
committerJakob Bornecrantz <jakob@vmware.com>
Fri, 6 Nov 2009 17:03:01 +0000 (17:03 +0000)
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
src/gallium/winsys/drm/i965/gem/i965_drm_buffer.c
src/gallium/winsys/drm/i965/gem/i965_drm_winsys.h

index 2399835d7984c0ada030c280f34e81694d87b6bf..191a733c3682a208179ed0cc6daf617d4b93f550 100644 (file)
@@ -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);
 }
index 339354059fdefdf991abb84f1db0a8bafd9bcf5f..725140fbabea6b21721791520d8f1286416ab045 100644 (file)
@@ -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;
 }
index bfcd512cef1b4c6c93f4c0e493bced1e1b1c5572..79457112636bcc859fd33742ed75425a81e11650 100644 (file)
@@ -20,6 +20,7 @@ struct i965_libdrm_winsys
    drm_intel_bufmgr *gem;
 
    boolean dump_cmd;
+   boolean send_cmd;
 
    int fd; /**< Drm file discriptor */