Subversion Repositories Kolibri OS

Rev

Rev 4065 | Rev 4559 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4065 Rev 4103
Line 47... Line 47...
47
#define DRM_MODE_OBJECT_MODE 0xdededede
47
#define DRM_MODE_OBJECT_MODE 0xdededede
48
#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
48
#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
49
#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
49
#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
50
#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
50
#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
51
#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
51
#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
-
 
52
#define DRM_MODE_OBJECT_BRIDGE 0xbdbdbdbd
Line 52... Line 53...
52
 
53
 
53
struct drm_mode_object {
54
struct drm_mode_object {
54
	uint32_t id;
55
	uint32_t id;
55
	uint32_t type;
56
	uint32_t type;
Line 303... Line 304...
303
struct drm_crtc;
304
struct drm_crtc;
304
struct drm_connector;
305
struct drm_connector;
305
struct drm_encoder;
306
struct drm_encoder;
306
struct drm_pending_vblank_event;
307
struct drm_pending_vblank_event;
307
struct drm_plane;
308
struct drm_plane;
-
 
309
struct drm_bridge;
Line 308... Line 310...
308
 
310
 
309
/**
311
/**
310
 * drm_crtc_funcs - control CRTCs for a given device
312
 * drm_crtc_funcs - control CRTCs for a given device
311
 * @save: save CRTC state
313
 * @save: save CRTC state
Line 361... Line 363...
361
	 * argument will point to an event to send back when the flip
363
	 * argument will point to an event to send back when the flip
362
	 * completes, otherwise it will be NULL.
364
	 * completes, otherwise it will be NULL.
363
	 */
365
	 */
364
	int (*page_flip)(struct drm_crtc *crtc,
366
	int (*page_flip)(struct drm_crtc *crtc,
365
			 struct drm_framebuffer *fb,
367
			 struct drm_framebuffer *fb,
366
			 struct drm_pending_vblank_event *event);
368
			 struct drm_pending_vblank_event *event,
-
 
369
			 uint32_t flags);
Line 367... Line 370...
367
 
370
 
368
	int (*set_property)(struct drm_crtc *crtc,
371
	int (*set_property)(struct drm_crtc *crtc,
369
			    struct drm_property *property, uint64_t val);
372
			    struct drm_property *property, uint64_t val);
Line 492... Line 495...
492
struct drm_encoder_funcs {
495
struct drm_encoder_funcs {
493
	void (*reset)(struct drm_encoder *encoder);
496
	void (*reset)(struct drm_encoder *encoder);
494
	void (*destroy)(struct drm_encoder *encoder);
497
	void (*destroy)(struct drm_encoder *encoder);
495
};
498
};
Line 496... Line -...
496
 
-
 
497
#define DRM_CONNECTOR_MAX_UMODES 16
-
 
498
#define DRM_CONNECTOR_LEN 32
499
 
Line 499... Line 500...
499
#define DRM_CONNECTOR_MAX_ENCODER 3
500
#define DRM_CONNECTOR_MAX_ENCODER 3
500
 
501
 
501
/**
502
/**
Line 505... Line 506...
505
 * @base: base KMS object
506
 * @base: base KMS object
506
 * @encoder_type: one of the %DRM_MODE_ENCODER_ types in drm_mode.h
507
 * @encoder_type: one of the %DRM_MODE_ENCODER_ types in drm_mode.h
507
 * @possible_crtcs: bitmask of potential CRTC bindings
508
 * @possible_crtcs: bitmask of potential CRTC bindings
508
 * @possible_clones: bitmask of potential sibling encoders for cloning
509
 * @possible_clones: bitmask of potential sibling encoders for cloning
509
 * @crtc: currently bound CRTC
510
 * @crtc: currently bound CRTC
-
 
511
 * @bridge: bridge associated to the encoder
510
 * @funcs: control functions
512
 * @funcs: control functions
511
 * @helper_private: mid-layer private data
513
 * @helper_private: mid-layer private data
512
 *
514
 *
513
 * CRTCs drive pixels to encoders, which convert them into signals
515
 * CRTCs drive pixels to encoders, which convert them into signals
514
 * appropriate for a given connector or set of connectors.
516
 * appropriate for a given connector or set of connectors.
Line 521... Line 523...
521
	int encoder_type;
523
	int encoder_type;
522
	uint32_t possible_crtcs;
524
	uint32_t possible_crtcs;
523
	uint32_t possible_clones;
525
	uint32_t possible_clones;
Line 524... Line 526...
524
 
526
 
-
 
527
	struct drm_crtc *crtc;
525
	struct drm_crtc *crtc;
528
	struct drm_bridge *bridge;
526
	const struct drm_encoder_funcs *funcs;
529
	const struct drm_encoder_funcs *funcs;
527
	void *helper_private;
530
	void *helper_private;
Line 528... Line 531...
528
};
531
};
Line 681... Line 684...
681
 
684
 
682
	struct drm_object_properties properties;
685
	struct drm_object_properties properties;
Line 683... Line 686...
683
};
686
};
-
 
687
 
-
 
688
/**
-
 
689
 * drm_bridge_funcs - drm_bridge control functions
-
 
690
 * @mode_fixup: Try to fixup (or reject entirely) proposed mode for this bridge
-
 
691
 * @disable: Called right before encoder prepare, disables the bridge
-
 
692
 * @post_disable: Called right after encoder prepare, for lockstepped disable
-
 
693
 * @mode_set: Set this mode to the bridge
-
 
694
 * @pre_enable: Called right before encoder commit, for lockstepped commit
-
 
695
 * @enable: Called right after encoder commit, enables the bridge
-
 
696
 * @destroy: make object go away
-
 
697
 */
-
 
698
struct drm_bridge_funcs {
-
 
699
	bool (*mode_fixup)(struct drm_bridge *bridge,
-
 
700
			   const struct drm_display_mode *mode,
-
 
701
			   struct drm_display_mode *adjusted_mode);
-
 
702
	void (*disable)(struct drm_bridge *bridge);
-
 
703
	void (*post_disable)(struct drm_bridge *bridge);
-
 
704
	void (*mode_set)(struct drm_bridge *bridge,
-
 
705
			 struct drm_display_mode *mode,
-
 
706
			 struct drm_display_mode *adjusted_mode);
-
 
707
	void (*pre_enable)(struct drm_bridge *bridge);
-
 
708
	void (*enable)(struct drm_bridge *bridge);
-
 
709
	void (*destroy)(struct drm_bridge *bridge);
-
 
710
};
-
 
711
 
-
 
712
/**
-
 
713
 * drm_bridge - central DRM bridge control structure
-
 
714
 * @dev: DRM device this bridge belongs to
-
 
715
 * @head: list management
-
 
716
 * @base: base mode object
-
 
717
 * @funcs: control functions
-
 
718
 * @driver_private: pointer to the bridge driver's internal context
-
 
719
 */
-
 
720
struct drm_bridge {
-
 
721
	struct drm_device *dev;
-
 
722
	struct list_head head;
-
 
723
 
-
 
724
	struct drm_mode_object base;
-
 
725
 
-
 
726
	const struct drm_bridge_funcs *funcs;
-
 
727
	void *driver_private;
-
 
728
};
684
 
729
 
685
/**
730
/**
686
 * drm_mode_set - new values for a CRTC config change
731
 * drm_mode_set - new values for a CRTC config change
687
 * @head: list management
732
 * @head: list management
688
 * @fb: framebuffer to use for new config
733
 * @fb: framebuffer to use for new config
Line 740... Line 785...
740
 */
785
 */
741
struct drm_mode_group {
786
struct drm_mode_group {
742
	uint32_t num_crtcs;
787
	uint32_t num_crtcs;
743
	uint32_t num_encoders;
788
	uint32_t num_encoders;
744
	uint32_t num_connectors;
789
	uint32_t num_connectors;
-
 
790
	uint32_t num_bridges;
Line 745... Line 791...
745
 
791
 
746
	/* list of object IDs for this group */
792
	/* list of object IDs for this group */
747
	uint32_t *id_list;
793
	uint32_t *id_list;
Line 754... Line 800...
754
 * @crtc_idr: main KMS ID tracking object
800
 * @crtc_idr: main KMS ID tracking object
755
 * @num_fb: number of fbs available
801
 * @num_fb: number of fbs available
756
 * @fb_list: list of framebuffers available
802
 * @fb_list: list of framebuffers available
757
 * @num_connector: number of connectors on this device
803
 * @num_connector: number of connectors on this device
758
 * @connector_list: list of connector objects
804
 * @connector_list: list of connector objects
-
 
805
 * @num_bridge: number of bridges on this device
-
 
806
 * @bridge_list: list of bridge objects
759
 * @num_encoder: number of encoders on this device
807
 * @num_encoder: number of encoders on this device
760
 * @encoder_list: list of encoder objects
808
 * @encoder_list: list of encoder objects
761
 * @num_crtc: number of CRTCs on this device
809
 * @num_crtc: number of CRTCs on this device
762
 * @crtc_list: list of CRTC objects
810
 * @crtc_list: list of CRTC objects
763
 * @min_width: minimum pixel width on this device
811
 * @min_width: minimum pixel width on this device
Line 791... Line 839...
791
	int num_fb;
839
	int num_fb;
792
	struct list_head fb_list;
840
	struct list_head fb_list;
Line 793... Line 841...
793
 
841
 
794
	int num_connector;
842
	int num_connector;
-
 
843
	struct list_head connector_list;
-
 
844
	int num_bridge;
795
	struct list_head connector_list;
845
	struct list_head bridge_list;
796
	int num_encoder;
846
	int num_encoder;
797
	struct list_head encoder_list;
847
	struct list_head encoder_list;
798
	int num_plane;
848
	int num_plane;
Line 837... Line 887...
837
	struct drm_property *tv_saturation_property;
887
	struct drm_property *tv_saturation_property;
838
	struct drm_property *tv_hue_property;
888
	struct drm_property *tv_hue_property;
Line 839... Line 889...
839
 
889
 
840
	/* Optional properties */
890
	/* Optional properties */
841
	struct drm_property *scaling_mode_property;
-
 
842
	struct drm_property *dithering_mode_property;
891
	struct drm_property *scaling_mode_property;
Line 843... Line 892...
843
	struct drm_property *dirty_info_property;
892
	struct drm_property *dirty_info_property;
844
 
893
 
-
 
894
	/* dumb ioctl parameters */
-
 
895
	uint32_t preferred_depth, prefer_shadow;
-
 
896
 
845
	/* dumb ioctl parameters */
897
	/* whether async page flip is supported or not */
Line 846... Line 898...
846
	uint32_t preferred_depth, prefer_shadow;
898
	bool async_page_flip;
847
};
899
};
848
 
900
 
Line 867... Line 919...
867
extern int drm_crtc_init(struct drm_device *dev,
919
extern int drm_crtc_init(struct drm_device *dev,
868
			  struct drm_crtc *crtc,
920
			  struct drm_crtc *crtc,
869
			  const struct drm_crtc_funcs *funcs);
921
			  const struct drm_crtc_funcs *funcs);
870
extern void drm_crtc_cleanup(struct drm_crtc *crtc);
922
extern void drm_crtc_cleanup(struct drm_crtc *crtc);
Line -... Line 923...
-
 
923
 
-
 
924
extern void drm_connector_ida_init(void);
871
 
925
extern void drm_connector_ida_destroy(void);
872
extern int drm_connector_init(struct drm_device *dev,
926
extern int drm_connector_init(struct drm_device *dev,
873
			    struct drm_connector *connector,
927
			    struct drm_connector *connector,
874
			    const struct drm_connector_funcs *funcs,
928
			    const struct drm_connector_funcs *funcs,
Line 875... Line 929...
875
			    int connector_type);
929
			    int connector_type);
876
 
930
 
877
extern void drm_connector_cleanup(struct drm_connector *connector);
931
extern void drm_connector_cleanup(struct drm_connector *connector);
Line -... Line 932...
-
 
932
/* helper to unplug all connectors from sysfs for device */
-
 
933
extern void drm_connector_unplug_all(struct drm_device *dev);
-
 
934
 
-
 
935
extern int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge,
878
/* helper to unplug all connectors from sysfs for device */
936
			   const struct drm_bridge_funcs *funcs);
879
extern void drm_connector_unplug_all(struct drm_device *dev);
937
extern void drm_bridge_cleanup(struct drm_bridge *bridge);
880
 
938
 
881
extern int drm_encoder_init(struct drm_device *dev,
939
extern int drm_encoder_init(struct drm_device *dev,
Line 906... Line 964...
906
extern bool drm_probe_ddc(struct i2c_adapter *adapter);
964
extern bool drm_probe_ddc(struct i2c_adapter *adapter);
907
extern struct edid *drm_get_edid(struct drm_connector *connector,
965
extern struct edid *drm_get_edid(struct drm_connector *connector,
908
				 struct i2c_adapter *adapter);
966
				 struct i2c_adapter *adapter);
909
extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
967
extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
910
extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
968
extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
911
extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode);
-
 
912
extern void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src);
969
extern void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src);
913
extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
970
extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
914
						   const struct drm_display_mode *mode);
