projects/linux·blob master · refs

71 lines · 1.5 KiB

1// SPDX-License-Identifier: MIT
2/* Copyright © 2026 Intel Corporation */
3
4#include <drm/drm_gem.h>
5#include <drm/intel/display_parent_interface.h>
6
7#include "intel_frontbuffer.h"
8#include "xe_frontbuffer.h"
9
10struct xe_frontbuffer {
11 struct intel_frontbuffer base;
12 struct drm_gem_object *obj;
13 struct kref ref;
14};
15
16static struct intel_frontbuffer *xe_frontbuffer_get(struct drm_gem_object *obj)
17{
18 struct xe_frontbuffer *front;
19
20 front = kmalloc_obj(*front);
21 if (!front)
22 return NULL;
23
24 intel_frontbuffer_init(&front->base, obj->dev);
25
26 kref_init(&front->ref);
27
28 drm_gem_object_get(obj);
29 front->obj = obj;
30
31 return &front->base;
32}
33
34static void xe_frontbuffer_ref(struct intel_frontbuffer *_front)
35{
36 struct xe_frontbuffer *front =
37 container_of(_front, typeof(*front), base);
38
39 kref_get(&front->ref);
40}
41
42static void frontbuffer_release(struct kref *ref)
43{
44 struct xe_frontbuffer *front =
45 container_of(ref, typeof(*front), ref);
46
47 intel_frontbuffer_fini(&front->base);
48
49 drm_gem_object_put(front->obj);
50
51 kfree(front);
52}
53
54static void xe_frontbuffer_put(struct intel_frontbuffer *_front)
55{
56 struct xe_frontbuffer *front =
57 container_of(_front, typeof(*front), base);
58
59 kref_put(&front->ref, frontbuffer_release);
60}
61
62static void xe_frontbuffer_flush_for_display(struct intel_frontbuffer *front)
63{
64}
65
66const struct intel_display_frontbuffer_interface xe_display_frontbuffer_interface = {
67 .get = xe_frontbuffer_get,
68 .ref = xe_frontbuffer_ref,
69 .put = xe_frontbuffer_put,
70 .flush_for_display = xe_frontbuffer_flush_for_display,
71};