aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-10 14:04:36 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-10 14:04:36 -0500
commit1a464cbb3d483f2f195b614cffa4aa1b910a0440 (patch)
treeaf57dee6436532dbb546b8670e9e1f6910d489b5 /include
parentdbe950f201a8edd353b0bd9079e8d536ee4ce37c (diff)
parent095f979a539245a46b9e5d600ec9c720b4d928e5 (diff)
Merge branch 'drm-core-next' of git://people.freedesktop.org/~airlied/linux
* 'drm-core-next' of git://people.freedesktop.org/~airlied/linux: (307 commits) drm/nouveau/pm: fix build with HWMON off gma500: silence gcc warnings in mid_get_vbt_data() drm/ttm: fix condition (and vs or) drm/radeon: double lock typo in radeon_vm_bo_rmv() drm/radeon: use after free in radeon_vm_bo_add() drm/sis|via: don't return stack garbage from free_mem ioctl drm/radeon/kms: remove pointless CS flags priority struct drm/radeon/kms: check if vm is supported in VA ioctl drm: introduce drm_can_sleep and use in intel/radeon drivers. (v2) radeon: Fix disabling PCI bus mastering on big endian hosts. ttm: fix agp since ttm tt rework agp: Fix multi-line warning message whitespace drm/ttm/dma: Fix accounting error when calling ttm_mem_global_free_page and don't try to free freed pages. drm/ttm/dma: Only call set_pages_array_wb when the page is not in WB pool. drm/radeon/kms: sync across multiple rings when doing bo moves v3 drm/radeon/kms: Add support for multi-ring sync in CS ioctl (v2) drm/radeon: GPU virtual memory support v22 drm: make DRM_UNLOCKED ioctls with their own mutex drm: no need to hold global mutex for static data drm/radeon/benchmark: common modes sweep ignores 640x480@32 ... Fix up trivial conflicts in radeon/evergreen.c and vmwgfx/vmwgfx_kms.c
Diffstat (limited to 'include')
-rw-r--r--include/drm/Kbuild1
-rw-r--r--include/drm/drm.h4
-rw-r--r--include/drm/drmP.h10
-rw-r--r--include/drm/drm_crtc.h212
-rw-r--r--include/drm/drm_crtc_helper.h5
-rw-r--r--include/drm/drm_fourcc.h137
-rw-r--r--include/drm/drm_mode.h74
-rw-r--r--include/drm/drm_sman.h176
-rw-r--r--include/drm/exynos_drm.h37
-rw-r--r--include/drm/gma_drm.h91
-rw-r--r--include/drm/i915_drm.h40
-rw-r--r--include/drm/radeon_drm.h36
-rw-r--r--include/drm/sis_drm.h4
-rw-r--r--include/drm/ttm/ttm_bo_api.h24
-rw-r--r--include/drm/ttm/ttm_bo_driver.h203
-rw-r--r--include/drm/ttm/ttm_page_alloc.h77
-rw-r--r--include/drm/via_drm.h4
-rw-r--r--include/linux/swiotlb.h2
18 files changed, 793 insertions, 344 deletions
diff --git a/include/drm/Kbuild b/include/drm/Kbuild
index 3a60ac88952..a5c0e10fd47 100644
--- a/include/drm/Kbuild
+++ b/include/drm/Kbuild
@@ -1,4 +1,5 @@
1header-y += drm.h 1header-y += drm.h
2header-y += drm_fourcc.h
2header-y += drm_mode.h 3header-y += drm_mode.h
3header-y += drm_sarea.h 4header-y += drm_sarea.h
4header-y += i810_drm.h 5header-y += i810_drm.h
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 4be33b4ca2f..49d94ede2ec 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -714,6 +714,10 @@ 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)
720#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2)
717 721
718/** 722/**
719 * Device specific ioctls should only be in their respective headers 723 * Device specific ioctls should only be in their respective headers
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index e8acca892af..76caa67c22e 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -918,7 +918,7 @@ struct drm_driver {
918 int dev_priv_size; 918 int dev_priv_size;
919 struct drm_ioctl_desc *ioctls; 919 struct drm_ioctl_desc *ioctls;
920 int num_ioctls; 920 int num_ioctls;
921 struct file_operations fops; 921 const struct file_operations *fops;
922 union { 922 union {
923 struct pci_driver *pci; 923 struct pci_driver *pci;
924 struct platform_device *platform_device; 924 struct platform_device *platform_device;
@@ -1696,5 +1696,13 @@ extern void drm_platform_exit(struct drm_driver *driver, struct platform_device
1696extern int drm_get_platform_dev(struct platform_device *pdev, 1696extern int drm_get_platform_dev(struct platform_device *pdev,
1697 struct drm_driver *driver); 1697 struct drm_driver *driver);
1698 1698
1699/* returns true if currently okay to sleep */
1700static __inline__ bool drm_can_sleep(void)
1701{
1702 if (in_atomic() || in_dbg_master() || irqs_disabled())
1703 return false;
1704 return true;
1705}
1706
1699#endif /* __KERNEL__ */ 1707#endif /* __KERNEL__ */
1700#endif 1708#endif
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 80207980928..63e4fce6728 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -29,9 +29,10 @@
29#include <linux/spinlock.h> 29#include <linux/spinlock.h>
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/idr.h> 31#include <linux/idr.h>
32
33#include <linux/fb.h> 32#include <linux/fb.h>
34 33
34#include <drm/drm_fourcc.h>
35
35struct drm_device; 36struct drm_device;
36struct drm_mode_set; 37struct drm_mode_set;
37struct drm_framebuffer; 38struct drm_framebuffer;
@@ -44,6 +45,7 @@ struct drm_framebuffer;
44#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0 45#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
45#define DRM_MODE_OBJECT_FB 0xfbfbfbfb 46#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
46#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb 47#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
48#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
47 49
48struct drm_mode_object { 50struct drm_mode_object {
49 uint32_t id; 51 uint32_t id;
@@ -118,7 +120,6 @@ struct drm_display_mode {
118 120
119 char name[DRM_DISPLAY_MODE_LEN]; 121 char name[DRM_DISPLAY_MODE_LEN];
120 122
121 int connector_count;
122 enum drm_mode_status status; 123 enum drm_mode_status status;
123 int type; 124 int type;
124 125
@@ -238,13 +239,15 @@ struct drm_framebuffer {
238 struct list_head head; 239 struct list_head head;
239 struct drm_mode_object base; 240 struct drm_mode_object base;
240 const struct drm_framebuffer_funcs *funcs; 241 const struct drm_framebuffer_funcs *funcs;
241 unsigned int pitch; 242 unsigned int pitches[4];
243 unsigned int offsets[4];
242 unsigned int width; 244 unsigned int width;
243 unsigned int height; 245 unsigned int height;
244 /* depth can be 15 or 16 */ 246 /* depth can be 15 or 16 */
245 unsigned int depth; 247 unsigned int depth;
246 int bits_per_pixel; 248 int bits_per_pixel;
247 int flags; 249 int flags;
250 uint32_t pixel_format; /* fourcc format */
248 struct list_head filp_head; 251 struct list_head filp_head;
249 /* if you are using the helper */ 252 /* if you are using the helper */
250 void *helper_private; 253 void *helper_private;
@@ -278,6 +281,7 @@ struct drm_crtc;
278struct drm_connector; 281struct drm_connector;
279struct drm_encoder; 282struct drm_encoder;
280struct drm_pending_vblank_event; 283struct drm_pending_vblank_event;
284struct drm_plane;
281 285
282/** 286/**
283 * drm_crtc_funcs - control CRTCs for a given device 287 * drm_crtc_funcs - control CRTCs for a given device
@@ -341,10 +345,21 @@ struct drm_crtc_funcs {
341 345
342/** 346/**
343 * drm_crtc - central CRTC control structure 347 * drm_crtc - central CRTC control structure
348 * @dev: parent DRM device
349 * @head: list management
350 * @base: base KMS object for ID tracking etc.
344 * @enabled: is this CRTC enabled? 351 * @enabled: is this CRTC enabled?
352 * @mode: current mode timings
353 * @hwmode: mode timings as programmed to hw regs
345 * @x: x position on screen 354 * @x: x position on screen
346 * @y: y position on screen 355 * @y: y position on screen
347 * @funcs: CRTC control functions 356 * @funcs: CRTC control functions
357 * @gamma_size: size of gamma ramp
358 * @gamma_store: gamma ramp values
359 * @framedur_ns: precise frame timing
360 * @framedur_ns: precise line timing
361 * @pixeldur_ns: precise pixel timing
362 * @helper_private: mid-layer private data
348 * 363 *
349 * Each CRTC may have one or more connectors associated with it. This structure 364 * Each CRTC may have one or more connectors associated with it. This structure
350 * allows the CRTC to be controlled. 365 * allows the CRTC to be controlled.
@@ -423,6 +438,13 @@ struct drm_connector_funcs {
423 void (*force)(struct drm_connector *connector); 438 void (*force)(struct drm_connector *connector);
424}; 439};
425 440
441/**
442 * drm_encoder_funcs - encoder controls
443 * @reset: reset state (e.g. at init or resume time)
444 * @destroy: cleanup and free associated data
445 *
446 * Encoders sit between CRTCs and connectors.
447 */
426struct drm_encoder_funcs { 448struct drm_encoder_funcs {
427 void (*reset)(struct drm_encoder *encoder); 449 void (*reset)(struct drm_encoder *encoder);
428 void (*destroy)(struct drm_encoder *encoder); 450 void (*destroy)(struct drm_encoder *encoder);
@@ -435,6 +457,18 @@ struct drm_encoder_funcs {
435 457
436/** 458/**
437 * drm_encoder - central DRM encoder structure 459 * drm_encoder - central DRM encoder structure
460 * @dev: parent DRM device
461 * @head: list management
462 * @base: base KMS object
463 * @encoder_type: one of the %DRM_MODE_ENCODER_<foo> types in drm_mode.h
464 * @possible_crtcs: bitmask of potential CRTC bindings
465 * @possible_clones: bitmask of potential sibling encoders for cloning
466 * @crtc: currently bound CRTC
467 * @funcs: control functions
468 * @helper_private: mid-layer private data
469 *
470 * CRTCs drive pixels to encoders, which convert them into signals
471 * appropriate for a given connector or set of connectors.
438 */ 472 */
439struct drm_encoder { 473struct drm_encoder {
440 struct drm_device *dev; 474 struct drm_device *dev;
@@ -470,14 +504,37 @@ enum drm_connector_force {
470 504
471/** 505/**
472 * drm_connector - central DRM connector control structure 506 * drm_connector - central DRM connector control structure
473 * @crtc: CRTC this connector is currently connected to, NULL if none 507 * @dev: parent DRM device
508 * @kdev: kernel device for sysfs attributes
509 * @attr: sysfs attributes
510 * @head: list management
511 * @base: base KMS object
512 * @connector_type: one of the %DRM_MODE_CONNECTOR_<foo> types from drm_mode.h
513 * @connector_type_id: index into connector type enum
474 * @interlace_allowed: can this connector handle interlaced modes? 514 * @interlace_allowed: can this connector handle interlaced modes?
475 * @doublescan_allowed: can this connector handle doublescan? 515 * @doublescan_allowed: can this connector handle doublescan?
476 * @available_modes: modes available on this connector (from get_modes() + user) 516 * @modes: modes available on this connector (from fill_modes() + user)
477 * @initial_x: initial x position for this connector 517 * @status: one of the drm_connector_status enums (connected, not, or unknown)
478 * @initial_y: initial y position for this connector 518 * @probed_modes: list of modes derived directly from the display
479 * @status: connector connected? 519 * @display_info: information about attached display (e.g. from EDID)
480 * @funcs: connector control functions 520 * @funcs: connector control functions
521 * @user_modes: user added mode list
522 * @edid_blob_ptr: DRM property containing EDID if present
523 * @property_ids: property tracking for this connector
524 * @property_values: value pointers or data for properties
525 * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling
526 * @dpms: current dpms state
527 * @helper_private: mid-layer private data
528 * @force: a %DRM_FORCE_<foo> state for forced mode sets
529 * @encoder_ids: valid encoders for this connector
530 * @encoder: encoder driving this connector, if any
531 * @eld: EDID-like data, if present
532 * @dvi_dual: dual link DVI, if found
533 * @max_tmds_clock: max clock rate, if found
534 * @latency_present: AV delay info from ELD, if found
535 * @video_latency: video latency info from ELD, if found
536 * @audio_latency: audio latency info from ELD, if found
537 * @null_edid_counter: track sinks that give us all zeros for the EDID
481 * 538 *
482 * Each connector may be connected to one or more CRTCs, or may be clonable by 539 * Each connector may be connected to one or more CRTCs, or may be clonable by
483 * another connector if they can share a CRTC. Each connector also has a specific 540 * another connector if they can share a CRTC. Each connector also has a specific
@@ -498,7 +555,6 @@ struct drm_connector {
498 bool doublescan_allowed; 555 bool doublescan_allowed;
499 struct list_head modes; /* list of modes on this connector */ 556 struct list_head modes; /* list of modes on this connector */
500 557
501 int initial_x, initial_y;
502 enum drm_connector_status status; 558 enum drm_connector_status status;
503 559
504 /* these are modes added by probing with DDC or the BIOS */ 560 /* these are modes added by probing with DDC or the BIOS */
@@ -522,7 +578,6 @@ struct drm_connector {
522 /* forced on connector */ 578 /* forced on connector */
523 enum drm_connector_force force; 579 enum drm_connector_force force;
524 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; 580 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
525 uint32_t force_encoder_id;
526 struct drm_encoder *encoder; /* currently active encoder */ 581 struct drm_encoder *encoder; /* currently active encoder */
527 582
528 /* EDID bits */ 583 /* EDID bits */
@@ -536,7 +591,71 @@ struct drm_connector {
536}; 591};
537 592
538/** 593/**
539 * struct drm_mode_set 594 * drm_plane_funcs - driver plane control functions
595 * @update_plane: update the plane configuration
596 * @disable_plane: shut down the plane
597 * @destroy: clean up plane resources
598 */
599struct drm_plane_funcs {
600 int (*update_plane)(struct drm_plane *plane,
601 struct drm_crtc *crtc, struct drm_framebuffer *fb,
602 int crtc_x, int crtc_y,
603 unsigned int crtc_w, unsigned int crtc_h,
604 uint32_t src_x, uint32_t src_y,
605 uint32_t src_w, uint32_t src_h);
606 int (*disable_plane)(struct drm_plane *plane);
607 void (*destroy)(struct drm_plane *plane);
608};
609
610/**
611 * drm_plane - central DRM plane control structure
612 * @dev: DRM device this plane belongs to
613 * @head: for list management
614 * @base: base mode object
615 * @possible_crtcs: pipes this plane can be bound to
616 * @format_types: array of formats supported by this plane
617 * @format_count: number of formats supported
618 * @crtc: currently bound CRTC
619 * @fb: currently bound fb
620 * @gamma_size: size of gamma table
621 * @gamma_store: gamma correction table
622 * @enabled: enabled flag
623 * @funcs: helper functions
624 * @helper_private: storage for drver layer
625 */
626struct drm_plane {
627 struct drm_device *dev;
628 struct list_head head;
629
630 struct drm_mode_object base;
631
632 uint32_t possible_crtcs;
633 uint32_t *format_types;
634 uint32_t format_count;
635
636 struct drm_crtc *crtc;
637 struct drm_framebuffer *fb;
638
639 /* CRTC gamma size for reporting to userspace */
640 uint32_t gamma_size;
641 uint16_t *gamma_store;
642
643 bool enabled;
644
645 const struct drm_plane_funcs *funcs;
646 void *helper_private;
647};
648
649/**
650 * drm_mode_set - new values for a CRTC config change
651 * @head: list management
652 * @fb: framebuffer to use for new config
653 * @crtc: CRTC whose configuration we're about to change
654 * @mode: mode timings to use
655 * @x: position of this CRTC relative to @fb
656 * @y: position of this CRTC relative to @fb
657 * @connectors: array of connectors to drive with this CRTC if possible
658 * @num_connectors: size of @connectors array
540 * 659 *
541 * Represents a single crtc the connectors that it drives with what mode 660 * Represents a single crtc the connectors that it drives with what mode
542 * and from which framebuffer it scans out from. 661 * and from which framebuffer it scans out from.
@@ -558,13 +677,33 @@ struct drm_mode_set {
558}; 677};
559 678
560/** 679/**
561 * struct drm_mode_config_funcs - configure CRTCs for a given screen layout 680 * struct drm_mode_config_funcs - basic driver provided mode setting functions
681 * @fb_create: create a new framebuffer object
682 * @output_poll_changed: function to handle output configuration changes
683 *
684 * Some global (i.e. not per-CRTC, connector, etc) mode setting functions that
685 * involve drivers.
562 */ 686 */
563struct drm_mode_config_funcs { 687struct drm_mode_config_funcs {
564 struct drm_framebuffer *(*fb_create)(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd *mode_cmd); 688 struct drm_framebuffer *(*fb_create)(struct drm_device *dev,
689 struct drm_file *file_priv,
690 struct drm_mode_fb_cmd2 *mode_cmd);
565 void (*output_poll_changed)(struct drm_device *dev); 691 void (*output_poll_changed)(struct drm_device *dev);
566}; 692};
567 693
694/**
695 * drm_mode_group - group of mode setting resources for potential sub-grouping
696 * @num_crtcs: CRTC count
697 * @num_encoders: encoder count
698 * @num_connectors: connector count
699 * @id_list: list of KMS object IDs in this group
700 *
701 * Currently this simply tracks the global mode setting state. But in the
702 * future it could allow groups of objects to be set aside into independent
703 * control groups for use by different user level processes (e.g. two X servers
704 * running simultaneously on different heads, each with their own mode
705 * configuration and freedom of mode setting).
706 */
568struct drm_mode_group { 707struct drm_mode_group {
569 uint32_t num_crtcs; 708 uint32_t num_crtcs;
570 uint32_t num_encoders; 709 uint32_t num_encoders;
@@ -576,7 +715,30 @@ struct drm_mode_group {
576 715
577/** 716/**
578 * drm_mode_config - Mode configuration control structure 717 * drm_mode_config - Mode configuration control structure
718 * @mutex: mutex protecting KMS related lists and structures
719 * @idr_mutex: mutex for KMS ID allocation and management
720 * @crtc_idr: main KMS ID tracking object
721 * @num_fb: number of fbs available
722 * @fb_list: list of framebuffers available
723 * @num_connector: number of connectors on this device
724 * @connector_list: list of connector objects
725 * @num_encoder: number of encoders on this device
726 * @encoder_list: list of encoder objects
727 * @num_crtc: number of CRTCs on this device
728 * @crtc_list: list of CRTC objects
729 * @min_width: minimum pixel width on this device
730 * @min_height: minimum pixel height on this device
731 * @max_width: maximum pixel width on this device
732 * @max_height: maximum pixel height on this device
733 * @funcs: core driver provided mode setting functions
734 * @fb_base: base address of the framebuffer
735 * @poll_enabled: track polling status for this device
736 * @output_poll_work: delayed work for polling in process context
737 * @*_property: core property tracking
579 * 738 *
739 * Core mode resource tracking structure. All CRTC, encoders, and connectors
740 * enumerated by the driver are added here, as are global properties. Some
741 * global restrictions are also here, e.g. dimension restrictions.
580 */ 742 */
581struct drm_mode_config { 743struct drm_mode_config {
582 struct mutex mutex; /* protects configuration (mode lists etc.) */ 744 struct mutex mutex; /* protects configuration (mode lists etc.) */
@@ -589,6 +751,8 @@ struct drm_mode_config {
589 struct list_head connector_list; 751 struct list_head connector_list;
590 int num_encoder; 752 int num_encoder;
591 struct list_head encoder_list; 753 struct list_head encoder_list;
754 int num_plane;
755 struct list_head plane_list;
592 756
593 int num_crtc; 757 int num_crtc;
594 struct list_head crtc_list; 758 struct list_head crtc_list;
@@ -641,6 +805,7 @@ struct drm_mode_config {
641#define obj_to_fb(x) container_of(x, struct drm_framebuffer, base) 805#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) 806#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) 807#define obj_to_blob(x) container_of(x, struct drm_property_blob, base)
808#define obj_to_plane(x) container_of(x, struct drm_plane, base)
644 809
645 810
646extern void drm_crtc_init(struct drm_device *dev, 811extern void drm_crtc_init(struct drm_device *dev,
@@ -660,6 +825,14 @@ extern void drm_encoder_init(struct drm_device *dev,
660 const struct drm_encoder_funcs *funcs, 825 const struct drm_encoder_funcs *funcs,
661 int encoder_type); 826 int encoder_type);
662 827
828extern int drm_plane_init(struct drm_device *dev,
829 struct drm_plane *plane,
830 unsigned long possible_crtcs,
831 const struct drm_plane_funcs *funcs,
832 const uint32_t *formats, uint32_t format_count,
833 bool priv);
834extern void drm_plane_cleanup(struct drm_plane *plane);
835
663extern void drm_encoder_cleanup(struct drm_encoder *encoder); 836extern void drm_encoder_cleanup(struct drm_encoder *encoder);
664 837
665extern char *drm_get_connector_name(struct drm_connector *connector); 838extern char *drm_get_connector_name(struct drm_connector *connector);
@@ -753,17 +926,25 @@ extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev,
753/* IOCTLs */ 926/* IOCTLs */
754extern int drm_mode_getresources(struct drm_device *dev, 927extern int drm_mode_getresources(struct drm_device *dev,
755 void *data, struct drm_file *file_priv); 928 void *data, struct drm_file *file_priv);
756 929extern int drm_mode_getplane_res(struct drm_device *dev, void *data,
930 struct drm_file *file_priv);
757extern int drm_mode_getcrtc(struct drm_device *dev, 931extern int drm_mode_getcrtc(struct drm_device *dev,
758 void *data, struct drm_file *file_priv); 932 void *data, struct drm_file *file_priv);
759extern int drm_mode_getconnector(struct drm_device *dev, 933extern int drm_mode_getconnector(struct drm_device *dev,
760 void *data, struct drm_file *file_priv); 934 void *data, struct drm_file *file_priv);
761extern int drm_mode_setcrtc(struct drm_device *dev, 935extern int drm_mode_setcrtc(struct drm_device *dev,
762 void *data, struct drm_file *file_priv); 936 void *data, struct drm_file *file_priv);
937extern int drm_mode_getplane(struct drm_device *dev,
938 void *data, struct drm_file *file_priv);
939extern int drm_mode_setplane(struct drm_device *dev,
940 void *data, struct drm_file *file_priv);
763extern int drm_mode_cursor_ioctl(struct drm_device *dev, 941extern int drm_mode_cursor_ioctl(struct drm_device *dev,
764 void *data, struct drm_file *file_priv); 942 void *data, struct drm_file *file_priv);
765extern int drm_mode_addfb(struct drm_device *dev, 943extern int drm_mode_addfb(struct drm_device *dev,
766 void *data, struct drm_file *file_priv); 944 void *data, struct drm_file *file_priv);
945extern int drm_mode_addfb2(struct drm_device *dev,
946 void *data, struct drm_file *file_priv);
947extern uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth);
767extern int drm_mode_rmfb(struct drm_device *dev, 948extern int drm_mode_rmfb(struct drm_device *dev,
768 void *data, struct drm_file *file_priv); 949 void *data, struct drm_file *file_priv);
769extern int drm_mode_getfb(struct drm_device *dev, 950extern int drm_mode_getfb(struct drm_device *dev,
@@ -824,4 +1005,7 @@ extern int drm_mode_mmap_dumb_ioctl(struct drm_device *dev,
824 void *data, struct drm_file *file_priv); 1005 void *data, struct drm_file *file_priv);
825extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, 1006extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
826 void *data, struct drm_file *file_priv); 1007 void *data, struct drm_file *file_priv);
1008
1009extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
1010 int *bpp);
827#endif /* __DRM_CRTC_H__ */ 1011#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index 73b071203dc..37515d1afab 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -117,7 +117,7 @@ extern bool drm_helper_encoder_in_use(struct drm_encoder *encoder);
117extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode); 117extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode);
118 118
119extern int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb, 119extern int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
120 struct drm_mode_fb_cmd *mode_cmd); 120 struct drm_mode_fb_cmd2 *mode_cmd);
121 121
122static inline void drm_crtc_helper_add(struct drm_crtc *crtc, 122static inline void drm_crtc_helper_add(struct drm_crtc *crtc,
123 const struct drm_crtc_helper_funcs *funcs) 123 const struct drm_crtc_helper_funcs *funcs)
@@ -144,4 +144,7 @@ extern void drm_helper_hpd_irq_event(struct drm_device *dev);
144 144
145extern void drm_kms_helper_poll_disable(struct drm_device *dev); 145extern void drm_kms_helper_poll_disable(struct drm_device *dev);
146extern void drm_kms_helper_poll_enable(struct drm_device *dev); 146extern void drm_kms_helper_poll_enable(struct drm_device *dev);
147
148extern int drm_format_num_planes(uint32_t format);
149
147#endif 150#endif
diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
new file mode 100644
index 00000000000..bdf0152cbbe
--- /dev/null
+++ b/include/drm/drm_fourcc.h
@@ -0,0 +1,137 @@
1/*
2 * Copyright 2011 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24#ifndef DRM_FOURCC_H
25#define DRM_FOURCC_H
26
27#include <linux/types.h>
28
29#define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \
30 ((__u32)(c) << 16) | ((__u32)(d) << 24))
31
32#define DRM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */
33
34/* color index */
35#define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */
36
37/* 8 bpp RGB */
38#define DRM_FORMAT_RGB332 fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */
39#define DRM_FORMAT_BGR233 fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */
40
41/* 16 bpp RGB */
42#define DRM_FORMAT_XRGB4444 fourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */
43#define DRM_FORMAT_XBGR4444 fourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */
44#define DRM_FORMAT_RGBX4444 fourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */
45#define DRM_FORMAT_BGRX4444 fourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */
46
47#define DRM_FORMAT_ARGB4444 fourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */
48#define DRM_FORMAT_ABGR4444 fourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */
49#define DRM_FORMAT_RGBA4444 fourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */
50#define DRM_FORMAT_BGRA4444 fourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */
51
52#define DRM_FORMAT_XRGB1555 fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */
53#define DRM_FORMAT_XBGR1555 fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */
54#define DRM_FORMAT_RGBX5551 fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */
55#define DRM_FORMAT_BGRX5551 fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */
56
57#define DRM_FORMAT_ARGB1555 fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */
58#define DRM_FORMAT_ABGR1555 fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */
59#define DRM_FORMAT_RGBA5551 fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */
60#define DRM_FORMAT_BGRA5551 fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */
61
62#define DRM_FORMAT_RGB565 fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */
63#define DRM_FORMAT_BGR565 fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */
64
65/* 24 bpp RGB */
66#define DRM_FORMAT_RGB888 fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */
67#define DRM_FORMAT_BGR888 fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */
68
69/* 32 bpp RGB */
70#define DRM_FORMAT_XRGB8888 fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */
71#define DRM_FORMAT_XBGR8888 fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */
72#define DRM_FORMAT_RGBX8888 fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */
73#define DRM_FORMAT_BGRX8888 fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */
74
75#define DRM_FORMAT_ARGB8888 fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */
76#define DRM_FORMAT_ABGR8888 fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */
77#define DRM_FORMAT_RGBA8888 fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */
78#define DRM_FORMAT_BGRA8888 fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */
79
80#define DRM_FORMAT_XRGB2101010 fourcc_code('X', 'R', '3', '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */
81#define DRM_FORMAT_XBGR2101010 fourcc_code('X', 'B', '3', '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */
82#define DRM_FORMAT_RGBX1010102 fourcc_code('R', 'X', '3', '0') /* [31:0] R:G:B:x 10:10:10:2 little endian */
83#define DRM_FORMAT_BGRX1010102 fourcc_code('B', 'X', '3', '0') /* [31:0] B:G:R:x 10:10:10:2 little endian */
84
85#define DRM_FORMAT_ARGB2101010 fourcc_code('A', 'R', '3', '0') /* [31:0] A:R:G:B 2:10:10:10 little endian */
86#define DRM_FORMAT_ABGR2101010 fourcc_code('A', 'B', '3', '0') /* [31:0] A:B:G:R 2:10:10:10 little endian */
87#define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */
88#define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */
89
90/* packed YCbCr */
91#define DRM_FORMAT_YUYV fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */
92#define DRM_FORMAT_YVYU fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */
93#define DRM_FORMAT_UYVY fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */
94#define DRM_FORMAT_VYUY fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */
95
96#define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
97
98/*
99 * 2 plane YCbCr
100 * index 0 = Y plane, [7:0] Y
101 * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
102 * or
103 * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
104 */
105#define DRM_FORMAT_NV12 fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */
106#define DRM_FORMAT_NV21 fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */
107#define DRM_FORMAT_NV16 fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */
108#define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */
109
110/* 2 non contiguous plane YCbCr */
111#define DRM_FORMAT_NV12M fourcc_code('N', 'M', '1', '2') /* 2x2 subsampled Cr:Cb plane */
112#define DRM_FORMAT_NV12MT fourcc_code('T', 'M', '1', '2') /* 2x2 subsampled Cr:Cb plane 64x32 macroblocks */
113
114/*
115 * 3 plane YCbCr
116 * index 0: Y plane, [7:0] Y
117 * index 1: Cb plane, [7:0] Cb
118 * index 2: Cr plane, [7:0] Cr
119 * or
120 * index 1: Cr plane, [7:0] Cr
121 * index 2: Cb plane, [7:0] Cb
122 */
123#define DRM_FORMAT_YUV410 fourcc_code('Y', 'U', 'V', '9') /* 4x4 subsampled Cb (1) and Cr (2) planes */
124#define DRM_FORMAT_YVU410 fourcc_code('Y', 'V', 'U', '9') /* 4x4 subsampled Cr (1) and Cb (2) planes */
125#define DRM_FORMAT_YUV411 fourcc_code('Y', 'U', '1', '1') /* 4x1 subsampled Cb (1) and Cr (2) planes */
126#define DRM_FORMAT_YVU411 fourcc_code('Y', 'V', '1', '1') /* 4x1 subsampled Cr (1) and Cb (2) planes */
127#define DRM_FORMAT_YUV420 fourcc_code('Y', 'U', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */
128#define DRM_FORMAT_YVU420 fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */
129#define DRM_FORMAT_YUV422 fourcc_code('Y', 'U', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes */
130#define DRM_FORMAT_YVU422 fourcc_code('Y', 'V', '1', '6') /* 2x1 subsampled Cr (1) and Cb (2) planes */
131#define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */
132#define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */
133
134/* 3 non contiguous plane YCbCr */
135#define DRM_FORMAT_YUV420M fourcc_code('Y', 'M', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */
136
137#endif /* DRM_FOURCC_H */
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index ddd46db65b5..2a2acda8b43 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 127struct 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
142struct 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
155struct 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
130struct drm_mode_get_encoder { 167struct drm_mode_get_encoder {
@@ -231,6 +268,33 @@ struct drm_mode_fb_cmd {
231 __u32 handle; 268 __u32 handle;
232}; 269};
233 270
271#define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */
272
273struct drm_mode_fb_cmd2 {
274 __u32 fb_id;
275 __u32 width, height;
276 __u32 pixel_format; /* fourcc code from drm_fourcc.h */
277 __u32 flags; /* see above flags */
278
279 /*
280 * In case of planar formats, this ioctl allows up to 4
281 * buffer objects with offets and pitches per plane.
282 * The pitch and offset order is dictated by the fourcc,
283 * e.g. NV12 (http://fourcc.org/yuv.php#NV12) is described as:
284 *
285 * YUV 4:2:0 image with a plane of 8 bit Y samples
286 * followed by an interleaved U/V plane containing
287 * 8 bit 2x2 subsampled colour difference samples.
288 *
289 * So it would consist of Y as offset[0] and UV as
290 * offeset[1]. Note that offset[0] will generally
291 * be 0.
292 */
293 __u32 handles[4];
294 __u32 pitches[4]; /* pitch for each plane */
295 __u32 offsets[4]; /* offset of each plane */
296};
297
234#define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01 298#define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01
235#define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02 299#define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02
236#define DRM_MODE_FB_DIRTY_FLAGS 0x03 300#define DRM_MODE_FB_DIRTY_FLAGS 0x03
diff --git a/include/drm/drm_sman.h b/include/drm/drm_sman.h
deleted file mode 100644
index 08ecf83ad5d..00000000000
--- a/include/drm/drm_sman.h
+++ /dev/null
@@ -1,176 +0,0 @@
1/**************************************************************************
2 *
3 * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 *
27 **************************************************************************/
28/*
29 * Simple memory MANager interface that keeps track on allocate regions on a
30 * per "owner" basis. All regions associated with an "owner" can be released
31 * with a simple call. Typically if the "owner" exists. The owner is any
32 * "unsigned long" identifier. Can typically be a pointer to a file private
33 * struct or a context identifier.
34 *
35 * Authors:
36 * Thomas Hellström <thomas-at-tungstengraphics-dot-com>
37 */
38
39#ifndef DRM_SMAN_H
40#define DRM_SMAN_H
41
42#include "drmP.h"
43#include "drm_hashtab.h"
44
45/*
46 * A class that is an abstration of a simple memory allocator.
47 * The sman implementation provides a default such allocator
48 * using the drm_mm.c implementation. But the user can replace it.
49 * See the SiS implementation, which may use the SiS FB kernel module
50 * for memory management.
51 */
52
53struct drm_sman_mm {
54 /* private info. If allocated, needs to be destroyed by the destroy
55 function */
56 void *private;
57
58 /* Allocate a memory block with given size and alignment.
59 Return an opaque reference to the memory block */
60
61 void *(*allocate) (void *private, unsigned long size,
62 unsigned alignment);
63
64 /* Free a memory block. "ref" is the opaque reference that we got from
65 the "alloc" function */
66
67 void (*free) (void *private, void *ref);
68
69 /* Free all resources associated with this allocator */
70
71 void (*destroy) (void *private);
72
73 /* Return a memory offset from the opaque reference returned from the
74 "alloc" function */
75
76 unsigned long (*offset) (void *private, void *ref);
77};
78
79struct drm_memblock_item {
80 struct list_head owner_list;
81 struct drm_hash_item user_hash;
82 void *mm_info;
83 struct drm_sman_mm *mm;
84 struct drm_sman *sman;
85};
86
87struct drm_sman {
88 struct drm_sman_mm *mm;
89 int num_managers;
90 struct drm_open_hash owner_hash_tab;
91 struct drm_open_hash user_hash_tab;
92 struct list_head owner_items;
93};
94
95/*
96 * Take down a memory manager. This function should only be called after a
97 * successful init and after a call to drm_sman_cleanup.
98 */
99
100extern void drm_sman_takedown(struct drm_sman * sman);
101
102/*
103 * Allocate structures for a manager.
104 * num_managers are the number of memory pools to manage. (VRAM, AGP, ....)
105 * user_order is the log2 of the number of buckets in the user hash table.
106 * set this to approximately log2 of the max number of memory regions
107 * that will be allocated for _all_ pools together.
108 * owner_order is the log2 of the number of buckets in the owner hash table.
109 * set this to approximately log2 of
110 * the number of client file connections that will
111 * be using the manager.
112 *
113 */
114
115extern int drm_sman_init(struct drm_sman * sman, unsigned int num_managers,
116 unsigned int user_order, unsigned int owner_order);
117
118/*
119 * Initialize a drm_mm.c allocator. Should be called only once for each
120 * manager unless a customized allogator is used.
121 */
122
123extern int drm_sman_set_range(struct drm_sman * sman, unsigned int manager,
124 unsigned long start, unsigned long size);
125
126/*
127 * Initialize a customized allocator for one of the managers.
128 * (See the SiS module). The object pointed to by "allocator" is copied,
129 * so it can be destroyed after this call.
130 */
131
132extern int drm_sman_set_manager(struct drm_sman * sman, unsigned int mananger,
133 struct drm_sman_mm * allocator);
134
135/*
136 * Allocate a memory block. Aligment is not implemented yet.
137 */
138
139extern struct drm_memblock_item *drm_sman_alloc(struct drm_sman * sman,
140 unsigned int manager,
141 unsigned long size,
142 unsigned alignment,
143 unsigned long owner);
144/*
145 * Free a memory block identified by its user hash key.
146 */
147
148extern int drm_sman_free_key(struct drm_sman * sman, unsigned int key);
149
150/*
151 * returns 1 iff there are no stale memory blocks associated with this owner.
152 * Typically called to determine if we need to idle the hardware and call
153 * drm_sman_owner_cleanup. If there are no stale memory blocks, it removes all
154 * resources associated with owner.
155 */
156
157extern int drm_sman_owner_clean(struct drm_sman * sman, unsigned long owner);
158
159/*
160 * Frees all stale memory blocks associated with this owner. Note that this
161 * requires that the hardware is finished with all blocks, so the graphics engine
162 * should be idled before this call is made. This function also frees
163 * any resources associated with "owner" and should be called when owner
164 * is not going to be referenced anymore.
165 */
166
167extern void drm_sman_owner_cleanup(struct drm_sman * sman, unsigned long owner);
168
169/*
170 * Frees all stale memory blocks associated with the memory manager.
171 * See idling above.
172 */
173
174extern void drm_sman_cleanup(struct drm_sman * sman);
175
176#endif
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
index 12050434d57..5e120f1c5cd 100644
--- a/include/drm/exynos_drm.h
+++ b/include/drm/exynos_drm.h
@@ -74,9 +74,16 @@ struct drm_exynos_gem_mmap {
74 uint64_t mapped; 74 uint64_t mapped;
75}; 75};
76 76
77struct drm_exynos_plane_set_zpos {
78 __u32 plane_id;
79 __s32 zpos;
80};
81
77#define DRM_EXYNOS_GEM_CREATE 0x00 82#define DRM_EXYNOS_GEM_CREATE 0x00
78#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01 83#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01
79#define DRM_EXYNOS_GEM_MMAP 0x02 84#define DRM_EXYNOS_GEM_MMAP 0x02
85/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
86#define DRM_EXYNOS_PLANE_SET_ZPOS 0x06
80 87
81#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ 88#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
82 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create) 89 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
@@ -87,6 +94,9 @@ struct drm_exynos_gem_mmap {
87#define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \ 94#define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \
88 DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap) 95 DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap)
89 96
97#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \
98 DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos)
99
90/** 100/**
91 * Platform Specific Structure for DRM based FIMD. 101 * Platform Specific Structure for DRM based FIMD.
92 * 102 *
@@ -102,4 +112,31 @@ struct exynos_drm_fimd_pdata {
102 unsigned int bpp; 112 unsigned int bpp;
103}; 113};
104 114
115/**
116 * Platform Specific Structure for DRM based HDMI.
117 *
118 * @hdmi_dev: device point to specific hdmi driver.
119 * @mixer_dev: device point to specific mixer driver.
120 *
121 * this structure is used for common hdmi driver and each device object
122 * would be used to access specific device driver(hdmi or mixer driver)
123 */
124struct exynos_drm_common_hdmi_pd {
125 struct device *hdmi_dev;
126 struct device *mixer_dev;
127};
128
129/**
130 * Platform Specific Structure for DRM based HDMI core.
131 *
132 * @timing: default video mode for initializing
133 * @default_win: default window layer number to be used for UI.
134 * @bpp: default bit per pixel.
135 */
136struct exynos_drm_hdmi_pdata {
137 struct fb_videomode timing;
138 unsigned int default_win;
139 unsigned int bpp;
140};
141
105#endif 142#endif
diff --git a/include/drm/gma_drm.h b/include/drm/gma_drm.h
new file mode 100644
index 00000000000..11368678571
--- /dev/null
+++ b/include/drm/gma_drm.h
@@ -0,0 +1,91 @@
1/**************************************************************************
2 * Copyright (c) 2007-2011, Intel Corporation.
3 * All Rights Reserved.
4 * Copyright (c) 2008, Tungsten Graphics Inc. Cedar Park, TX., USA.
5 * All Rights Reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 **************************************************************************/
21
22#ifndef _PSB_DRM_H_
23#define _PSB_DRM_H_
24
25/*
26 * Manage the LUT for an output
27 */
28struct drm_psb_dpst_lut_arg {
29 uint8_t lut[256];
30 int output_id;
31};
32
33/*
34 * Validate modes
35 */
36struct drm_psb_mode_operation_arg {
37 u32 obj_id;
38 u16 operation;
39 struct drm_mode_modeinfo mode;
40 u64 data;
41};
42
43/*
44 * Query the stolen memory for smarter management of
45 * memory by the server
46 */
47struct drm_psb_stolen_memory_arg {
48 u32 base;
49 u32 size;
50};
51
52struct drm_psb_get_pipe_from_crtc_id_arg {
53 /** ID of CRTC being requested **/
54 u32 crtc_id;
55 /** pipe of requested CRTC **/
56 u32 pipe;
57};
58
59struct drm_psb_gem_create {
60 __u64 size;
61 __u32 handle;
62 __u32 flags;
63#define GMA_GEM_CREATE_STOLEN 1 /* Stolen memory can be used */
64};
65
66struct drm_psb_gem_mmap {
67 __u32 handle;
68 __u32 pad;
69 /**
70 * Fake offset to use for subsequent mmap call
71 *
72 * This is a fixed-size type for 32/64 compatibility.
73 */
74 __u64 offset;
75};
76
77/* Controlling the kernel modesetting buffers */
78
79#define DRM_GMA_GEM_CREATE 0x00 /* Create a GEM object */
80#define DRM_GMA_GEM_MMAP 0x01 /* Map GEM memory */
81#define DRM_GMA_STOLEN_MEMORY 0x02 /* Report stolen memory */
82#define DRM_GMA_2D_OP 0x03 /* Will be merged later */
83#define DRM_GMA_GAMMA 0x04 /* Set gamma table */
84#define DRM_GMA_ADB 0x05 /* Get backlight */
85#define DRM_GMA_DPST_BL 0x06 /* Set backlight */
86#define DRM_GMA_GET_PIPE_FROM_CRTC_ID 0x1 /* CRTC to physical pipe# */
87#define DRM_GMA_MODE_OPERATION 0x07 /* Mode validation/DC set */
88#define PSB_MODE_OPERATION_MODE_VALID 0x01
89
90
91#endif
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 28c0d114cb5..924f6a454fe 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -198,6 +198,8 @@ typedef struct _drm_i915_sarea {
198#define DRM_I915_OVERLAY_PUT_IMAGE 0x27 198#define DRM_I915_OVERLAY_PUT_IMAGE 0x27
199#define DRM_I915_OVERLAY_ATTRS 0x28 199#define DRM_I915_OVERLAY_ATTRS 0x28
200#define DRM_I915_GEM_EXECBUFFER2 0x29 200#define DRM_I915_GEM_EXECBUFFER2 0x29
201#define DRM_I915_GET_SPRITE_COLORKEY 0x2a
202#define DRM_I915_SET_SPRITE_COLORKEY 0x2b
201 203
202#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 204#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
203#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 205#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -239,6 +241,8 @@ typedef struct _drm_i915_sarea {
239#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise) 241#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise)
240#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image) 242#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image)
241#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs) 243#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs)
244#define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
245#define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
242 246
243/* Allow drivers to submit batchbuffers directly to hardware, relying 247/* Allow drivers to submit batchbuffers directly to hardware, relying
244 * on the security mechanisms provided by hardware. 248 * on the security mechanisms provided by hardware.
@@ -291,6 +295,7 @@ typedef struct drm_i915_irq_wait {
291#define I915_PARAM_HAS_COHERENT_RINGS 13 295#define I915_PARAM_HAS_COHERENT_RINGS 13
292#define I915_PARAM_HAS_EXEC_CONSTANTS 14 296#define I915_PARAM_HAS_EXEC_CONSTANTS 14
293#define I915_PARAM_HAS_RELAXED_DELTA 15 297#define I915_PARAM_HAS_RELAXED_DELTA 15
298#define I915_PARAM_HAS_GEN7_SOL_RESET 16
294 299
295typedef struct drm_i915_getparam { 300typedef struct drm_i915_getparam {
296 int param; 301 int param;
@@ -653,6 +658,9 @@ struct drm_i915_gem_execbuffer2 {
653 __u64 rsvd2; 658 __u64 rsvd2;
654}; 659};
655 660
661/** Resets the SO write offset registers for transform feedback on gen7. */
662#define I915_EXEC_GEN7_SOL_RESET (1<<8)
663
656struct drm_i915_gem_pin { 664struct drm_i915_gem_pin {
657 /** Handle of the buffer to be pinned. */ 665 /** Handle of the buffer to be pinned. */
658 __u32 handle; 666 __u32 handle;
@@ -844,4 +852,36 @@ struct drm_intel_overlay_attrs {
844 __u32 gamma5; 852 __u32 gamma5;
845}; 853};
846 854
855/*
856 * Intel sprite handling
857 *
858 * Color keying works with a min/mask/max tuple. Both source and destination
859 * color keying is allowed.
860 *
861 * Source keying:
862 * Sprite pixels within the min & max values, masked against the color channels
863 * specified in the mask field, will be transparent. All other pixels will
864 * be displayed on top of the primary plane. For RGB surfaces, only the min
865 * and mask fields will be used; ranged compares are not allowed.
866 *
867 * Destination keying:
868 * Primary plane pixels that match the min value, masked against the color
869 * channels specified in the mask field, will be replaced by corresponding
870 * pixels from the sprite plane.
871 *
872 * Note that source & destination keying are exclusive; only one can be
873 * active on a given plane.
874 */
875
876#define I915_SET_COLORKEY_NONE (1<<0) /* disable color key matching */
877#define I915_SET_COLORKEY_DESTINATION (1<<1)
878#define I915_SET_COLORKEY_SOURCE (1<<2)
879struct drm_intel_sprite_colorkey {
880 __u32 plane_id;
881 __u32 min_value;
882 __u32 channel_mask;
883 __u32 max_value;
884 __u32 flags;
885};
886
847#endif /* _I915_DRM_H_ */ 887#endif /* _I915_DRM_H_ */
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index be94be6d6f1..b55da40953f 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -509,6 +509,7 @@ typedef struct {
509#define DRM_RADEON_GEM_SET_TILING 0x28 509#define DRM_RADEON_GEM_SET_TILING 0x28
510#define DRM_RADEON_GEM_GET_TILING 0x29 510#define DRM_RADEON_GEM_GET_TILING 0x29
511#define DRM_RADEON_GEM_BUSY 0x2a 511#define DRM_RADEON_GEM_BUSY 0x2a
512#define DRM_RADEON_GEM_VA 0x2b
512 513
513#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) 514#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)
514#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) 515#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START)
@@ -550,6 +551,7 @@ typedef struct {
550#define DRM_IOCTL_RADEON_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling) 551#define DRM_IOCTL_RADEON_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling)
551#define DRM_IOCTL_RADEON_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling) 552#define DRM_IOCTL_RADEON_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling)
552#define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy) 553#define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy)
554#define DRM_IOCTL_RADEON_GEM_VA DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_VA, struct drm_radeon_gem_va)
553 555
554typedef struct drm_radeon_init { 556typedef struct drm_radeon_init {
555 enum { 557 enum {
@@ -872,12 +874,39 @@ struct drm_radeon_gem_pwrite {
872 uint64_t data_ptr; 874 uint64_t data_ptr;
873}; 875};
874 876
877#define RADEON_VA_MAP 1
878#define RADEON_VA_UNMAP 2
879
880#define RADEON_VA_RESULT_OK 0
881#define RADEON_VA_RESULT_ERROR 1
882#define RADEON_VA_RESULT_VA_EXIST 2
883
884#define RADEON_VM_PAGE_VALID (1 << 0)
885#define RADEON_VM_PAGE_READABLE (1 << 1)
886#define RADEON_VM_PAGE_WRITEABLE (1 << 2)
887#define RADEON_VM_PAGE_SYSTEM (1 << 3)
888#define RADEON_VM_PAGE_SNOOPED (1 << 4)
889
890struct drm_radeon_gem_va {
891 uint32_t handle;
892 uint32_t operation;
893 uint32_t vm_id;
894 uint32_t flags;
895 uint64_t offset;
896};
897
875#define RADEON_CHUNK_ID_RELOCS 0x01 898#define RADEON_CHUNK_ID_RELOCS 0x01
876#define RADEON_CHUNK_ID_IB 0x02 899#define RADEON_CHUNK_ID_IB 0x02
877#define RADEON_CHUNK_ID_FLAGS 0x03 900#define RADEON_CHUNK_ID_FLAGS 0x03
878 901
879/* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */ 902/* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */
880#define RADEON_CS_KEEP_TILING_FLAGS 0x01 903#define RADEON_CS_KEEP_TILING_FLAGS 0x01
904#define RADEON_CS_USE_VM 0x02
905/* The second dword of RADEON_CHUNK_ID_FLAGS is a uint32 that sets the ring type */
906#define RADEON_CS_RING_GFX 0
907#define RADEON_CS_RING_COMPUTE 1
908/* The third dword of RADEON_CHUNK_ID_FLAGS is a sint32 that sets the priority */
909/* 0 = normal, + = higher priority, - = lower priority */
881 910
882struct drm_radeon_cs_chunk { 911struct drm_radeon_cs_chunk {
883 uint32_t chunk_id; 912 uint32_t chunk_id;
@@ -885,6 +914,9 @@ struct drm_radeon_cs_chunk {
885 uint64_t chunk_data; 914 uint64_t chunk_data;
886}; 915};
887 916
917/* drm_radeon_cs_reloc.flags */
918#define RADEON_RELOC_DONT_SYNC 0x01
919
888struct drm_radeon_cs_reloc { 920struct drm_radeon_cs_reloc {
889 uint32_t handle; 921 uint32_t handle;
890 uint32_t read_domains; 922 uint32_t read_domains;
@@ -916,6 +948,10 @@ struct drm_radeon_cs {
916#define RADEON_INFO_NUM_TILE_PIPES 0x0b /* tile pipes for r600+ */ 948#define RADEON_INFO_NUM_TILE_PIPES 0x0b /* tile pipes for r600+ */
917#define RADEON_INFO_FUSION_GART_WORKING 0x0c /* fusion writes to GTT were broken before this */ 949#define RADEON_INFO_FUSION_GART_WORKING 0x0c /* fusion writes to GTT were broken before this */
918#define RADEON_INFO_BACKEND_MAP 0x0d /* pipe to backend map, needed by mesa */ 950#define RADEON_INFO_BACKEND_MAP 0x0d /* pipe to backend map, needed by mesa */
951/* virtual address start, va < start are reserved by the kernel */
952#define RADEON_INFO_VA_START 0x0e
953/* maximum size of ib using the virtual memory cs */
954#define RADEON_INFO_IB_VM_MAX_SIZE 0x0f
919 955
920struct drm_radeon_info { 956struct drm_radeon_info {
921 uint32_t request; 957 uint32_t request;
diff --git a/include/drm/sis_drm.h b/include/drm/sis_drm.h
index 30f7b382746..035b804dda6 100644
--- a/include/drm/sis_drm.h
+++ b/include/drm/sis_drm.h
@@ -64,4 +64,8 @@ typedef struct {
64 unsigned int offset, size; 64 unsigned int offset, size;
65} drm_sis_fb_t; 65} drm_sis_fb_t;
66 66
67struct sis_file_private {
68 struct list_head obj_list;
69};
70
67#endif /* __SIS_DRM_H__ */ 71#endif /* __SIS_DRM_H__ */
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 42e34698518..974c8f801c3 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -122,17 +122,12 @@ struct ttm_mem_reg {
122 * be mmapped by user space. Each of these bos occupy a slot in the 122 * be mmapped by user space. Each of these bos occupy a slot in the
123 * device address space, that can be used for normal vm operations. 123 * device address space, that can be used for normal vm operations.
124 * 124 *
125 * @ttm_bo_type_user: These are user-space memory areas that are made
126 * available to the GPU by mapping the buffer pages into the GPU aperture
127 * space. These buffers cannot be mmaped from the device address space.
128 *
129 * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers, 125 * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers,
130 * but they cannot be accessed from user-space. For kernel-only use. 126 * but they cannot be accessed from user-space. For kernel-only use.
131 */ 127 */
132 128
133enum ttm_bo_type { 129enum ttm_bo_type {
134 ttm_bo_type_device, 130 ttm_bo_type_device,
135 ttm_bo_type_user,
136 ttm_bo_type_kernel 131 ttm_bo_type_kernel
137}; 132};
138 133
@@ -434,9 +429,9 @@ extern void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev,
434 * -EBUSY if the buffer is busy and no_wait is true. 429 * -EBUSY if the buffer is busy and no_wait is true.
435 * -ERESTARTSYS if interrupted by a signal. 430 * -ERESTARTSYS if interrupted by a signal.
436 */ 431 */
437
438extern int 432extern int
439ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait); 433ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait);
434
440/** 435/**
441 * ttm_bo_synccpu_write_release: 436 * ttm_bo_synccpu_write_release:
442 * 437 *
@@ -447,6 +442,22 @@ ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait);
447extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo); 442extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo);
448 443
449/** 444/**
445 * ttm_bo_acc_size
446 *
447 * @bdev: Pointer to a ttm_bo_device struct.
448 * @bo_size: size of the buffer object in byte.
449 * @struct_size: size of the structure holding buffer object datas
450 *
451 * Returns size to account for a buffer object
452 */
453size_t ttm_bo_acc_size(struct ttm_bo_device *bdev,
454 unsigned long bo_size,
455 unsigned struct_size);
456size_t ttm_bo_dma_acc_size(struct ttm_bo_device *bdev,
457 unsigned long bo_size,
458 unsigned struct_size);
459
460/**
450 * ttm_bo_init 461 * ttm_bo_init
451 * 462 *
452 * @bdev: Pointer to a ttm_bo_device struct. 463 * @bdev: Pointer to a ttm_bo_device struct.
@@ -493,6 +504,7 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev,
493 struct file *persistent_swap_storage, 504 struct file *persistent_swap_storage,
494 size_t acc_size, 505 size_t acc_size,
495 void (*destroy) (struct ttm_buffer_object *)); 506 void (*destroy) (struct ttm_buffer_object *));
507
496/** 508/**
497 * ttm_bo_synccpu_object_init 509 * ttm_bo_synccpu_object_init
498 * 510 *
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 94eb1434316..d43e892307f 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -43,36 +43,9 @@ struct ttm_backend;
43 43
44struct ttm_backend_func { 44struct ttm_backend_func {
45 /** 45 /**
46 * struct ttm_backend_func member populate
47 *
48 * @backend: Pointer to a struct ttm_backend.
49 * @num_pages: Number of pages to populate.
50 * @pages: Array of pointers to ttm pages.
51 * @dummy_read_page: Page to be used instead of NULL pages in the
52 * array @pages.
53 * @dma_addrs: Array of DMA (bus) address of the ttm pages.
54 *
55 * Populate the backend with ttm pages. Depending on the backend,
56 * it may or may not copy the @pages array.
57 */
58 int (*populate) (struct ttm_backend *backend,
59 unsigned long num_pages, struct page **pages,
60 struct page *dummy_read_page,
61 dma_addr_t *dma_addrs);
62 /**
63 * struct ttm_backend_func member clear
64 *
65 * @backend: Pointer to a struct ttm_backend.
66 *
67 * This is an "unpopulate" function. Release all resources
68 * allocated with populate.
69 */
70 void (*clear) (struct ttm_backend *backend);
71
72 /**
73 * struct ttm_backend_func member bind 46 * struct ttm_backend_func member bind
74 * 47 *
75 * @backend: Pointer to a struct ttm_backend. 48 * @ttm: Pointer to a struct ttm_tt.
76 * @bo_mem: Pointer to a struct ttm_mem_reg describing the 49 * @bo_mem: Pointer to a struct ttm_mem_reg describing the
77 * memory type and location for binding. 50 * memory type and location for binding.
78 * 51 *
@@ -80,46 +53,29 @@ struct ttm_backend_func {
80 * indicated by @bo_mem. This function should be able to handle 53 * indicated by @bo_mem. This function should be able to handle
81 * differences between aperture and system page sizes. 54 * differences between aperture and system page sizes.
82 */ 55 */
83 int (*bind) (struct ttm_backend *backend, struct ttm_mem_reg *bo_mem); 56 int (*bind) (struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem);
84 57
85 /** 58 /**
86 * struct ttm_backend_func member unbind 59 * struct ttm_backend_func member unbind
87 * 60 *
88 * @backend: Pointer to a struct ttm_backend. 61 * @ttm: Pointer to a struct ttm_tt.
89 * 62 *
90 * Unbind previously bound backend pages. This function should be 63 * Unbind previously bound backend pages. This function should be
91 * able to handle differences between aperture and system page sizes. 64 * able to handle differences between aperture and system page sizes.
92 */ 65 */
93 int (*unbind) (struct ttm_backend *backend); 66 int (*unbind) (struct ttm_tt *ttm);
94 67
95 /** 68 /**
96 * struct ttm_backend_func member destroy 69 * struct ttm_backend_func member destroy
97 * 70 *
98 * @backend: Pointer to a struct ttm_backend. 71 * @ttm: Pointer to a struct ttm_tt.
99 * 72 *
100 * Destroy the backend. 73 * Destroy the backend. This will be call back from ttm_tt_destroy so
74 * don't call ttm_tt_destroy from the callback or infinite loop.
101 */ 75 */
102 void (*destroy) (struct ttm_backend *backend); 76 void (*destroy) (struct ttm_tt *ttm);
103};
104
105/**
106 * struct ttm_backend
107 *
108 * @bdev: Pointer to a struct ttm_bo_device.
109 * @flags: For driver use.
110 * @func: Pointer to a struct ttm_backend_func that describes
111 * the backend methods.
112 *
113 */
114
115struct ttm_backend {
116 struct ttm_bo_device *bdev;
117 uint32_t flags;
118 struct ttm_backend_func *func;
119}; 77};
120 78
121#define TTM_PAGE_FLAG_USER (1 << 1)
122#define TTM_PAGE_FLAG_USER_DIRTY (1 << 2)
123#define TTM_PAGE_FLAG_WRITE (1 << 3) 79#define TTM_PAGE_FLAG_WRITE (1 << 3)
124#define TTM_PAGE_FLAG_SWAPPED (1 << 4) 80#define TTM_PAGE_FLAG_SWAPPED (1 << 4)
125#define TTM_PAGE_FLAG_PERSISTENT_SWAP (1 << 5) 81#define TTM_PAGE_FLAG_PERSISTENT_SWAP (1 << 5)
@@ -135,23 +91,18 @@ enum ttm_caching_state {
135/** 91/**
136 * struct ttm_tt 92 * struct ttm_tt
137 * 93 *
94 * @bdev: Pointer to a struct ttm_bo_device.
95 * @func: Pointer to a struct ttm_backend_func that describes
96 * the backend methods.
138 * @dummy_read_page: Page to map where the ttm_tt page array contains a NULL 97 * @dummy_read_page: Page to map where the ttm_tt page array contains a NULL
139 * pointer. 98 * pointer.
140 * @pages: Array of pages backing the data. 99 * @pages: Array of pages backing the data.
141 * @first_himem_page: Himem pages are put last in the page array, which
142 * enables us to run caching attribute changes on only the first part
143 * of the page array containing lomem pages. This is the index of the
144 * first himem page.
145 * @last_lomem_page: Index of the last lomem page in the page array.
146 * @num_pages: Number of pages in the page array. 100 * @num_pages: Number of pages in the page array.
147 * @bdev: Pointer to the current struct ttm_bo_device. 101 * @bdev: Pointer to the current struct ttm_bo_device.
148 * @be: Pointer to the ttm backend. 102 * @be: Pointer to the ttm backend.
149 * @tsk: The task for user ttm.
150 * @start: virtual address for user ttm.
151 * @swap_storage: Pointer to shmem struct file for swap storage. 103 * @swap_storage: Pointer to shmem struct file for swap storage.
152 * @caching_state: The current caching state of the pages. 104 * @caching_state: The current caching state of the pages.
153 * @state: The current binding state of the pages. 105 * @state: The current binding state of the pages.
154 * @dma_address: The DMA (bus) addresses of the pages (if TTM_PAGE_FLAG_DMA32)
155 * 106 *
156 * This is a structure holding the pages, caching- and aperture binding 107 * This is a structure holding the pages, caching- and aperture binding
157 * status for a buffer object that isn't backed by fixed (VRAM / AGP) 108 * status for a buffer object that isn't backed by fixed (VRAM / AGP)
@@ -159,16 +110,14 @@ enum ttm_caching_state {
159 */ 110 */
160 111
161struct ttm_tt { 112struct ttm_tt {
113 struct ttm_bo_device *bdev;
114 struct ttm_backend_func *func;
162 struct page *dummy_read_page; 115 struct page *dummy_read_page;
163 struct page **pages; 116 struct page **pages;
164 long first_himem_page;
165 long last_lomem_page;
166 uint32_t page_flags; 117 uint32_t page_flags;
167 unsigned long num_pages; 118 unsigned long num_pages;
168 struct ttm_bo_global *glob; 119 struct ttm_bo_global *glob;
169 struct ttm_backend *be; 120 struct ttm_backend *be;
170 struct task_struct *tsk;
171 unsigned long start;
172 struct file *swap_storage; 121 struct file *swap_storage;
173 enum ttm_caching_state caching_state; 122 enum ttm_caching_state caching_state;
174 enum { 123 enum {
@@ -176,7 +125,23 @@ struct ttm_tt {
176 tt_unbound, 125 tt_unbound,
177 tt_unpopulated, 126 tt_unpopulated,
178 } state; 127 } state;
128};
129
130/**
131 * struct ttm_dma_tt
132 *
133 * @ttm: Base ttm_tt struct.
134 * @dma_address: The DMA (bus) addresses of the pages
135 * @pages_list: used by some page allocation backend
136 *
137 * This is a structure holding the pages, caching- and aperture binding
138 * status for a buffer object that isn't backed by fixed (VRAM / AGP)
139 * memory.
140 */
141struct ttm_dma_tt {
142 struct ttm_tt ttm;
179 dma_addr_t *dma_address; 143 dma_addr_t *dma_address;
144 struct list_head pages_list;
180}; 145};
181 146
182#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */ 147#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */
@@ -351,15 +316,42 @@ struct ttm_mem_type_manager {
351 316
352struct ttm_bo_driver { 317struct ttm_bo_driver {
353 /** 318 /**
354 * struct ttm_bo_driver member create_ttm_backend_entry 319 * ttm_tt_create
355 * 320 *
356 * @bdev: The buffer object device. 321 * @bdev: pointer to a struct ttm_bo_device:
322 * @size: Size of the data needed backing.
323 * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags.
324 * @dummy_read_page: See struct ttm_bo_device.
357 * 325 *
358 * Create a driver specific struct ttm_backend. 326 * Create a struct ttm_tt to back data with system memory pages.
327 * No pages are actually allocated.
328 * Returns:
329 * NULL: Out of memory.
359 */ 330 */
331 struct ttm_tt *(*ttm_tt_create)(struct ttm_bo_device *bdev,
332 unsigned long size,
333 uint32_t page_flags,
334 struct page *dummy_read_page);
360 335
361 struct ttm_backend *(*create_ttm_backend_entry) 336 /**
362 (struct ttm_bo_device *bdev); 337 * ttm_tt_populate
338 *
339 * @ttm: The struct ttm_tt to contain the backing pages.
340 *
341 * Allocate all backing pages
342 * Returns:
343 * -ENOMEM: Out of memory.
344 */
345 int (*ttm_tt_populate)(struct ttm_tt *ttm);
346
347 /**
348 * ttm_tt_unpopulate
349 *
350 * @ttm: The struct ttm_tt to contain the backing pages.
351 *
352 * Free all backing page
353 */
354 void (*ttm_tt_unpopulate)(struct ttm_tt *ttm);
363 355
364 /** 356 /**
365 * struct ttm_bo_driver member invalidate_caches 357 * struct ttm_bo_driver member invalidate_caches
@@ -477,9 +469,6 @@ struct ttm_bo_global_ref {
477 * @dummy_read_page: Pointer to a dummy page used for mapping requests 469 * @dummy_read_page: Pointer to a dummy page used for mapping requests
478 * of unpopulated pages. 470 * of unpopulated pages.
479 * @shrink: A shrink callback object used for buffer object swap. 471 * @shrink: A shrink callback object used for buffer object swap.
480 * @ttm_bo_extra_size: Extra size (sizeof(struct ttm_buffer_object) excluded)
481 * used by a buffer object. This is excluding page arrays and backing pages.
482 * @ttm_bo_size: This is @ttm_bo_extra_size + sizeof(struct ttm_buffer_object).
483 * @device_list_mutex: Mutex protecting the device list. 472 * @device_list_mutex: Mutex protecting the device list.
484 * This mutex is held while traversing the device list for pm options. 473 * This mutex is held while traversing the device list for pm options.
485 * @lru_lock: Spinlock protecting the bo subsystem lru lists. 474 * @lru_lock: Spinlock protecting the bo subsystem lru lists.
@@ -497,8 +486,6 @@ struct ttm_bo_global {
497 struct ttm_mem_global *mem_glob; 486 struct ttm_mem_global *mem_glob;
498 struct page *dummy_read_page; 487 struct page *dummy_read_page;
499 struct ttm_mem_shrink shrink; 488 struct ttm_mem_shrink shrink;
500 size_t ttm_bo_extra_size;
501 size_t ttm_bo_size;
502 struct mutex device_list_mutex; 489 struct mutex device_list_mutex;
503 spinlock_t lru_lock; 490 spinlock_t lru_lock;
504 491
@@ -600,8 +587,9 @@ ttm_flag_masked(uint32_t *old, uint32_t new, uint32_t mask)
600} 587}
601 588
602/** 589/**
603 * ttm_tt_create 590 * ttm_tt_init
604 * 591 *
592 * @ttm: The struct ttm_tt.
605 * @bdev: pointer to a struct ttm_bo_device: 593 * @bdev: pointer to a struct ttm_bo_device:
606 * @size: Size of the data needed backing. 594 * @size: Size of the data needed backing.
607 * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags. 595 * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags.
@@ -612,28 +600,22 @@ ttm_flag_masked(uint32_t *old, uint32_t new, uint32_t mask)
612 * Returns: 600 * Returns:
613 * NULL: Out of memory. 601 * NULL: Out of memory.
614 */ 602 */
615extern struct ttm_tt *ttm_tt_create(struct ttm_bo_device *bdev, 603extern int ttm_tt_init(struct ttm_tt *ttm, struct ttm_bo_device *bdev,
616 unsigned long size, 604 unsigned long size, uint32_t page_flags,
617 uint32_t page_flags, 605 struct page *dummy_read_page);
618 struct page *dummy_read_page); 606extern int ttm_dma_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_bo_device *bdev,
607 unsigned long size, uint32_t page_flags,
608 struct page *dummy_read_page);
619 609
620/** 610/**
621 * ttm_tt_set_user: 611 * ttm_tt_fini
622 * 612 *
623 * @ttm: The struct ttm_tt to populate. 613 * @ttm: the ttm_tt structure.
624 * @tsk: A struct task_struct for which @start is a valid user-space address.
625 * @start: A valid user-space address.
626 * @num_pages: Size in pages of the user memory area.
627 * 614 *
628 * Populate a struct ttm_tt with a user-space memory area after first pinning 615 * Free memory of ttm_tt structure
629 * the pages backing it.
630 * Returns:
631 * !0: Error.
632 */ 616 */
633 617extern void ttm_tt_fini(struct ttm_tt *ttm);
634extern int ttm_tt_set_user(struct ttm_tt *ttm, 618extern void ttm_dma_tt_fini(struct ttm_dma_tt *ttm_dma);
635 struct task_struct *tsk,
636 unsigned long start, unsigned long num_pages);
637 619
638/** 620/**
639 * ttm_ttm_bind: 621 * ttm_ttm_bind:
@@ -646,20 +628,11 @@ extern int ttm_tt_set_user(struct ttm_tt *ttm,
646extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem); 628extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem);
647 629
648/** 630/**
649 * ttm_tt_populate:
650 *
651 * @ttm: The struct ttm_tt to contain the backing pages.
652 *
653 * Add backing pages to all of @ttm
654 */
655extern int ttm_tt_populate(struct ttm_tt *ttm);
656
657/**
658 * ttm_ttm_destroy: 631 * ttm_ttm_destroy:
659 * 632 *
660 * @ttm: The struct ttm_tt. 633 * @ttm: The struct ttm_tt.
661 * 634 *
662 * Unbind, unpopulate and destroy a struct ttm_tt. 635 * Unbind, unpopulate and destroy common struct ttm_tt.
663 */ 636 */
664extern void ttm_tt_destroy(struct ttm_tt *ttm); 637extern void ttm_tt_destroy(struct ttm_tt *ttm);
665 638
@@ -673,19 +646,13 @@ extern void ttm_tt_destroy(struct ttm_tt *ttm);
673extern void ttm_tt_unbind(struct ttm_tt *ttm); 646extern void ttm_tt_unbind(struct ttm_tt *ttm);
674 647
675/** 648/**
676 * ttm_ttm_destroy: 649 * ttm_tt_swapin:
677 * 650 *
678 * @ttm: The struct ttm_tt. 651 * @ttm: The struct ttm_tt.
679 * @index: Index of the desired page.
680 *
681 * Return a pointer to the struct page backing @ttm at page
682 * index @index. If the page is unpopulated, one will be allocated to
683 * populate that index.
684 * 652 *
685 * Returns: 653 * Swap in a previously swap out ttm_tt.
686 * NULL on OOM.
687 */ 654 */
688extern struct page *ttm_tt_get_page(struct ttm_tt *ttm, int index); 655extern int ttm_tt_swapin(struct ttm_tt *ttm);
689 656
690/** 657/**
691 * ttm_tt_cache_flush: 658 * ttm_tt_cache_flush:
@@ -1046,17 +1013,25 @@ extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
1046#include <linux/agp_backend.h> 1013#include <linux/agp_backend.h>
1047 1014
1048/** 1015/**
1049 * ttm_agp_backend_init 1016 * ttm_agp_tt_create
1050 * 1017 *
1051 * @bdev: Pointer to a struct ttm_bo_device. 1018 * @bdev: Pointer to a struct ttm_bo_device.
1052 * @bridge: The agp bridge this device is sitting on. 1019 * @bridge: The agp bridge this device is sitting on.
1020 * @size: Size of the data needed backing.
1021 * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags.
1022 * @dummy_read_page: See struct ttm_bo_device.
1023 *
1053 * 1024 *
1054 * Create a TTM backend that uses the indicated AGP bridge as an aperture 1025 * Create a TTM backend that uses the indicated AGP bridge as an aperture
1055 * for TT memory. This function uses the linux agpgart interface to 1026 * for TT memory. This function uses the linux agpgart interface to
1056 * bind and unbind memory backing a ttm_tt. 1027 * bind and unbind memory backing a ttm_tt.
1057 */ 1028 */
1058extern struct ttm_backend *ttm_agp_backend_init(struct ttm_bo_device *bdev, 1029extern struct ttm_tt *ttm_agp_tt_create(struct ttm_bo_device *bdev,
1059 struct agp_bridge_data *bridge); 1030 struct agp_bridge_data *bridge,
1031 unsigned long size, uint32_t page_flags,
1032 struct page *dummy_read_page);
1033int ttm_agp_tt_populate(struct ttm_tt *ttm);
1034void ttm_agp_tt_unpopulate(struct ttm_tt *ttm);
1060#endif 1035#endif
1061 1036
1062#endif 1037#endif
diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h
index 129de12353f..5fe27400d17 100644
--- a/include/drm/ttm/ttm_page_alloc.h
+++ b/include/drm/ttm/ttm_page_alloc.h
@@ -30,45 +30,70 @@
30#include "ttm_memory.h" 30#include "ttm_memory.h"
31 31
32/** 32/**
33 * Get count number of pages from pool to pages list. 33 * Initialize pool allocator.
34 */
35int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages);
36/**
37 * Free pool allocator.
38 */
39void ttm_page_alloc_fini(void);
40
41/**
42 * ttm_pool_populate:
43 *
44 * @ttm: The struct ttm_tt to contain the backing pages.
34 * 45 *
35 * @pages: head of empty linked list where pages are filled. 46 * Add backing pages to all of @ttm
36 * @flags: ttm flags for page allocation.
37 * @cstate: ttm caching state for the page.
38 * @count: number of pages to allocate.
39 * @dma_address: The DMA (bus) address of pages (if TTM_PAGE_FLAG_DMA32 set).
40 */ 47 */
41int ttm_get_pages(struct list_head *pages, 48extern int ttm_pool_populate(struct ttm_tt *ttm);
42 int flags, 49
43 enum ttm_caching_state cstate,
44 unsigned count,
45 dma_addr_t *dma_address);
46/** 50/**
47 * Put linked list of pages to pool. 51 * ttm_pool_unpopulate:
52 *
53 * @ttm: The struct ttm_tt which to free backing pages.
48 * 54 *
49 * @pages: list of pages to free. 55 * Free all pages of @ttm
50 * @page_count: number of pages in the list. Zero can be passed for unknown
51 * count.
52 * @flags: ttm flags for page allocation.
53 * @cstate: ttm caching state.
54 * @dma_address: The DMA (bus) address of pages (if TTM_PAGE_FLAG_DMA32 set).
55 */ 56 */
56void ttm_put_pages(struct list_head *pages, 57extern void ttm_pool_unpopulate(struct ttm_tt *ttm);
57 unsigned page_count, 58
58 int flags, 59/**
59 enum ttm_caching_state cstate, 60 * Output the state of pools to debugfs file
60 dma_addr_t *dma_address); 61 */
62extern int ttm_page_alloc_debugfs(struct seq_file *m, void *data);
63
64
65#ifdef CONFIG_SWIOTLB
61/** 66/**
62 * Initialize pool allocator. 67 * Initialize pool allocator.
63 */ 68 */
64int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages); 69int ttm_dma_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages);
70
65/** 71/**
66 * Free pool allocator. 72 * Free pool allocator.
67 */ 73 */
68void ttm_page_alloc_fini(void); 74void ttm_dma_page_alloc_fini(void);
69 75
70/** 76/**
71 * Output the state of pools to debugfs file 77 * Output the state of pools to debugfs file
72 */ 78 */
73extern int ttm_page_alloc_debugfs(struct seq_file *m, void *data); 79extern int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data);
80
81extern int ttm_dma_populate(struct ttm_dma_tt *ttm_dma, struct device *dev);
82extern void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev);
83
84#else
85static inline int ttm_dma_page_alloc_init(struct ttm_mem_global *glob,
86 unsigned max_pages)
87{
88 return -ENODEV;
89}
90
91static inline void ttm_dma_page_alloc_fini(void) { return; }
92
93static inline int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data)
94{
95 return 0;
96}
97#endif
98
74#endif 99#endif
diff --git a/include/drm/via_drm.h b/include/drm/via_drm.h
index fd11a5bd892..79b3b6e0f6b 100644
--- a/include/drm/via_drm.h
+++ b/include/drm/via_drm.h
@@ -274,4 +274,8 @@ typedef struct drm_via_dmablit {
274 drm_via_blitsync_t sync; 274 drm_via_blitsync_t sync;
275} drm_via_dmablit_t; 275} drm_via_dmablit_t;
276 276
277struct via_file_private {
278 struct list_head obj_list;
279};
280
277#endif /* _VIA_DRM_H_ */ 281#endif /* _VIA_DRM_H_ */
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index 445702c60d0..e872526fdc5 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -24,7 +24,7 @@ extern int swiotlb_force;
24 24
25extern void swiotlb_init(int verbose); 25extern void swiotlb_init(int verbose);
26extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose); 26extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose);
27extern unsigned long swioltb_nr_tbl(void); 27extern unsigned long swiotlb_nr_tbl(void);
28 28
29/* 29/*
30 * Enumeration for sync targets 30 * Enumeration for sync targets