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/drm/drm_crtc.h | |
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/drm/drm_crtc.h')
-rw-r--r-- | include/drm/drm_crtc.h | 75 |
1 files changed, 74 insertions, 1 deletions
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, |