drivers/gpu/drm/i915/display/intel_global_state.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/display/intel_global_state.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/i915/display/intel_global_state.c
Extension
.c
Size
10249 bytes
Lines
418
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct intel_global_objs_state {
	struct intel_global_obj *ptr;
	struct intel_global_state *state, *old_state, *new_state;
};

struct intel_global_commit {
	struct kref ref;
	struct completion done;
};

static struct intel_global_commit *commit_new(void)
{
	struct intel_global_commit *commit;

	commit = kzalloc_obj(*commit);
	if (!commit)
		return NULL;

	init_completion(&commit->done);
	kref_init(&commit->ref);

	return commit;
}

static void __commit_free(struct kref *kref)
{
	struct intel_global_commit *commit =
		container_of(kref, typeof(*commit), ref);

	kfree(commit);
}

static struct intel_global_commit *commit_get(struct intel_global_commit *commit)
{
	if (commit)
		kref_get(&commit->ref);

	return commit;
}

static void commit_put(struct intel_global_commit *commit)
{
	if (commit)
		kref_put(&commit->ref, __commit_free);
}

static void __intel_atomic_global_state_free(struct kref *kref)
{
	struct intel_global_state *obj_state =
		container_of(kref, struct intel_global_state, ref);
	struct intel_global_obj *obj = obj_state->obj;

	commit_put(obj_state->commit);

	obj->funcs->atomic_destroy_state(obj, obj_state);
}

static void intel_atomic_global_state_put(struct intel_global_state *obj_state)
{
	kref_put(&obj_state->ref, __intel_atomic_global_state_free);
}

static struct intel_global_state *
intel_atomic_global_state_get(struct intel_global_state *obj_state)
{
	kref_get(&obj_state->ref);

	return obj_state;
}

void intel_atomic_global_obj_init(struct intel_display *display,
				  struct intel_global_obj *obj,
				  struct intel_global_state *state,
				  const struct intel_global_state_funcs *funcs)
{
	memset(obj, 0, sizeof(*obj));

	state->obj = obj;

	kref_init(&state->ref);

	obj->state = state;
	obj->funcs = funcs;
	list_add_tail(&obj->head, &display->global.obj_list);
}

void intel_atomic_global_obj_cleanup(struct intel_display *display)
{
	struct intel_global_obj *obj, *next;

Annotation

Implementation Notes