xref: /netbsd-src/sys/external/bsd/drm2/drm/drm_client.c (revision 50b58d1feccb036a2ba076c846f03fe325bdc03e)
1 /*	$NetBSD: drm_client.c,v 1.3 2021/12/19 11:07:55 riastradh Exp $	*/
2 
3 /*-
4  * Copyright (c) 2020 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Taylor R. Campbell.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD: drm_client.c,v 1.3 2021/12/19 11:07:55 riastradh Exp $");
34 
35 #include <sys/kmem.h>
36 
37 #include <linux/err.h>
38 
39 #include <drm/drm_client.h>
40 #include <drm/drm_drv.h>
41 
42 int
drm_client_init(struct drm_device * dev,struct drm_client_dev * client,const char * name,const struct drm_client_funcs * funcs)43 drm_client_init(struct drm_device *dev, struct drm_client_dev *client,
44     const char *name, const struct drm_client_funcs *funcs)
45 {
46 	int ret;
47 
48 	client->dev = dev;
49 
50 	ret = drm_client_modeset_create(client);
51 	if (ret)
52 		goto out0;
53 
54 	drm_dev_get(dev);
55 	return 0;
56 
57 out0:	return ret;
58 }
59 
60 void
drm_client_register(struct drm_client_dev * client)61 drm_client_register(struct drm_client_dev *client)
62 {
63 }
64 
65 void
drm_client_release(struct drm_client_dev * client)66 drm_client_release(struct drm_client_dev *client)
67 {
68 
69 	drm_client_modeset_free(client);
70 	drm_dev_put(client->dev);
71 }
72 
73 void
drm_client_dev_hotplug(struct drm_device * dev)74 drm_client_dev_hotplug(struct drm_device *dev)
75 {
76 }
77 
78 void
drm_client_dev_restore(struct drm_device * dev)79 drm_client_dev_restore(struct drm_device *dev)
80 {
81 }
82 
83 void
drm_client_dev_unregister(struct drm_device * dev)84 drm_client_dev_unregister(struct drm_device *dev)
85 {
86 }
87 
88 struct drm_client_buffer *
drm_client_framebuffer_create(struct drm_client_dev * client,u32 width,u32 height,u32 format)89 drm_client_framebuffer_create(struct drm_client_dev *client,
90     u32 width, u32 height, u32 format)
91 {
92 	struct drm_client_buffer *buffer;
93 
94 	buffer = kmem_zalloc(sizeof(*buffer), KM_SLEEP);
95 
96 	return buffer;
97 }
98 
99 void *
drm_client_buffer_vmap(struct drm_client_buffer * buffer)100 drm_client_buffer_vmap(struct drm_client_buffer *buffer)
101 {
102 	return ERR_PTR(-ENODEV);
103 }
104 
105 void
drm_client_buffer_vunmap(struct drm_client_buffer * buffer)106 drm_client_buffer_vunmap(struct drm_client_buffer *buffer)
107 {
108 	panic("impossible");
109 }
110 
111 void
drm_client_framebuffer_delete(struct drm_client_buffer * buffer)112 drm_client_framebuffer_delete(struct drm_client_buffer *buffer)
113 {
114 	kmem_free(buffer, sizeof(*buffer));
115 }
116