[Mesa-dev] [PATCH 47/53] i965: Just use a uint32_t context handle rather than a malloc'd wrapper.
Chris Wilson
chris at chris-wilson.co.uk
Wed Apr 5 12:01:47 UTC 2017
On Tue, Apr 04, 2017 at 05:10:37PM -0700, Kenneth Graunke wrote:
> drm_bacon_context is a malloc'd struct containing a uint32_t context ID
> and a pointer back to the bufmgr. The bufmgr pointer is pretty useless,
> as everybody already has brw->bufmgr. At that point...we may as well
> just use the ctx_id handle directly. A number of places already had to
> call drm_bacon_gem_context_get_id() to extract the ID anyway. Now they
> just have it.
About time!
> ---
> void
> -drm_bacon_gem_context_destroy(drm_bacon_context *ctx)
> +brw_destroy_hw_context(drm_bacon_bufmgr *bufmgr, uint32_t ctx_id)
> {
> - struct drm_i915_gem_context_destroy destroy;
> - int ret;
> -
> - if (ctx == NULL)
> - return;
> -
> - memclear(destroy);
> + struct drm_i915_gem_context_destroy d = { .ctx_id = ctx_id };
>
> - destroy.ctx_id = ctx->ctx_id;
> - ret = drmIoctl(ctx->bufmgr->fd, DRM_IOCTL_I915_GEM_CONTEXT_DESTROY,
> - &destroy);
For funsie, this is just drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_DESTROY, &ctx_id);
> - if (ret != 0)
> + if (ctx_id != 0 &&
> + drmIoctl(bufmgr->fd, DRM_IOCTL_I915_GEM_CONTEXT_DESTROY, &d) != 0) {
> fprintf(stderr, "DRM_IOCTL_I915_GEM_CONTEXT_DESTROY failed: %s\n",
Reviewing the fprintf I hope are on the todo list.
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the mesa-dev
mailing list