blob: eb494835f93750cb817f0597fa510fd3fd90696d [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"
32
Ray Smith3c33c3d2013-03-26 16:06:37 +000033struct drmmode_interface {
Dave Barnishde45ed42013-06-05 13:47:56 +010034
Dave Barnish2e998952013-06-11 16:31:10 +010035 /* Flags value to pass to DRM_IOCTL_MODE_CREATE_DUMB to allocate
36 * a scanout-capable buffer. A buffer allocated with these flags
37 * must be able to be wrapped in a DRM framebuffer (via
38 * DRM_IOCTL_MODE_ADDFB or DRM_IOCTL_MODE_ADDFB2).
Ray Smith3c33c3d2013-03-26 16:06:37 +000039 */
40 uint32_t dumb_scanout_flags;
41
42 /* Flags value to pass to DRM_IOCTL_MODE_CREATE_DUMB to allocate a
Dave Barnish2e998952013-06-11 16:31:10 +010043 * non-scanout-capable buffer. It is acceptable for the driver to
44 * create a scanout-capable buffer when given this flag, this flag
45 * is used to give the option of preserving scarce scanout-capable
46 * memory if applicable.
Ray Smith3c33c3d2013-03-26 16:06:37 +000047 */
48 uint32_t dumb_no_scanout_flags;
49
Dave Barnish2e998952013-06-11 16:31:10 +010050 /* Boolean value indicating whether DRM page flip events should
51 * be requested and waited for during DRM_IOCTL_MODE_PAGE_FLIP.
Ray Smith3c33c3d2013-03-26 16:06:37 +000052 */
53 int use_page_flip_events;
Ray Smithb93cd892013-04-03 10:06:18 +010054
Dave Barnishde45ed42013-06-05 13:47:56 +010055 /* The cursor width */
56 int cursor_width;
57
58 /* The cursor height */
59 int cursor_height;
60
Dave Barnish2e998952013-06-11 16:31:10 +010061 /* A padding column of pixels of this width is added to either
62 * side of the image
63 */
Dave Barnishde45ed42013-06-05 13:47:56 +010064 int cursor_padding;
65
Ray Smithb93cd892013-04-03 10:06:18 +010066 /* (Optional) Initialize the given plane for use as a hardware cursor.
67 *
Dave Barnish2e998952013-06-11 16:31:10 +010068 * This function should do any initialization necessary, for example
69 * setting the z-order on the plane to appear above all other layers.
Ray Smithb93cd892013-04-03 10:06:18 +010070 *
71 * @param drm_fd The DRM device file
72 * @param plane_id The plane to initialize
73 * @return 0 on success, non-zero on failure
74 */
75 int (*init_plane_for_cursor)(int drm_fd, uint32_t plane_id);
Dave Barnishde45ed42013-06-05 13:47:56 +010076
77 /* (Mandatory) Set the cursor image from an ARGB image
78 *
Dave Barnish2e998952013-06-11 16:31:10 +010079 * If the cursor image is ARGB this is a straight copy, otherwise
80 * it must perform any necessary conversion from ARGB to the
81 * cursor format.
Dave Barnishde45ed42013-06-05 13:47:56 +010082 *
83 * @param crtc The CRTC in use
84 * @param [out] d Pointer to the destination cursor image
85 * @param [in] s Pointer to the source for the cursor image
86 */
Dave Barnish2e998952013-06-11 16:31:10 +010087 void (*set_cursor_image)(xf86CrtcPtr crtc, uint32_t *d, CARD32 *s);
Dave Barnishde45ed42013-06-05 13:47:56 +010088
Dave Barnishe762b122013-08-12 17:13:46 +010089 /* Boolean value indicating whether the DRM supports
90 * vblank timestamp query
91 */
92 int vblank_query_supported;
Ray Smith3c33c3d2013-03-26 16:06:37 +000093};
94
95struct drmmode_interface *drmmode_interface_get_implementation(int drm_fd);
96
97#endif