Ray Smith | 3c33c3d | 2013-03-26 16:06:37 +0000 | [diff] [blame] | 1 | /* |
| 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 Barnish | de45ed4 | 2013-06-05 13:47:56 +0100 | [diff] [blame] | 30 | #include "xorg-server.h" |
| 31 | #include "xf86Crtc.h" |
| 32 | |
Ray Smith | 3c33c3d | 2013-03-26 16:06:37 +0000 | [diff] [blame] | 33 | struct drmmode_interface { |
Dave Barnish | de45ed4 | 2013-06-05 13:47:56 +0100 | [diff] [blame] | 34 | |
Dave Barnish | 2e99895 | 2013-06-11 16:31:10 +0100 | [diff] [blame] | 35 | /* 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 Smith | 3c33c3d | 2013-03-26 16:06:37 +0000 | [diff] [blame] | 39 | */ |
| 40 | uint32_t dumb_scanout_flags; |
| 41 | |
| 42 | /* Flags value to pass to DRM_IOCTL_MODE_CREATE_DUMB to allocate a |
Dave Barnish | 2e99895 | 2013-06-11 16:31:10 +0100 | [diff] [blame] | 43 | * 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 Smith | 3c33c3d | 2013-03-26 16:06:37 +0000 | [diff] [blame] | 47 | */ |
| 48 | uint32_t dumb_no_scanout_flags; |
| 49 | |
Dave Barnish | 2e99895 | 2013-06-11 16:31:10 +0100 | [diff] [blame] | 50 | /* Boolean value indicating whether DRM page flip events should |
| 51 | * be requested and waited for during DRM_IOCTL_MODE_PAGE_FLIP. |
Ray Smith | 3c33c3d | 2013-03-26 16:06:37 +0000 | [diff] [blame] | 52 | */ |
| 53 | int use_page_flip_events; |
Ray Smith | b93cd89 | 2013-04-03 10:06:18 +0100 | [diff] [blame] | 54 | |
Dave Barnish | de45ed4 | 2013-06-05 13:47:56 +0100 | [diff] [blame] | 55 | /* The cursor width */ |
| 56 | int cursor_width; |
| 57 | |
| 58 | /* The cursor height */ |
| 59 | int cursor_height; |
| 60 | |
Dave Barnish | 2e99895 | 2013-06-11 16:31:10 +0100 | [diff] [blame] | 61 | /* A padding column of pixels of this width is added to either |
| 62 | * side of the image |
| 63 | */ |
Dave Barnish | de45ed4 | 2013-06-05 13:47:56 +0100 | [diff] [blame] | 64 | int cursor_padding; |
| 65 | |
Ray Smith | b93cd89 | 2013-04-03 10:06:18 +0100 | [diff] [blame] | 66 | /* (Optional) Initialize the given plane for use as a hardware cursor. |
| 67 | * |
Dave Barnish | 2e99895 | 2013-06-11 16:31:10 +0100 | [diff] [blame] | 68 | * This function should do any initialization necessary, for example |
| 69 | * setting the z-order on the plane to appear above all other layers. |
Ray Smith | b93cd89 | 2013-04-03 10:06:18 +0100 | [diff] [blame] | 70 | * |
| 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 Barnish | de45ed4 | 2013-06-05 13:47:56 +0100 | [diff] [blame] | 76 | |
| 77 | /* (Mandatory) Set the cursor image from an ARGB image |
| 78 | * |
Dave Barnish | 2e99895 | 2013-06-11 16:31:10 +0100 | [diff] [blame] | 79 | * 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 Barnish | de45ed4 | 2013-06-05 13:47:56 +0100 | [diff] [blame] | 82 | * |
| 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 Barnish | 2e99895 | 2013-06-11 16:31:10 +0100 | [diff] [blame] | 87 | void (*set_cursor_image)(xf86CrtcPtr crtc, uint32_t *d, CARD32 *s); |
Dave Barnish | de45ed4 | 2013-06-05 13:47:56 +0100 | [diff] [blame] | 88 | |
Dave Barnish | e762b12 | 2013-08-12 17:13:46 +0100 | [diff] [blame^] | 89 | /* Boolean value indicating whether the DRM supports |
| 90 | * vblank timestamp query |
| 91 | */ |
| 92 | int vblank_query_supported; |
Ray Smith | 3c33c3d | 2013-03-26 16:06:37 +0000 | [diff] [blame] | 93 | }; |
| 94 | |
| 95 | struct drmmode_interface *drmmode_interface_get_implementation(int drm_fd); |
| 96 | |
| 97 | #endif |