diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/drm/drmP.h | 3 | ||||
| -rw-r--r-- | include/drm/drm_crtc.h | 43 | ||||
| -rw-r--r-- | include/drm/drm_crtc_helper.h | 9 | ||||
| -rw-r--r-- | include/drm/drm_edid.h | 5 | ||||
| -rw-r--r-- | include/drm/drm_fb_helper.h | 67 | ||||
| -rw-r--r-- | include/drm/drm_fixed.h | 67 | ||||
| -rw-r--r-- | include/drm/radeon_drm.h | 1 | ||||
| -rw-r--r-- | include/drm/ttm/ttm_bo_api.h | 46 | ||||
| -rw-r--r-- | include/drm/ttm/ttm_bo_driver.h | 57 | ||||
| -rw-r--r-- | include/drm/ttm/ttm_page_alloc.h | 74 | ||||
| -rw-r--r-- | include/linux/fb.h | 19 |
11 files changed, 310 insertions, 81 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 2f3b3a00b7a3..c1b987158dfa 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
| @@ -1428,10 +1428,13 @@ extern void drm_sysfs_connector_remove(struct drm_connector *connector); | |||
| 1428 | /* Graphics Execution Manager library functions (drm_gem.c) */ | 1428 | /* Graphics Execution Manager library functions (drm_gem.c) */ |
| 1429 | int drm_gem_init(struct drm_device *dev); | 1429 | int drm_gem_init(struct drm_device *dev); |
| 1430 | void drm_gem_destroy(struct drm_device *dev); | 1430 | void drm_gem_destroy(struct drm_device *dev); |
| 1431 | void drm_gem_object_release(struct drm_gem_object *obj); | ||
| 1431 | void drm_gem_object_free(struct kref *kref); | 1432 | void drm_gem_object_free(struct kref *kref); |
| 1432 | void drm_gem_object_free_unlocked(struct kref *kref); | 1433 | void drm_gem_object_free_unlocked(struct kref *kref); |
| 1433 | struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, | 1434 | struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, |
| 1434 | size_t size); | 1435 | size_t size); |
| 1436 | int drm_gem_object_init(struct drm_device *dev, | ||
| 1437 | struct drm_gem_object *obj, size_t size); | ||
| 1435 | void drm_gem_object_handle_free(struct kref *kref); | 1438 | void drm_gem_object_handle_free(struct kref *kref); |
| 1436 | void drm_gem_vm_open(struct vm_area_struct *vma); | 1439 | void drm_gem_vm_open(struct vm_area_struct *vma); |
| 1437 | void drm_gem_vm_close(struct vm_area_struct *vma); | 1440 | void drm_gem_vm_close(struct vm_area_struct *vma); |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 1347524a8e30..93a1a31b9c2d 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <linux/idr.h> | 31 | #include <linux/idr.h> |
| 32 | 32 | ||
| 33 | #include <linux/fb.h> | 33 | #include <linux/fb.h> |
| 34 | #include <linux/slow-work.h> | ||
| 34 | 35 | ||
| 35 | struct drm_device; | 36 | struct drm_device; |
| 36 | struct drm_mode_set; | 37 | struct drm_mode_set; |
| @@ -271,8 +272,6 @@ struct drm_framebuffer { | |||
| 271 | unsigned int depth; | 272 | unsigned int depth; |
| 272 | int bits_per_pixel; | 273 | int bits_per_pixel; |
| 273 | int flags; | 274 | int flags; |
| 274 | struct fb_info *fbdev; | ||
| 275 | u32 pseudo_palette[17]; | ||
| 276 | struct list_head filp_head; | 275 | struct list_head filp_head; |
| 277 | /* if you are using the helper */ | 276 | /* if you are using the helper */ |
| 278 | void *helper_private; | 277 | void *helper_private; |
| @@ -369,9 +368,6 @@ struct drm_crtc_funcs { | |||
| 369 | * @enabled: is this CRTC enabled? | 368 | * @enabled: is this CRTC enabled? |
| 370 | * @x: x position on screen | 369 | * @x: x position on screen |
| 371 | * @y: y position on screen | 370 | * @y: y position on screen |
| 372 | * @desired_mode: new desired mode | ||
| 373 | * @desired_x: desired x for desired_mode | ||
| 374 | * @desired_y: desired y for desired_mode | ||
| 375 | * @funcs: CRTC control functions | 371 | * @funcs: CRTC control functions |
| 376 | * | 372 | * |
| 377 | * Each CRTC may have one or more connectors associated with it. This structure | 373 | * Each CRTC may have one or more connectors associated with it. This structure |
| @@ -391,8 +387,6 @@ struct drm_crtc { | |||
| 391 | struct drm_display_mode mode; | 387 | struct drm_display_mode mode; |
| 392 | 388 | ||
| 393 | int x, y; | 389 | int x, y; |
| 394 | struct drm_display_mode *desired_mode; | ||
| 395 | int desired_x, desired_y; | ||
| 396 | const struct drm_crtc_funcs *funcs; | 390 | const struct drm_crtc_funcs *funcs; |
| 397 | 391 | ||
| 398 | /* CRTC gamma size for reporting to userspace */ | 392 | /* CRTC gamma size for reporting to userspace */ |
| @@ -467,6 +461,15 @@ enum drm_connector_force { | |||
| 467 | DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */ | 461 | DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */ |
| 468 | }; | 462 | }; |
| 469 | 463 | ||
| 464 | /* should we poll this connector for connects and disconnects */ | ||
| 465 | /* hot plug detectable */ | ||
| 466 | #define DRM_CONNECTOR_POLL_HPD (1 << 0) | ||
| 467 | /* poll for connections */ | ||
| 468 | #define DRM_CONNECTOR_POLL_CONNECT (1 << 1) | ||
| 469 | /* can cleanly poll for disconnections without flickering the screen */ | ||
| 470 | /* DACs should rarely do this without a lot of testing */ | ||
| 471 | #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2) | ||
| 472 | |||
| 470 | /** | 473 | /** |
| 471 | * drm_connector - central DRM connector control structure | 474 | * drm_connector - central DRM connector control structure |
| 472 | * @crtc: CRTC this connector is currently connected to, NULL if none | 475 | * @crtc: CRTC this connector is currently connected to, NULL if none |
| @@ -511,6 +514,8 @@ struct drm_connector { | |||
| 511 | u32 property_ids[DRM_CONNECTOR_MAX_PROPERTY]; | 514 | u32 property_ids[DRM_CONNECTOR_MAX_PROPERTY]; |
| 512 | uint64_t property_values[DRM_CONNECTOR_MAX_PROPERTY]; | 515 | uint64_t property_values[DRM_CONNECTOR_MAX_PROPERTY]; |
| 513 | 516 | ||
| 517 | uint8_t polled; /* DRM_CONNECTOR_POLL_* */ | ||
| 518 | |||
| 514 | /* requested DPMS state */ | 519 | /* requested DPMS state */ |
| 515 | int dpms; | 520 | int dpms; |
| 516 | 521 | ||
| @@ -521,7 +526,6 @@ struct drm_connector { | |||
| 521 | uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; | 526 | uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; |
| 522 | uint32_t force_encoder_id; | 527 | uint32_t force_encoder_id; |
| 523 | struct drm_encoder *encoder; /* currently active encoder */ | 528 | struct drm_encoder *encoder; /* currently active encoder */ |
| 524 | void *fb_helper_private; | ||
| 525 | }; | 529 | }; |
| 526 | 530 | ||
| 527 | /** | 531 | /** |
| @@ -548,16 +552,10 @@ struct drm_mode_set { | |||
| 548 | 552 | ||
| 549 | /** | 553 | /** |
| 550 | * struct drm_mode_config_funcs - configure CRTCs for a given screen layout | 554 | * struct drm_mode_config_funcs - configure CRTCs for a given screen layout |
| 551 | * @resize: adjust CRTCs as necessary for the proposed layout | ||
| 552 | * | ||
| 553 | * Currently only a resize hook is available. DRM will call back into the | ||
| 554 | * driver with a new screen width and height. If the driver can't support | ||
| 555 | * the proposed size, it can return false. Otherwise it should adjust | ||
| 556 | * the CRTC<->connector mappings as needed and update its view of the screen. | ||
| 557 | */ | 555 | */ |
| 558 | struct drm_mode_config_funcs { | 556 | struct drm_mode_config_funcs { |
| 559 | struct drm_framebuffer *(*fb_create)(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd *mode_cmd); | 557 | struct drm_framebuffer *(*fb_create)(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd *mode_cmd); |
| 560 | int (*fb_changed)(struct drm_device *dev); | 558 | void (*output_poll_changed)(struct drm_device *dev); |
| 561 | }; | 559 | }; |
| 562 | 560 | ||
| 563 | struct drm_mode_group { | 561 | struct drm_mode_group { |
| @@ -590,14 +588,15 @@ struct drm_mode_config { | |||
| 590 | 588 | ||
| 591 | struct list_head property_list; | 589 | struct list_head property_list; |
| 592 | 590 | ||
| 593 | /* in-kernel framebuffers - hung of filp_head in drm_framebuffer */ | ||
| 594 | struct list_head fb_kernel_list; | ||
| 595 | |||
| 596 | int min_width, min_height; | 591 | int min_width, min_height; |
| 597 | int max_width, max_height; | 592 | int max_width, max_height; |
| 598 | struct drm_mode_config_funcs *funcs; | 593 | struct drm_mode_config_funcs *funcs; |
| 599 | resource_size_t fb_base; | 594 | resource_size_t fb_base; |
| 600 | 595 | ||
| 596 | /* output poll support */ | ||
| 597 | bool poll_enabled; | ||
| 598 | struct delayed_slow_work output_poll_slow_work; | ||
| 599 | |||
| 601 | /* pointers to standard properties */ | 600 | /* pointers to standard properties */ |
| 602 | struct list_head property_blob_list; | 601 | struct list_head property_blob_list; |
| 603 | struct drm_property *edid_property; | 602 | struct drm_property *edid_property; |
| @@ -666,8 +665,6 @@ extern void drm_fb_release(struct drm_file *file_priv); | |||
| 666 | extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); | 665 | extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); |
| 667 | extern struct edid *drm_get_edid(struct drm_connector *connector, | 666 | extern struct edid *drm_get_edid(struct drm_connector *connector, |
| 668 | struct i2c_adapter *adapter); | 667 | struct i2c_adapter *adapter); |
| 669 | extern int drm_do_probe_ddc_edid(struct i2c_adapter *adapter, | ||
| 670 | unsigned char *buf, int len); | ||
| 671 | extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); | 668 | extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); |
| 672 | extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); | 669 | extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); |
| 673 | extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode); | 670 | extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode); |
| @@ -799,8 +796,14 @@ extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, | |||
| 799 | extern struct drm_display_mode *drm_gtf_mode(struct drm_device *dev, | 796 | extern struct drm_display_mode *drm_gtf_mode(struct drm_device *dev, |
| 800 | int hdisplay, int vdisplay, int vrefresh, | 797 | int hdisplay, int vdisplay, int vrefresh, |
| 801 | bool interlaced, int margins); | 798 | bool interlaced, int margins); |
| 799 | extern struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev, | ||
| 800 | int hdisplay, int vdisplay, int vrefresh, | ||
| 801 | bool interlaced, int margins, int GTF_M, | ||
| 802 | int GTF_2C, int GTF_K, int GTF_2J); | ||
| 802 | extern int drm_add_modes_noedid(struct drm_connector *connector, | 803 | extern int drm_add_modes_noedid(struct drm_connector *connector, |
| 803 | int hdisplay, int vdisplay); | 804 | int hdisplay, int vdisplay); |
| 804 | 805 | ||
| 805 | extern bool drm_edid_is_valid(struct edid *edid); | 806 | extern bool drm_edid_is_valid(struct edid *edid); |
| 807 | struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, | ||
| 808 | int hsize, int vsize, int fresh); | ||
| 806 | #endif /* __DRM_CRTC_H__ */ | 809 | #endif /* __DRM_CRTC_H__ */ |
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h index b29e20168b5f..dc5873c21e45 100644 --- a/include/drm/drm_crtc_helper.h +++ b/include/drm/drm_crtc_helper.h | |||
| @@ -39,7 +39,6 @@ | |||
| 39 | 39 | ||
| 40 | #include <linux/fb.h> | 40 | #include <linux/fb.h> |
| 41 | 41 | ||
| 42 | #include "drm_fb_helper.h" | ||
| 43 | struct drm_crtc_helper_funcs { | 42 | struct drm_crtc_helper_funcs { |
| 44 | /* | 43 | /* |
| 45 | * Control power levels on the CRTC. If the mode passed in is | 44 | * Control power levels on the CRTC. If the mode passed in is |
| @@ -96,8 +95,6 @@ struct drm_connector_helper_funcs { | |||
| 96 | 95 | ||
| 97 | extern int drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY); | 96 | extern int drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY); |
| 98 | extern void drm_helper_disable_unused_functions(struct drm_device *dev); | 97 | extern void drm_helper_disable_unused_functions(struct drm_device *dev); |
| 99 | extern int drm_helper_hotplug_stage_two(struct drm_device *dev); | ||
| 100 | extern bool drm_helper_initial_config(struct drm_device *dev); | ||
| 101 | extern int drm_crtc_helper_set_config(struct drm_mode_set *set); | 98 | extern int drm_crtc_helper_set_config(struct drm_mode_set *set); |
| 102 | extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, | 99 | extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, |
| 103 | struct drm_display_mode *mode, | 100 | struct drm_display_mode *mode, |
| @@ -123,12 +120,14 @@ static inline void drm_encoder_helper_add(struct drm_encoder *encoder, | |||
| 123 | encoder->helper_private = (void *)funcs; | 120 | encoder->helper_private = (void *)funcs; |
| 124 | } | 121 | } |
| 125 | 122 | ||
| 126 | static inline int drm_connector_helper_add(struct drm_connector *connector, | 123 | static inline void drm_connector_helper_add(struct drm_connector *connector, |
| 127 | const struct drm_connector_helper_funcs *funcs) | 124 | const struct drm_connector_helper_funcs *funcs) |
| 128 | { | 125 | { |
| 129 | connector->helper_private = (void *)funcs; | 126 | connector->helper_private = (void *)funcs; |
| 130 | return drm_fb_helper_add_connector(connector); | ||
| 131 | } | 127 | } |
| 132 | 128 | ||
| 133 | extern int drm_helper_resume_force_mode(struct drm_device *dev); | 129 | extern int drm_helper_resume_force_mode(struct drm_device *dev); |
| 130 | extern void drm_kms_helper_poll_init(struct drm_device *dev); | ||
| 131 | extern void drm_kms_helper_poll_fini(struct drm_device *dev); | ||
| 132 | extern void drm_helper_hpd_irq_event(struct drm_device *dev); | ||
| 134 | #endif | 133 | #endif |
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index b4209898f115..39e2cc5c7e66 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h | |||
| @@ -120,7 +120,7 @@ struct detailed_non_pixel { | |||
| 120 | struct detailed_data_string str; | 120 | struct detailed_data_string str; |
| 121 | struct detailed_data_monitor_range range; | 121 | struct detailed_data_monitor_range range; |
| 122 | struct detailed_data_wpindex color; | 122 | struct detailed_data_wpindex color; |
| 123 | struct std_timing timings[5]; | 123 | struct std_timing timings[6]; |
| 124 | struct cvt_timing cvt[4]; | 124 | struct cvt_timing cvt[4]; |
| 125 | } data; | 125 | } data; |
| 126 | } __attribute__((packed)); | 126 | } __attribute__((packed)); |
| @@ -201,7 +201,4 @@ struct edid { | |||
| 201 | 201 | ||
| 202 | #define EDID_PRODUCT_ID(e) ((e)->prod_code[0] | ((e)->prod_code[1] << 8)) | 202 | #define EDID_PRODUCT_ID(e) ((e)->prod_code[0] | ((e)->prod_code[1] << 8)) |
| 203 | 203 | ||
| 204 | /* define the number of Extension EDID block */ | ||
| 205 | #define DRM_MAX_EDID_EXT_NUM 4 | ||
| 206 | |||
| 207 | #endif /* __DRM_EDID_H__ */ | 204 | #endif /* __DRM_EDID_H__ */ |
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index 58c892a2cbfa..f0a6afc47e76 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h | |||
| @@ -30,17 +30,12 @@ | |||
| 30 | #ifndef DRM_FB_HELPER_H | 30 | #ifndef DRM_FB_HELPER_H |
| 31 | #define DRM_FB_HELPER_H | 31 | #define DRM_FB_HELPER_H |
| 32 | 32 | ||
| 33 | struct drm_fb_helper; | ||
| 34 | |||
| 33 | struct drm_fb_helper_crtc { | 35 | struct drm_fb_helper_crtc { |
| 34 | uint32_t crtc_id; | 36 | uint32_t crtc_id; |
| 35 | struct drm_mode_set mode_set; | 37 | struct drm_mode_set mode_set; |
| 36 | }; | 38 | struct drm_display_mode *desired_mode; |
| 37 | |||
| 38 | |||
| 39 | struct drm_fb_helper_funcs { | ||
| 40 | void (*gamma_set)(struct drm_crtc *crtc, u16 red, u16 green, | ||
| 41 | u16 blue, int regno); | ||
| 42 | void (*gamma_get)(struct drm_crtc *crtc, u16 *red, u16 *green, | ||
| 43 | u16 *blue, int regno); | ||
| 44 | }; | 39 | }; |
| 45 | 40 | ||
| 46 | /* mode specified on the command line */ | 41 | /* mode specified on the command line */ |
| @@ -57,8 +52,28 @@ struct drm_fb_helper_cmdline_mode { | |||
| 57 | bool margins; | 52 | bool margins; |
| 58 | }; | 53 | }; |
| 59 | 54 | ||
| 55 | struct drm_fb_helper_surface_size { | ||
| 56 | u32 fb_width; | ||
| 57 | u32 fb_height; | ||
| 58 | u32 surface_width; | ||
| 59 | u32 surface_height; | ||
| 60 | u32 surface_bpp; | ||
| 61 | u32 surface_depth; | ||
| 62 | }; | ||
| 63 | |||
| 64 | struct drm_fb_helper_funcs { | ||
| 65 | void (*gamma_set)(struct drm_crtc *crtc, u16 red, u16 green, | ||
| 66 | u16 blue, int regno); | ||
| 67 | void (*gamma_get)(struct drm_crtc *crtc, u16 *red, u16 *green, | ||
| 68 | u16 *blue, int regno); | ||
| 69 | |||
| 70 | int (*fb_probe)(struct drm_fb_helper *helper, | ||
| 71 | struct drm_fb_helper_surface_size *sizes); | ||
| 72 | }; | ||
| 73 | |||
| 60 | struct drm_fb_helper_connector { | 74 | struct drm_fb_helper_connector { |
| 61 | struct drm_fb_helper_cmdline_mode cmdline_mode; | 75 | struct drm_fb_helper_cmdline_mode cmdline_mode; |
| 76 | struct drm_connector *connector; | ||
| 62 | }; | 77 | }; |
| 63 | 78 | ||
| 64 | struct drm_fb_helper { | 79 | struct drm_fb_helper { |
| @@ -67,24 +82,26 @@ struct drm_fb_helper { | |||
| 67 | struct drm_display_mode *mode; | 82 | struct drm_display_mode *mode; |
| 68 | int crtc_count; | 83 | int crtc_count; |
| 69 | struct drm_fb_helper_crtc *crtc_info; | 84 | struct drm_fb_helper_crtc *crtc_info; |
| 85 | int connector_count; | ||
| 86 | struct drm_fb_helper_connector **connector_info; | ||
| 70 | struct drm_fb_helper_funcs *funcs; | 87 | struct drm_fb_helper_funcs *funcs; |
| 71 | int conn_limit; | 88 | int conn_limit; |
| 89 | struct fb_info *fbdev; | ||
| 90 | u32 pseudo_palette[17]; | ||
| 72 | struct list_head kernel_fb_list; | 91 | struct list_head kernel_fb_list; |
| 92 | |||
| 93 | /* we got a hotplug but fbdev wasn't running the console | ||
| 94 | delay until next set_par */ | ||
| 95 | bool delayed_hotplug; | ||
| 73 | }; | 96 | }; |
| 74 | 97 | ||
| 75 | int drm_fb_helper_single_fb_probe(struct drm_device *dev, | 98 | int drm_fb_helper_single_fb_probe(struct drm_fb_helper *helper, |
| 76 | int preferred_bpp, | 99 | int preferred_bpp); |
| 77 | int (*fb_create)(struct drm_device *dev, | 100 | |
| 78 | uint32_t fb_width, | 101 | int drm_fb_helper_init(struct drm_device *dev, |
| 79 | uint32_t fb_height, | 102 | struct drm_fb_helper *helper, int crtc_count, |
| 80 | uint32_t surface_width, | 103 | int max_conn); |
| 81 | uint32_t surface_height, | 104 | void drm_fb_helper_fini(struct drm_fb_helper *helper); |
| 82 | uint32_t surface_depth, | ||
| 83 | uint32_t surface_bpp, | ||
| 84 | struct drm_framebuffer **fb_ptr)); | ||
| 85 | int drm_fb_helper_init_crtc_count(struct drm_fb_helper *helper, int crtc_count, | ||
| 86 | int max_conn); | ||
| 87 | void drm_fb_helper_free(struct drm_fb_helper *helper); | ||
| 88 | int drm_fb_helper_blank(int blank, struct fb_info *info); | 105 | int drm_fb_helper_blank(int blank, struct fb_info *info); |
| 89 | int drm_fb_helper_pan_display(struct fb_var_screeninfo *var, | 106 | int drm_fb_helper_pan_display(struct fb_var_screeninfo *var, |
| 90 | struct fb_info *info); | 107 | struct fb_info *info); |
| @@ -99,13 +116,15 @@ int drm_fb_helper_setcolreg(unsigned regno, | |||
| 99 | struct fb_info *info); | 116 | struct fb_info *info); |
| 100 | 117 | ||
| 101 | void drm_fb_helper_restore(void); | 118 | void drm_fb_helper_restore(void); |
| 102 | void drm_fb_helper_fill_var(struct fb_info *info, struct drm_framebuffer *fb, | 119 | void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper, |
| 103 | uint32_t fb_width, uint32_t fb_height); | 120 | uint32_t fb_width, uint32_t fb_height); |
| 104 | void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, | 121 | void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, |
| 105 | uint32_t depth); | 122 | uint32_t depth); |
| 106 | 123 | ||
| 107 | int drm_fb_helper_add_connector(struct drm_connector *connector); | ||
| 108 | int drm_fb_helper_parse_command_line(struct drm_device *dev); | ||
| 109 | int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info); | 124 | int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info); |
| 110 | 125 | ||
| 126 | bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper); | ||
| 127 | bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel); | ||
| 128 | int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper); | ||
| 129 | |||
| 111 | #endif | 130 | #endif |
diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h new file mode 100644 index 000000000000..4a08a664ff1f --- /dev/null +++ b/include/drm/drm_fixed.h | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2009 Red Hat Inc. | ||
| 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 shall be included in | ||
| 12 | * all copies or substantial portions of the Software. | ||
| 13 | * | ||
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
| 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
| 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
| 20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
| 21 | * | ||
| 22 | * Authors: Dave Airlie | ||
| 23 | */ | ||
| 24 | #ifndef DRM_FIXED_H | ||
| 25 | #define DRM_FIXED_H | ||
| 26 | |||
| 27 | typedef union dfixed { | ||
| 28 | u32 full; | ||
| 29 | } fixed20_12; | ||
| 30 | |||
| 31 | |||
| 32 | #define dfixed_const(A) (u32)(((A) << 12))/* + ((B + 0.000122)*4096)) */ | ||
| 33 | #define dfixed_const_half(A) (u32)(((A) << 12) + 2048) | ||
| 34 | #define dfixed_const_666(A) (u32)(((A) << 12) + 2731) | ||
| 35 | #define dfixed_const_8(A) (u32)(((A) << 12) + 3277) | ||
| 36 | #define dfixed_mul(A, B) ((u64)((u64)(A).full * (B).full + 2048) >> 12) | ||
| 37 | #define dfixed_init(A) { .full = dfixed_const((A)) } | ||
| 38 | #define dfixed_init_half(A) { .full = dfixed_const_half((A)) } | ||
| 39 | #define dfixed_trunc(A) ((A).full >> 12) | ||
| 40 | |||
| 41 | static inline u32 dfixed_floor(fixed20_12 A) | ||
| 42 | { | ||
| 43 | u32 non_frac = dfixed_trunc(A); | ||
| 44 | |||
| 45 | return dfixed_const(non_frac); | ||
| 46 | } | ||
| 47 | |||
| 48 | static inline u32 dfixed_ceil(fixed20_12 A) | ||
| 49 | { | ||
| 50 | u32 non_frac = dfixed_trunc(A); | ||
| 51 | |||
| 52 | if (A.full > dfixed_const(non_frac)) | ||
| 53 | return dfixed_const(non_frac + 1); | ||
| 54 | else | ||
| 55 | return dfixed_const(non_frac); | ||
| 56 | } | ||
| 57 | |||
| 58 | static inline u32 dfixed_div(fixed20_12 A, fixed20_12 B) | ||
| 59 | { | ||
| 60 | u64 tmp = ((u64)A.full << 13); | ||
| 61 | |||
| 62 | do_div(tmp, B.full); | ||
| 63 | tmp += 1; | ||
| 64 | tmp /= 2; | ||
| 65 | return lower_32_bits(tmp); | ||
| 66 | } | ||
| 67 | #endif | ||
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h index 81e614bf2dc3..3ff9fc071dfe 100644 --- a/include/drm/radeon_drm.h +++ b/include/drm/radeon_drm.h | |||
| @@ -902,6 +902,7 @@ struct drm_radeon_cs { | |||
| 902 | #define RADEON_INFO_NUM_GB_PIPES 0x01 | 902 | #define RADEON_INFO_NUM_GB_PIPES 0x01 |
| 903 | #define RADEON_INFO_NUM_Z_PIPES 0x02 | 903 | #define RADEON_INFO_NUM_Z_PIPES 0x02 |
| 904 | #define RADEON_INFO_ACCEL_WORKING 0x03 | 904 | #define RADEON_INFO_ACCEL_WORKING 0x03 |
| 905 | #define RADEON_INFO_CRTC_FROM_ID 0x04 | ||
| 905 | 906 | ||
| 906 | struct drm_radeon_info { | 907 | struct drm_radeon_info { |
| 907 | uint32_t request; | 908 | uint32_t request; |
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index 81eb9f45883c..267a86c74e2e 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h | |||
| @@ -66,6 +66,26 @@ struct ttm_placement { | |||
| 66 | const uint32_t *busy_placement; | 66 | const uint32_t *busy_placement; |
| 67 | }; | 67 | }; |
| 68 | 68 | ||
| 69 | /** | ||
| 70 | * struct ttm_bus_placement | ||
| 71 | * | ||
| 72 | * @addr: mapped virtual address | ||
| 73 | * @base: bus base address | ||
| 74 | * @is_iomem: is this io memory ? | ||
| 75 | * @size: size in byte | ||
| 76 | * @offset: offset from the base address | ||
| 77 | * | ||
| 78 | * Structure indicating the bus placement of an object. | ||
| 79 | */ | ||
| 80 | struct ttm_bus_placement { | ||
| 81 | void *addr; | ||
| 82 | unsigned long base; | ||
| 83 | unsigned long size; | ||
| 84 | unsigned long offset; | ||
| 85 | bool is_iomem; | ||
| 86 | bool io_reserved; | ||
| 87 | }; | ||
| 88 | |||
| 69 | 89 | ||
| 70 | /** | 90 | /** |
| 71 | * struct ttm_mem_reg | 91 | * struct ttm_mem_reg |
| @@ -75,6 +95,7 @@ struct ttm_placement { | |||
| 75 | * @num_pages: Actual size of memory region in pages. | 95 | * @num_pages: Actual size of memory region in pages. |
| 76 | * @page_alignment: Page alignment. | 96 | * @page_alignment: Page alignment. |
| 77 | * @placement: Placement flags. | 97 | * @placement: Placement flags. |
| 98 | * @bus: Placement on io bus accessible to the CPU | ||
| 78 | * | 99 | * |
| 79 | * Structure indicating the placement and space resources used by a | 100 | * Structure indicating the placement and space resources used by a |
| 80 | * buffer object. | 101 | * buffer object. |
| @@ -87,6 +108,7 @@ struct ttm_mem_reg { | |||
| 87 | uint32_t page_alignment; | 108 | uint32_t page_alignment; |
| 88 | uint32_t mem_type; | 109 | uint32_t mem_type; |
| 89 | uint32_t placement; | 110 | uint32_t placement; |
| 111 | struct ttm_bus_placement bus; | ||
| 90 | }; | 112 | }; |
| 91 | 113 | ||
| 92 | /** | 114 | /** |
| @@ -274,6 +296,7 @@ struct ttm_bo_kmap_obj { | |||
| 274 | ttm_bo_map_kmap = 3, | 296 | ttm_bo_map_kmap = 3, |
| 275 | ttm_bo_map_premapped = 4 | TTM_BO_MAP_IOMEM_MASK, | 297 | ttm_bo_map_premapped = 4 | TTM_BO_MAP_IOMEM_MASK, |
| 276 | } bo_kmap_type; | 298 | } bo_kmap_type; |
| 299 | struct ttm_buffer_object *bo; | ||
| 277 | }; | 300 | }; |
| 278 | 301 | ||
| 279 | /** | 302 | /** |
| @@ -313,7 +336,8 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy, | |||
| 313 | * @bo: The buffer object. | 336 | * @bo: The buffer object. |
| 314 | * @placement: Proposed placement for the buffer object. | 337 | * @placement: Proposed placement for the buffer object. |
| 315 | * @interruptible: Sleep interruptible if sleeping. | 338 | * @interruptible: Sleep interruptible if sleeping. |
| 316 | * @no_wait: Return immediately if the buffer is busy. | 339 | * @no_wait_reserve: Return immediately if other buffers are busy. |
| 340 | * @no_wait_gpu: Return immediately if the GPU is busy. | ||
| 317 | * | 341 | * |
| 318 | * Changes placement and caching policy of the buffer object | 342 | * Changes placement and caching policy of the buffer object |
| 319 | * according proposed placement. | 343 | * according proposed placement. |
| @@ -325,7 +349,8 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy, | |||
| 325 | */ | 349 | */ |
| 326 | extern int ttm_bo_validate(struct ttm_buffer_object *bo, | 350 | extern int ttm_bo_validate(struct ttm_buffer_object *bo, |
| 327 | struct ttm_placement *placement, | 351 | struct ttm_placement *placement, |
| 328 | bool interruptible, bool no_wait); | 352 | bool interruptible, bool no_wait_reserve, |
| 353 | bool no_wait_gpu); | ||
| 329 | 354 | ||
| 330 | /** | 355 | /** |
| 331 | * ttm_bo_unref | 356 | * ttm_bo_unref |
| @@ -337,6 +362,23 @@ extern int ttm_bo_validate(struct ttm_buffer_object *bo, | |||
| 337 | extern void ttm_bo_unref(struct ttm_buffer_object **bo); | 362 | extern void ttm_bo_unref(struct ttm_buffer_object **bo); |
| 338 | 363 | ||
| 339 | /** | 364 | /** |
| 365 | * ttm_bo_lock_delayed_workqueue | ||
| 366 | * | ||
| 367 | * Prevent the delayed workqueue from running. | ||
| 368 | * Returns | ||
| 369 | * True if the workqueue was queued at the time | ||
| 370 | */ | ||
| 371 | extern int ttm_bo_lock_delayed_workqueue(struct ttm_bo_device *bdev); | ||
| 372 | |||
| 373 | /** | ||
| 374 | * ttm_bo_unlock_delayed_workqueue | ||
| 375 | * | ||
| 376 | * Allows the delayed workqueue to run. | ||
| 377 | */ | ||
| 378 | extern void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev, | ||
| 379 | int resched); | ||
| 380 | |||
| 381 | /** | ||
| 340 | * ttm_bo_synccpu_write_grab | 382 | * ttm_bo_synccpu_write_grab |
| 341 | * | 383 | * |
| 342 | * @bo: The buffer object: | 384 | * @bo: The buffer object: |
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 6b9db917e717..0ea602da43e7 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
| @@ -176,8 +176,6 @@ struct ttm_tt { | |||
| 176 | 176 | ||
| 177 | #define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */ | 177 | #define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */ |
| 178 | #define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */ | 178 | #define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */ |
| 179 | #define TTM_MEMTYPE_FLAG_NEEDS_IOREMAP (1 << 2) /* Fixed memory needs ioremap | ||
| 180 | before kernel access. */ | ||
| 181 | #define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */ | 179 | #define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */ |
| 182 | 180 | ||
| 183 | /** | 181 | /** |
| @@ -189,13 +187,6 @@ struct ttm_tt { | |||
| 189 | * managed by this memory type. | 187 | * managed by this memory type. |
| 190 | * @gpu_offset: If used, the GPU offset of the first managed page of | 188 | * @gpu_offset: If used, the GPU offset of the first managed page of |
| 191 | * fixed memory or the first managed location in an aperture. | 189 | * fixed memory or the first managed location in an aperture. |
| 192 | * @io_offset: The io_offset of the first managed page of IO memory or | ||
| 193 | * the first managed location in an aperture. For TTM_MEMTYPE_FLAG_CMA | ||
| 194 | * memory, this should be set to NULL. | ||
| 195 | * @io_size: The size of a managed IO region (fixed memory or aperture). | ||
| 196 | * @io_addr: Virtual kernel address if the io region is pre-mapped. For | ||
| 197 | * TTM_MEMTYPE_FLAG_NEEDS_IOREMAP there is no pre-mapped io map and | ||
| 198 | * @io_addr should be set to NULL. | ||
| 199 | * @size: Size of the managed region. | 190 | * @size: Size of the managed region. |
| 200 | * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX, | 191 | * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX, |
| 201 | * as defined in ttm_placement_common.h | 192 | * as defined in ttm_placement_common.h |
| @@ -221,9 +212,6 @@ struct ttm_mem_type_manager { | |||
| 221 | bool use_type; | 212 | bool use_type; |
| 222 | uint32_t flags; | 213 | uint32_t flags; |
| 223 | unsigned long gpu_offset; | 214 | unsigned long gpu_offset; |
| 224 | unsigned long io_offset; | ||
| 225 | unsigned long io_size; | ||
| 226 | void *io_addr; | ||
| 227 | uint64_t size; | 215 | uint64_t size; |
| 228 | uint32_t available_caching; | 216 | uint32_t available_caching; |
| 229 | uint32_t default_caching; | 217 | uint32_t default_caching; |
| @@ -311,7 +299,8 @@ struct ttm_bo_driver { | |||
| 311 | */ | 299 | */ |
| 312 | int (*move) (struct ttm_buffer_object *bo, | 300 | int (*move) (struct ttm_buffer_object *bo, |
| 313 | bool evict, bool interruptible, | 301 | bool evict, bool interruptible, |
| 314 | bool no_wait, struct ttm_mem_reg *new_mem); | 302 | bool no_wait_reserve, bool no_wait_gpu, |
| 303 | struct ttm_mem_reg *new_mem); | ||
| 315 | 304 | ||
| 316 | /** | 305 | /** |
| 317 | * struct ttm_bo_driver_member verify_access | 306 | * struct ttm_bo_driver_member verify_access |
| @@ -351,12 +340,21 @@ struct ttm_bo_driver { | |||
| 351 | struct ttm_mem_reg *new_mem); | 340 | struct ttm_mem_reg *new_mem); |
| 352 | /* notify the driver we are taking a fault on this BO | 341 | /* notify the driver we are taking a fault on this BO |
| 353 | * and have reserved it */ | 342 | * and have reserved it */ |
| 354 | void (*fault_reserve_notify)(struct ttm_buffer_object *bo); | 343 | int (*fault_reserve_notify)(struct ttm_buffer_object *bo); |
| 355 | 344 | ||
| 356 | /** | 345 | /** |
| 357 | * notify the driver that we're about to swap out this bo | 346 | * notify the driver that we're about to swap out this bo |
| 358 | */ | 347 | */ |
| 359 | void (*swap_notify) (struct ttm_buffer_object *bo); | 348 | void (*swap_notify) (struct ttm_buffer_object *bo); |
| 349 | |||
| 350 | /** | ||
| 351 | * Driver callback on when mapping io memory (for bo_move_memcpy | ||
| 352 | * for instance). TTM will take care to call io_mem_free whenever | ||
| 353 | * the mapping is not use anymore. io_mem_reserve & io_mem_free | ||
| 354 | * are balanced. | ||
| 355 | */ | ||
| 356 | int (*io_mem_reserve)(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem); | ||
| 357 | void (*io_mem_free)(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem); | ||
| 360 | }; | 358 | }; |
| 361 | 359 | ||
| 362 | /** | 360 | /** |
| @@ -633,7 +631,8 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev, | |||
| 633 | * @proposed_placement: Proposed new placement for the buffer object. | 631 | * @proposed_placement: Proposed new placement for the buffer object. |
| 634 | * @mem: A struct ttm_mem_reg. | 632 | * @mem: A struct ttm_mem_reg. |
| 635 | * @interruptible: Sleep interruptible when sliping. | 633 | * @interruptible: Sleep interruptible when sliping. |
| 636 | * @no_wait: Don't sleep waiting for space to become available. | 634 | * @no_wait_reserve: Return immediately if other buffers are busy. |
| 635 | * @no_wait_gpu: Return immediately if the GPU is busy. | ||
| 637 | * | 636 | * |
| 638 | * Allocate memory space for the buffer object pointed to by @bo, using | 637 | * Allocate memory space for the buffer object pointed to by @bo, using |
| 639 | * the placement flags in @mem, potentially evicting other idle buffer objects. | 638 | * the placement flags in @mem, potentially evicting other idle buffer objects. |
| @@ -647,7 +646,8 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev, | |||
| 647 | extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, | 646 | extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, |
| 648 | struct ttm_placement *placement, | 647 | struct ttm_placement *placement, |
| 649 | struct ttm_mem_reg *mem, | 648 | struct ttm_mem_reg *mem, |
| 650 | bool interruptible, bool no_wait); | 649 | bool interruptible, |
| 650 | bool no_wait_reserve, bool no_wait_gpu); | ||
| 651 | /** | 651 | /** |
| 652 | * ttm_bo_wait_for_cpu | 652 | * ttm_bo_wait_for_cpu |
| 653 | * | 653 | * |
| @@ -682,6 +682,11 @@ extern int ttm_bo_pci_offset(struct ttm_bo_device *bdev, | |||
| 682 | unsigned long *bus_offset, | 682 | unsigned long *bus_offset, |
| 683 | unsigned long *bus_size); | 683 | unsigned long *bus_size); |
| 684 | 684 | ||
| 685 | extern int ttm_mem_io_reserve(struct ttm_bo_device *bdev, | ||
| 686 | struct ttm_mem_reg *mem); | ||
| 687 | extern void ttm_mem_io_free(struct ttm_bo_device *bdev, | ||
| 688 | struct ttm_mem_reg *mem); | ||
| 689 | |||
| 685 | extern void ttm_bo_global_release(struct ttm_global_reference *ref); | 690 | extern void ttm_bo_global_release(struct ttm_global_reference *ref); |
| 686 | extern int ttm_bo_global_init(struct ttm_global_reference *ref); | 691 | extern int ttm_bo_global_init(struct ttm_global_reference *ref); |
| 687 | 692 | ||
| @@ -798,7 +803,8 @@ extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo, | |||
| 798 | * | 803 | * |
| 799 | * @bo: A pointer to a struct ttm_buffer_object. | 804 | * @bo: A pointer to a struct ttm_buffer_object. |
| 800 | * @evict: 1: This is an eviction. Don't try to pipeline. | 805 | * @evict: 1: This is an eviction. Don't try to pipeline. |
| 801 | * @no_wait: Never sleep, but rather return with -EBUSY. | 806 | * @no_wait_reserve: Return immediately if other buffers are busy. |
| 807 | * @no_wait_gpu: Return immediately if the GPU is busy. | ||
| 802 | * @new_mem: struct ttm_mem_reg indicating where to move. | 808 | * @new_mem: struct ttm_mem_reg indicating where to move. |
| 803 | * | 809 | * |
| 804 | * Optimized move function for a buffer object with both old and | 810 | * Optimized move function for a buffer object with both old and |
| @@ -812,15 +818,16 @@ extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo, | |||
| 812 | */ | 818 | */ |
| 813 | 819 | ||
| 814 | extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo, | 820 | extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo, |
| 815 | bool evict, bool no_wait, | 821 | bool evict, bool no_wait_reserve, |
| 816 | struct ttm_mem_reg *new_mem); | 822 | bool no_wait_gpu, struct ttm_mem_reg *new_mem); |
| 817 | 823 | ||
| 818 | /** | 824 | /** |
| 819 | * ttm_bo_move_memcpy | 825 | * ttm_bo_move_memcpy |
| 820 | * | 826 | * |
| 821 | * @bo: A pointer to a struct ttm_buffer_object. | 827 | * @bo: A pointer to a struct ttm_buffer_object. |
| 822 | * @evict: 1: This is an eviction. Don't try to pipeline. | 828 | * @evict: 1: This is an eviction. Don't try to pipeline. |
| 823 | * @no_wait: Never sleep, but rather return with -EBUSY. | 829 | * @no_wait_reserve: Return immediately if other buffers are busy. |
| 830 | * @no_wait_gpu: Return immediately if the GPU is busy. | ||
| 824 | * @new_mem: struct ttm_mem_reg indicating where to move. | 831 | * @new_mem: struct ttm_mem_reg indicating where to move. |
| 825 | * | 832 | * |
| 826 | * Fallback move function for a mappable buffer object in mappable memory. | 833 | * Fallback move function for a mappable buffer object in mappable memory. |
| @@ -834,8 +841,8 @@ extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo, | |||
| 834 | */ | 841 | */ |
| 835 | 842 | ||
| 836 | extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, | 843 | extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, |
| 837 | bool evict, | 844 | bool evict, bool no_wait_reserve, |
| 838 | bool no_wait, struct ttm_mem_reg *new_mem); | 845 | bool no_wait_gpu, struct ttm_mem_reg *new_mem); |
| 839 | 846 | ||
| 840 | /** | 847 | /** |
| 841 | * ttm_bo_free_old_node | 848 | * ttm_bo_free_old_node |
| @@ -854,7 +861,8 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo); | |||
| 854 | * @sync_obj_arg: An argument to pass to the sync object idle / wait | 861 | * @sync_obj_arg: An argument to pass to the sync object idle / wait |
| 855 | * functions. | 862 | * functions. |
| 856 | * @evict: This is an evict move. Don't return until the buffer is idle. | 863 | * @evict: This is an evict move. Don't return until the buffer is idle. |
| 857 | * @no_wait: Never sleep, but rather return with -EBUSY. | 864 | * @no_wait_reserve: Return immediately if other buffers are busy. |
| 865 | * @no_wait_gpu: Return immediately if the GPU is busy. | ||
| 858 | * @new_mem: struct ttm_mem_reg indicating where to move. | 866 | * @new_mem: struct ttm_mem_reg indicating where to move. |
| 859 | * | 867 | * |
| 860 | * Accelerated move function to be called when an accelerated move | 868 | * Accelerated move function to be called when an accelerated move |
| @@ -868,7 +876,8 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo); | |||
| 868 | extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, | 876 | extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, |
| 869 | void *sync_obj, | 877 | void *sync_obj, |
| 870 | void *sync_obj_arg, | 878 | void *sync_obj_arg, |
| 871 | bool evict, bool no_wait, | 879 | bool evict, bool no_wait_reserve, |
| 880 | bool no_wait_gpu, | ||
| 872 | struct ttm_mem_reg *new_mem); | 881 | struct ttm_mem_reg *new_mem); |
| 873 | /** | 882 | /** |
| 874 | * ttm_io_prot | 883 | * ttm_io_prot |
diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h new file mode 100644 index 000000000000..8bb4de567b2c --- /dev/null +++ b/include/drm/ttm/ttm_page_alloc.h | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) Red Hat Inc. | ||
| 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, sub license, | ||
| 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 | ||
| 12 | * next paragraph) shall be included in all copies or substantial portions | ||
| 13 | * of the 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 NON-INFRINGEMENT. IN NO EVENT SHALL | ||
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
| 21 | * DEALINGS IN THE SOFTWARE. | ||
| 22 | * | ||
| 23 | * Authors: Dave Airlie <airlied@redhat.com> | ||
| 24 | * Jerome Glisse <jglisse@redhat.com> | ||
| 25 | */ | ||
| 26 | #ifndef TTM_PAGE_ALLOC | ||
| 27 | #define TTM_PAGE_ALLOC | ||
| 28 | |||
| 29 | #include "ttm_bo_driver.h" | ||
| 30 | #include "ttm_memory.h" | ||
| 31 | |||
| 32 | /** | ||
| 33 | * Get count number of pages from pool to pages list. | ||
| 34 | * | ||
| 35 | * @pages: heado of empty linked list where pages are filled. | ||
| 36 | * @flags: ttm flags for page allocation. | ||
| 37 | * @cstate: ttm caching state for the page. | ||
| 38 | * @count: number of pages to allocate. | ||
| 39 | */ | ||
| 40 | int ttm_get_pages(struct list_head *pages, | ||
| 41 | int flags, | ||
| 42 | enum ttm_caching_state cstate, | ||
| 43 | unsigned count); | ||
| 44 | /** | ||
| 45 | * Put linked list of pages to pool. | ||
| 46 | * | ||
| 47 | * @pages: list of pages to free. | ||
| 48 | * @page_count: number of pages in the list. Zero can be passed for unknown | ||
| 49 | * count. | ||
| 50 | * @flags: ttm flags for page allocation. | ||
| 51 | * @cstate: ttm caching state. | ||
| 52 | */ | ||
| 53 | void ttm_put_pages(struct list_head *pages, | ||
| 54 | unsigned page_count, | ||
| 55 | int flags, | ||
| 56 | enum ttm_caching_state cstate); | ||
| 57 | /** | ||
| 58 | * Initialize pool allocator. | ||
| 59 | * | ||
| 60 | * Pool allocator is internaly reference counted so it can be initialized | ||
| 61 | * multiple times but ttm_page_alloc_fini has to be called same number of | ||
| 62 | * times. | ||
| 63 | */ | ||
| 64 | int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages); | ||
| 65 | /** | ||
| 66 | * Free pool allocator. | ||
| 67 | */ | ||
| 68 | void ttm_page_alloc_fini(void); | ||
| 69 | |||
| 70 | /** | ||
| 71 | * Output the state of pools to debugfs file | ||
| 72 | */ | ||
| 73 | extern int ttm_page_alloc_debugfs(struct seq_file *m, void *data); | ||
| 74 | #endif | ||
diff --git a/include/linux/fb.h b/include/linux/fb.h index c10163b4c40e..1296af45169d 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
| @@ -403,6 +403,7 @@ struct fb_cursor { | |||
| 403 | #include <linux/notifier.h> | 403 | #include <linux/notifier.h> |
| 404 | #include <linux/list.h> | 404 | #include <linux/list.h> |
| 405 | #include <linux/backlight.h> | 405 | #include <linux/backlight.h> |
| 406 | #include <linux/slab.h> | ||
| 406 | #include <asm/io.h> | 407 | #include <asm/io.h> |
| 407 | 408 | ||
| 408 | struct vm_area_struct; | 409 | struct vm_area_struct; |
| @@ -862,10 +863,22 @@ struct fb_info { | |||
| 862 | /* we need the PCI or similiar aperture base/size not | 863 | /* we need the PCI or similiar aperture base/size not |
| 863 | smem_start/size as smem_start may just be an object | 864 | smem_start/size as smem_start may just be an object |
| 864 | allocated inside the aperture so may not actually overlap */ | 865 | allocated inside the aperture so may not actually overlap */ |
| 865 | resource_size_t aperture_base; | 866 | struct apertures_struct { |
| 866 | resource_size_t aperture_size; | 867 | unsigned int count; |
| 868 | struct aperture { | ||
| 869 | resource_size_t base; | ||
| 870 | resource_size_t size; | ||
| 871 | } ranges[0]; | ||
| 872 | } *apertures; | ||
| 867 | }; | 873 | }; |
| 868 | 874 | ||
| 875 | static inline struct apertures_struct *alloc_apertures(unsigned int max_num) { | ||
| 876 | struct apertures_struct *a = kzalloc(sizeof(struct apertures_struct) | ||
| 877 | + max_num * sizeof(struct aperture), GFP_KERNEL); | ||
| 878 | a->count = max_num; | ||
| 879 | return a; | ||
| 880 | } | ||
| 881 | |||
| 869 | #ifdef MODULE | 882 | #ifdef MODULE |
| 870 | #define FBINFO_DEFAULT FBINFO_MODULE | 883 | #define FBINFO_DEFAULT FBINFO_MODULE |
| 871 | #else | 884 | #else |
| @@ -958,6 +971,8 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, | |||
| 958 | /* drivers/video/fbmem.c */ | 971 | /* drivers/video/fbmem.c */ |
| 959 | extern int register_framebuffer(struct fb_info *fb_info); | 972 | extern int register_framebuffer(struct fb_info *fb_info); |
| 960 | extern int unregister_framebuffer(struct fb_info *fb_info); | 973 | extern int unregister_framebuffer(struct fb_info *fb_info); |
| 974 | extern void remove_conflicting_framebuffers(struct apertures_struct *a, | ||
| 975 | const char *name, bool primary); | ||
| 961 | extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); | 976 | extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); |
| 962 | extern int fb_show_logo(struct fb_info *fb_info, int rotate); | 977 | extern int fb_show_logo(struct fb_info *fb_info, int rotate); |
| 963 | extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size); | 978 | extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size); |
