intel: make PIPELINE_SELECT a queue state

Mantle has the concept of a universal queue, and it can switch between
GRAPHICS and COMPUTE within a command buffer.  On the other hand, an XGL
command buffer is created with either XGL_QUEUE_TYPE_GRAPHICS or
XGL_QUEUE_TYPE_COMPUTE.  Swtiching to another queue type in the middle of a
command buffer is not allowed.  Letting the queue emit PIPELINE_SELECT allows
us to avoid unnecessary PIPELINE_SELECTs in the command buffer.
diff --git a/icd/intel/cmd.c b/icd/intel/cmd.c
index c97d4a1..a7e6dc7 100644
--- a/icd/intel/cmd.c
+++ b/icd/intel/cmd.c
@@ -153,8 +153,24 @@
                             const XGL_CMD_BUFFER_CREATE_INFO *info,
                             struct intel_cmd **cmd_ret)
 {
+    int pipeline_select;
     struct intel_cmd *cmd;
 
+    switch (info->queueType) {
+    case XGL_QUEUE_TYPE_GRAPHICS:
+        pipeline_select = GEN6_PIPELINE_SELECT_DW0_SELECT_3D;
+        break;
+    case XGL_QUEUE_TYPE_COMPUTE:
+        pipeline_select = GEN6_PIPELINE_SELECT_DW0_SELECT_MEDIA;
+        break;
+    case XGL_QUEUE_TYPE_DMA:
+        pipeline_select = -1;
+        break;
+    default:
+        return XGL_ERROR_INVALID_VALUE;
+        break;
+    }
+
     cmd = (struct intel_cmd *) intel_base_create(dev, sizeof(*cmd),
             dev->base.dbg, XGL_DBG_OBJECT_CMD_BUFFER, info, 0);
     if (!cmd)
@@ -163,6 +179,7 @@
     cmd->obj.destroy = cmd_destroy;
 
     cmd->dev = dev;
+    cmd->pipeline_select = pipeline_select;
 
     /*
      * XXX This is not quite right.  intel_gpu sets maxMemRefsPerSubmission to