Esempio n. 1
0
static struct intel_bo *alloc_writer_bo(struct intel_winsys *winsys,
                                        enum intel_cmd_writer_type which,
                                        size_t size)
{
    static const char *writer_names[INTEL_CMD_WRITER_COUNT] = {
        [INTEL_CMD_WRITER_BATCH] = "batch",
        [INTEL_CMD_WRITER_SURFACE] = "surface",
        [INTEL_CMD_WRITER_STATE] = "state",
        [INTEL_CMD_WRITER_INSTRUCTION] = "instruction",
    };

    return intel_winsys_alloc_bo(winsys, writer_names[which], size, true);
}
Esempio n. 2
0
static bool
tex_create_bo(struct ilo_texture *tex)
{
   struct ilo_screen *is = ilo_screen(tex->base.screen);
   const char *name = resource_get_bo_name(&tex->base);
   const enum intel_domain_flag initial_domain =
      resource_get_bo_initial_domain(&tex->base);

   tex->bo = intel_winsys_alloc_bo(is->winsys, name, tex->layout.tiling,
         tex->layout.bo_stride, tex->layout.bo_height, initial_domain);

   return (tex->bo != NULL);
}
Esempio n. 3
0
static bool
tex_create_mcs(struct ilo_texture *tex)
{
   struct ilo_screen *is = ilo_screen(tex->base.screen);

   assert(tex->layout.aux_enables == (1 << (tex->base.last_level + 1)) - 1);

   tex->aux_bo = intel_winsys_alloc_bo(is->winsys, "mcs texture",
         INTEL_TILING_Y, tex->layout.aux_stride, tex->layout.aux_height,
         false);
   if (!tex->aux_bo)
      return false;

   return true;
}
Esempio n. 4
0
bool
ilo_init_draw_query(struct ilo_context *ilo, struct ilo_query *q)
{
   unsigned bo_size;

   switch (q->type) {
   case PIPE_QUERY_OCCLUSION_COUNTER:
   case PIPE_QUERY_OCCLUSION_PREDICATE:
   case PIPE_QUERY_TIME_ELAPSED:
   case PIPE_QUERY_PRIMITIVES_GENERATED:
   case PIPE_QUERY_PRIMITIVES_EMITTED:
      q->stride = sizeof(uint64_t);
      q->in_pairs = true;
      break;
   case PIPE_QUERY_TIMESTAMP:
      q->stride = sizeof(uint64_t);
      q->in_pairs = false;
      break;
   case PIPE_QUERY_PIPELINE_STATISTICS:
      q->stride = sizeof(uint64_t) * 11;
      q->in_pairs = true;
      break;
   default:
      return false;
      break;
   }

   q->cmd_len = ilo_render_get_query_len(ilo->render, q->type);

   /* double cmd_len and stride if in pairs */
   q->cmd_len <<= q->in_pairs;
   q->stride <<= q->in_pairs;

   bo_size = (q->stride > 4096) ? q->stride : 4096;
   q->bo = intel_winsys_alloc_bo(ilo->winsys, "query", bo_size, false);
   if (!q->bo)
      return false;

   q->count = bo_size / q->stride;

   return true;
}
Esempio n. 5
0
static bool
resize_scratch_space(struct ilo_render *render,
                     struct ilo_render_scratch_space *scratch,
                     const char *name, int new_size)
{
   struct intel_bo *bo;

   if (scratch->size >= new_size)
      return true;

   bo = intel_winsys_alloc_bo(render->builder->winsys, name, new_size, false);
   if (!bo)
      return false;

   intel_bo_unref(scratch->bo);
   scratch->bo = bo;
   scratch->size = new_size;

   return true;
}
Esempio n. 6
0
VkResult intel_dev_create(struct intel_gpu *gpu,
                          const VkDeviceCreateInfo *info,
                          struct intel_dev **dev_ret)
{
    struct intel_dev *dev;
    uint32_t i;
    VkResult ret;

    // ICD limited to a single virtual device
    if (gpu->winsys)
        return VK_ERROR_INITIALIZATION_FAILED;

    dev = (struct intel_dev *) intel_base_create(&gpu->handle,
            sizeof(*dev), false,
            VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, info, sizeof(struct intel_dev_dbg));
    if (!dev)
        return VK_ERROR_OUT_OF_HOST_MEMORY;

    for (i = 0; i < info->enabledExtensionCount; i++) {
        const enum intel_phy_dev_ext_type ext =
            intel_gpu_lookup_phy_dev_extension(gpu,
                    info->ppEnabledExtensionNames[i]);

        if (ext != INTEL_PHY_DEV_EXT_INVALID)
            dev->phy_dev_exts[ext] = true;
    }

    dev->gpu = gpu;

    ret = intel_gpu_init_winsys(gpu);
    if (ret != VK_SUCCESS) {
        intel_dev_destroy(dev);
        return ret;
    }

    dev->winsys = gpu->winsys;

    dev->cmd_scratch_bo = intel_winsys_alloc_bo(dev->winsys,
            "command buffer scratch", 4096, false);
    if (!dev->cmd_scratch_bo) {
        intel_dev_destroy(dev);
        return VK_ERROR_OUT_OF_DEVICE_MEMORY;
    }

    if (!dev_create_meta_shaders(dev)) {
        intel_dev_destroy(dev);
        return VK_ERROR_OUT_OF_HOST_MEMORY;
    }

    ret = intel_desc_region_create(dev, &dev->desc_region);
    if (ret != VK_SUCCESS) {
        intel_dev_destroy(dev);
        return ret;
    }

    intel_pipeline_init_default_sample_patterns(dev,
            (uint8_t *) &dev->sample_pattern_1x,
            (uint8_t *) &dev->sample_pattern_2x,
            (uint8_t *) &dev->sample_pattern_4x,
            (uint8_t *) dev->sample_pattern_8x,
            (uint8_t *) dev->sample_pattern_16x);

    ret = dev_create_queues(dev, info->pQueueCreateInfos,
            info->queueCreateInfoCount);
    if (ret != VK_SUCCESS) {
        intel_dev_destroy(dev);
        return ret;
    }

    *dev_ret = dev;

    return VK_SUCCESS;
}