Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
0002 
0003 /*
0004  *  Xen para-virtual DRM device
0005  *
0006  * Copyright (C) 2016-2018 EPAM Systems Inc.
0007  *
0008  * Author: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
0009  */
0010 
0011 #ifndef __XEN_DRM_FRONT_EVTCHNL_H_
0012 #define __XEN_DRM_FRONT_EVTCHNL_H_
0013 
0014 #include <linux/completion.h>
0015 #include <linux/types.h>
0016 
0017 #include <xen/interface/io/ring.h>
0018 #include <xen/interface/io/displif.h>
0019 
0020 /*
0021  * All operations which are not connector oriented use this ctrl event channel,
0022  * e.g. fb_attach/destroy which belong to a DRM device, not to a CRTC.
0023  */
0024 #define GENERIC_OP_EVT_CHNL 0
0025 
0026 enum xen_drm_front_evtchnl_state {
0027     EVTCHNL_STATE_DISCONNECTED,
0028     EVTCHNL_STATE_CONNECTED,
0029 };
0030 
0031 enum xen_drm_front_evtchnl_type {
0032     EVTCHNL_TYPE_REQ,
0033     EVTCHNL_TYPE_EVT,
0034 };
0035 
0036 struct xen_drm_front_drm_info;
0037 
0038 struct xen_drm_front_evtchnl {
0039     struct xen_drm_front_info *front_info;
0040     int gref;
0041     int port;
0042     int irq;
0043     int index;
0044     enum xen_drm_front_evtchnl_state state;
0045     enum xen_drm_front_evtchnl_type type;
0046     /* either response id or incoming event id */
0047     u16 evt_id;
0048     /* next request id or next expected event id */
0049     u16 evt_next_id;
0050     union {
0051         struct {
0052             struct xen_displif_front_ring ring;
0053             struct completion completion;
0054             /* latest response status */
0055             int resp_status;
0056             /* serializer for backend IO: request/response */
0057             struct mutex req_io_lock;
0058         } req;
0059         struct {
0060             struct xendispl_event_page *page;
0061         } evt;
0062     } u;
0063 };
0064 
0065 struct xen_drm_front_evtchnl_pair {
0066     struct xen_drm_front_evtchnl req;
0067     struct xen_drm_front_evtchnl evt;
0068 };
0069 
0070 int xen_drm_front_evtchnl_create_all(struct xen_drm_front_info *front_info);
0071 
0072 int xen_drm_front_evtchnl_publish_all(struct xen_drm_front_info *front_info);
0073 
0074 void xen_drm_front_evtchnl_flush(struct xen_drm_front_evtchnl *evtchnl);
0075 
0076 void xen_drm_front_evtchnl_set_state(struct xen_drm_front_info *front_info,
0077                      enum xen_drm_front_evtchnl_state state);
0078 
0079 void xen_drm_front_evtchnl_free_all(struct xen_drm_front_info *front_info);
0080 
0081 #endif /* __XEN_DRM_FRONT_EVTCHNL_H_ */