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" |
Javier Martin | 981264d | 2013-08-21 16:48:07 +0100 | [diff] [blame] | 32 | #include "armsoc_dumb.h" |
Dave Barnish | de45ed4 | 2013-06-05 13:47:56 +0100 | [diff] [blame] | 33 | |
Javier Martin | 4c57279 | 2013-09-11 15:08:19 +0100 | [diff] [blame] | 34 | enum hwcursor_api { |
| 35 | HWCURSOR_API_PLANE = 0, |
| 36 | HWCURSOR_API_STANDARD = 1, |
| 37 | }; |
| 38 | |
Ray Smith | 3c33c3d | 2013-03-26 16:06:37 +0000 | [diff] [blame] | 39 | struct drmmode_interface { |
Dave Barnish | 2e99895 | 2013-06-11 16:31:10 +0100 | [diff] [blame] | 40 | /* Boolean value indicating whether DRM page flip events should |
| 41 | * be requested and waited for during DRM_IOCTL_MODE_PAGE_FLIP. |
Ray Smith | 3c33c3d | 2013-03-26 16:06:37 +0000 | [diff] [blame] | 42 | */ |
| 43 | int use_page_flip_events; |
Ray Smith | b93cd89 | 2013-04-03 10:06:18 +0100 | [diff] [blame] | 44 | |
Dave Barnish | de45ed4 | 2013-06-05 13:47:56 +0100 | [diff] [blame] | 45 | /* The cursor width */ |
| 46 | int cursor_width; |
| 47 | |
| 48 | /* The cursor height */ |
| 49 | int cursor_height; |
| 50 | |
Dave Barnish | 2e99895 | 2013-06-11 16:31:10 +0100 | [diff] [blame] | 51 | /* A padding column of pixels of this width is added to either |
| 52 | * side of the image |
| 53 | */ |
Dave Barnish | de45ed4 | 2013-06-05 13:47:56 +0100 | [diff] [blame] | 54 | int cursor_padding; |
| 55 | |
Javier Martin | 4c57279 | 2013-09-11 15:08:19 +0100 | [diff] [blame] | 56 | /* 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 Smith | b93cd89 | 2013-04-03 10:06:18 +0100 | [diff] [blame] | 62 | /* (Optional) Initialize the given plane for use as a hardware cursor. |
| 63 | * |
Dave Barnish | 2e99895 | 2013-06-11 16:31:10 +0100 | [diff] [blame] | 64 | * This function should do any initialization necessary, for example |
| 65 | * 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] | 66 | * |
| 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 Barnish | de45ed4 | 2013-06-05 13:47:56 +0100 | [diff] [blame] | 72 | |
Dave Barnish | e762b12 | 2013-08-12 17:13:46 +0100 | [diff] [blame] | 73 | /* Boolean value indicating whether the DRM supports |
| 74 | * vblank timestamp query |
| 75 | */ |
| 76 | int vblank_query_supported; |
Javier Martin | 981264d | 2013-08-21 16:48:07 +0100 | [diff] [blame] | 77 | |
| 78 | /* (Mandatory) Create new gem object |
| 79 | * |
| 80 | * A driver specific ioctl() is usually needed to create GEM objects |
| 81 | * with particular features such as contiguous memory, uncached, etc... |
| 82 | * |
| 83 | * @param fd DRM device file descriptor |
| 84 | * @param create_gem generic GEM description |
| 85 | * @return 0 on success, non-zero on failure |
| 86 | */ |
| 87 | int (*create_custom_gem)(int fd, struct armsoc_create_gem *create_gem); |
Ray Smith | 3c33c3d | 2013-03-26 16:06:37 +0000 | [diff] [blame] | 88 | }; |
| 89 | |
| 90 | struct drmmode_interface *drmmode_interface_get_implementation(int drm_fd); |
| 91 | |
| 92 | #endif |