aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-24 15:42:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-24 15:42:54 -0400
commitf2fde3a65e88330017b816faf2ef75f141d21375 (patch)
tree57152ab5756e7ed1c58742e7e16f13a45ff11f21 /include
parent28f3d717618156c0dcd2f497d791b578a7931d87 (diff)
parent8c914028f5ddaa417b7d0f4b7fdc24caceaa8043 (diff)
Merge branch 'drm-core-next' of git://people.freedesktop.org/~airlied/linux
Pull main drm updates from Dave Airlie: "This is the main merge window request for the drm. It's big, but jam packed will lots of features and of course 0 regressions. (okay maybe there'll be one). Highlights: - new KMS drivers for server GPU chipsets: ast, mgag200 and cirrus (qemu only). These drivers use the generic modesetting drivers. - initial prime/dma-buf support for i915, nouveau, radeon, udl and exynos - switcheroo audio support: so GPUs with HDMI can turn off the sound driver without crashing stuff. - There are some patches drifting outside drivers/gpu into x86 and EFI for better handling of multiple video adapters in Apple Macs, they've got correct acks except one trivial fixup. - Core: edid parser has better DMT and reduced blanking support, crtc properties, plane properties, - Drivers: exynos: add 2D core accel support, prime support, hdmi features intel: more Haswell support, initial Valleyview support, more hdmi infoframe fixes, update MAINTAINERS for Daniel, lots of cleanups and fixes radeon: more HDMI audio support, improved GPU lockup recovery support, remove nested mutexes, less memory copying on PCIE, fix bus master enable race (kexec), improved fence handling gma500: cleanups, 1080p support, acpi fixes nouveau: better nva3 memory reclocking, kepler accel (needs external firmware rip), async buffer moves on nv84+ hw. I've some more dma-buf patches that rely on the dma-buf merge for vmap stuff, and I've a few fixes building up, but I'd decided I'd better get rid of the main pull sooner rather than later, so the audio guys are also unblocked." Fix up trivial conflict due to some duplicated changes in drivers/gpu/drm/i915/intel_ringbuffer.c * 'drm-core-next' of git://people.freedesktop.org/~airlied/linux: (605 commits) drm/nouveau/nvd9: Fix GPIO initialisation sequence. drm/nouveau: Unregister switcheroo client on exit drm/nouveau: Check dsm on switcheroo unregister drm/nouveau: fix a minor annoyance in an output string drm/nouveau: turn a BUG into a WARN drm/nv50: decode PGRAPH DATA_ERROR = 0x24 drm/nouveau/disp: fix dithering not being enabled on some eDP macbooks drm/nvd9/copy: initialise copy engine, seems to work like nvc0 drm/nvc0/ttm: use copy engines for async buffer moves drm/nva3/ttm: use copy engine for async buffer moves drm/nv98/ttm: add in a (disabled) crypto engine buffer copy method drm/nv84/ttm: use crypto engine for async buffer copies drm/nouveau/ttm: untangle code to support accelerated buffer moves drm/nouveau/fbcon: use fence for sync, rather than notifier drm/nv98/crypt: non-stub implementation of the engine hooks drm/nouveau/fifo: turn all fifo modules into engine modules drm/nv50/graph: remove ability to do interrupt-driven context switching drm/nv50: remove manual context unload on context destruction drm/nv50: remove execution engine context saves on suspend drm/nv50/fifo: use hardware channel kickoff functionality ...
Diffstat (limited to 'include')
-rw-r--r--include/drm/drm.h6
-rw-r--r--include/drm/drmP.h19
-rw-r--r--include/drm/drm_crtc.h86
-rw-r--r--include/drm/drm_crtc_helper.h23
-rw-r--r--include/drm/drm_dp_helper.h8
-rw-r--r--include/drm/drm_edid.h26
-rw-r--r--include/drm/drm_fixed.h1
-rw-r--r--include/drm/drm_mode.h16
-rw-r--r--include/drm/exynos_drm.h99
-rw-r--r--include/drm/i915_drm.h3
-rw-r--r--include/drm/radeon_drm.h1
-rw-r--r--include/drm/ttm/ttm_bo_api.h9
-rw-r--r--include/drm/ttm/ttm_bo_driver.h2
-rw-r--r--include/linux/pagemap.h64
-rw-r--r--include/linux/vga_switcheroo.h19
-rw-r--r--include/linux/vgaarb.h7
16 files changed, 329 insertions, 60 deletions
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 64ff02d5b730..e51035a3757f 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -730,6 +730,8 @@ struct drm_prime_handle {
730#define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane) 730#define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane)
731#define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane) 731#define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane)
732#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2) 732#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2)
733#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties)
734#define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property)
733 735
734/** 736/**
735 * Device specific ioctls should only be in their respective headers 737 * Device specific ioctls should only be in their respective headers
@@ -775,6 +777,10 @@ struct drm_event_vblank {
775#define DRM_CAP_VBLANK_HIGH_CRTC 0x2 777#define DRM_CAP_VBLANK_HIGH_CRTC 0x2
776#define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3 778#define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3
777#define DRM_CAP_DUMB_PREFER_SHADOW 0x4 779#define DRM_CAP_DUMB_PREFER_SHADOW 0x4
780#define DRM_CAP_PRIME 0x5
781
782#define DRM_PRIME_CAP_IMPORT 0x1
783#define DRM_PRIME_CAP_EXPORT 0x2
778 784
779/* typedef area */ 785/* typedef area */
780#ifndef __KERNEL__ 786#ifndef __KERNEL__
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index dd731043fecd..31ad880ca2ef 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -755,11 +755,11 @@ struct drm_driver {
755 * @dev: DRM device 755 * @dev: DRM device
756 * @crtc: counter to fetch 756 * @crtc: counter to fetch
757 * 757 *
758 * Driver callback for fetching a raw hardware vblank counter 758 * Driver callback for fetching a raw hardware vblank counter for @crtc.
759 * for @crtc. If a device doesn't have a hardware counter, the 759 * If a device doesn't have a hardware counter, the driver can simply
760 * driver can simply return the value of drm_vblank_count and 760 * return the value of drm_vblank_count. The DRM core will account for
761 * make the enable_vblank() and disable_vblank() hooks into no-ops, 761 * missed vblank events while interrupts where disabled based on system
762 * leaving interrupts enabled at all times. 762 * timestamps.
763 * 763 *
764 * Wraparound handling and loss of events due to modesetting is dealt 764 * Wraparound handling and loss of events due to modesetting is dealt
765 * with in the DRM core code. 765 * with in the DRM core code.
@@ -941,7 +941,7 @@ struct drm_driver {
941 uint32_t handle); 941 uint32_t handle);
942 942
943 /* Driver private ops for this object */ 943 /* Driver private ops for this object */
944 struct vm_operations_struct *gem_vm_ops; 944 const struct vm_operations_struct *gem_vm_ops;
945 945
946 int major; 946 int major;
947 int minor; 947 int minor;
@@ -1309,8 +1309,8 @@ extern int drm_release(struct inode *inode, struct file *filp);
1309 /* Mapping support (drm_vm.h) */ 1309 /* Mapping support (drm_vm.h) */
1310extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); 1310extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
1311extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma); 1311extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma);
1312extern void drm_vm_open_locked(struct vm_area_struct *vma); 1312extern void drm_vm_open_locked(struct drm_device *dev, struct vm_area_struct *vma);
1313extern void drm_vm_close_locked(struct vm_area_struct *vma); 1313extern void drm_vm_close_locked(struct drm_device *dev, struct vm_area_struct *vma);
1314extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); 1314extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
1315 1315
1316 /* Memory management support (drm_memory.h) */ 1316 /* Memory management support (drm_memory.h) */
@@ -1378,6 +1378,7 @@ extern int drm_remove_magic(struct drm_master *master, drm_magic_t magic);
1378 1378
1379/* Cache management (drm_cache.c) */ 1379/* Cache management (drm_cache.c) */
1380void drm_clflush_pages(struct page *pages[], unsigned long num_pages); 1380void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
1381void drm_clflush_virt_range(char *addr, unsigned long length);
1381 1382
1382 /* Locking IOCTL support (drm_lock.h) */ 1383 /* Locking IOCTL support (drm_lock.h) */
1383extern int drm_lock(struct drm_device *dev, void *data, 1384extern int drm_lock(struct drm_device *dev, void *data,
@@ -1557,6 +1558,8 @@ extern int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
1557extern int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data, 1558extern int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
1558 struct drm_file *file_priv); 1559 struct drm_file *file_priv);
1559 1560
1561extern int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages,
1562 dma_addr_t *addrs, int max_pages);
1560extern struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages); 1563extern struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages);
1561extern void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg); 1564extern void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg);
1562 1565
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index e250eda4e3a8..73e45600f95d 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -36,6 +36,7 @@
36struct drm_device; 36struct drm_device;
37struct drm_mode_set; 37struct drm_mode_set;
38struct drm_framebuffer; 38struct drm_framebuffer;
39struct drm_object_properties;
39 40
40 41
41#define DRM_MODE_OBJECT_CRTC 0xcccccccc 42#define DRM_MODE_OBJECT_CRTC 0xcccccccc
@@ -50,6 +51,14 @@ struct drm_framebuffer;
50struct drm_mode_object { 51struct drm_mode_object {
51 uint32_t id; 52 uint32_t id;
52 uint32_t type; 53 uint32_t type;
54 struct drm_object_properties *properties;
55};
56
57#define DRM_OBJECT_MAX_PROPERTY 16
58struct drm_object_properties {
59 int count;
60 uint32_t ids[DRM_OBJECT_MAX_PROPERTY];
61 uint64_t values[DRM_OBJECT_MAX_PROPERTY];
53}; 62};
54 63
55/* 64/*
@@ -285,19 +294,16 @@ struct drm_plane;
285 294
286/** 295/**
287 * drm_crtc_funcs - control CRTCs for a given device 296 * drm_crtc_funcs - control CRTCs for a given device
288 * @reset: reset CRTC after state has been invalidate (e.g. resume)
289 * @dpms: control display power levels
290 * @save: save CRTC state 297 * @save: save CRTC state
291 * @resore: restore CRTC state 298 * @restore: restore CRTC state
292 * @lock: lock the CRTC 299 * @reset: reset CRTC after state has been invalidate (e.g. resume)
293 * @unlock: unlock the CRTC 300 * @cursor_set: setup the cursor
294 * @shadow_allocate: allocate shadow pixmap 301 * @cursor_move: move the cursor
295 * @shadow_create: create shadow pixmap for rotation support
296 * @shadow_destroy: free shadow pixmap
297 * @mode_fixup: fixup proposed mode
298 * @mode_set: set the desired mode on the CRTC
299 * @gamma_set: specify color ramp for CRTC 302 * @gamma_set: specify color ramp for CRTC
300 * @destroy: deinit and free object. 303 * @destroy: deinit and free object
304 * @set_property: called when a property is changed
305 * @set_config: apply a new CRTC configuration
306 * @page_flip: initiate a page flip
301 * 307 *
302 * The drm_crtc_funcs structure is the central CRTC management structure 308 * The drm_crtc_funcs structure is the central CRTC management structure
303 * in the DRM. Each CRTC controls one or more connectors (note that the name 309 * in the DRM. Each CRTC controls one or more connectors (note that the name
@@ -341,6 +347,9 @@ struct drm_crtc_funcs {
341 int (*page_flip)(struct drm_crtc *crtc, 347 int (*page_flip)(struct drm_crtc *crtc,
342 struct drm_framebuffer *fb, 348 struct drm_framebuffer *fb,
343 struct drm_pending_vblank_event *event); 349 struct drm_pending_vblank_event *event);
350
351 int (*set_property)(struct drm_crtc *crtc,
352 struct drm_property *property, uint64_t val);
344}; 353};
345 354
346/** 355/**
@@ -360,6 +369,7 @@ struct drm_crtc_funcs {
360 * @framedur_ns: precise line timing 369 * @framedur_ns: precise line timing
361 * @pixeldur_ns: precise pixel timing 370 * @pixeldur_ns: precise pixel timing
362 * @helper_private: mid-layer private data 371 * @helper_private: mid-layer private data
372 * @properties: property tracking for this CRTC
363 * 373 *
364 * Each CRTC may have one or more connectors associated with it. This structure 374 * Each CRTC may have one or more connectors associated with it. This structure
365 * allows the CRTC to be controlled. 375 * allows the CRTC to be controlled.
@@ -395,6 +405,8 @@ struct drm_crtc {
395 405
396 /* if you are using the helper */ 406 /* if you are using the helper */
397 void *helper_private; 407 void *helper_private;
408
409 struct drm_object_properties properties;
398}; 410};
399 411
400 412
@@ -404,11 +416,8 @@ struct drm_crtc {
404 * @save: save connector state 416 * @save: save connector state
405 * @restore: restore connector state 417 * @restore: restore connector state
406 * @reset: reset connector after state has been invalidate (e.g. resume) 418 * @reset: reset connector after state has been invalidate (e.g. resume)
407 * @mode_valid: is this mode valid on the given connector?
408 * @mode_fixup: try to fixup proposed mode for this connector
409 * @mode_set: set this mode
410 * @detect: is this connector active? 419 * @detect: is this connector active?
411 * @get_modes: get mode list for this connector 420 * @fill_modes: fill mode list for this connector
412 * @set_property: property for this connector may need update 421 * @set_property: property for this connector may need update
413 * @destroy: make object go away 422 * @destroy: make object go away
414 * @force: notify the driver the connector is forced on 423 * @force: notify the driver the connector is forced on
@@ -451,7 +460,6 @@ struct drm_encoder_funcs {
451}; 460};
452 461
453#define DRM_CONNECTOR_MAX_UMODES 16 462#define DRM_CONNECTOR_MAX_UMODES 16
454#define DRM_CONNECTOR_MAX_PROPERTY 16
455#define DRM_CONNECTOR_LEN 32 463#define DRM_CONNECTOR_LEN 32
456#define DRM_CONNECTOR_MAX_ENCODER 3 464#define DRM_CONNECTOR_MAX_ENCODER 3
457 465
@@ -520,8 +528,7 @@ enum drm_connector_force {
520 * @funcs: connector control functions 528 * @funcs: connector control functions
521 * @user_modes: user added mode list 529 * @user_modes: user added mode list
522 * @edid_blob_ptr: DRM property containing EDID if present 530 * @edid_blob_ptr: DRM property containing EDID if present
523 * @property_ids: property tracking for this connector 531 * @properties: 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 532 * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling
526 * @dpms: current dpms state 533 * @dpms: current dpms state
527 * @helper_private: mid-layer private data 534 * @helper_private: mid-layer private data
@@ -565,8 +572,7 @@ struct drm_connector {
565 572
566 struct list_head user_modes; 573 struct list_head user_modes;
567 struct drm_property_blob *edid_blob_ptr; 574 struct drm_property_blob *edid_blob_ptr;
568 u32 property_ids[DRM_CONNECTOR_MAX_PROPERTY]; 575 struct drm_object_properties properties;
569 uint64_t property_values[DRM_CONNECTOR_MAX_PROPERTY];
570 576
571 uint8_t polled; /* DRM_CONNECTOR_POLL_* */ 577 uint8_t polled; /* DRM_CONNECTOR_POLL_* */
572 578
@@ -595,6 +601,7 @@ struct drm_connector {
595 * @update_plane: update the plane configuration 601 * @update_plane: update the plane configuration
596 * @disable_plane: shut down the plane 602 * @disable_plane: shut down the plane
597 * @destroy: clean up plane resources 603 * @destroy: clean up plane resources
604 * @set_property: called when a property is changed
598 */ 605 */
599struct drm_plane_funcs { 606struct drm_plane_funcs {
600 int (*update_plane)(struct drm_plane *plane, 607 int (*update_plane)(struct drm_plane *plane,
@@ -605,6 +612,9 @@ struct drm_plane_funcs {
605 uint32_t src_w, uint32_t src_h); 612 uint32_t src_w, uint32_t src_h);
606 int (*disable_plane)(struct drm_plane *plane); 613 int (*disable_plane)(struct drm_plane *plane);
607 void (*destroy)(struct drm_plane *plane); 614 void (*destroy)(struct drm_plane *plane);
615
616 int (*set_property)(struct drm_plane *plane,
617 struct drm_property *property, uint64_t val);
608}; 618};
609 619
610/** 620/**
@@ -622,6 +632,7 @@ struct drm_plane_funcs {
622 * @enabled: enabled flag 632 * @enabled: enabled flag
623 * @funcs: helper functions 633 * @funcs: helper functions
624 * @helper_private: storage for drver layer 634 * @helper_private: storage for drver layer
635 * @properties: property tracking for this plane
625 */ 636 */
626struct drm_plane { 637struct drm_plane {
627 struct drm_device *dev; 638 struct drm_device *dev;
@@ -644,6 +655,8 @@ struct drm_plane {
644 655
645 const struct drm_plane_funcs *funcs; 656 const struct drm_plane_funcs *funcs;
646 void *helper_private; 657 void *helper_private;
658
659 struct drm_object_properties properties;
647}; 660};
648 661
649/** 662/**
@@ -761,7 +774,7 @@ struct drm_mode_config {
761 774
762 int min_width, min_height; 775 int min_width, min_height;
763 int max_width, max_height; 776 int max_width, max_height;
764 struct drm_mode_config_funcs *funcs; 777 const struct drm_mode_config_funcs *funcs;
765 resource_size_t fb_base; 778 resource_size_t fb_base;
766 779
767 /* output poll support */ 780 /* output poll support */
@@ -898,6 +911,12 @@ extern int drm_connector_property_set_value(struct drm_connector *connector,
898extern int drm_connector_property_get_value(struct drm_connector *connector, 911extern int drm_connector_property_get_value(struct drm_connector *connector,
899 struct drm_property *property, 912 struct drm_property *property,
900 uint64_t *value); 913 uint64_t *value);
914extern int drm_object_property_set_value(struct drm_mode_object *obj,
915 struct drm_property *property,
916 uint64_t val);
917extern int drm_object_property_get_value(struct drm_mode_object *obj,
918 struct drm_property *property,
919 uint64_t *value);
901extern struct drm_display_mode *drm_crtc_mode_create(struct drm_device *dev); 920extern struct drm_display_mode *drm_crtc_mode_create(struct drm_device *dev);
902extern void drm_framebuffer_set_object(struct drm_device *dev, 921extern void drm_framebuffer_set_object(struct drm_device *dev,
903 unsigned long handle); 922 unsigned long handle);
@@ -910,14 +929,21 @@ extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
910extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY); 929extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY);
911extern bool drm_crtc_in_use(struct drm_crtc *crtc); 930extern bool drm_crtc_in_use(struct drm_crtc *crtc);
912 931
913extern int drm_connector_attach_property(struct drm_connector *connector, 932extern void drm_connector_attach_property(struct drm_connector *connector,
914 struct drm_property *property, uint64_t init_val); 933 struct drm_property *property, uint64_t init_val);
934extern void drm_object_attach_property(struct drm_mode_object *obj,
935 struct drm_property *property,
936 uint64_t init_val);
915extern struct drm_property *drm_property_create(struct drm_device *dev, int flags, 937extern struct drm_property *drm_property_create(struct drm_device *dev, int flags,
916 const char *name, int num_values); 938 const char *name, int num_values);
917extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags, 939extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags,
918 const char *name, 940 const char *name,
919 const struct drm_prop_enum_list *props, 941 const struct drm_prop_enum_list *props,
920 int num_values); 942 int num_values);
943struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
944 int flags, const char *name,
945 const struct drm_prop_enum_list *props,
946 int num_values);
921struct drm_property *drm_property_create_range(struct drm_device *dev, int flags, 947struct drm_property *drm_property_create_range(struct drm_device *dev, int flags,
922 const char *name, 948 const char *name,
923 uint64_t min, uint64_t max); 949 uint64_t min, uint64_t max);
@@ -1012,10 +1038,11 @@ extern int drm_add_modes_noedid(struct drm_connector *connector,
1012 int hdisplay, int vdisplay); 1038 int hdisplay, int vdisplay);
1013 1039
1014extern int drm_edid_header_is_valid(const u8 *raw_edid); 1040extern int drm_edid_header_is_valid(const u8 *raw_edid);
1015extern bool drm_edid_block_valid(u8 *raw_edid); 1041extern bool drm_edid_block_valid(u8 *raw_edid, int block);
1016extern bool drm_edid_is_valid(struct edid *edid); 1042extern bool drm_edid_is_valid(struct edid *edid);
1017struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, 1043struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
1018 int hsize, int vsize, int fresh); 1044 int hsize, int vsize, int fresh,
1045 bool rb);
1019 1046
1020extern int drm_mode_create_dumb_ioctl(struct drm_device *dev, 1047extern int drm_mode_create_dumb_ioctl(struct drm_device *dev,
1021 void *data, struct drm_file *file_priv); 1048 void *data, struct drm_file *file_priv);
@@ -1023,7 +1050,16 @@ extern int drm_mode_mmap_dumb_ioctl(struct drm_device *dev,
1023 void *data, struct drm_file *file_priv); 1050 void *data, struct drm_file *file_priv);
1024extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, 1051extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
1025 void *data, struct drm_file *file_priv); 1052 void *data, struct drm_file *file_priv);
1053extern int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
1054 struct drm_file *file_priv);
1055extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
1056 struct drm_file *file_priv);
1026 1057
1027extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, 1058extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
1028 int *bpp); 1059 int *bpp);
1060extern int drm_format_num_planes(uint32_t format);
1061extern int drm_format_plane_cpp(uint32_t format, int plane);
1062extern int drm_format_horz_chroma_subsampling(uint32_t format);
1063extern int drm_format_vert_chroma_subsampling(uint32_t format);
1064
1029#endif /* __DRM_CRTC_H__ */ 1065#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index 37515d1afab3..7988e55c98d0 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -44,6 +44,13 @@ enum mode_set_atomic {
44 ENTER_ATOMIC_MODE_SET, 44 ENTER_ATOMIC_MODE_SET,
45}; 45};
46 46
47/**
48 * drm_crtc_helper_funcs - helper operations for CRTCs
49 * @mode_fixup: try to fixup proposed mode for this connector
50 * @mode_set: set this mode
51 *
52 * The helper operations are called by the mid-layer CRTC helper.
53 */
47struct drm_crtc_helper_funcs { 54struct drm_crtc_helper_funcs {
48 /* 55 /*
49 * Control power levels on the CRTC. If the mode passed in is 56 * Control power levels on the CRTC. If the mode passed in is
@@ -76,6 +83,13 @@ struct drm_crtc_helper_funcs {
76 void (*disable)(struct drm_crtc *crtc); 83 void (*disable)(struct drm_crtc *crtc);
77}; 84};
78 85
86/**
87 * drm_encoder_helper_funcs - helper operations for encoders
88 * @mode_fixup: try to fixup proposed mode for this connector
89 * @mode_set: set this mode
90 *
91 * The helper operations are called by the mid-layer CRTC helper.
92 */
79struct drm_encoder_helper_funcs { 93struct drm_encoder_helper_funcs {
80 void (*dpms)(struct drm_encoder *encoder, int mode); 94 void (*dpms)(struct drm_encoder *encoder, int mode);
81 void (*save)(struct drm_encoder *encoder); 95 void (*save)(struct drm_encoder *encoder);
@@ -97,6 +111,13 @@ struct drm_encoder_helper_funcs {
97 void (*disable)(struct drm_encoder *encoder); 111 void (*disable)(struct drm_encoder *encoder);
98}; 112};
99 113
114/**
115 * drm_connector_helper_funcs - helper operations for connectors
116 * @get_modes: get mode list for this connector
117 * @mode_valid: is this mode valid on the given connector?
118 *
119 * The helper operations are called by the mid-layer CRTC helper.
120 */
100struct drm_connector_helper_funcs { 121struct drm_connector_helper_funcs {
101 int (*get_modes)(struct drm_connector *connector); 122 int (*get_modes)(struct drm_connector *connector);
102 int (*mode_valid)(struct drm_connector *connector, 123 int (*mode_valid)(struct drm_connector *connector,
@@ -145,6 +166,4 @@ extern void drm_helper_hpd_irq_event(struct drm_device *dev);
145extern void drm_kms_helper_poll_disable(struct drm_device *dev); 166extern void drm_kms_helper_poll_disable(struct drm_device *dev);
146extern void drm_kms_helper_poll_enable(struct drm_device *dev); 167extern void drm_kms_helper_poll_enable(struct drm_device *dev);
147 168
148extern int drm_format_num_planes(uint32_t format);
149
150#endif 169#endif
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 93df2d72750b..1744b18c06b3 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -72,6 +72,10 @@
72 72
73#define DP_MAIN_LINK_CHANNEL_CODING 0x006 73#define DP_MAIN_LINK_CHANNEL_CODING 0x006
74 74
75#define DP_DOWN_STREAM_PORT_COUNT 0x007
76#define DP_PORT_COUNT_MASK 0x0f
77#define DP_OUI_SUPPORT (1 << 7)
78
75#define DP_EDP_CONFIGURATION_CAP 0x00d 79#define DP_EDP_CONFIGURATION_CAP 0x00d
76#define DP_TRAINING_AUX_RD_INTERVAL 0x00e 80#define DP_TRAINING_AUX_RD_INTERVAL 0x00e
77 81
@@ -213,6 +217,10 @@
213# define DP_TEST_NAK (1 << 1) 217# define DP_TEST_NAK (1 << 1)
214# define DP_TEST_EDID_CHECKSUM_WRITE (1 << 2) 218# define DP_TEST_EDID_CHECKSUM_WRITE (1 << 2)
215 219
220#define DP_SOURCE_OUI 0x300
221#define DP_SINK_OUI 0x400
222#define DP_BRANCH_OUI 0x500
223
216#define DP_SET_POWER 0x600 224#define DP_SET_POWER 0x600
217# define DP_SET_POWER_D0 0x1 225# define DP_SET_POWER_D0 0x1
218# define DP_SET_POWER_D3 0x2 226# define DP_SET_POWER_D3 0x2
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index bcb9a66baa8c..0cac551c5347 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -90,12 +90,26 @@ struct detailed_data_monitor_range {
90 u8 min_hfreq_khz; 90 u8 min_hfreq_khz;
91 u8 max_hfreq_khz; 91 u8 max_hfreq_khz;
92 u8 pixel_clock_mhz; /* need to multiply by 10 */ 92 u8 pixel_clock_mhz; /* need to multiply by 10 */
93 __le16 sec_gtf_toggle; /* A000=use above, 20=use below */ 93 u8 flags;
94 u8 hfreq_start_khz; /* need to multiply by 2 */ 94 union {
95 u8 c; /* need to divide by 2 */ 95 struct {
96 __le16 m; 96 u8 reserved;
97 u8 k; 97 u8 hfreq_start_khz; /* need to multiply by 2 */
98 u8 j; /* need to divide by 2 */ 98 u8 c; /* need to divide by 2 */
99 __le16 m;
100 u8 k;
101 u8 j; /* need to divide by 2 */
102 } __attribute__((packed)) gtf2;
103 struct {
104 u8 version;
105 u8 data1; /* high 6 bits: extra clock resolution */
106 u8 data2; /* plus low 2 of above: max hactive */
107 u8 supported_aspects;
108 u8 flags; /* preferred aspect and blanking support */
109 u8 supported_scalings;
110 u8 preferred_refresh;
111 } __attribute__((packed)) cvt;
112 } formula;
99} __attribute__((packed)); 113} __attribute__((packed));
100 114
101struct detailed_data_wpindex { 115struct detailed_data_wpindex {
diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h
index 4a08a664ff1f..0ead502e17d2 100644
--- a/include/drm/drm_fixed.h
+++ b/include/drm/drm_fixed.h
@@ -37,6 +37,7 @@ typedef union dfixed {
37#define dfixed_init(A) { .full = dfixed_const((A)) } 37#define dfixed_init(A) { .full = dfixed_const((A)) }
38#define dfixed_init_half(A) { .full = dfixed_const_half((A)) } 38#define dfixed_init_half(A) { .full = dfixed_const_half((A)) }
39#define dfixed_trunc(A) ((A).full >> 12) 39#define dfixed_trunc(A) ((A).full >> 12)
40#define dfixed_frac(A) ((A).full & ((1 << 12) - 1))
40 41
41static inline u32 dfixed_floor(fixed20_12 A) 42static inline u32 dfixed_floor(fixed20_12 A)
42{ 43{
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 4a0aae38e160..5581980b14f6 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -230,6 +230,7 @@ struct drm_mode_get_connector {
230#define DRM_MODE_PROP_IMMUTABLE (1<<2) 230#define DRM_MODE_PROP_IMMUTABLE (1<<2)
231#define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */ 231#define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */
232#define DRM_MODE_PROP_BLOB (1<<4) 232#define DRM_MODE_PROP_BLOB (1<<4)
233#define DRM_MODE_PROP_BITMASK (1<<5) /* bitmask of enumerated types */
233 234
234struct drm_mode_property_enum { 235struct drm_mode_property_enum {
235 __u64 value; 236 __u64 value;
@@ -254,6 +255,21 @@ struct drm_mode_connector_set_property {
254 __u32 connector_id; 255 __u32 connector_id;
255}; 256};
256 257
258struct drm_mode_obj_get_properties {
259 __u64 props_ptr;
260 __u64 prop_values_ptr;
261 __u32 count_props;
262 __u32 obj_id;
263 __u32 obj_type;
264};
265
266struct drm_mode_obj_set_property {
267 __u64 value;
268 __u32 prop_id;
269 __u32 obj_id;
270 __u32 obj_type;
271};
272
257struct drm_mode_get_blob { 273struct drm_mode_get_blob {
258 __u32 blob_id; 274 __u32 blob_id;
259 __u32 length; 275 __u32 length;
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
index e478de4e5d56..b6d7ce92eadd 100644
--- a/include/drm/exynos_drm.h
+++ b/include/drm/exynos_drm.h
@@ -29,6 +29,8 @@
29#ifndef _EXYNOS_DRM_H_ 29#ifndef _EXYNOS_DRM_H_
30#define _EXYNOS_DRM_H_ 30#define _EXYNOS_DRM_H_
31 31
32#include "drm.h"
33
32/** 34/**
33 * User-desired buffer creation information structure. 35 * User-desired buffer creation information structure.
34 * 36 *
@@ -75,6 +77,21 @@ struct drm_exynos_gem_mmap {
75}; 77};
76 78
77/** 79/**
80 * A structure to gem information.
81 *
82 * @handle: a handle to gem object created.
83 * @flags: flag value including memory type and cache attribute and
84 * this value would be set by driver.
85 * @size: size to memory region allocated by gem and this size would
86 * be set by driver.
87 */
88struct drm_exynos_gem_info {
89 unsigned int handle;
90 unsigned int flags;
91 uint64_t size;
92};
93
94/**
78 * A structure for user connection request of virtual display. 95 * A structure for user connection request of virtual display.
79 * 96 *
80 * @connection: indicate whether doing connetion or not by user. 97 * @connection: indicate whether doing connetion or not by user.
@@ -95,18 +112,64 @@ struct drm_exynos_plane_set_zpos {
95 112
96/* memory type definitions. */ 113/* memory type definitions. */
97enum e_drm_exynos_gem_mem_type { 114enum e_drm_exynos_gem_mem_type {
115 /* Physically Continuous memory and used as default. */
116 EXYNOS_BO_CONTIG = 0 << 0,
98 /* Physically Non-Continuous memory. */ 117 /* Physically Non-Continuous memory. */
99 EXYNOS_BO_NONCONTIG = 1 << 0, 118 EXYNOS_BO_NONCONTIG = 1 << 0,
100 EXYNOS_BO_MASK = EXYNOS_BO_NONCONTIG 119 /* non-cachable mapping and used as default. */
120 EXYNOS_BO_NONCACHABLE = 0 << 1,
121 /* cachable mapping. */
122 EXYNOS_BO_CACHABLE = 1 << 1,
123 /* write-combine mapping. */
124 EXYNOS_BO_WC = 1 << 2,
125 EXYNOS_BO_MASK = EXYNOS_BO_NONCONTIG | EXYNOS_BO_CACHABLE |
126 EXYNOS_BO_WC
127};
128
129struct drm_exynos_g2d_get_ver {
130 __u32 major;
131 __u32 minor;
132};
133
134struct drm_exynos_g2d_cmd {
135 __u32 offset;
136 __u32 data;
137};
138
139enum drm_exynos_g2d_event_type {
140 G2D_EVENT_NOT,
141 G2D_EVENT_NONSTOP,
142 G2D_EVENT_STOP, /* not yet */
143};
144
145struct drm_exynos_g2d_set_cmdlist {
146 __u64 cmd;
147 __u64 cmd_gem;
148 __u32 cmd_nr;
149 __u32 cmd_gem_nr;
150
151 /* for g2d event */
152 __u64 event_type;
153 __u64 user_data;
154};
155
156struct drm_exynos_g2d_exec {
157 __u64 async;
101}; 158};
102 159
103#define DRM_EXYNOS_GEM_CREATE 0x00 160#define DRM_EXYNOS_GEM_CREATE 0x00
104#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01 161#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01
105#define DRM_EXYNOS_GEM_MMAP 0x02 162#define DRM_EXYNOS_GEM_MMAP 0x02
106/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */ 163/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
164#define DRM_EXYNOS_GEM_GET 0x04
107#define DRM_EXYNOS_PLANE_SET_ZPOS 0x06 165#define DRM_EXYNOS_PLANE_SET_ZPOS 0x06
108#define DRM_EXYNOS_VIDI_CONNECTION 0x07 166#define DRM_EXYNOS_VIDI_CONNECTION 0x07
109 167
168/* G2D */
169#define DRM_EXYNOS_G2D_GET_VER 0x20
170#define DRM_EXYNOS_G2D_SET_CMDLIST 0x21
171#define DRM_EXYNOS_G2D_EXEC 0x22
172
110#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ 173#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
111 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create) 174 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
112 175
@@ -116,12 +179,34 @@ enum e_drm_exynos_gem_mem_type {
116#define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \ 179#define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \
117 DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap) 180 DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap)
118 181
182#define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \
183 DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info)
184
119#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \ 185#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \
120 DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos) 186 DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos)
121 187
122#define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \ 188#define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \
123 DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection) 189 DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection)
124 190
191#define DRM_IOCTL_EXYNOS_G2D_GET_VER DRM_IOWR(DRM_COMMAND_BASE + \
192 DRM_EXYNOS_G2D_GET_VER, struct drm_exynos_g2d_get_ver)
193#define DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST DRM_IOWR(DRM_COMMAND_BASE + \
194 DRM_EXYNOS_G2D_SET_CMDLIST, struct drm_exynos_g2d_set_cmdlist)
195#define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \
196 DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec)
197
198/* EXYNOS specific events */
199#define DRM_EXYNOS_G2D_EVENT 0x80000000
200
201struct drm_exynos_g2d_event {
202 struct drm_event base;
203 __u64 user_data;
204 __u32 tv_sec;
205 __u32 tv_usec;
206 __u32 cmdlist_no;
207 __u32 reserved;
208};
209
125#ifdef __KERNEL__ 210#ifdef __KERNEL__
126 211
127/** 212/**
@@ -169,16 +254,14 @@ struct exynos_drm_common_hdmi_pd {
169/** 254/**
170 * Platform Specific Structure for DRM based HDMI core. 255 * Platform Specific Structure for DRM based HDMI core.
171 * 256 *
172 * @timing: default video mode for initializing
173 * @default_win: default window layer number to be used for UI.
174 * @bpp: default bit per pixel.
175 * @is_v13: set if hdmi version 13 is. 257 * @is_v13: set if hdmi version 13 is.
258 * @cfg_hpd: function pointer to configure hdmi hotplug detection pin
259 * @get_hpd: function pointer to get value of hdmi hotplug detection pin
176 */ 260 */
177struct exynos_drm_hdmi_pdata { 261struct exynos_drm_hdmi_pdata {
178 struct fb_videomode timing; 262 bool is_v13;
179 unsigned int default_win; 263 void (*cfg_hpd)(bool external);
180 unsigned int bpp; 264 int (*get_hpd)(void);
181 unsigned int is_v13:1;
182}; 265};
183 266
184#endif /* __KERNEL__ */ 267#endif /* __KERNEL__ */
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index da929bb5b788..f3f82242bf1d 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -296,7 +296,8 @@ typedef struct drm_i915_irq_wait {
296#define I915_PARAM_HAS_EXEC_CONSTANTS 14 296#define I915_PARAM_HAS_EXEC_CONSTANTS 14
297#define I915_PARAM_HAS_RELAXED_DELTA 15 297#define I915_PARAM_HAS_RELAXED_DELTA 15
298#define I915_PARAM_HAS_GEN7_SOL_RESET 16 298#define I915_PARAM_HAS_GEN7_SOL_RESET 16
299#define I915_PARAM_HAS_LLC 17 299#define I915_PARAM_HAS_LLC 17
300#define I915_PARAM_HAS_ALIASING_PPGTT 18
300 301
301typedef struct drm_i915_getparam { 302typedef struct drm_i915_getparam {
302 int param; 303 int param;
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 7c491b4bcf65..58056865b8e9 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -926,7 +926,6 @@ struct drm_radeon_cs_chunk {
926}; 926};
927 927
928/* drm_radeon_cs_reloc.flags */ 928/* drm_radeon_cs_reloc.flags */
929#define RADEON_RELOC_DONT_SYNC 0x01
930 929
931struct drm_radeon_cs_reloc { 930struct drm_radeon_cs_reloc {
932 uint32_t handle; 931 uint32_t handle;
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 974c8f801c39..e15f2a89a270 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -124,11 +124,15 @@ struct ttm_mem_reg {
124 * 124 *
125 * @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,
126 * 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.
127 *
128 * @ttm_bo_type_sg: Buffer made from dmabuf sg table shared with another
129 * driver.
127 */ 130 */
128 131
129enum ttm_bo_type { 132enum ttm_bo_type {
130 ttm_bo_type_device, 133 ttm_bo_type_device,
131 ttm_bo_type_kernel 134 ttm_bo_type_kernel,
135 ttm_bo_type_sg
132}; 136};
133 137
134struct ttm_tt; 138struct ttm_tt;
@@ -271,6 +275,8 @@ struct ttm_buffer_object {
271 275
272 unsigned long offset; 276 unsigned long offset;
273 uint32_t cur_placement; 277 uint32_t cur_placement;
278
279 struct sg_table *sg;
274}; 280};
275 281
276/** 282/**
@@ -503,6 +509,7 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev,
503 bool interrubtible, 509 bool interrubtible,
504 struct file *persistent_swap_storage, 510 struct file *persistent_swap_storage,
505 size_t acc_size, 511 size_t acc_size,
512 struct sg_table *sg,
506 void (*destroy) (struct ttm_buffer_object *)); 513 void (*destroy) (struct ttm_buffer_object *));
507 514
508/** 515/**
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index d43e892307ff..a05f1b55714d 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -81,6 +81,7 @@ struct ttm_backend_func {
81#define TTM_PAGE_FLAG_PERSISTENT_SWAP (1 << 5) 81#define TTM_PAGE_FLAG_PERSISTENT_SWAP (1 << 5)
82#define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6) 82#define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6)
83#define TTM_PAGE_FLAG_DMA32 (1 << 7) 83#define TTM_PAGE_FLAG_DMA32 (1 << 7)
84#define TTM_PAGE_FLAG_SG (1 << 8)
84 85
85enum ttm_caching_state { 86enum ttm_caching_state {
86 tt_uncached, 87 tt_uncached,
@@ -116,6 +117,7 @@ struct ttm_tt {
116 struct page **pages; 117 struct page **pages;
117 uint32_t page_flags; 118 uint32_t page_flags;
118 unsigned long num_pages; 119 unsigned long num_pages;
120 struct sg_table *sg; /* for SG objects via dma-buf */
119 struct ttm_bo_global *glob; 121 struct ttm_bo_global *glob;
120 struct ttm_backend *be; 122 struct ttm_backend *be;
121 struct file *swap_storage; 123 struct file *swap_storage;
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index cfaaa6949b8b..efa26b4da8d2 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -426,7 +426,7 @@ static inline int fault_in_pages_writeable(char __user *uaddr, int size)
426 */ 426 */
427 if (((unsigned long)uaddr & PAGE_MASK) != 427 if (((unsigned long)uaddr & PAGE_MASK) !=
428 ((unsigned long)end & PAGE_MASK)) 428 ((unsigned long)end & PAGE_MASK))
429 ret = __put_user(0, end); 429 ret = __put_user(0, end);
430 } 430 }
431 return ret; 431 return ret;
432} 432}
@@ -445,13 +445,73 @@ static inline int fault_in_pages_readable(const char __user *uaddr, int size)
445 445
446 if (((unsigned long)uaddr & PAGE_MASK) != 446 if (((unsigned long)uaddr & PAGE_MASK) !=
447 ((unsigned long)end & PAGE_MASK)) { 447 ((unsigned long)end & PAGE_MASK)) {
448 ret = __get_user(c, end); 448 ret = __get_user(c, end);
449 (void)c; 449 (void)c;
450 } 450 }
451 } 451 }
452 return ret; 452 return ret;
453} 453}
454 454
455/*
456 * Multipage variants of the above prefault helpers, useful if more than
457 * PAGE_SIZE of data needs to be prefaulted. These are separate from the above
458 * functions (which only handle up to PAGE_SIZE) to avoid clobbering the
459 * filemap.c hotpaths.
460 */
461static inline int fault_in_multipages_writeable(char __user *uaddr, int size)
462{
463 int ret;
464 char __user *end = uaddr + size - 1;
465
466 if (unlikely(size == 0))
467 return 0;
468
469 /*
470 * Writing zeroes into userspace here is OK, because we know that if
471 * the zero gets there, we'll be overwriting it.
472 */
473 while (uaddr <= end) {
474 ret = __put_user(0, uaddr);
475 if (ret != 0)
476 return ret;
477 uaddr += PAGE_SIZE;
478 }
479
480 /* Check whether the range spilled into the next page. */
481 if (((unsigned long)uaddr & PAGE_MASK) ==
482 ((unsigned long)end & PAGE_MASK))
483 ret = __put_user(0, end);
484
485 return ret;
486}
487
488static inline int fault_in_multipages_readable(const char __user *uaddr,
489 int size)
490{
491 volatile char c;
492 int ret;
493 const char __user *end = uaddr + size - 1;
494
495 if (unlikely(size == 0))
496 return 0;
497
498 while (uaddr <= end) {
499 ret = __get_user(c, uaddr);
500 if (ret != 0)
501 return ret;
502 uaddr += PAGE_SIZE;
503 }
504
505 /* Check whether the range spilled into the next page. */
506 if (((unsigned long)uaddr & PAGE_MASK) ==
507 ((unsigned long)end & PAGE_MASK)) {
508 ret = __get_user(c, end);
509 (void)c;
510 }
511
512 return ret;
513}
514
455int add_to_page_cache_locked(struct page *page, struct address_space *mapping, 515int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
456 pgoff_t index, gfp_t gfp_mask); 516 pgoff_t index, gfp_t gfp_mask);
457int add_to_page_cache_lru(struct page *page, struct address_space *mapping, 517int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
index 4b9a7f596f92..b455c7c212eb 100644
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -28,13 +28,19 @@ struct vga_switcheroo_handler {
28 int (*get_client_id)(struct pci_dev *pdev); 28 int (*get_client_id)(struct pci_dev *pdev);
29}; 29};
30 30
31struct vga_switcheroo_client_ops {
32 void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state);
33 void (*reprobe)(struct pci_dev *dev);
34 bool (*can_switch)(struct pci_dev *dev);
35};
31 36
32#if defined(CONFIG_VGA_SWITCHEROO) 37#if defined(CONFIG_VGA_SWITCHEROO)
33void vga_switcheroo_unregister_client(struct pci_dev *dev); 38void vga_switcheroo_unregister_client(struct pci_dev *dev);
34int vga_switcheroo_register_client(struct pci_dev *dev, 39int vga_switcheroo_register_client(struct pci_dev *dev,
35 void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state), 40 const struct vga_switcheroo_client_ops *ops);
36 void (*reprobe)(struct pci_dev *dev), 41int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
37 bool (*can_switch)(struct pci_dev *dev)); 42 const struct vga_switcheroo_client_ops *ops,
43 int id, bool active);
38 44
39void vga_switcheroo_client_fb_set(struct pci_dev *dev, 45void vga_switcheroo_client_fb_set(struct pci_dev *dev,
40 struct fb_info *info); 46 struct fb_info *info);
@@ -48,11 +54,12 @@ int vga_switcheroo_process_delayed_switch(void);
48 54
49static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {} 55static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {}
50static inline int vga_switcheroo_register_client(struct pci_dev *dev, 56static inline int vga_switcheroo_register_client(struct pci_dev *dev,
51 void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state), 57 const struct vga_switcheroo_client_ops *ops) { return 0; }
52 void (*reprobe)(struct pci_dev *dev),
53 bool (*can_switch)(struct pci_dev *dev)) { return 0; }
54static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {} 58static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {}
55static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; } 59static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; }
60static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
61 const struct vga_switcheroo_client_ops *ops,
62 int id, bool active) { return 0; }
56static inline void vga_switcheroo_unregister_handler(void) {} 63static inline void vga_switcheroo_unregister_handler(void) {}
57static inline int vga_switcheroo_process_delayed_switch(void) { return 0; } 64static inline int vga_switcheroo_process_delayed_switch(void) { return 0; }
58 65
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index b572f80bdfd5..0ee42d9acdc0 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -31,6 +31,7 @@
31#ifndef LINUX_VGA_H 31#ifndef LINUX_VGA_H
32#define LINUX_VGA_H 32#define LINUX_VGA_H
33 33
34#include <video/vga.h>
34 35
35/* Legacy VGA regions */ 36/* Legacy VGA regions */
36#define VGA_RSRC_NONE 0x00 37#define VGA_RSRC_NONE 0x00
@@ -182,7 +183,13 @@ extern void vga_put(struct pci_dev *pdev, unsigned int rsrc);
182 */ 183 */
183 184
184#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE 185#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
186#ifdef CONFIG_VGA_ARB
185extern struct pci_dev *vga_default_device(void); 187extern struct pci_dev *vga_default_device(void);
188extern void vga_set_default_device(struct pci_dev *pdev);
189#else
190static inline struct pci_dev *vga_default_device(void) { return NULL; };
191static inline void vga_set_default_device(struct pci_dev *pdev) { };
192#endif
186#endif 193#endif
187 194
188/** 195/**