971
						   const struct drm_display_mode *mode);
915
extern void drm_mode_debug_printmodeline(const struct drm_display_mode *mode);
972
extern void drm_mode_debug_printmodeline(const struct drm_display_mode *mode);
916
extern void drm_mode_config_init(struct drm_device *dev);
973
extern void drm_mode_config_init(struct drm_device *dev);
Line 923... Line 980...
923
extern int drm_mode_height(const struct drm_display_mode *mode);
980
extern int drm_mode_height(const struct drm_display_mode *mode);
Line 924... Line 981...
924
 
981
 
925
/* for us by fb module */
982
/* for us by fb module */
926
extern struct drm_display_mode *drm_mode_create(struct drm_device *dev);
983
extern struct drm_display_mode *drm_mode_create(struct drm_device *dev);
927
extern void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode);
-
 
928
extern void drm_mode_list_concat(struct list_head *head,
-
 
929
                struct list_head *new);
984
extern void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode);
930
extern void drm_mode_validate_size(struct drm_device *dev,
985
extern void drm_mode_validate_size(struct drm_device *dev,
931
                  struct list_head *mode_list,
986
                  struct list_head *mode_list,
932
                  int maxX, int maxY, int maxPitch);
-
 
933
extern void drm_mode_validate_clocks(struct drm_device *dev,
-
 
934
				     struct list_head *mode_list,
-
 
935
				     int *min, int *max, int n_ranges);
987
                  int maxX, int maxY, int maxPitch);
