blob: f9d88972ddadd85afca3cb78d83f5a93c2f75417 [file] [log] [blame]
Ray Smith3c33c3d2013-03-26 16:06:37 +00001/*
2 * Copyright © 2013 ARM Limited.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 *
23 */
24
25#ifndef DRMMODE_DRIVER_H
26#define DRMMODE_DRIVER_H
27
28#include <stdint.h>
29
Dave Barnishde45ed42013-06-05 13:47:56 +010030#include "xorg-server.h"
31#include "xf86Crtc.h"
Javier Martin981264d2013-08-21 16:48:07 +010032#include "armsoc_dumb.h"
Dave Barnishde45ed42013-06-05 13:47:56 +010033
Javier Martin4c572792013-09-11 15:08:19 +010034enum hwcursor_api {
35 HWCURSOR_API_PLANE = 0,
36 HWCURSOR_API_STANDARD = 1,
37};
38
Ray Smith3c33c3d2013-03-26 16:06:37 +000039struct drmmode_interface {
Dave Barnish2e998952013-06-11 16:31:10 +010040 /* Boolean value indicating whether DRM page flip events should
41 * be requested and waited for during DRM_IOCTL_MODE_PAGE_FLIP.
Ray Smith3c33c3d2013-03-26 16:06:37 +000042 */
43 int use_page_flip_events;
Ray Smithb93cd892013-04-03 10:06:18 +010044
Dave Barnishde45ed42013-06-05 13:47:56 +010045 /* The cursor width */
46 int cursor_width;
47
48 /* The cursor height */
49 int cursor_height;
50
Dave Barnish2e998952013-06-11 16:31:10 +010051 /* A padding column of pixels of this width is added to either
52 * side of the image
53 */
Dave Barnishde45ed42013-06-05 13:47:56 +010054 int cursor_padding;
55
Javier Martin4c572792013-09-11 15:08:19 +010056 /* This specifies whether the DRM implements HW cursor support
57 * using planes or the standard HW cursor API using drmModeSetCursor()
58 * and drmModeMoveCursor().
59 */
60 enum hwcursor_api cursor_api;
61
Ray Smithb93cd892013-04-03 10:06:18 +010062 /* (Optional) Initialize the given plane for use as a hardware cursor.
63 *
Dave Barnish2e998952013-06-11 16:31:10 +010064 * This function should do any initialization necessary, for example
65 * setting the z-order on the plane to appear above all other layers.
Ray Smithb93cd892013-04-03 10:06:18 +010066 *
67 * @param drm_fd The DRM device file
68 * @param plane_id The plane to initialize
69 * @return 0 on success, non-zero on failure
70 */
71 int (*init_plane_for_cursor)(int drm_fd, uint32_t plane_id);
Dave Barnishde45ed42013-06-05 13:47:56 +010072
73 /* (Mandatory) Set the cursor image from an ARGB image
74 *
Dave Barnish2e998952013-06-11 16:31:10 +010075 * If the cursor image is ARGB this is a straight copy, otherwise
76 * it must perform any necessary conversion from ARGB to the
77 * cursor format.
Dave Barnishde45ed42013-06-05 13:47:56 +010078 *
79 * @param crtc The CRTC in use
80 * @param [out] d Pointer to the destination cursor image
81 * @param [in] s Pointer to the source for the cursor image
82 */
Dave Barnish2e998952013-06-11 16:31:10 +010083 void (*set_cursor_image)(xf86CrtcPtr crtc, uint32_t *d, CARD32 *s);
Dave Barnishde45ed42013-06-05 13:47:56 +010084
Dave Barnishe762b122013-08-12 17:13:46 +010085 /* Boolean value indicating whether the DRM supports
86 * vblank timestamp query
87 */
88 int vblank_query_supported;
Javier Martin981264d2013-08-21 16:48:07 +010089
90 /* (Mandatory) Create new gem object
91 *
92 * A driver specific ioctl() is usually needed to create GEM objects
93 * with particular features such as contiguous memory, uncached, etc...
94 *
95 * @param fd DRM device file descriptor
96 * @param create_gem generic GEM description
97 * @return 0 on success, non-zero on failure
98 */
99 int (*create_custom_gem)(int fd, struct armsoc_create_gem *create_gem);
Ray Smith3c33c3d2013-03-26 16:06:37 +0000100};
101
102struct drmmode_interface *drmmode_interface_get_implementation(int drm_fd);
103
104#endif