| 1 | /* SPDX-License-Identifier: GPL-2.0 OR MIT */ |
| 2 | /************************************************************************** |
| 3 | * |
| 4 | * Copyright (c) 2024-2025 Broadcom. All Rights Reserved. The term |
| 5 | * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. |
| 6 | * |
| 7 | **************************************************************************/ |
| 8 | |
| 9 | #ifndef VMWGFX_CURSOR_PLANE_H |
| 10 | #define VMWGFX_CURSOR_PLANE_H |
| 11 | |
| 12 | #include "device_include/svga3d_cmd.h" |
| 13 | #include "drm/drm_file.h" |
| 14 | #include "drm/drm_fourcc.h" |
| 15 | #include "drm/drm_plane.h" |
| 16 | |
| 17 | #include <linux/types.h> |
| 18 | |
| 19 | struct ; |
| 20 | struct ttm_buffer_object; |
| 21 | struct vmw_bo; |
| 22 | struct vmw_cursor; |
| 23 | struct vmw_private; |
| 24 | struct vmw_surface; |
| 25 | struct vmw_user_object; |
| 26 | |
| 27 | #define vmw_plane_to_vcp(x) container_of(x, struct vmw_cursor_plane, base) |
| 28 | |
| 29 | static const u32 __maybe_unused vmw_cursor_plane_formats[] = { |
| 30 | DRM_FORMAT_ARGB8888, |
| 31 | }; |
| 32 | |
| 33 | enum vmw_cursor_update_type { |
| 34 | VMW_CURSOR_UPDATE_NONE = 0, |
| 35 | VMW_CURSOR_UPDATE_LEGACY, |
| 36 | VMW_CURSOR_UPDATE_GB_ONLY, |
| 37 | VMW_CURSOR_UPDATE_MOB, |
| 38 | }; |
| 39 | |
| 40 | struct vmw_cursor_plane_state { |
| 41 | enum vmw_cursor_update_type update_type; |
| 42 | bool changed; |
| 43 | bool surface_changed; |
| 44 | struct vmw_bo *mob; |
| 45 | struct { |
| 46 | s32 hotspot_x; |
| 47 | s32 hotspot_y; |
| 48 | u32 id; |
| 49 | } legacy; |
| 50 | }; |
| 51 | |
| 52 | /** |
| 53 | * Derived class for cursor plane object |
| 54 | * |
| 55 | * @base DRM plane object |
| 56 | * @cursor.cursor_mobs Cursor mobs available for re-use |
| 57 | */ |
| 58 | struct vmw_cursor_plane { |
| 59 | struct drm_plane base; |
| 60 | |
| 61 | struct vmw_bo *cursor_mobs[3]; |
| 62 | }; |
| 63 | |
| 64 | struct vmw_surface_metadata; |
| 65 | void *vmw_cursor_snooper_create(struct drm_file *file_priv, |
| 66 | struct vmw_surface_metadata *metadata); |
| 67 | void vmw_cursor_cmd_dma_snoop(SVGA3dCmdHeader *, |
| 68 | struct vmw_surface *srf, |
| 69 | struct ttm_buffer_object *bo); |
| 70 | |
| 71 | void vmw_cursor_plane_destroy(struct drm_plane *plane); |
| 72 | |
| 73 | int vmw_cursor_plane_atomic_check(struct drm_plane *plane, |
| 74 | struct drm_atomic_state *state); |
| 75 | void vmw_cursor_plane_atomic_update(struct drm_plane *plane, |
| 76 | struct drm_atomic_state *state); |
| 77 | int vmw_cursor_plane_prepare_fb(struct drm_plane *plane, |
| 78 | struct drm_plane_state *new_state); |
| 79 | void vmw_cursor_plane_cleanup_fb(struct drm_plane *plane, |
| 80 | struct drm_plane_state *old_state); |
| 81 | |
| 82 | #endif /* VMWGFX_CURSOR_H */ |
| 83 | |