936
extern void drm_mode_prune_invalid(struct drm_device *dev,
988
extern void drm_mode_prune_invalid(struct drm_device *dev,
937
                  struct list_head *mode_list, bool verbose);
989
                  struct list_head *mode_list, bool verbose);
938
extern void drm_mode_sort(struct list_head *mode_list);
990
extern void drm_mode_sort(struct list_head *mode_list);
939
extern int drm_mode_hsync(const struct drm_display_mode *mode);
991
extern int drm_mode_hsync(const struct drm_display_mode *mode);
Line 947... Line 999...
947
					 struct drm_property *property,
999
					 struct drm_property *property,
948
					 uint64_t val);
1000
					 uint64_t val);
949
extern int drm_object_property_get_value(struct drm_mode_object *obj,
1001
extern int drm_object_property_get_value(struct drm_mode_object *obj,
950
					 struct drm_property *property,
1002
					 struct drm_property *property,
951
					 uint64_t *value);
1003
					 uint64_t *value);
952
extern struct drm_display_mode *drm_crtc_mode_create(struct drm_device *dev);
-
 
953
extern void drm_framebuffer_set_object(struct drm_device *dev,
-
 
954
				       unsigned long handle);
-
 
955
extern int drm_framebuffer_init(struct drm_device *dev,
1004
extern int drm_framebuffer_init(struct drm_device *dev,
956
				struct drm_framebuffer *fb,
1005
				struct drm_framebuffer *fb,
957
				const struct drm_framebuffer_funcs *funcs);
1006
				const struct drm_framebuffer_funcs *funcs);
