diff options
author | Jesse Barnes <jbarnes@virtuousgeek.org> | 2011-11-14 17:51:27 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-11-15 14:53:10 -0500 |
commit | 8cf5c9177151537e73ff1816540e4ba24b174391 (patch) | |
tree | 0b805659ef5b68550b37166c5d98319c4fde5639 /include | |
parent | e08e96de986ceb2c6b683df0bd0c4ddd4f91dcfd (diff) |
drm: add plane support v3
Planes are a bit like half-CRTCs. They have a location and fb, but
don't drive outputs directly. Add support for handling them to the core
KMS code.
v2: fix ABI of get_plane - move format_type_ptr to the end
v3: add 'flags' field for interlaced support (from Ville)
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Reviewed-by: Rob Clark <rob.clark@linaro.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/drm/drm.h | 3 | ||||
-rw-r--r-- | include/drm/drm_crtc.h | 75 | ||||
-rw-r--r-- | include/drm/drm_mode.h | 47 |
3 files changed, 119 insertions, 6 deletions
diff --git a/include/drm/drm.h b/include/drm/drm.h index 4be33b4ca2f8..28979677f94e 100644 --- a/include/drm/drm.h +++ b/include/drm/drm.h | |||
@@ -714,6 +714,9 @@ struct drm_get_cap { | |||
714 | #define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb) | 714 | #define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb) |
715 | #define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb) | 715 | #define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb) |
716 | #define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb) | 716 | #define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb) |
717 | #define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res) | ||
718 | #define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane) | ||
719 | #define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane) | ||
717 | 720 | ||
718 | /** | 721 | /** |
719 | * Device specific ioctls should only be in their respective headers | 722 | * Device specific ioctls should only be in their respective headers |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 802079809282..e20867ed7c90 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -44,6 +44,7 @@ struct drm_framebuffer; | |||
44 | #define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0 | 44 | #define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0 |
45 | #define DRM_MODE_OBJECT_FB 0xfbfbfbfb | 45 | #define DRM_MODE_OBJECT_FB 0xfbfbfbfb |
46 | #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb | 46 | #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb |
47 | #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee | ||
47 | 48 | ||
48 | struct drm_mode_object { | 49 | struct drm_mode_object { |
49 | uint32_t id; | 50 | uint32_t id; |
@@ -278,6 +279,7 @@ struct drm_crtc; | |||
278 | struct drm_connector; | 279 | struct drm_connector; |
279 | struct drm_encoder; | 280 | struct drm_encoder; |
280 | struct drm_pending_vblank_event; | 281 | struct drm_pending_vblank_event; |
282 | struct drm_plane; | ||
281 | 283 | ||
282 | /** | 284 | /** |
283 | * drm_crtc_funcs - control CRTCs for a given device | 285 | * drm_crtc_funcs - control CRTCs for a given device |
@@ -536,6 +538,62 @@ struct drm_connector { | |||
536 | }; | 538 | }; |
537 | 539 | ||
538 | /** | 540 | /** |
541 | * drm_plane_funcs - driver plane control functions | ||
542 | * @update_plane: update the plane configuration | ||
543 | * @disable_plane: shut down the plane | ||
544 | * @destroy: clean up plane resources | ||
545 | */ | ||
546 | struct drm_plane_funcs { | ||
547 | int (*update_plane)(struct drm_plane *plane, | ||
548 | struct drm_crtc *crtc, struct drm_framebuffer *fb, | ||
549 | int crtc_x, int crtc_y, | ||
550 | unsigned int crtc_w, unsigned int crtc_h, | ||
551 | uint32_t src_x, uint32_t src_y, | ||
552 | uint32_t src_w, uint32_t src_h); | ||
553 | int (*disable_plane)(struct drm_plane *plane); | ||
554 | void (*destroy)(struct drm_plane *plane); | ||
555 | }; | ||
556 | |||
557 | /** | ||
558 | * drm_plane - central DRM plane control structure | ||
559 | * @dev: DRM device this plane belongs to | ||
560 | * @head: for list management | ||
561 | * @base: base mode object | ||
562 | * @possible_crtcs: pipes this plane can be bound to | ||
563 | * @format_types: array of formats supported by this plane | ||
564 | * @format_count: number of formats supported | ||
565 | * @crtc: currently bound CRTC | ||
566 | * @fb: currently bound fb | ||
567 | * @gamma_size: size of gamma table | ||
568 | * @gamma_store: gamma correction table | ||
569 | * @enabled: enabled flag | ||
570 | * @funcs: helper functions | ||
571 | * @helper_private: storage for drver layer | ||
572 | */ | ||
573 | struct drm_plane { | ||
574 | struct drm_device *dev; | ||
575 | struct list_head head; | ||
576 | |||
577 | struct drm_mode_object base; | ||
578 | |||
579 | uint32_t possible_crtcs; | ||
580 | uint32_t *format_types; | ||
581 | uint32_t format_count; | ||
582 | |||
583 | struct drm_crtc *crtc; | ||
584 | struct drm_framebuffer *fb; | ||
585 | |||
586 | /* CRTC gamma size for reporting to userspace */ | ||
587 | uint32_t gamma_size; | ||
588 | uint16_t *gamma_store; | ||
589 | |||
590 | bool enabled; | ||
591 | |||
592 | const struct drm_plane_funcs *funcs; | ||
593 | void *helper_private; | ||
594 | }; | ||
595 | |||
596 | /** | ||
539 | * struct drm_mode_set | 597 | * struct drm_mode_set |
540 | * | 598 | * |
541 | * Represents a single crtc the connectors that it drives with what mode | 599 | * Represents a single crtc the connectors that it drives with what mode |
@@ -589,6 +647,8 @@ struct drm_mode_config { | |||
589 | struct list_head connector_list; | 647 | struct list_head connector_list; |
590 | int num_encoder; | 648 | int num_encoder; |
591 | struct list_head encoder_list; | 649 | struct list_head encoder_list; |
650 | int num_plane; | ||
651 | struct list_head plane_list; | ||
592 | 652 | ||
593 | int num_crtc; | 653 | int num_crtc; |
594 | struct list_head crtc_list; | 654 | struct list_head crtc_list; |
@@ -641,6 +701,7 @@ struct drm_mode_config { | |||
641 | #define obj_to_fb(x) container_of(x, struct drm_framebuffer, base) | 701 | #define obj_to_fb(x) container_of(x, struct drm_framebuffer, base) |
642 | #define obj_to_property(x) container_of(x, struct drm_property, base) | 702 | #define obj_to_property(x) container_of(x, struct drm_property, base) |
643 | #define obj_to_blob(x) container_of(x, struct drm_property_blob, base) | 703 | #define obj_to_blob(x) container_of(x, struct drm_property_blob, base) |
704 | #define obj_to_plane(x) container_of(x, struct drm_plane, base) | ||
644 | 705 | ||
645 | 706 | ||
646 | extern void drm_crtc_init(struct drm_device *dev, | 707 | extern void drm_crtc_init(struct drm_device *dev, |
@@ -660,6 +721,13 @@ extern void drm_encoder_init(struct drm_device *dev, | |||
660 | const struct drm_encoder_funcs *funcs, | 721 | const struct drm_encoder_funcs *funcs, |
661 | int encoder_type); | 722 | int encoder_type); |
662 | 723 | ||
724 | extern int drm_plane_init(struct drm_device *dev, | ||
725 | struct drm_plane *plane, | ||
726 | unsigned long possible_crtcs, | ||
727 | const struct drm_plane_funcs *funcs, | ||
728 | uint32_t *formats, uint32_t format_count); | ||
729 | extern void drm_plane_cleanup(struct drm_plane *plane); | ||
730 | |||
663 | extern void drm_encoder_cleanup(struct drm_encoder *encoder); | 731 | extern void drm_encoder_cleanup(struct drm_encoder *encoder); |
664 | 732 | ||
665 | extern char *drm_get_connector_name(struct drm_connector *connector); | 733 | extern char *drm_get_connector_name(struct drm_connector *connector); |
@@ -753,13 +821,18 @@ extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, | |||
753 | /* IOCTLs */ | 821 | /* IOCTLs */ |
754 | extern int drm_mode_getresources(struct drm_device *dev, | 822 | extern int drm_mode_getresources(struct drm_device *dev, |
755 | void *data, struct drm_file *file_priv); | 823 | void *data, struct drm_file *file_priv); |
756 | 824 | extern int drm_mode_getplane_res(struct drm_device *dev, void *data, | |
825 | struct drm_file *file_priv); | ||
757 | extern int drm_mode_getcrtc(struct drm_device *dev, | 826 | extern int drm_mode_getcrtc(struct drm_device *dev, |
758 | void *data, struct drm_file *file_priv); | 827 | void *data, struct drm_file *file_priv); |
759 | extern int drm_mode_getconnector(struct drm_device *dev, | 828 | extern int drm_mode_getconnector(struct drm_device *dev, |
760 | void *data, struct drm_file *file_priv); | 829 | void *data, struct drm_file *file_priv); |
761 | extern int drm_mode_setcrtc(struct drm_device *dev, | 830 | extern int drm_mode_setcrtc(struct drm_device *dev, |
762 | void *data, struct drm_file *file_priv); | 831 | void *data, struct drm_file *file_priv); |
832 | extern int drm_mode_getplane(struct drm_device *dev, | ||
833 | void *data, struct drm_file *file_priv); | ||
834 | extern int drm_mode_setplane(struct drm_device *dev, | ||
835 | void *data, struct drm_file *file_priv); | ||
763 | extern int drm_mode_cursor_ioctl(struct drm_device *dev, | 836 | extern int drm_mode_cursor_ioctl(struct drm_device *dev, |
764 | void *data, struct drm_file *file_priv); | 837 | void *data, struct drm_file *file_priv); |
765 | extern int drm_mode_addfb(struct drm_device *dev, | 838 | extern int drm_mode_addfb(struct drm_device *dev, |
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h index d30bedfeb7ef..44576a54dc3b 100644 --- a/include/drm/drm_mode.h +++ b/include/drm/drm_mode.h | |||
@@ -120,11 +120,48 @@ struct drm_mode_crtc { | |||
120 | struct drm_mode_modeinfo mode; | 120 | struct drm_mode_modeinfo mode; |
121 | }; | 121 | }; |
122 | 122 | ||
123 | #define DRM_MODE_ENCODER_NONE 0 | 123 | #define DRM_MODE_PRESENT_TOP_FIELD (1<<0) |
124 | #define DRM_MODE_ENCODER_DAC 1 | 124 | #define DRM_MODE_PRESENT_BOTTOM_FIELD (1<<1) |
125 | #define DRM_MODE_ENCODER_TMDS 2 | 125 | |
126 | #define DRM_MODE_ENCODER_LVDS 3 | 126 | /* Planes blend with or override other bits on the CRTC */ |
127 | #define DRM_MODE_ENCODER_TVDAC 4 | 127 | struct drm_mode_set_plane { |
128 | __u32 plane_id; | ||
129 | __u32 crtc_id; | ||
130 | __u32 fb_id; /* fb object contains surface format type */ | ||
131 | __u32 flags; /* see above flags */ | ||
132 | |||
133 | /* Signed dest location allows it to be partially off screen */ | ||
134 | __s32 crtc_x, crtc_y; | ||
135 | __u32 crtc_w, crtc_h; | ||
136 | |||
137 | /* Source values are 16.16 fixed point */ | ||
138 | __u32 src_x, src_y; | ||
139 | __u32 src_h, src_w; | ||
140 | }; | ||
141 | |||
142 | struct drm_mode_get_plane { | ||
143 | __u32 plane_id; | ||
144 | |||
145 | __u32 crtc_id; | ||
146 | __u32 fb_id; | ||
147 | |||
148 | __u32 possible_crtcs; | ||
149 | __u32 gamma_size; | ||
150 | |||
151 | __u32 count_format_types; | ||
152 | __u64 format_type_ptr; | ||
153 | }; | ||
154 | |||
155 | struct drm_mode_get_plane_res { | ||
156 | __u64 plane_id_ptr; | ||
157 | __u32 count_planes; | ||
158 | }; | ||
159 | |||
160 | #define DRM_MODE_ENCODER_NONE 0 | ||
161 | #define DRM_MODE_ENCODER_DAC 1 | ||
162 | #define DRM_MODE_ENCODER_TMDS 2 | ||
163 | #define DRM_MODE_ENCODER_LVDS 3 | ||
164 | #define DRM_MODE_ENCODER_TVDAC 4 | ||
128 | #define DRM_MODE_ENCODER_VIRTUAL 5 | 165 | #define DRM_MODE_ENCODER_VIRTUAL 5 |
129 | 166 | ||
130 | struct drm_mode_get_encoder { | 167 | struct drm_mode_get_encoder { |