0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef __XEN_DRM_FRONT_H_
0012 #define __XEN_DRM_FRONT_H_
0013
0014 #include <linux/scatterlist.h>
0015
0016 #include <drm/drm_connector.h>
0017 #include <drm/drm_simple_kms_helper.h>
0018
0019 #include "xen_drm_front_cfg.h"
0020
0021 struct drm_device;
0022 struct drm_framebuffer;
0023 struct drm_gem_object;
0024 struct drm_pending_vblank_event;
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081 #define XEN_DRM_FRONT_WAIT_BACK_MS 3000
0082
0083 struct xen_drm_front_info {
0084 struct xenbus_device *xb_dev;
0085 struct xen_drm_front_drm_info *drm_info;
0086
0087
0088 spinlock_t io_lock;
0089
0090 int num_evt_pairs;
0091 struct xen_drm_front_evtchnl_pair *evt_pairs;
0092 struct xen_drm_front_cfg cfg;
0093
0094
0095 struct list_head dbuf_list;
0096 };
0097
0098 struct xen_drm_front_drm_pipeline {
0099 struct xen_drm_front_drm_info *drm_info;
0100
0101 int index;
0102
0103 struct drm_simple_display_pipe pipe;
0104
0105 struct drm_connector conn;
0106
0107 int width, height;
0108
0109 struct drm_pending_vblank_event *pending_event;
0110
0111 struct delayed_work pflip_to_worker;
0112
0113 bool conn_connected;
0114 };
0115
0116 struct xen_drm_front_drm_info {
0117 struct xen_drm_front_info *front_info;
0118 struct drm_device *drm_dev;
0119
0120 struct xen_drm_front_drm_pipeline pipeline[XEN_DRM_FRONT_MAX_CRTCS];
0121 };
0122
0123 static inline u64 xen_drm_front_fb_to_cookie(struct drm_framebuffer *fb)
0124 {
0125 return (uintptr_t)fb;
0126 }
0127
0128 static inline u64 xen_drm_front_dbuf_to_cookie(struct drm_gem_object *gem_obj)
0129 {
0130 return (uintptr_t)gem_obj;
0131 }
0132
0133 int xen_drm_front_mode_set(struct xen_drm_front_drm_pipeline *pipeline,
0134 u32 x, u32 y, u32 width, u32 height,
0135 u32 bpp, u64 fb_cookie);
0136
0137 int xen_drm_front_dbuf_create(struct xen_drm_front_info *front_info,
0138 u64 dbuf_cookie, u32 width, u32 height,
0139 u32 bpp, u64 size, u32 offset, struct page **pages);
0140
0141 int xen_drm_front_fb_attach(struct xen_drm_front_info *front_info,
0142 u64 dbuf_cookie, u64 fb_cookie, u32 width,
0143 u32 height, u32 pixel_format);
0144
0145 int xen_drm_front_fb_detach(struct xen_drm_front_info *front_info,
0146 u64 fb_cookie);
0147
0148 int xen_drm_front_page_flip(struct xen_drm_front_info *front_info,
0149 int conn_idx, u64 fb_cookie);
0150
0151 void xen_drm_front_on_frame_done(struct xen_drm_front_info *front_info,
0152 int conn_idx, u64 fb_cookie);
0153
0154 void xen_drm_front_gem_object_free(struct drm_gem_object *obj);
0155
0156 #endif