958
extern struct drm_framebuffer *drm_framebuffer_lookup(struct drm_device *dev,
1007
extern struct drm_framebuffer *drm_framebuffer_lookup(struct drm_device *dev,
959
						      uint32_t id);
1008
						      uint32_t id);
960
extern void drm_framebuffer_unreference(struct drm_framebuffer *fb);
1009
extern void drm_framebuffer_unreference(struct drm_framebuffer *fb);
961
extern void drm_framebuffer_reference(struct drm_framebuffer *fb);
1010
extern void drm_framebuffer_reference(struct drm_framebuffer *fb);
962
extern void drm_framebuffer_remove(struct drm_framebuffer *fb);
1011
extern void drm_framebuffer_remove(struct drm_framebuffer *fb);
963
extern void drm_framebuffer_cleanup(struct drm_framebuffer *fb);
1012
extern void drm_framebuffer_cleanup(struct drm_framebuffer *fb);
964
extern void drm_framebuffer_unregister_private(struct drm_framebuffer *fb);
1013
extern void drm_framebuffer_unregister_private(struct drm_framebuffer *fb);
965
extern int drmfb_probe(struct drm_device *dev, struct drm_crtc *crtc);
-
 
966
extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
-
 
967
extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY);
-
 
968
extern bool drm_crtc_in_use(struct drm_crtc *crtc);
-
 
