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