From f13ed3cc8c886d30a1f55a783112d072621717b2 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 22 Feb 2015 14:09:00 +0800 Subject: [PATCH] intel: use intel_alloc()/intel_free() everywhere Make intel_handle available in the functions that icd_alloc()/icd_free() is still called, and convert them to use intel_alloc()/intel_free(). --- .../pipeline/pipeline_compiler_interface.cpp | 16 ++++---- .../pipeline/pipeline_compiler_interface.h | 3 +- .../pipeline/pipeline_compiler_interface_meta.cpp | 13 ++++--- icd/intel/desc.c | 9 +++-- icd/intel/desc.h | 3 +- icd/intel/dev.c | 4 +- icd/intel/gpu.c | 4 +- icd/intel/instance.c | 2 - icd/intel/intel.h | 1 - icd/intel/kmd/winsys.h | 3 +- icd/intel/kmd/winsys_drm.c | 15 +++++--- icd/intel/obj.c | 26 +++++++------ icd/intel/obj.h | 4 +- icd/intel/pipeline.c | 19 +++++----- icd/intel/pipeline.h | 3 +- icd/intel/wsi_x11.c | 44 ++++++++++++---------- icd/intel/wsi_x11.h | 6 ++- 17 files changed, 98 insertions(+), 77 deletions(-) diff --git a/icd/intel/compiler/pipeline/pipeline_compiler_interface.cpp b/icd/intel/compiler/pipeline/pipeline_compiler_interface.cpp index edb0560..ffbd490 100644 --- a/icd/intel/compiler/pipeline/pipeline_compiler_interface.cpp +++ b/icd/intel/compiler/pipeline/pipeline_compiler_interface.cpp @@ -280,10 +280,11 @@ static void fs_data_dump(FILE *fp, struct brw_wm_prog_data* data) fflush(fp); } -static void rmap_destroy(struct intel_pipeline_rmap *rmap) +static void rmap_destroy(const struct intel_gpu *gpu, + struct intel_pipeline_rmap *rmap) { - icd_free(rmap->slots); - icd_free(rmap); + intel_free(gpu, rmap->slots); + intel_free(gpu, rmap); } static struct intel_pipeline_rmap *rmap_create(const struct intel_gpu *gpu, @@ -686,7 +687,7 @@ XGL_RESULT intel_pipeline_shader_compile(struct intel_pipeline_shader *pipe_shad if (status == XGL_SUCCESS) { pipe_shader->rmap = rmap_create(gpu, info->stage, layout, &bt); if (!pipe_shader->rmap) { - intel_pipeline_shader_cleanup(pipe_shader); + intel_pipeline_shader_cleanup(pipe_shader, gpu); status = XGL_ERROR_OUT_OF_MEMORY; } } @@ -696,11 +697,12 @@ XGL_RESULT intel_pipeline_shader_compile(struct intel_pipeline_shader *pipe_shad return status; } -void intel_pipeline_shader_cleanup(struct intel_pipeline_shader *sh) +void intel_pipeline_shader_cleanup(struct intel_pipeline_shader *sh, + const struct intel_gpu *gpu) { - icd_free(sh->pCode); + intel_free(gpu, sh->pCode); if (sh->rmap) - rmap_destroy(sh->rmap); + rmap_destroy(gpu, sh->rmap); memset(sh, 0, sizeof(*sh)); } diff --git a/icd/intel/compiler/pipeline/pipeline_compiler_interface.h b/icd/intel/compiler/pipeline/pipeline_compiler_interface.h index a994961..fd867ab 100644 --- a/icd/intel/compiler/pipeline/pipeline_compiler_interface.h +++ b/icd/intel/compiler/pipeline/pipeline_compiler_interface.h @@ -49,7 +49,8 @@ XGL_RESULT intel_pipeline_shader_compile(struct intel_pipeline_shader *ips, const struct intel_desc_layout *layout, const XGL_PIPELINE_SHADER *info); -void intel_pipeline_shader_cleanup(struct intel_pipeline_shader *sh); +void intel_pipeline_shader_cleanup(struct intel_pipeline_shader *sh, + const struct intel_gpu *gpu); XGL_RESULT intel_pipeline_shader_compile_meta(struct intel_pipeline_shader *sh, const struct intel_gpu *gpu, diff --git a/icd/intel/compiler/pipeline/pipeline_compiler_interface_meta.cpp b/icd/intel/compiler/pipeline/pipeline_compiler_interface_meta.cpp index f027af1..1feb3c6 100644 --- a/icd/intel/compiler/pipeline/pipeline_compiler_interface_meta.cpp +++ b/icd/intel/compiler/pipeline/pipeline_compiler_interface_meta.cpp @@ -44,7 +44,8 @@ enum sampler_param { class intel_meta_compiler : public brw_blorp_eu_emitter { public: - intel_meta_compiler(struct brw_context *brw, + intel_meta_compiler(const struct intel_gpu *gpu, + struct brw_context *brw, enum intel_dev_meta_shader id); void *compile(brw_blorp_prog_data *prog_data, uint32_t *code_size); @@ -80,6 +81,7 @@ private: void emit_clear_depth(); void *codegen(uint32_t *code_size); + const struct intel_gpu *gpu; struct brw_context *brw; enum intel_dev_meta_shader id; @@ -112,9 +114,10 @@ private: struct brw_reg temps[4]; }; -intel_meta_compiler::intel_meta_compiler(struct brw_context *brw, +intel_meta_compiler::intel_meta_compiler(const struct intel_gpu *gpu, + struct brw_context *brw, enum intel_dev_meta_shader id) - : brw_blorp_eu_emitter(brw), brw(brw), id(id), + : brw_blorp_eu_emitter(brw), gpu(gpu), brw(brw), id(id), poison(brw_imm_ud(0x12345678)), r0(retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UD)), r1(retype(brw_vec8_grf(1, 0), BRW_REGISTER_TYPE_UD)), @@ -616,7 +619,7 @@ void *intel_meta_compiler::codegen(uint32_t *code_size) prog = get_program(&prog_size, stderr); - code = icd_alloc(prog_size, 0, XGL_SYSTEM_ALLOC_INTERNAL); + code = intel_alloc(gpu, prog_size, 0, XGL_SYSTEM_ALLOC_INTERNAL); if (!code) return NULL; @@ -698,7 +701,7 @@ XGL_RESULT intel_pipeline_shader_compile_meta(struct intel_pipeline_shader *sh, { struct brw_context *brw = intel_create_brw_context(gpu); - intel_meta_compiler c(brw, id); + intel_meta_compiler c(gpu, brw, id); brw_blorp_prog_data prog_data; sh->pCode = c.compile(&prog_data, &sh->codeSize); diff --git a/icd/intel/desc.c b/icd/intel/desc.c index 51d7beb..003ec12 100644 --- a/icd/intel/desc.c +++ b/icd/intel/desc.c @@ -107,11 +107,12 @@ XGL_RESULT intel_desc_pool_create(struct intel_dev *dev, return XGL_SUCCESS; } -void intel_desc_pool_destroy(struct intel_desc_pool *pool) +void intel_desc_pool_destroy(struct intel_dev *dev, + struct intel_desc_pool *pool) { - icd_free(pool->samplers); - icd_free(pool->surfaces); - icd_free(pool); + intel_free(dev, pool->samplers); + intel_free(dev, pool->surfaces); + intel_free(dev, pool); } /** diff --git a/icd/intel/desc.h b/icd/intel/desc.h index b642d8b..01b5921 100644 --- a/icd/intel/desc.h +++ b/icd/intel/desc.h @@ -213,7 +213,8 @@ static inline bool intel_desc_offset_within(const struct intel_desc_offset *offs XGL_RESULT intel_desc_pool_create(struct intel_dev *dev, struct intel_desc_pool **pool_ret); -void intel_desc_pool_destroy(struct intel_desc_pool *pool); +void intel_desc_pool_destroy(struct intel_dev *dev, + struct intel_desc_pool *pool); XGL_RESULT intel_desc_pool_alloc(struct intel_desc_pool *pool, const XGL_DESCRIPTOR_REGION_CREATE_INFO *info, diff --git a/icd/intel/dev.c b/icd/intel/dev.c index 063940e..9dd076b 100644 --- a/icd/intel/dev.c +++ b/icd/intel/dev.c @@ -41,7 +41,7 @@ static void dev_destroy_meta_shaders(struct intel_dev *dev) if (!dev->cmd_meta_shaders[i]) break; - intel_pipeline_shader_destroy(dev->cmd_meta_shaders[i]); + intel_pipeline_shader_destroy(dev, dev->cmd_meta_shaders[i]); dev->cmd_meta_shaders[i] = NULL; } } @@ -195,7 +195,7 @@ void intel_dev_destroy(struct intel_dev *dev) } if (dev->desc_pool) - intel_desc_pool_destroy(dev->desc_pool); + intel_desc_pool_destroy(dev, dev->desc_pool); dev_destroy_meta_shaders(dev); diff --git a/icd/intel/gpu.c b/icd/intel/gpu.c index 2785f03..7baafbb 100644 --- a/icd/intel/gpu.c +++ b/icd/intel/gpu.c @@ -118,7 +118,7 @@ void intel_gpu_destroy(struct intel_gpu *gpu) #ifdef ENABLE_WSI_X11 if (gpu->x11) - intel_wsi_x11_destroy(gpu->x11); + intel_wsi_x11_destroy(gpu, gpu->x11); #endif intel_free(gpu, gpu->primary_node); @@ -363,7 +363,7 @@ XGL_RESULT intel_gpu_open(struct intel_gpu *gpu) if (fd < 0) return XGL_ERROR_UNKNOWN; - gpu->winsys = intel_winsys_create_for_fd(fd); + gpu->winsys = intel_winsys_create_for_fd(gpu->handle.icd, fd); if (!gpu->winsys) { icd_log(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, XGL_NULL_HANDLE, 0, 0, "failed to create GPU winsys"); diff --git a/icd/intel/instance.c b/icd/intel/instance.c index 1564e02..7b7c50b 100644 --- a/icd/intel/instance.c +++ b/icd/intel/instance.c @@ -132,8 +132,6 @@ static struct intel_instance *intel_instance_create(const XGL_APPLICATION_INFO * instance->icd = icd; - icd_allocator_init(alloc_cb); - return instance; } diff --git a/icd/intel/intel.h b/icd/intel/intel.h index 4fb47e1..e6381d9 100644 --- a/icd/intel/intel.h +++ b/icd/intel/intel.h @@ -42,7 +42,6 @@ #include #include "icd.h" -#include "icd-alloc.h" #include "icd-bil.h" #include "icd-format.h" #include "icd-instance.h" diff --git a/icd/intel/kmd/winsys.h b/icd/intel/kmd/winsys.h index c79882a..179bec6 100644 --- a/icd/intel/kmd/winsys.h +++ b/icd/intel/kmd/winsys.h @@ -65,6 +65,7 @@ enum intel_winsys_handle_type { INTEL_WINSYS_HANDLE_FD, }; +struct icd_instance; struct intel_winsys; struct intel_bo; @@ -94,7 +95,7 @@ struct intel_winsys_handle { }; struct intel_winsys * -intel_winsys_create_for_fd(int fd); +intel_winsys_create_for_fd(const struct icd_instance *instance, int fd); void intel_winsys_destroy(struct intel_winsys *winsys); diff --git a/icd/intel/kmd/winsys_drm.c b/icd/intel/kmd/winsys_drm.c index a9568dc..849295a 100644 --- a/icd/intel/kmd/winsys_drm.c +++ b/icd/intel/kmd/winsys_drm.c @@ -38,11 +38,12 @@ #include #include -#include "icd-alloc.h" +#include "icd-instance.h" #include "icd-utils.h" #include "winsys.h" struct intel_winsys { + const struct icd_instance *instance; int fd; drm_intel_bufmgr *bufmgr; struct intel_winsys_info info; @@ -160,29 +161,31 @@ probe_winsys(struct intel_winsys *winsys) } struct intel_winsys * -intel_winsys_create_for_fd(int fd) +intel_winsys_create_for_fd(const struct icd_instance *instance, int fd) { /* so that we can have enough relocs per bo */ const int batch_size = sizeof(uint32_t) * 150 * 1024; struct intel_winsys *winsys; - winsys = icd_alloc(sizeof(*winsys), 0, XGL_SYSTEM_ALLOC_INTERNAL); + winsys = icd_instance_alloc(instance, sizeof(*winsys), 0, + XGL_SYSTEM_ALLOC_INTERNAL); if (!winsys) return NULL; memset(winsys, 0, sizeof(*winsys)); + winsys->instance = instance; winsys->fd = fd; winsys->bufmgr = drm_intel_bufmgr_gem_init(winsys->fd, batch_size); if (!winsys->bufmgr) { - icd_free(winsys); + icd_instance_free(instance, winsys); return NULL; } if (!probe_winsys(winsys)) { drm_intel_bufmgr_destroy(winsys->bufmgr); - icd_free(winsys); + icd_instance_free(instance, winsys); return NULL; } @@ -203,7 +206,7 @@ intel_winsys_destroy(struct intel_winsys *winsys) { drm_intel_gem_context_destroy(winsys->ctx); drm_intel_bufmgr_destroy(winsys->bufmgr); - icd_free(winsys); + icd_instance_free(winsys->instance, winsys); } const struct intel_winsys_info * diff --git a/icd/intel/obj.c b/icd/intel/obj.c index e54f9db..145e463 100644 --- a/icd/intel/obj.c +++ b/icd/intel/obj.c @@ -78,7 +78,8 @@ XGL_RESULT intel_base_get_info(struct intel_base *base, int type, return ret; } -static bool base_dbg_copy_create_info(struct intel_base_dbg *dbg, +static bool base_dbg_copy_create_info(const struct intel_handle *handle, + struct intel_base_dbg *dbg, const void *create_info) { const union { @@ -194,7 +195,8 @@ static bool base_dbg_copy_create_info(struct intel_base_dbg *dbg, } if (shallow_copy) { - dbg->create_info = icd_alloc(shallow_copy, 0, XGL_SYSTEM_ALLOC_DEBUG); + dbg->create_info = intel_alloc(handle, shallow_copy, 0, + XGL_SYSTEM_ALLOC_DEBUG); if (!dbg->create_info) return false; @@ -223,7 +225,7 @@ static bool base_dbg_copy_create_info(struct intel_base_dbg *dbg, ptr_next = (XGL_MEMORY_ALLOC_INFO *) ptr_next->pNext; } dbg->create_info_size = size; - dst = icd_alloc(size, 0, XGL_SYSTEM_ALLOC_DEBUG); + dst = intel_alloc(handle, size, 0, XGL_SYSTEM_ALLOC_DEBUG); if (!dst) return false; memcpy(dst, src, sizeof(*src)); @@ -264,7 +266,7 @@ static bool base_dbg_copy_create_info(struct intel_base_dbg *dbg, size += 1 + strlen(src->ppEnabledExtensionNames[i]); } - dst = icd_alloc(size, 0, XGL_SYSTEM_ALLOC_DEBUG); + dst = intel_alloc(handle, size, 0, XGL_SYSTEM_ALLOC_DEBUG); if (!dst) return false; @@ -319,10 +321,9 @@ struct intel_base_dbg *intel_base_dbg_create(const struct intel_handle *handle, memset(dbg, 0, dbg_size); - dbg->alloc_id = icd_allocator_get_id(); dbg->type = type; - if (!base_dbg_copy_create_info(dbg, create_info)) { + if (!base_dbg_copy_create_info(handle, dbg, create_info)) { intel_free(handle, dbg); return NULL; } @@ -330,15 +331,16 @@ struct intel_base_dbg *intel_base_dbg_create(const struct intel_handle *handle, return dbg; } -void intel_base_dbg_destroy(struct intel_base_dbg *dbg) +void intel_base_dbg_destroy(const struct intel_handle *handle, + struct intel_base_dbg *dbg) { if (dbg->tag) - icd_free(dbg->tag); + intel_free(handle, dbg->tag); if (dbg->create_info) - icd_free(dbg->create_info); + intel_free(handle, dbg->create_info); - icd_free(dbg); + intel_free(handle, dbg); } /** @@ -366,7 +368,7 @@ struct intel_base *intel_base_create(const struct intel_handle *handle, intel_handle_init(&base->handle, type, handle->icd); if (debug) { - base->dbg = intel_base_dbg_create(handle, + base->dbg = intel_base_dbg_create(&base->handle, type, create_info, dbg_size); if (!base->dbg) { intel_free(handle, base); @@ -382,7 +384,7 @@ struct intel_base *intel_base_create(const struct intel_handle *handle, void intel_base_destroy(struct intel_base *base) { if (base->dbg) - intel_base_dbg_destroy(base->dbg); + intel_base_dbg_destroy(&base->handle, base->dbg); intel_free(base, base); } diff --git a/icd/intel/obj.h b/icd/intel/obj.h index 48cf6ef..ee38a9d 100644 --- a/icd/intel/obj.h +++ b/icd/intel/obj.h @@ -34,7 +34,6 @@ struct intel_dev; struct intel_mem; struct intel_base_dbg { - uint32_t alloc_id; XGL_DBG_OBJECT_TYPE type; void *create_info; @@ -88,7 +87,8 @@ struct intel_base_dbg *intel_base_dbg_create(const struct intel_handle *handle, XGL_DBG_OBJECT_TYPE type, const void *create_info, size_t dbg_size); -void intel_base_dbg_destroy(struct intel_base_dbg *dbg); +void intel_base_dbg_destroy(const struct intel_handle *handle, + struct intel_base_dbg *dbg); struct intel_base *intel_base_create(const struct intel_handle *handle, size_t obj_size, bool debug, diff --git a/icd/intel/pipeline.c b/icd/intel/pipeline.c index d5f4be1..58c0c46 100644 --- a/icd/intel/pipeline.c +++ b/icd/intel/pipeline.c @@ -160,10 +160,11 @@ struct intel_pipeline_shader *intel_pipeline_shader_create_meta(struct intel_dev return sh; } -void intel_pipeline_shader_destroy(struct intel_pipeline_shader *sh) +void intel_pipeline_shader_destroy(struct intel_dev *dev, + struct intel_pipeline_shader *sh) { - intel_pipeline_shader_cleanup(sh); - icd_free(sh); + intel_pipeline_shader_cleanup(sh, dev->gpu); + intel_free(dev, sh); } static XGL_RESULT pipeline_build_shader(struct intel_pipeline *pipeline, @@ -382,27 +383,27 @@ static void pipeline_destroy(struct intel_obj *obj) struct intel_pipeline *pipeline = intel_pipeline_from_obj(obj); if (pipeline->active_shaders & SHADER_VERTEX_FLAG) { - intel_pipeline_shader_cleanup(&pipeline->vs); + intel_pipeline_shader_cleanup(&pipeline->vs, pipeline->dev->gpu); } if (pipeline->active_shaders & SHADER_TESS_CONTROL_FLAG) { - intel_pipeline_shader_cleanup(&pipeline->tcs); + intel_pipeline_shader_cleanup(&pipeline->tcs, pipeline->dev->gpu); } if (pipeline->active_shaders & SHADER_TESS_EVAL_FLAG) { - intel_pipeline_shader_cleanup(&pipeline->tes); + intel_pipeline_shader_cleanup(&pipeline->tes, pipeline->dev->gpu); } if (pipeline->active_shaders & SHADER_GEOMETRY_FLAG) { - intel_pipeline_shader_cleanup(&pipeline->gs); + intel_pipeline_shader_cleanup(&pipeline->gs, pipeline->dev->gpu); } if (pipeline->active_shaders & SHADER_FRAGMENT_FLAG) { - intel_pipeline_shader_cleanup(&pipeline->fs); + intel_pipeline_shader_cleanup(&pipeline->fs, pipeline->dev->gpu); } if (pipeline->active_shaders & SHADER_COMPUTE_FLAG) { - intel_pipeline_shader_cleanup(&pipeline->cs); + intel_pipeline_shader_cleanup(&pipeline->cs, pipeline->dev->gpu); } intel_base_destroy(&pipeline->obj.base); diff --git a/icd/intel/pipeline.h b/icd/intel/pipeline.h index d1b54ec..f933491 100644 --- a/icd/intel/pipeline.h +++ b/icd/intel/pipeline.h @@ -252,6 +252,7 @@ static inline struct intel_pipeline *intel_pipeline_from_obj(struct intel_obj *o struct intel_pipeline_shader *intel_pipeline_shader_create_meta(struct intel_dev *dev, enum intel_dev_meta_shader id); -void intel_pipeline_shader_destroy(struct intel_pipeline_shader *sh); +void intel_pipeline_shader_destroy(struct intel_dev *dev, + struct intel_pipeline_shader *sh); #endif /* PIPELINE_H */ diff --git a/icd/intel/wsi_x11.c b/icd/intel/wsi_x11.c index 582aa70..ef0f95f 100644 --- a/icd/intel/wsi_x11.c +++ b/icd/intel/wsi_x11.c @@ -117,7 +117,8 @@ static int wsi_x11_get_root_depth(struct intel_wsi_x11 *x11) /** * Query DRI3 and Present versions and return an intel_wsi_x11. */ -static struct intel_wsi_x11 *wsi_x11_create(xcb_connection_t *c, +static struct intel_wsi_x11 *wsi_x11_create(const struct intel_gpu *gpu, + xcb_connection_t *c, xcb_window_t root, xcb_randr_provider_t provider) { @@ -132,7 +133,7 @@ static struct intel_wsi_x11 *wsi_x11_create(xcb_connection_t *c, present_cookie = xcb_present_query_version(c, XCB_PRESENT_MAJOR_VERSION, XCB_PRESENT_MINOR_VERSION); - x11 = icd_alloc(sizeof(*x11), 0, XGL_SYSTEM_ALLOC_INTERNAL); + x11 = intel_alloc(gpu, sizeof(*x11), 0, XGL_SYSTEM_ALLOC_INTERNAL); if (!x11) return NULL; memset(x11, 0, sizeof(*x11)); @@ -145,7 +146,7 @@ static struct intel_wsi_x11 *wsi_x11_create(xcb_connection_t *c, dri3_reply = xcb_dri3_query_version_reply(c, dri3_cookie, NULL); if (!dri3_reply) { - icd_free(x11); + intel_free(gpu, x11); return NULL; } @@ -155,7 +156,7 @@ static struct intel_wsi_x11 *wsi_x11_create(xcb_connection_t *c, present_reply = xcb_present_query_version_reply(c, present_cookie, NULL); if (!present_reply) { - icd_free(x11); + intel_free(gpu, x11); return NULL; } @@ -355,12 +356,13 @@ static void wsi_x11_present_event(struct intel_wsi_x11 *x11, } } -static struct intel_wsi_x11_window *wsi_x11_create_window(struct intel_wsi_x11 *x11, +static struct intel_wsi_x11_window *wsi_x11_create_window(const struct intel_gpu *gpu, + struct intel_wsi_x11 *x11, xcb_window_t win_id) { struct intel_wsi_x11_window *win; - win = icd_alloc(sizeof(*win), 0, XGL_SYSTEM_ALLOC_INTERNAL); + win = intel_alloc(gpu, sizeof(*win), 0, XGL_SYSTEM_ALLOC_INTERNAL); if (!win) return NULL; @@ -369,23 +371,25 @@ static struct intel_wsi_x11_window *wsi_x11_create_window(struct intel_wsi_x11 * win->window_id = win_id; if (wsi_x11_present_select_input(x11, win) != XGL_SUCCESS) { - icd_free(win); + intel_free(gpu, win); return NULL; } return win; } -static void wsi_x11_destroy_window(struct intel_wsi_x11 *x11, +static void wsi_x11_destroy_window(const struct intel_gpu *gpu, + struct intel_wsi_x11 *x11, struct intel_wsi_x11_window *win) { if (win->present_special_event) xcb_unregister_for_special_event(x11->c, win->present_special_event); - icd_free(win); + intel_free(gpu, win); } -static struct intel_wsi_x11_window *wsi_x11_lookup_window(struct intel_wsi_x11 *x11, +static struct intel_wsi_x11_window *wsi_x11_lookup_window(const struct intel_gpu *gpu, + struct intel_wsi_x11 *x11, xcb_window_t win_id) { struct intel_wsi_x11_window *win = x11->windows; @@ -398,7 +402,7 @@ static struct intel_wsi_x11_window *wsi_x11_lookup_window(struct intel_wsi_x11 * /* lookup failed */ if (!win) { - win = wsi_x11_create_window(x11, win_id); + win = wsi_x11_create_window(gpu, x11, win_id); if (win) { win->next = x11->windows; x11->windows = win; @@ -408,20 +412,21 @@ static struct intel_wsi_x11_window *wsi_x11_lookup_window(struct intel_wsi_x11 * return win; } -void intel_wsi_x11_destroy(struct intel_wsi_x11 *x11) +void intel_wsi_x11_destroy(const struct intel_gpu *gpu, + struct intel_wsi_x11 *x11) { struct intel_wsi_x11_window *win = x11->windows; while (win) { struct intel_wsi_x11_window *next = win->next; - wsi_x11_destroy_window(x11, win); + wsi_x11_destroy_window(gpu, x11, win); win = next; } if (x11->fd >= 0) close(x11->fd); - icd_free(x11); + intel_free(gpu, x11); } XGL_RESULT intel_wsi_x11_wait(struct intel_wsi_x11 *x11, @@ -552,19 +557,19 @@ ICD_EXPORT XGL_RESULT XGLAPI xglWsiX11AssociateConnection( if (!wsi_x11_has_dri3_and_present(pConnectionInfo->pConnection)) return XGL_ERROR_UNKNOWN; - x11 = wsi_x11_create(pConnectionInfo->pConnection, + x11 = wsi_x11_create(gpu, pConnectionInfo->pConnection, pConnectionInfo->root, pConnectionInfo->provider); if (!x11) return XGL_ERROR_UNKNOWN; ret = wsi_x11_dri3_open(x11); if (ret != XGL_SUCCESS) { - intel_wsi_x11_destroy(x11); + intel_wsi_x11_destroy(gpu, x11); return ret; } if (!wsi_x11_uses_gpu(x11, gpu)) { - intel_wsi_x11_destroy(x11); + intel_wsi_x11_destroy(gpu, x11); return XGL_ERROR_UNKNOWN; } @@ -584,7 +589,7 @@ ICD_EXPORT XGL_RESULT XGLAPI xglWsiX11GetMSC( struct intel_wsi_x11_window *win; XGL_RESULT ret; - win = wsi_x11_lookup_window(x11, window); + win = wsi_x11_lookup_window(dev->gpu, x11, window); if (!win) return XGL_ERROR_UNKNOWN; @@ -631,7 +636,8 @@ ICD_EXPORT XGL_RESULT XGLAPI xglWsiX11QueuePresent( struct intel_wsi_x11_window *win; XGL_RESULT ret; - win = wsi_x11_lookup_window(x11, pPresentInfo->destWindow); + win = wsi_x11_lookup_window(queue->dev->gpu, + x11, pPresentInfo->destWindow); if (!win) return XGL_ERROR_UNKNOWN; diff --git a/icd/intel/wsi_x11.h b/icd/intel/wsi_x11.h index f195348..6356931 100644 --- a/icd/intel/wsi_x11.h +++ b/icd/intel/wsi_x11.h @@ -39,7 +39,8 @@ XGL_RESULT intel_wsi_x11_wait(struct intel_wsi_x11 *x11, struct intel_wsi_x11_window *win, uint32_t serial, bool wait); -void intel_wsi_x11_destroy(struct intel_wsi_x11 *x11); +void intel_wsi_x11_destroy(const struct intel_gpu *gpu, + struct intel_wsi_x11 *x11); #else /* ENABLE_WSI_X11 */ @@ -50,7 +51,8 @@ static inline XGL_RESULT intel_wsi_x11_wait(struct intel_wsi_x11 *x11, return XGL_SUCCESS; } -static inline void intel_wsi_x11_destroy(struct intel_wsi_x11 *x11) +static inline void intel_wsi_x11_destroy(const struct intel_gpu *gpu, + struct intel_wsi_x11 *x11) { } -- 2.7.4