Line 969... Line 1014...
969
 
1014
 
970
extern void drm_object_attach_property(struct drm_mode_object *obj,
1015
extern void drm_object_attach_property(struct drm_mode_object *obj,
971
				       struct drm_property *property,
1016
				       struct drm_property *property,
972
				       uint64_t init_val);
1017
				       uint64_t init_val);
Line 988... Line 1033...
988
				 uint64_t value, const char *name);
1033
				 uint64_t value, const char *name);
989
extern int drm_mode_create_dvi_i_properties(struct drm_device *dev);
1034
extern int drm_mode_create_dvi_i_properties(struct drm_device *dev);
990
extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats,
1035
extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats,
991
				     char *formats[]);
1036
				     char *formats[]);
992
extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
1037
extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
993
extern int drm_mode_create_dithering_property(struct drm_device *dev);
-
 
994
extern int drm_mode_create_dirty_info_property(struct drm_device *dev);
1038
extern int drm_mode_create_dirty_info_property(struct drm_device *dev);
995
extern const char *drm_get_encoder_name(const struct drm_encoder *encoder);
1039
extern const char *drm_get_encoder_name(const struct drm_encoder *encoder);
Line 996... Line 1040...
996
 
1040
 
997
extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
1041
extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
Line 1038... Line 1082...
1038
				      void *data, struct drm_file *file_priv);
1082
				      void *data, struct drm_file *file_priv);
1039
extern int drm_mode_getblob_ioctl(struct drm_device *dev,
1083
extern int drm_mode_getblob_ioctl(struct drm_device *dev,
1040
				  void *data, struct drm_file *file_priv);
1084
				  void *data, struct drm_file *file_priv);
1041
extern int drm_mode_connector_property_set_ioctl(struct drm_device *dev,
1085
extern int drm_mode_connector_property_set_ioctl(struct drm_device *dev,
1042
					      void *data, struct drm_file *file_priv);
1086
					      void *data, struct drm_file *file_priv);
1043
extern int drm_mode_hotplug_ioctl(struct drm_device *dev,
-
 
1044
				  void *data, struct drm_file *file_priv);
-
 
1045
extern int drm_mode_replacefb(struct drm_device *dev,
-
 
1046
			      void *data, struct drm_file *file_priv);
-
 
1047
extern int drm_mode_getencoder(struct drm_device *dev,
1087
extern int drm_mode_getencoder(struct drm_device *dev,
1048
			       void *data, struct drm_file *file_priv);
1088
			       void *data, struct drm_file *file_priv);
1049
extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
1089
extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
1050
				    void *data, struct drm_file *file_priv);
1090
				    void *data, struct drm_file *file_priv);
1051
extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
1091
extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
1052
				    void *data, struct drm_file *file_priv);
1092
				    void *data, struct drm_file *file_priv);
1053
extern u8 *drm_find_cea_extension(struct edid *edid);
-
 
1054
extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
1093
extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
1055
extern bool drm_detect_hdmi_monitor(struct edid *edid);
1094
extern bool drm_detect_hdmi_monitor(struct edid *edid);
1056
extern bool drm_detect_monitor_audio(struct edid *edid);
1095
extern bool drm_detect_monitor_audio(struct edid *edid);
1057
extern bool drm_rgb_quant_range_selectable(struct edid *edid);
1096
extern bool drm_rgb_quant_range_selectable(struct edid *edid);
1058
extern int drm_mode_page_flip_ioctl(struct drm_device *dev,
1097
extern int drm_mode_page_flip_ioctl(struct drm_device *dev,