diff options
Diffstat (limited to 'drivers/gpu')
37 files changed, 551 insertions, 292 deletions
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 23120c00a881..90e28081712d 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig | |||
@@ -22,6 +22,7 @@ menuconfig DRM | |||
22 | config DRM_USB | 22 | config DRM_USB |
23 | tristate | 23 | tristate |
24 | depends on DRM | 24 | depends on DRM |
25 | depends on USB_ARCH_HAS_HCD | ||
25 | select USB | 26 | select USB |
26 | 27 | ||
27 | config DRM_KMS_HELPER | 28 | config DRM_KMS_HELPER |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 08a7aa722d6b..6fbfc244748f 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -1981,7 +1981,7 @@ int drm_mode_cursor_ioctl(struct drm_device *dev, | |||
1981 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 1981 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
1982 | return -EINVAL; | 1982 | return -EINVAL; |
1983 | 1983 | ||
1984 | if (!req->flags) | 1984 | if (!req->flags || (~DRM_MODE_CURSOR_FLAGS & req->flags)) |
1985 | return -EINVAL; | 1985 | return -EINVAL; |
1986 | 1986 | ||
1987 | mutex_lock(&dev->mode_config.mutex); | 1987 | mutex_lock(&dev->mode_config.mutex); |
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index a8743c399e83..b7ee230572b7 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -87,6 +87,9 @@ static struct edid_quirk { | |||
87 | int product_id; | 87 | int product_id; |
88 | u32 quirks; | 88 | u32 quirks; |
89 | } edid_quirk_list[] = { | 89 | } edid_quirk_list[] = { |
90 | /* ASUS VW222S */ | ||
91 | { "ACI", 0x22a2, EDID_QUIRK_FORCE_REDUCED_BLANKING }, | ||
92 | |||
90 | /* Acer AL1706 */ | 93 | /* Acer AL1706 */ |
91 | { "ACR", 44358, EDID_QUIRK_PREFER_LARGE_60 }, | 94 | { "ACR", 44358, EDID_QUIRK_PREFER_LARGE_60 }, |
92 | /* Acer F51 */ | 95 | /* Acer F51 */ |
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index b7adb4a967fd..28637c181b15 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c | |||
@@ -706,9 +706,6 @@ void drm_mode_set_crtcinfo(struct drm_display_mode *p, int adjust_flags) | |||
706 | p->crtc_vblank_end = max(p->crtc_vsync_end, p->crtc_vtotal); | 706 | p->crtc_vblank_end = max(p->crtc_vsync_end, p->crtc_vtotal); |
707 | p->crtc_hblank_start = min(p->crtc_hsync_start, p->crtc_hdisplay); | 707 | p->crtc_hblank_start = min(p->crtc_hsync_start, p->crtc_hdisplay); |
708 | p->crtc_hblank_end = max(p->crtc_hsync_end, p->crtc_htotal); | 708 | p->crtc_hblank_end = max(p->crtc_hsync_end, p->crtc_htotal); |
709 | |||
710 | p->crtc_hadjusted = false; | ||
711 | p->crtc_vadjusted = false; | ||
712 | } | 709 | } |
713 | EXPORT_SYMBOL(drm_mode_set_crtcinfo); | 710 | EXPORT_SYMBOL(drm_mode_set_crtcinfo); |
714 | 711 | ||
diff --git a/drivers/gpu/drm/drm_proc.c b/drivers/gpu/drm/drm_proc.c index 371c695322d9..da457b18eaaf 100644 --- a/drivers/gpu/drm/drm_proc.c +++ b/drivers/gpu/drm/drm_proc.c | |||
@@ -89,7 +89,7 @@ static const struct file_operations drm_proc_fops = { | |||
89 | * Create a given set of proc files represented by an array of | 89 | * Create a given set of proc files represented by an array of |
90 | * gdm_proc_lists in the given root directory. | 90 | * gdm_proc_lists in the given root directory. |
91 | */ | 91 | */ |
92 | int drm_proc_create_files(struct drm_info_list *files, int count, | 92 | static int drm_proc_create_files(struct drm_info_list *files, int count, |
93 | struct proc_dir_entry *root, struct drm_minor *minor) | 93 | struct proc_dir_entry *root, struct drm_minor *minor) |
94 | { | 94 | { |
95 | struct drm_device *dev = minor->dev; | 95 | struct drm_device *dev = minor->dev; |
@@ -172,7 +172,7 @@ int drm_proc_init(struct drm_minor *minor, int minor_id, | |||
172 | return 0; | 172 | return 0; |
173 | } | 173 | } |
174 | 174 | ||
175 | int drm_proc_remove_files(struct drm_info_list *files, int count, | 175 | static int drm_proc_remove_files(struct drm_info_list *files, int count, |
176 | struct drm_minor *minor) | 176 | struct drm_minor *minor) |
177 | { | 177 | { |
178 | struct list_head *pos, *q; | 178 | struct list_head *pos, *q; |
diff --git a/drivers/gpu/drm/gma500/psb_intel_display.c b/drivers/gpu/drm/gma500/psb_intel_display.c index 30dc22a7156c..8033526bb53b 100644 --- a/drivers/gpu/drm/gma500/psb_intel_display.c +++ b/drivers/gpu/drm/gma500/psb_intel_display.c | |||
@@ -1362,6 +1362,9 @@ void psb_intel_crtc_init(struct drm_device *dev, int pipe, | |||
1362 | (struct drm_connector **) (psb_intel_crtc + 1); | 1362 | (struct drm_connector **) (psb_intel_crtc + 1); |
1363 | psb_intel_crtc->mode_set.num_connectors = 0; | 1363 | psb_intel_crtc->mode_set.num_connectors = 0; |
1364 | psb_intel_cursor_init(dev, psb_intel_crtc); | 1364 | psb_intel_cursor_init(dev, psb_intel_crtc); |
1365 | |||
1366 | /* Set to true so that the pipe is forced off on initial config. */ | ||
1367 | psb_intel_crtc->active = true; | ||
1365 | } | 1368 | } |
1366 | 1369 | ||
1367 | int psb_intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, | 1370 | int psb_intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 5c4657a54f97..489e2b162b27 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -2365,6 +2365,10 @@ int i915_gpu_idle(struct drm_device *dev) | |||
2365 | 2365 | ||
2366 | /* Flush everything onto the inactive list. */ | 2366 | /* Flush everything onto the inactive list. */ |
2367 | for_each_ring(ring, dev_priv, i) { | 2367 | for_each_ring(ring, dev_priv, i) { |
2368 | ret = i915_switch_context(ring, NULL, DEFAULT_CONTEXT_ID); | ||
2369 | if (ret) | ||
2370 | return ret; | ||
2371 | |||
2368 | ret = i915_ring_idle(ring); | 2372 | ret = i915_ring_idle(ring); |
2369 | if (ret) | 2373 | if (ret) |
2370 | return ret; | 2374 | return ret; |
@@ -2372,10 +2376,6 @@ int i915_gpu_idle(struct drm_device *dev) | |||
2372 | /* Is the device fubar? */ | 2376 | /* Is the device fubar? */ |
2373 | if (WARN_ON(!list_empty(&ring->gpu_write_list))) | 2377 | if (WARN_ON(!list_empty(&ring->gpu_write_list))) |
2374 | return -EBUSY; | 2378 | return -EBUSY; |
2375 | |||
2376 | ret = i915_switch_context(ring, NULL, DEFAULT_CONTEXT_ID); | ||
2377 | if (ret) | ||
2378 | return ret; | ||
2379 | } | 2379 | } |
2380 | 2380 | ||
2381 | return 0; | 2381 | return 0; |
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index ee9b68f6bc36..60815b861ec2 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -72,7 +72,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev) | |||
72 | /* ppgtt PDEs reside in the global gtt pagetable, which has 512*1024 | 72 | /* ppgtt PDEs reside in the global gtt pagetable, which has 512*1024 |
73 | * entries. For aliasing ppgtt support we just steal them at the end for | 73 | * entries. For aliasing ppgtt support we just steal them at the end for |
74 | * now. */ | 74 | * now. */ |
75 | first_pd_entry_in_global_pt = 512*1024 - I915_PPGTT_PD_ENTRIES; | 75 | first_pd_entry_in_global_pt = dev_priv->mm.gtt->gtt_total_entries - I915_PPGTT_PD_ENTRIES; |
76 | 76 | ||
77 | ppgtt = kzalloc(sizeof(*ppgtt), GFP_KERNEL); | 77 | ppgtt = kzalloc(sizeof(*ppgtt), GFP_KERNEL); |
78 | if (!ppgtt) | 78 | if (!ppgtt) |
@@ -261,7 +261,10 @@ void i915_ppgtt_bind_object(struct i915_hw_ppgtt *ppgtt, | |||
261 | pte_flags |= GEN6_PTE_CACHE_LLC; | 261 | pte_flags |= GEN6_PTE_CACHE_LLC; |
262 | break; | 262 | break; |
263 | case I915_CACHE_NONE: | 263 | case I915_CACHE_NONE: |
264 | pte_flags |= GEN6_PTE_UNCACHED; | 264 | if (IS_HASWELL(dev)) |
265 | pte_flags |= HSW_PTE_UNCACHED; | ||
266 | else | ||
267 | pte_flags |= GEN6_PTE_UNCACHED; | ||
265 | break; | 268 | break; |
266 | default: | 269 | default: |
267 | BUG(); | 270 | BUG(); |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index acc99b21e0b6..28725ce5b82c 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -115,6 +115,7 @@ | |||
115 | 115 | ||
116 | #define GEN6_PTE_VALID (1 << 0) | 116 | #define GEN6_PTE_VALID (1 << 0) |
117 | #define GEN6_PTE_UNCACHED (1 << 1) | 117 | #define GEN6_PTE_UNCACHED (1 << 1) |
118 | #define HSW_PTE_UNCACHED (0) | ||
118 | #define GEN6_PTE_CACHE_LLC (2 << 1) | 119 | #define GEN6_PTE_CACHE_LLC (2 << 1) |
119 | #define GEN6_PTE_CACHE_LLC_MLC (3 << 1) | 120 | #define GEN6_PTE_CACHE_LLC_MLC (3 << 1) |
120 | #define GEN6_PTE_CACHE_BITS (3 << 1) | 121 | #define GEN6_PTE_CACHE_BITS (3 << 1) |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 7ed4a41c3965..23bdc8cd1458 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -326,6 +326,36 @@ static bool intel_crt_detect_hotplug(struct drm_connector *connector) | |||
326 | return ret; | 326 | return ret; |
327 | } | 327 | } |
328 | 328 | ||
329 | static struct edid *intel_crt_get_edid(struct drm_connector *connector, | ||
330 | struct i2c_adapter *i2c) | ||
331 | { | ||
332 | struct edid *edid; | ||
333 | |||
334 | edid = drm_get_edid(connector, i2c); | ||
335 | |||
336 | if (!edid && !intel_gmbus_is_forced_bit(i2c)) { | ||
337 | DRM_DEBUG_KMS("CRT GMBUS EDID read failed, retry using GPIO bit-banging\n"); | ||
338 | intel_gmbus_force_bit(i2c, true); | ||
339 | edid = drm_get_edid(connector, i2c); | ||
340 | intel_gmbus_force_bit(i2c, false); | ||
341 | } | ||
342 | |||
343 | return edid; | ||
344 | } | ||
345 | |||
346 | /* local version of intel_ddc_get_modes() to use intel_crt_get_edid() */ | ||
347 | static int intel_crt_ddc_get_modes(struct drm_connector *connector, | ||
348 | struct i2c_adapter *adapter) | ||
349 | { | ||
350 | struct edid *edid; | ||
351 | |||
352 | edid = intel_crt_get_edid(connector, adapter); | ||
353 | if (!edid) | ||
354 | return 0; | ||
355 | |||
356 | return intel_connector_update_modes(connector, edid); | ||
357 | } | ||
358 | |||
329 | static bool intel_crt_detect_ddc(struct drm_connector *connector) | 359 | static bool intel_crt_detect_ddc(struct drm_connector *connector) |
330 | { | 360 | { |
331 | struct intel_crt *crt = intel_attached_crt(connector); | 361 | struct intel_crt *crt = intel_attached_crt(connector); |
@@ -336,7 +366,7 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector) | |||
336 | BUG_ON(crt->base.type != INTEL_OUTPUT_ANALOG); | 366 | BUG_ON(crt->base.type != INTEL_OUTPUT_ANALOG); |
337 | 367 | ||
338 | i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin); | 368 | i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin); |
339 | edid = drm_get_edid(connector, i2c); | 369 | edid = intel_crt_get_edid(connector, i2c); |
340 | 370 | ||
341 | if (edid) { | 371 | if (edid) { |
342 | bool is_digital = edid->input & DRM_EDID_INPUT_DIGITAL; | 372 | bool is_digital = edid->input & DRM_EDID_INPUT_DIGITAL; |
@@ -544,13 +574,13 @@ static int intel_crt_get_modes(struct drm_connector *connector) | |||
544 | struct i2c_adapter *i2c; | 574 | struct i2c_adapter *i2c; |
545 | 575 | ||
546 | i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin); | 576 | i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin); |
547 | ret = intel_ddc_get_modes(connector, i2c); | 577 | ret = intel_crt_ddc_get_modes(connector, i2c); |
548 | if (ret || !IS_G4X(dev)) | 578 | if (ret || !IS_G4X(dev)) |
549 | return ret; | 579 | return ret; |
550 | 580 | ||
551 | /* Try to probe digital port for output in DVI-I -> VGA mode. */ | 581 | /* Try to probe digital port for output in DVI-I -> VGA mode. */ |
552 | i2c = intel_gmbus_get_adapter(dev_priv, GMBUS_PORT_DPB); | 582 | i2c = intel_gmbus_get_adapter(dev_priv, GMBUS_PORT_DPB); |
553 | return intel_ddc_get_modes(connector, i2c); | 583 | return intel_crt_ddc_get_modes(connector, i2c); |
554 | } | 584 | } |
555 | 585 | ||
556 | static int intel_crt_set_property(struct drm_connector *connector, | 586 | static int intel_crt_set_property(struct drm_connector *connector, |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index a69a3d0d3acf..2dfa6cf4886b 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1384,7 +1384,7 @@ static void assert_pch_hdmi_disabled(struct drm_i915_private *dev_priv, | |||
1384 | enum pipe pipe, int reg) | 1384 | enum pipe pipe, int reg) |
1385 | { | 1385 | { |
1386 | u32 val = I915_READ(reg); | 1386 | u32 val = I915_READ(reg); |
1387 | WARN(hdmi_pipe_enabled(dev_priv, val, pipe), | 1387 | WARN(hdmi_pipe_enabled(dev_priv, pipe, val), |
1388 | "PCH HDMI (0x%08x) enabled on transcoder %c, should be disabled\n", | 1388 | "PCH HDMI (0x%08x) enabled on transcoder %c, should be disabled\n", |
1389 | reg, pipe_name(pipe)); | 1389 | reg, pipe_name(pipe)); |
1390 | 1390 | ||
@@ -1404,13 +1404,13 @@ static void assert_pch_ports_disabled(struct drm_i915_private *dev_priv, | |||
1404 | 1404 | ||
1405 | reg = PCH_ADPA; | 1405 | reg = PCH_ADPA; |
1406 | val = I915_READ(reg); | 1406 | val = I915_READ(reg); |
1407 | WARN(adpa_pipe_enabled(dev_priv, val, pipe), | 1407 | WARN(adpa_pipe_enabled(dev_priv, pipe, val), |
1408 | "PCH VGA enabled on transcoder %c, should be disabled\n", | 1408 | "PCH VGA enabled on transcoder %c, should be disabled\n", |
1409 | pipe_name(pipe)); | 1409 | pipe_name(pipe)); |
1410 | 1410 | ||
1411 | reg = PCH_LVDS; | 1411 | reg = PCH_LVDS; |
1412 | val = I915_READ(reg); | 1412 | val = I915_READ(reg); |
1413 | WARN(lvds_pipe_enabled(dev_priv, val, pipe), | 1413 | WARN(lvds_pipe_enabled(dev_priv, pipe, val), |
1414 | "PCH LVDS enabled on transcoder %c, should be disabled\n", | 1414 | "PCH LVDS enabled on transcoder %c, should be disabled\n", |
1415 | pipe_name(pipe)); | 1415 | pipe_name(pipe)); |
1416 | 1416 | ||
@@ -1872,7 +1872,7 @@ static void disable_pch_hdmi(struct drm_i915_private *dev_priv, | |||
1872 | enum pipe pipe, int reg) | 1872 | enum pipe pipe, int reg) |
1873 | { | 1873 | { |
1874 | u32 val = I915_READ(reg); | 1874 | u32 val = I915_READ(reg); |
1875 | if (hdmi_pipe_enabled(dev_priv, val, pipe)) { | 1875 | if (hdmi_pipe_enabled(dev_priv, pipe, val)) { |
1876 | DRM_DEBUG_KMS("Disabling pch HDMI %x on pipe %d\n", | 1876 | DRM_DEBUG_KMS("Disabling pch HDMI %x on pipe %d\n", |
1877 | reg, pipe); | 1877 | reg, pipe); |
1878 | I915_WRITE(reg, val & ~PORT_ENABLE); | 1878 | I915_WRITE(reg, val & ~PORT_ENABLE); |
@@ -1894,12 +1894,12 @@ static void intel_disable_pch_ports(struct drm_i915_private *dev_priv, | |||
1894 | 1894 | ||
1895 | reg = PCH_ADPA; | 1895 | reg = PCH_ADPA; |
1896 | val = I915_READ(reg); | 1896 | val = I915_READ(reg); |
1897 | if (adpa_pipe_enabled(dev_priv, val, pipe)) | 1897 | if (adpa_pipe_enabled(dev_priv, pipe, val)) |
1898 | I915_WRITE(reg, val & ~ADPA_DAC_ENABLE); | 1898 | I915_WRITE(reg, val & ~ADPA_DAC_ENABLE); |
1899 | 1899 | ||
1900 | reg = PCH_LVDS; | 1900 | reg = PCH_LVDS; |
1901 | val = I915_READ(reg); | 1901 | val = I915_READ(reg); |
1902 | if (lvds_pipe_enabled(dev_priv, val, pipe)) { | 1902 | if (lvds_pipe_enabled(dev_priv, pipe, val)) { |
1903 | DRM_DEBUG_KMS("disable lvds on pipe %d val 0x%08x\n", pipe, val); | 1903 | DRM_DEBUG_KMS("disable lvds on pipe %d val 0x%08x\n", pipe, val); |
1904 | I915_WRITE(reg, val & ~LVDS_PORT_EN); | 1904 | I915_WRITE(reg, val & ~LVDS_PORT_EN); |
1905 | POSTING_READ(reg); | 1905 | POSTING_READ(reg); |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 132ab511b90c..cd54cf88a28f 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -342,6 +342,8 @@ struct intel_fbc_work { | |||
342 | int interval; | 342 | int interval; |
343 | }; | 343 | }; |
344 | 344 | ||
345 | int intel_connector_update_modes(struct drm_connector *connector, | ||
346 | struct edid *edid); | ||
345 | int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter); | 347 | int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter); |
346 | 348 | ||
347 | extern void intel_attach_force_audio_property(struct drm_connector *connector); | 349 | extern void intel_attach_force_audio_property(struct drm_connector *connector); |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index e05c0d3e3440..e9a6f6aaed85 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -780,6 +780,14 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
780 | DMI_MATCH(DMI_BOARD_NAME, "ZBOXSD-ID12/ID13"), | 780 | DMI_MATCH(DMI_BOARD_NAME, "ZBOXSD-ID12/ID13"), |
781 | }, | 781 | }, |
782 | }, | 782 | }, |
783 | { | ||
784 | .callback = intel_no_lvds_dmi_callback, | ||
785 | .ident = "Gigabyte GA-D525TUD", | ||
786 | .matches = { | ||
787 | DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co., Ltd."), | ||
788 | DMI_MATCH(DMI_BOARD_NAME, "D525TUD"), | ||
789 | }, | ||
790 | }, | ||
783 | 791 | ||
784 | { } /* terminating entry */ | 792 | { } /* terminating entry */ |
785 | }; | 793 | }; |
diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c index 45848b9b670b..29b72593fbb2 100644 --- a/drivers/gpu/drm/i915/intel_modes.c +++ b/drivers/gpu/drm/i915/intel_modes.c | |||
@@ -33,6 +33,25 @@ | |||
33 | #include "i915_drv.h" | 33 | #include "i915_drv.h" |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * intel_connector_update_modes - update connector from edid | ||
37 | * @connector: DRM connector device to use | ||
38 | * @edid: previously read EDID information | ||
39 | */ | ||
40 | int intel_connector_update_modes(struct drm_connector *connector, | ||
41 | struct edid *edid) | ||
42 | { | ||
43 | int ret; | ||
44 | |||
45 | drm_mode_connector_update_edid_property(connector, edid); | ||
46 | ret = drm_add_edid_modes(connector, edid); | ||
47 | drm_edid_to_eld(connector, edid); | ||
48 | connector->display_info.raw_edid = NULL; | ||
49 | kfree(edid); | ||
50 | |||
51 | return ret; | ||
52 | } | ||
53 | |||
54 | /** | ||
36 | * intel_ddc_get_modes - get modelist from monitor | 55 | * intel_ddc_get_modes - get modelist from monitor |
37 | * @connector: DRM connector device to use | 56 | * @connector: DRM connector device to use |
38 | * @adapter: i2c adapter | 57 | * @adapter: i2c adapter |
@@ -43,18 +62,12 @@ int intel_ddc_get_modes(struct drm_connector *connector, | |||
43 | struct i2c_adapter *adapter) | 62 | struct i2c_adapter *adapter) |
44 | { | 63 | { |
45 | struct edid *edid; | 64 | struct edid *edid; |
46 | int ret = 0; | ||
47 | 65 | ||
48 | edid = drm_get_edid(connector, adapter); | 66 | edid = drm_get_edid(connector, adapter); |
49 | if (edid) { | 67 | if (!edid) |
50 | drm_mode_connector_update_edid_property(connector, edid); | 68 | return 0; |
51 | ret = drm_add_edid_modes(connector, edid); | ||
52 | drm_edid_to_eld(connector, edid); | ||
53 | connector->display_info.raw_edid = NULL; | ||
54 | kfree(edid); | ||
55 | } | ||
56 | 69 | ||
57 | return ret; | 70 | return intel_connector_update_modes(connector, edid); |
58 | } | 71 | } |
59 | 72 | ||
60 | static const struct drm_prop_enum_list force_audio_names[] = { | 73 | static const struct drm_prop_enum_list force_audio_names[] = { |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 58c07cdafb7e..1881c8c83f0e 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -2441,17 +2441,10 @@ static void gen6_enable_rps(struct drm_device *dev) | |||
2441 | dev_priv->max_delay << 24 | | 2441 | dev_priv->max_delay << 24 | |
2442 | dev_priv->min_delay << 16); | 2442 | dev_priv->min_delay << 16); |
2443 | 2443 | ||
2444 | if (IS_HASWELL(dev)) { | 2444 | I915_WRITE(GEN6_RP_UP_THRESHOLD, 59400); |
2445 | I915_WRITE(GEN6_RP_UP_THRESHOLD, 59400); | 2445 | I915_WRITE(GEN6_RP_DOWN_THRESHOLD, 245000); |
2446 | I915_WRITE(GEN6_RP_DOWN_THRESHOLD, 245000); | 2446 | I915_WRITE(GEN6_RP_UP_EI, 66000); |
2447 | I915_WRITE(GEN6_RP_UP_EI, 66000); | 2447 | I915_WRITE(GEN6_RP_DOWN_EI, 350000); |
2448 | I915_WRITE(GEN6_RP_DOWN_EI, 350000); | ||
2449 | } else { | ||
2450 | I915_WRITE(GEN6_RP_UP_THRESHOLD, 10000); | ||
2451 | I915_WRITE(GEN6_RP_DOWN_THRESHOLD, 1000000); | ||
2452 | I915_WRITE(GEN6_RP_UP_EI, 100000); | ||
2453 | I915_WRITE(GEN6_RP_DOWN_EI, 5000000); | ||
2454 | } | ||
2455 | 2448 | ||
2456 | I915_WRITE(GEN6_RP_IDLE_HYSTERSIS, 10); | 2449 | I915_WRITE(GEN6_RP_IDLE_HYSTERSIS, 10); |
2457 | I915_WRITE(GEN6_RP_CONTROL, | 2450 | I915_WRITE(GEN6_RP_CONTROL, |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index d172e9873131..d81bb0bf2885 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -1692,6 +1692,7 @@ static bool intel_sdvo_detect_hdmi_audio(struct drm_connector *connector) | |||
1692 | edid = intel_sdvo_get_edid(connector); | 1692 | edid = intel_sdvo_get_edid(connector); |
1693 | if (edid != NULL && edid->input & DRM_EDID_INPUT_DIGITAL) | 1693 | if (edid != NULL && edid->input & DRM_EDID_INPUT_DIGITAL) |
1694 | has_audio = drm_detect_monitor_audio(edid); | 1694 | has_audio = drm_detect_monitor_audio(edid); |
1695 | kfree(edid); | ||
1695 | 1696 | ||
1696 | return has_audio; | 1697 | return has_audio; |
1697 | } | 1698 | } |
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index cc8df4de2d92..7644f31a3778 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c | |||
@@ -60,11 +60,11 @@ ivb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb, | |||
60 | 60 | ||
61 | switch (fb->pixel_format) { | 61 | switch (fb->pixel_format) { |
62 | case DRM_FORMAT_XBGR8888: | 62 | case DRM_FORMAT_XBGR8888: |
63 | sprctl |= SPRITE_FORMAT_RGBX888; | 63 | sprctl |= SPRITE_FORMAT_RGBX888 | SPRITE_RGB_ORDER_RGBX; |
64 | pixel_size = 4; | 64 | pixel_size = 4; |
65 | break; | 65 | break; |
66 | case DRM_FORMAT_XRGB8888: | 66 | case DRM_FORMAT_XRGB8888: |
67 | sprctl |= SPRITE_FORMAT_RGBX888 | SPRITE_RGB_ORDER_RGBX; | 67 | sprctl |= SPRITE_FORMAT_RGBX888; |
68 | pixel_size = 4; | 68 | pixel_size = 4; |
69 | break; | 69 | break; |
70 | case DRM_FORMAT_YUYV: | 70 | case DRM_FORMAT_YUYV: |
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c index fc841e87b343..26ebffebe710 100644 --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c | |||
@@ -211,11 +211,6 @@ static int nouveau_dsm_power_state(enum vga_switcheroo_client_id id, | |||
211 | return nouveau_dsm_set_discrete_state(nouveau_dsm_priv.dhandle, state); | 211 | return nouveau_dsm_set_discrete_state(nouveau_dsm_priv.dhandle, state); |
212 | } | 212 | } |
213 | 213 | ||
214 | static int nouveau_dsm_init(void) | ||
215 | { | ||
216 | return 0; | ||
217 | } | ||
218 | |||
219 | static int nouveau_dsm_get_client_id(struct pci_dev *pdev) | 214 | static int nouveau_dsm_get_client_id(struct pci_dev *pdev) |
220 | { | 215 | { |
221 | /* easy option one - intel vendor ID means Integrated */ | 216 | /* easy option one - intel vendor ID means Integrated */ |
@@ -232,7 +227,6 @@ static int nouveau_dsm_get_client_id(struct pci_dev *pdev) | |||
232 | static struct vga_switcheroo_handler nouveau_dsm_handler = { | 227 | static struct vga_switcheroo_handler nouveau_dsm_handler = { |
233 | .switchto = nouveau_dsm_switchto, | 228 | .switchto = nouveau_dsm_switchto, |
234 | .power_state = nouveau_dsm_power_state, | 229 | .power_state = nouveau_dsm_power_state, |
235 | .init = nouveau_dsm_init, | ||
236 | .get_client_id = nouveau_dsm_get_client_id, | 230 | .get_client_id = nouveau_dsm_get_client_id, |
237 | }; | 231 | }; |
238 | 232 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index 1866dbb49979..c61014442aa9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -736,9 +736,11 @@ nouveau_card_init(struct drm_device *dev) | |||
736 | } | 736 | } |
737 | break; | 737 | break; |
738 | case NV_C0: | 738 | case NV_C0: |
739 | nvc0_copy_create(dev, 1); | 739 | if (!(nv_rd32(dev, 0x022500) & 0x00000200)) |
740 | nvc0_copy_create(dev, 1); | ||
740 | case NV_D0: | 741 | case NV_D0: |
741 | nvc0_copy_create(dev, 0); | 742 | if (!(nv_rd32(dev, 0x022500) & 0x00000100)) |
743 | nvc0_copy_create(dev, 0); | ||
742 | break; | 744 | break; |
743 | default: | 745 | default: |
744 | break; | 746 | break; |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index c6fcb5b86a45..2817101fb167 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -258,7 +258,6 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
258 | radeon_crtc->enabled = true; | 258 | radeon_crtc->enabled = true; |
259 | /* adjust pm to dpms changes BEFORE enabling crtcs */ | 259 | /* adjust pm to dpms changes BEFORE enabling crtcs */ |
260 | radeon_pm_compute_clocks(rdev); | 260 | radeon_pm_compute_clocks(rdev); |
261 | /* disable crtc pair power gating before programming */ | ||
262 | if (ASIC_IS_DCE6(rdev) && !radeon_crtc->in_mode_set) | 261 | if (ASIC_IS_DCE6(rdev) && !radeon_crtc->in_mode_set) |
263 | atombios_powergate_crtc(crtc, ATOM_DISABLE); | 262 | atombios_powergate_crtc(crtc, ATOM_DISABLE); |
264 | atombios_enable_crtc(crtc, ATOM_ENABLE); | 263 | atombios_enable_crtc(crtc, ATOM_ENABLE); |
@@ -278,25 +277,8 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
278 | atombios_enable_crtc_memreq(crtc, ATOM_DISABLE); | 277 | atombios_enable_crtc_memreq(crtc, ATOM_DISABLE); |
279 | atombios_enable_crtc(crtc, ATOM_DISABLE); | 278 | atombios_enable_crtc(crtc, ATOM_DISABLE); |
280 | radeon_crtc->enabled = false; | 279 | radeon_crtc->enabled = false; |
281 | /* power gating is per-pair */ | 280 | if (ASIC_IS_DCE6(rdev) && !radeon_crtc->in_mode_set) |
282 | if (ASIC_IS_DCE6(rdev) && !radeon_crtc->in_mode_set) { | 281 | atombios_powergate_crtc(crtc, ATOM_ENABLE); |
283 | struct drm_crtc *other_crtc; | ||
284 | struct radeon_crtc *other_radeon_crtc; | ||
285 | list_for_each_entry(other_crtc, &rdev->ddev->mode_config.crtc_list, head) { | ||
286 | other_radeon_crtc = to_radeon_crtc(other_crtc); | ||
287 | if (((radeon_crtc->crtc_id == 0) && (other_radeon_crtc->crtc_id == 1)) || | ||
288 | ((radeon_crtc->crtc_id == 1) && (other_radeon_crtc->crtc_id == 0)) || | ||
289 | ((radeon_crtc->crtc_id == 2) && (other_radeon_crtc->crtc_id == 3)) || | ||
290 | ((radeon_crtc->crtc_id == 3) && (other_radeon_crtc->crtc_id == 2)) || | ||
291 | ((radeon_crtc->crtc_id == 4) && (other_radeon_crtc->crtc_id == 5)) || | ||
292 | ((radeon_crtc->crtc_id == 5) && (other_radeon_crtc->crtc_id == 4))) { | ||
293 | /* if both crtcs in the pair are off, enable power gating */ | ||
294 | if (other_radeon_crtc->enabled == false) | ||
295 | atombios_powergate_crtc(crtc, ATOM_ENABLE); | ||
296 | break; | ||
297 | } | ||
298 | } | ||
299 | } | ||
300 | /* adjust pm to dpms changes AFTER disabling crtcs */ | 282 | /* adjust pm to dpms changes AFTER disabling crtcs */ |
301 | radeon_pm_compute_clocks(rdev); | 283 | radeon_pm_compute_clocks(rdev); |
302 | break; | 284 | break; |
@@ -444,11 +426,28 @@ union atom_enable_ss { | |||
444 | static void atombios_crtc_program_ss(struct radeon_device *rdev, | 426 | static void atombios_crtc_program_ss(struct radeon_device *rdev, |
445 | int enable, | 427 | int enable, |
446 | int pll_id, | 428 | int pll_id, |
429 | int crtc_id, | ||
447 | struct radeon_atom_ss *ss) | 430 | struct radeon_atom_ss *ss) |
448 | { | 431 | { |
432 | unsigned i; | ||
449 | int index = GetIndexIntoMasterTable(COMMAND, EnableSpreadSpectrumOnPPLL); | 433 | int index = GetIndexIntoMasterTable(COMMAND, EnableSpreadSpectrumOnPPLL); |
450 | union atom_enable_ss args; | 434 | union atom_enable_ss args; |
451 | 435 | ||
436 | if (!enable) { | ||
437 | for (i = 0; i < rdev->num_crtc; i++) { | ||
438 | if (rdev->mode_info.crtcs[i] && | ||
439 | rdev->mode_info.crtcs[i]->enabled && | ||
440 | i != crtc_id && | ||
441 | pll_id == rdev->mode_info.crtcs[i]->pll_id) { | ||
442 | /* one other crtc is using this pll don't turn | ||
443 | * off spread spectrum as it might turn off | ||
444 | * display on active crtc | ||
445 | */ | ||
446 | return; | ||
447 | } | ||
448 | } | ||
449 | } | ||
450 | |||
452 | memset(&args, 0, sizeof(args)); | 451 | memset(&args, 0, sizeof(args)); |
453 | 452 | ||
454 | if (ASIC_IS_DCE5(rdev)) { | 453 | if (ASIC_IS_DCE5(rdev)) { |
@@ -1028,7 +1027,7 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode | |||
1028 | radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, | 1027 | radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, |
1029 | &ref_div, &post_div); | 1028 | &ref_div, &post_div); |
1030 | 1029 | ||
1031 | atombios_crtc_program_ss(rdev, ATOM_DISABLE, radeon_crtc->pll_id, &ss); | 1030 | atombios_crtc_program_ss(rdev, ATOM_DISABLE, radeon_crtc->pll_id, radeon_crtc->crtc_id, &ss); |
1032 | 1031 | ||
1033 | atombios_crtc_program_pll(crtc, radeon_crtc->crtc_id, radeon_crtc->pll_id, | 1032 | atombios_crtc_program_pll(crtc, radeon_crtc->crtc_id, radeon_crtc->pll_id, |
1034 | encoder_mode, radeon_encoder->encoder_id, mode->clock, | 1033 | encoder_mode, radeon_encoder->encoder_id, mode->clock, |
@@ -1051,7 +1050,7 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode | |||
1051 | ss.step = step_size; | 1050 | ss.step = step_size; |
1052 | } | 1051 | } |
1053 | 1052 | ||
1054 | atombios_crtc_program_ss(rdev, ATOM_ENABLE, radeon_crtc->pll_id, &ss); | 1053 | atombios_crtc_program_ss(rdev, ATOM_ENABLE, radeon_crtc->pll_id, radeon_crtc->crtc_id, &ss); |
1055 | } | 1054 | } |
1056 | } | 1055 | } |
1057 | 1056 | ||
@@ -1572,11 +1571,11 @@ void radeon_atom_disp_eng_pll_init(struct radeon_device *rdev) | |||
1572 | ASIC_INTERNAL_SS_ON_DCPLL, | 1571 | ASIC_INTERNAL_SS_ON_DCPLL, |
1573 | rdev->clock.default_dispclk); | 1572 | rdev->clock.default_dispclk); |
1574 | if (ss_enabled) | 1573 | if (ss_enabled) |
1575 | atombios_crtc_program_ss(rdev, ATOM_DISABLE, ATOM_DCPLL, &ss); | 1574 | atombios_crtc_program_ss(rdev, ATOM_DISABLE, ATOM_DCPLL, -1, &ss); |
1576 | /* XXX: DCE5, make sure voltage, dispclk is high enough */ | 1575 | /* XXX: DCE5, make sure voltage, dispclk is high enough */ |
1577 | atombios_crtc_set_disp_eng_pll(rdev, rdev->clock.default_dispclk); | 1576 | atombios_crtc_set_disp_eng_pll(rdev, rdev->clock.default_dispclk); |
1578 | if (ss_enabled) | 1577 | if (ss_enabled) |
1579 | atombios_crtc_program_ss(rdev, ATOM_ENABLE, ATOM_DCPLL, &ss); | 1578 | atombios_crtc_program_ss(rdev, ATOM_ENABLE, ATOM_DCPLL, -1, &ss); |
1580 | } | 1579 | } |
1581 | 1580 | ||
1582 | } | 1581 | } |
@@ -1665,9 +1664,22 @@ static void atombios_crtc_disable(struct drm_crtc *crtc) | |||
1665 | struct drm_device *dev = crtc->dev; | 1664 | struct drm_device *dev = crtc->dev; |
1666 | struct radeon_device *rdev = dev->dev_private; | 1665 | struct radeon_device *rdev = dev->dev_private; |
1667 | struct radeon_atom_ss ss; | 1666 | struct radeon_atom_ss ss; |
1667 | int i; | ||
1668 | 1668 | ||
1669 | atombios_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); | 1669 | atombios_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); |
1670 | 1670 | ||
1671 | for (i = 0; i < rdev->num_crtc; i++) { | ||
1672 | if (rdev->mode_info.crtcs[i] && | ||
1673 | rdev->mode_info.crtcs[i]->enabled && | ||
1674 | i != radeon_crtc->crtc_id && | ||
1675 | radeon_crtc->pll_id == rdev->mode_info.crtcs[i]->pll_id) { | ||
1676 | /* one other crtc is using this pll don't turn | ||
1677 | * off the pll | ||
1678 | */ | ||
1679 | goto done; | ||
1680 | } | ||
1681 | } | ||
1682 | |||
1671 | switch (radeon_crtc->pll_id) { | 1683 | switch (radeon_crtc->pll_id) { |
1672 | case ATOM_PPLL1: | 1684 | case ATOM_PPLL1: |
1673 | case ATOM_PPLL2: | 1685 | case ATOM_PPLL2: |
@@ -1684,6 +1696,7 @@ static void atombios_crtc_disable(struct drm_crtc *crtc) | |||
1684 | default: | 1696 | default: |
1685 | break; | 1697 | break; |
1686 | } | 1698 | } |
1699 | done: | ||
1687 | radeon_crtc->pll_id = -1; | 1700 | radeon_crtc->pll_id = -1; |
1688 | } | 1701 | } |
1689 | 1702 | ||
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index 7712cf5ab33b..3623b98ed3fe 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -577,30 +577,25 @@ int radeon_dp_get_panel_mode(struct drm_encoder *encoder, | |||
577 | struct radeon_device *rdev = dev->dev_private; | 577 | struct radeon_device *rdev = dev->dev_private; |
578 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 578 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
579 | int panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE; | 579 | int panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE; |
580 | u16 dp_bridge = radeon_connector_encoder_get_dp_bridge_encoder_id(connector); | ||
581 | u8 tmp; | ||
580 | 582 | ||
581 | if (!ASIC_IS_DCE4(rdev)) | 583 | if (!ASIC_IS_DCE4(rdev)) |
582 | return panel_mode; | 584 | return panel_mode; |
583 | 585 | ||
584 | if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) == | 586 | if (dp_bridge != ENCODER_OBJECT_ID_NONE) { |
585 | ENCODER_OBJECT_ID_NUTMEG) | 587 | /* DP bridge chips */ |
586 | panel_mode = DP_PANEL_MODE_INTERNAL_DP1_MODE; | 588 | tmp = radeon_read_dpcd_reg(radeon_connector, DP_EDP_CONFIGURATION_CAP); |
587 | else if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) == | 589 | if (tmp & 1) |
588 | ENCODER_OBJECT_ID_TRAVIS) { | 590 | panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; |
589 | u8 id[6]; | 591 | else if ((dp_bridge == ENCODER_OBJECT_ID_NUTMEG) || |
590 | int i; | 592 | (dp_bridge == ENCODER_OBJECT_ID_TRAVIS)) |
591 | for (i = 0; i < 6; i++) | ||
592 | id[i] = radeon_read_dpcd_reg(radeon_connector, 0x503 + i); | ||
593 | if (id[0] == 0x73 && | ||
594 | id[1] == 0x69 && | ||
595 | id[2] == 0x76 && | ||
596 | id[3] == 0x61 && | ||
597 | id[4] == 0x72 && | ||
598 | id[5] == 0x54) | ||
599 | panel_mode = DP_PANEL_MODE_INTERNAL_DP1_MODE; | 593 | panel_mode = DP_PANEL_MODE_INTERNAL_DP1_MODE; |
600 | else | 594 | else |
601 | panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; | 595 | panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE; |
602 | } else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | 596 | } else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { |
603 | u8 tmp = radeon_read_dpcd_reg(radeon_connector, DP_EDP_CONFIGURATION_CAP); | 597 | /* eDP */ |
598 | tmp = radeon_read_dpcd_reg(radeon_connector, DP_EDP_CONFIGURATION_CAP); | ||
604 | if (tmp & 1) | 599 | if (tmp & 1) |
605 | panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; | 600 | panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; |
606 | } | 601 | } |
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index f9bc27fe269a..6e8803a1170c 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c | |||
@@ -1379,6 +1379,8 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode) | |||
1379 | struct drm_device *dev = encoder->dev; | 1379 | struct drm_device *dev = encoder->dev; |
1380 | struct radeon_device *rdev = dev->dev_private; | 1380 | struct radeon_device *rdev = dev->dev_private; |
1381 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 1381 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
1382 | struct drm_encoder *ext_encoder = radeon_get_external_encoder(encoder); | ||
1383 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | ||
1382 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | 1384 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); |
1383 | struct radeon_connector *radeon_connector = NULL; | 1385 | struct radeon_connector *radeon_connector = NULL; |
1384 | struct radeon_connector_atom_dig *radeon_dig_connector = NULL; | 1386 | struct radeon_connector_atom_dig *radeon_dig_connector = NULL; |
@@ -1390,19 +1392,37 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode) | |||
1390 | 1392 | ||
1391 | switch (mode) { | 1393 | switch (mode) { |
1392 | case DRM_MODE_DPMS_ON: | 1394 | case DRM_MODE_DPMS_ON: |
1393 | /* some early dce3.2 boards have a bug in their transmitter control table */ | 1395 | if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE5(rdev)) { |
1394 | if ((rdev->family == CHIP_RV710) || (rdev->family == CHIP_RV730) || | 1396 | if (!connector) |
1395 | ASIC_IS_DCE41(rdev) || ASIC_IS_DCE5(rdev)) { | 1397 | dig->panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE; |
1396 | if (ASIC_IS_DCE6(rdev)) { | 1398 | else |
1397 | /* It seems we need to call ATOM_ENCODER_CMD_SETUP again | 1399 | dig->panel_mode = radeon_dp_get_panel_mode(encoder, connector); |
1398 | * before reenabling encoder on DPMS ON, otherwise we never | 1400 | |
1399 | * get picture | 1401 | /* setup and enable the encoder */ |
1400 | */ | 1402 | atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_SETUP, 0); |
1401 | atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_SETUP, 0); | 1403 | atombios_dig_encoder_setup(encoder, |
1404 | ATOM_ENCODER_CMD_SETUP_PANEL_MODE, | ||
1405 | dig->panel_mode); | ||
1406 | if (ext_encoder) { | ||
1407 | if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE61(rdev)) | ||
1408 | atombios_external_encoder_setup(encoder, ext_encoder, | ||
1409 | EXTERNAL_ENCODER_ACTION_V3_ENCODER_SETUP); | ||
1402 | } | 1410 | } |
1403 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0); | 1411 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0); |
1404 | } else { | 1412 | } else if (ASIC_IS_DCE4(rdev)) { |
1413 | /* setup and enable the encoder */ | ||
1414 | atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_SETUP, 0); | ||
1415 | /* enable the transmitter */ | ||
1416 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0); | ||
1405 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0); | 1417 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0); |
1418 | } else { | ||
1419 | /* setup and enable the encoder and transmitter */ | ||
1420 | atombios_dig_encoder_setup(encoder, ATOM_ENABLE, 0); | ||
1421 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_SETUP, 0, 0); | ||
1422 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0); | ||
1423 | /* some early dce3.2 boards have a bug in their transmitter control table */ | ||
1424 | if ((rdev->family != CHIP_RV710) || (rdev->family != CHIP_RV730)) | ||
1425 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0); | ||
1406 | } | 1426 | } |
1407 | if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(encoder)) && connector) { | 1427 | if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(encoder)) && connector) { |
1408 | if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | 1428 | if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { |
@@ -1420,10 +1440,19 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode) | |||
1420 | case DRM_MODE_DPMS_STANDBY: | 1440 | case DRM_MODE_DPMS_STANDBY: |
1421 | case DRM_MODE_DPMS_SUSPEND: | 1441 | case DRM_MODE_DPMS_SUSPEND: |
1422 | case DRM_MODE_DPMS_OFF: | 1442 | case DRM_MODE_DPMS_OFF: |
1423 | if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE5(rdev)) | 1443 | if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE5(rdev)) { |
1444 | /* disable the transmitter */ | ||
1424 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE, 0, 0); | 1445 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE, 0, 0); |
1425 | else | 1446 | } else if (ASIC_IS_DCE4(rdev)) { |
1447 | /* disable the transmitter */ | ||
1448 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT, 0, 0); | ||
1449 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE, 0, 0); | ||
1450 | } else { | ||
1451 | /* disable the encoder and transmitter */ | ||
1426 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT, 0, 0); | 1452 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT, 0, 0); |
1453 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE, 0, 0); | ||
1454 | atombios_dig_encoder_setup(encoder, ATOM_DISABLE, 0); | ||
1455 | } | ||
1427 | if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(encoder)) && connector) { | 1456 | if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(encoder)) && connector) { |
1428 | if (ASIC_IS_DCE4(rdev)) | 1457 | if (ASIC_IS_DCE4(rdev)) |
1429 | atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_OFF, 0); | 1458 | atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_OFF, 0); |
@@ -1740,13 +1769,34 @@ static int radeon_atom_pick_dig_encoder(struct drm_encoder *encoder) | |||
1740 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); | 1769 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); |
1741 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 1770 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
1742 | struct drm_encoder *test_encoder; | 1771 | struct drm_encoder *test_encoder; |
1743 | struct radeon_encoder_atom_dig *dig; | 1772 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
1744 | uint32_t dig_enc_in_use = 0; | 1773 | uint32_t dig_enc_in_use = 0; |
1745 | 1774 | ||
1746 | /* DCE4/5 */ | 1775 | if (ASIC_IS_DCE6(rdev)) { |
1747 | if (ASIC_IS_DCE4(rdev)) { | 1776 | /* DCE6 */ |
1748 | dig = radeon_encoder->enc_priv; | 1777 | switch (radeon_encoder->encoder_id) { |
1749 | if (ASIC_IS_DCE41(rdev)) { | 1778 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: |
1779 | if (dig->linkb) | ||
1780 | return 1; | ||
1781 | else | ||
1782 | return 0; | ||
1783 | break; | ||
1784 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: | ||
1785 | if (dig->linkb) | ||
1786 | return 3; | ||
1787 | else | ||
1788 | return 2; | ||
1789 | break; | ||
1790 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: | ||
1791 | if (dig->linkb) | ||
1792 | return 5; | ||
1793 | else | ||
1794 | return 4; | ||
1795 | break; | ||
1796 | } | ||
1797 | } else if (ASIC_IS_DCE4(rdev)) { | ||
1798 | /* DCE4/5 */ | ||
1799 | if (ASIC_IS_DCE41(rdev) && !ASIC_IS_DCE61(rdev)) { | ||
1750 | /* ontario follows DCE4 */ | 1800 | /* ontario follows DCE4 */ |
1751 | if (rdev->family == CHIP_PALM) { | 1801 | if (rdev->family == CHIP_PALM) { |
1752 | if (dig->linkb) | 1802 | if (dig->linkb) |
@@ -1848,10 +1898,12 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, | |||
1848 | struct drm_device *dev = encoder->dev; | 1898 | struct drm_device *dev = encoder->dev; |
1849 | struct radeon_device *rdev = dev->dev_private; | 1899 | struct radeon_device *rdev = dev->dev_private; |
1850 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 1900 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
1851 | struct drm_encoder *ext_encoder = radeon_get_external_encoder(encoder); | ||
1852 | 1901 | ||
1853 | radeon_encoder->pixel_clock = adjusted_mode->clock; | 1902 | radeon_encoder->pixel_clock = adjusted_mode->clock; |
1854 | 1903 | ||
1904 | /* need to call this here rather than in prepare() since we need some crtc info */ | ||
1905 | radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF); | ||
1906 | |||
1855 | if (ASIC_IS_AVIVO(rdev) && !ASIC_IS_DCE4(rdev)) { | 1907 | if (ASIC_IS_AVIVO(rdev) && !ASIC_IS_DCE4(rdev)) { |
1856 | if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT | ATOM_DEVICE_TV_SUPPORT)) | 1908 | if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT | ATOM_DEVICE_TV_SUPPORT)) |
1857 | atombios_yuv_setup(encoder, true); | 1909 | atombios_yuv_setup(encoder, true); |
@@ -1870,38 +1922,7 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, | |||
1870 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: | 1922 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: |
1871 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: | 1923 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: |
1872 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: | 1924 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: |
1873 | if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE5(rdev)) { | 1925 | /* handled in dpms */ |
1874 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | ||
1875 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | ||
1876 | |||
1877 | if (!connector) | ||
1878 | dig->panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE; | ||
1879 | else | ||
1880 | dig->panel_mode = radeon_dp_get_panel_mode(encoder, connector); | ||
1881 | |||
1882 | /* setup and enable the encoder */ | ||
1883 | atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_SETUP, 0); | ||
1884 | atombios_dig_encoder_setup(encoder, | ||
1885 | ATOM_ENCODER_CMD_SETUP_PANEL_MODE, | ||
1886 | dig->panel_mode); | ||
1887 | } else if (ASIC_IS_DCE4(rdev)) { | ||
1888 | /* disable the transmitter */ | ||
1889 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE, 0, 0); | ||
1890 | /* setup and enable the encoder */ | ||
1891 | atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_SETUP, 0); | ||
1892 | |||
1893 | /* enable the transmitter */ | ||
1894 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0); | ||
1895 | } else { | ||
1896 | /* disable the encoder and transmitter */ | ||
1897 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE, 0, 0); | ||
1898 | atombios_dig_encoder_setup(encoder, ATOM_DISABLE, 0); | ||
1899 | |||
1900 | /* setup and enable the encoder and transmitter */ | ||
1901 | atombios_dig_encoder_setup(encoder, ATOM_ENABLE, 0); | ||
1902 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_SETUP, 0, 0); | ||
1903 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0); | ||
1904 | } | ||
1905 | break; | 1926 | break; |
1906 | case ENCODER_OBJECT_ID_INTERNAL_DDI: | 1927 | case ENCODER_OBJECT_ID_INTERNAL_DDI: |
1907 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: | 1928 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: |
@@ -1922,14 +1943,6 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, | |||
1922 | break; | 1943 | break; |
1923 | } | 1944 | } |
1924 | 1945 | ||
1925 | if (ext_encoder) { | ||
1926 | if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE61(rdev)) | ||
1927 | atombios_external_encoder_setup(encoder, ext_encoder, | ||
1928 | EXTERNAL_ENCODER_ACTION_V3_ENCODER_SETUP); | ||
1929 | else | ||
1930 | atombios_external_encoder_setup(encoder, ext_encoder, ATOM_ENABLE); | ||
1931 | } | ||
1932 | |||
1933 | atombios_apply_encoder_quirks(encoder, adjusted_mode); | 1946 | atombios_apply_encoder_quirks(encoder, adjusted_mode); |
1934 | 1947 | ||
1935 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) { | 1948 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) { |
@@ -2116,7 +2129,6 @@ static void radeon_atom_encoder_prepare(struct drm_encoder *encoder) | |||
2116 | } | 2129 | } |
2117 | 2130 | ||
2118 | radeon_atom_output_lock(encoder, true); | 2131 | radeon_atom_output_lock(encoder, true); |
2119 | radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF); | ||
2120 | 2132 | ||
2121 | if (connector) { | 2133 | if (connector) { |
2122 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 2134 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
@@ -2137,6 +2149,7 @@ static void radeon_atom_encoder_prepare(struct drm_encoder *encoder) | |||
2137 | 2149 | ||
2138 | static void radeon_atom_encoder_commit(struct drm_encoder *encoder) | 2150 | static void radeon_atom_encoder_commit(struct drm_encoder *encoder) |
2139 | { | 2151 | { |
2152 | /* need to call this here as we need the crtc set up */ | ||
2140 | radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_ON); | 2153 | radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_ON); |
2141 | radeon_atom_output_lock(encoder, false); | 2154 | radeon_atom_output_lock(encoder, false); |
2142 | } | 2155 | } |
@@ -2177,14 +2190,7 @@ static void radeon_atom_encoder_disable(struct drm_encoder *encoder) | |||
2177 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: | 2190 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: |
2178 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: | 2191 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: |
2179 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: | 2192 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: |
2180 | if (ASIC_IS_DCE4(rdev)) | 2193 | /* handled in dpms */ |
2181 | /* disable the transmitter */ | ||
2182 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE, 0, 0); | ||
2183 | else { | ||
2184 | /* disable the encoder and transmitter */ | ||
2185 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE, 0, 0); | ||
2186 | atombios_dig_encoder_setup(encoder, ATOM_DISABLE, 0); | ||
2187 | } | ||
2188 | break; | 2194 | break; |
2189 | case ENCODER_OBJECT_ID_INTERNAL_DDI: | 2195 | case ENCODER_OBJECT_ID_INTERNAL_DDI: |
2190 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: | 2196 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: |
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index 3dab49cb1d4a..f37676d7f217 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c | |||
@@ -47,18 +47,23 @@ struct r600_cs_track { | |||
47 | u32 npipes; | 47 | u32 npipes; |
48 | /* value we track */ | 48 | /* value we track */ |
49 | u32 sq_config; | 49 | u32 sq_config; |
50 | u32 log_nsamples; | ||
50 | u32 nsamples; | 51 | u32 nsamples; |
51 | u32 cb_color_base_last[8]; | 52 | u32 cb_color_base_last[8]; |
52 | struct radeon_bo *cb_color_bo[8]; | 53 | struct radeon_bo *cb_color_bo[8]; |
53 | u64 cb_color_bo_mc[8]; | 54 | u64 cb_color_bo_mc[8]; |
54 | u32 cb_color_bo_offset[8]; | 55 | u64 cb_color_bo_offset[8]; |
55 | struct radeon_bo *cb_color_frag_bo[8]; /* unused */ | 56 | struct radeon_bo *cb_color_frag_bo[8]; |
56 | struct radeon_bo *cb_color_tile_bo[8]; /* unused */ | 57 | u64 cb_color_frag_offset[8]; |
58 | struct radeon_bo *cb_color_tile_bo[8]; | ||
59 | u64 cb_color_tile_offset[8]; | ||
60 | u32 cb_color_mask[8]; | ||
57 | u32 cb_color_info[8]; | 61 | u32 cb_color_info[8]; |
58 | u32 cb_color_view[8]; | 62 | u32 cb_color_view[8]; |
59 | u32 cb_color_size_idx[8]; /* unused */ | 63 | u32 cb_color_size_idx[8]; /* unused */ |
60 | u32 cb_target_mask; | 64 | u32 cb_target_mask; |
61 | u32 cb_shader_mask; /* unused */ | 65 | u32 cb_shader_mask; /* unused */ |
66 | bool is_resolve; | ||
62 | u32 cb_color_size[8]; | 67 | u32 cb_color_size[8]; |
63 | u32 vgt_strmout_en; | 68 | u32 vgt_strmout_en; |
64 | u32 vgt_strmout_buffer_en; | 69 | u32 vgt_strmout_buffer_en; |
@@ -311,7 +316,15 @@ static void r600_cs_track_init(struct r600_cs_track *track) | |||
311 | track->cb_color_bo[i] = NULL; | 316 | track->cb_color_bo[i] = NULL; |
312 | track->cb_color_bo_offset[i] = 0xFFFFFFFF; | 317 | track->cb_color_bo_offset[i] = 0xFFFFFFFF; |
313 | track->cb_color_bo_mc[i] = 0xFFFFFFFF; | 318 | track->cb_color_bo_mc[i] = 0xFFFFFFFF; |
314 | } | 319 | track->cb_color_frag_bo[i] = NULL; |
320 | track->cb_color_frag_offset[i] = 0xFFFFFFFF; | ||
321 | track->cb_color_tile_bo[i] = NULL; | ||
322 | track->cb_color_tile_offset[i] = 0xFFFFFFFF; | ||
323 | track->cb_color_mask[i] = 0xFFFFFFFF; | ||
324 | } | ||
325 | track->is_resolve = false; | ||
326 | track->nsamples = 16; | ||
327 | track->log_nsamples = 4; | ||
315 | track->cb_target_mask = 0xFFFFFFFF; | 328 | track->cb_target_mask = 0xFFFFFFFF; |
316 | track->cb_shader_mask = 0xFFFFFFFF; | 329 | track->cb_shader_mask = 0xFFFFFFFF; |
317 | track->cb_dirty = true; | 330 | track->cb_dirty = true; |
@@ -348,11 +361,9 @@ static int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) | |||
348 | volatile u32 *ib = p->ib.ptr; | 361 | volatile u32 *ib = p->ib.ptr; |
349 | unsigned array_mode; | 362 | unsigned array_mode; |
350 | u32 format; | 363 | u32 format; |
364 | /* When resolve is used, the second colorbuffer has always 1 sample. */ | ||
365 | unsigned nsamples = track->is_resolve && i == 1 ? 1 : track->nsamples; | ||
351 | 366 | ||
352 | if (G_0280A0_TILE_MODE(track->cb_color_info[i])) { | ||
353 | dev_warn(p->dev, "FMASK or CMASK buffer are not supported by this kernel\n"); | ||
354 | return -EINVAL; | ||
355 | } | ||
356 | size = radeon_bo_size(track->cb_color_bo[i]) - track->cb_color_bo_offset[i]; | 367 | size = radeon_bo_size(track->cb_color_bo[i]) - track->cb_color_bo_offset[i]; |
357 | format = G_0280A0_FORMAT(track->cb_color_info[i]); | 368 | format = G_0280A0_FORMAT(track->cb_color_info[i]); |
358 | if (!r600_fmt_is_valid_color(format)) { | 369 | if (!r600_fmt_is_valid_color(format)) { |
@@ -375,7 +386,7 @@ static int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) | |||
375 | array_check.group_size = track->group_size; | 386 | array_check.group_size = track->group_size; |
376 | array_check.nbanks = track->nbanks; | 387 | array_check.nbanks = track->nbanks; |
377 | array_check.npipes = track->npipes; | 388 | array_check.npipes = track->npipes; |
378 | array_check.nsamples = track->nsamples; | 389 | array_check.nsamples = nsamples; |
379 | array_check.blocksize = r600_fmt_get_blocksize(format); | 390 | array_check.blocksize = r600_fmt_get_blocksize(format); |
380 | if (r600_get_array_mode_alignment(&array_check, | 391 | if (r600_get_array_mode_alignment(&array_check, |
381 | &pitch_align, &height_align, &depth_align, &base_align)) { | 392 | &pitch_align, &height_align, &depth_align, &base_align)) { |
@@ -420,7 +431,8 @@ static int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) | |||
420 | } | 431 | } |
421 | 432 | ||
422 | /* check offset */ | 433 | /* check offset */ |
423 | tmp = r600_fmt_get_nblocksy(format, height) * r600_fmt_get_nblocksx(format, pitch) * r600_fmt_get_blocksize(format); | 434 | tmp = r600_fmt_get_nblocksy(format, height) * r600_fmt_get_nblocksx(format, pitch) * |
435 | r600_fmt_get_blocksize(format) * nsamples; | ||
424 | switch (array_mode) { | 436 | switch (array_mode) { |
425 | default: | 437 | default: |
426 | case V_0280A0_ARRAY_LINEAR_GENERAL: | 438 | case V_0280A0_ARRAY_LINEAR_GENERAL: |
@@ -441,7 +453,7 @@ static int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) | |||
441 | * broken userspace. | 453 | * broken userspace. |
442 | */ | 454 | */ |
443 | } else { | 455 | } else { |
444 | dev_warn(p->dev, "%s offset[%d] %d %d %d %lu too big (%d %d) (%d %d %d)\n", | 456 | dev_warn(p->dev, "%s offset[%d] %d %llu %d %lu too big (%d %d) (%d %d %d)\n", |
445 | __func__, i, array_mode, | 457 | __func__, i, array_mode, |
446 | track->cb_color_bo_offset[i], tmp, | 458 | track->cb_color_bo_offset[i], tmp, |
447 | radeon_bo_size(track->cb_color_bo[i]), | 459 | radeon_bo_size(track->cb_color_bo[i]), |
@@ -458,6 +470,51 @@ static int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) | |||
458 | tmp = S_028060_PITCH_TILE_MAX((pitch / 8) - 1) | | 470 | tmp = S_028060_PITCH_TILE_MAX((pitch / 8) - 1) | |
459 | S_028060_SLICE_TILE_MAX(slice_tile_max - 1); | 471 | S_028060_SLICE_TILE_MAX(slice_tile_max - 1); |
460 | ib[track->cb_color_size_idx[i]] = tmp; | 472 | ib[track->cb_color_size_idx[i]] = tmp; |
473 | |||
474 | /* FMASK/CMASK */ | ||
475 | switch (G_0280A0_TILE_MODE(track->cb_color_info[i])) { | ||
476 | case V_0280A0_TILE_DISABLE: | ||
477 | break; | ||
478 | case V_0280A0_FRAG_ENABLE: | ||
479 | if (track->nsamples > 1) { | ||
480 | uint32_t tile_max = G_028100_FMASK_TILE_MAX(track->cb_color_mask[i]); | ||
481 | /* the tile size is 8x8, but the size is in units of bits. | ||
482 | * for bytes, do just * 8. */ | ||
483 | uint32_t bytes = track->nsamples * track->log_nsamples * 8 * (tile_max + 1); | ||
484 | |||
485 | if (bytes + track->cb_color_frag_offset[i] > | ||
486 | radeon_bo_size(track->cb_color_frag_bo[i])) { | ||
487 | dev_warn(p->dev, "%s FMASK_TILE_MAX too large " | ||
488 | "(tile_max=%u, bytes=%u, offset=%llu, bo_size=%lu)\n", | ||
489 | __func__, tile_max, bytes, | ||
490 | track->cb_color_frag_offset[i], | ||
491 | radeon_bo_size(track->cb_color_frag_bo[i])); | ||
492 | return -EINVAL; | ||
493 | } | ||
494 | } | ||
495 | /* fall through */ | ||
496 | case V_0280A0_CLEAR_ENABLE: | ||
497 | { | ||
498 | uint32_t block_max = G_028100_CMASK_BLOCK_MAX(track->cb_color_mask[i]); | ||
499 | /* One block = 128x128 pixels, one 8x8 tile has 4 bits.. | ||
500 | * (128*128) / (8*8) / 2 = 128 bytes per block. */ | ||
501 | uint32_t bytes = (block_max + 1) * 128; | ||
502 | |||
503 | if (bytes + track->cb_color_tile_offset[i] > | ||
504 | radeon_bo_size(track->cb_color_tile_bo[i])) { | ||
505 | dev_warn(p->dev, "%s CMASK_BLOCK_MAX too large " | ||
506 | "(block_max=%u, bytes=%u, offset=%llu, bo_size=%lu)\n", | ||
507 | __func__, block_max, bytes, | ||
508 | track->cb_color_tile_offset[i], | ||
509 | radeon_bo_size(track->cb_color_tile_bo[i])); | ||
510 | return -EINVAL; | ||
511 | } | ||
512 | break; | ||
513 | } | ||
514 | default: | ||
515 | dev_warn(p->dev, "%s invalid tile mode\n", __func__); | ||
516 | return -EINVAL; | ||
517 | } | ||
461 | return 0; | 518 | return 0; |
462 | } | 519 | } |
463 | 520 | ||
@@ -566,7 +623,7 @@ static int r600_cs_track_validate_db(struct radeon_cs_parser *p) | |||
566 | 623 | ||
567 | ntiles = G_028000_SLICE_TILE_MAX(track->db_depth_size) + 1; | 624 | ntiles = G_028000_SLICE_TILE_MAX(track->db_depth_size) + 1; |
568 | nviews = G_028004_SLICE_MAX(track->db_depth_view) + 1; | 625 | nviews = G_028004_SLICE_MAX(track->db_depth_view) + 1; |
569 | tmp = ntiles * bpe * 64 * nviews; | 626 | tmp = ntiles * bpe * 64 * nviews * track->nsamples; |
570 | if ((tmp + track->db_offset) > radeon_bo_size(track->db_bo)) { | 627 | if ((tmp + track->db_offset) > radeon_bo_size(track->db_bo)) { |
571 | dev_warn(p->dev, "z/stencil buffer (%d) too small (0x%08X %d %d %d -> %u have %lu)\n", | 628 | dev_warn(p->dev, "z/stencil buffer (%d) too small (0x%08X %d %d %d -> %u have %lu)\n", |
572 | array_mode, | 629 | array_mode, |
@@ -746,6 +803,12 @@ static int r600_cs_track_check(struct radeon_cs_parser *p) | |||
746 | */ | 803 | */ |
747 | if (track->cb_dirty) { | 804 | if (track->cb_dirty) { |
748 | tmp = track->cb_target_mask; | 805 | tmp = track->cb_target_mask; |
806 | |||
807 | /* We must check both colorbuffers for RESOLVE. */ | ||
808 | if (track->is_resolve) { | ||
809 | tmp |= 0xff; | ||
810 | } | ||
811 | |||
749 | for (i = 0; i < 8; i++) { | 812 | for (i = 0; i < 8; i++) { |
750 | if ((tmp >> (i * 4)) & 0xF) { | 813 | if ((tmp >> (i * 4)) & 0xF) { |
751 | /* at least one component is enabled */ | 814 | /* at least one component is enabled */ |
@@ -1231,9 +1294,15 @@ static int r600_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
1231 | break; | 1294 | break; |
1232 | case R_028C04_PA_SC_AA_CONFIG: | 1295 | case R_028C04_PA_SC_AA_CONFIG: |
1233 | tmp = G_028C04_MSAA_NUM_SAMPLES(radeon_get_ib_value(p, idx)); | 1296 | tmp = G_028C04_MSAA_NUM_SAMPLES(radeon_get_ib_value(p, idx)); |
1297 | track->log_nsamples = tmp; | ||
1234 | track->nsamples = 1 << tmp; | 1298 | track->nsamples = 1 << tmp; |
1235 | track->cb_dirty = true; | 1299 | track->cb_dirty = true; |
1236 | break; | 1300 | break; |
1301 | case R_028808_CB_COLOR_CONTROL: | ||
1302 | tmp = G_028808_SPECIAL_OP(radeon_get_ib_value(p, idx)); | ||
1303 | track->is_resolve = tmp == V_028808_SPECIAL_RESOLVE_BOX; | ||
1304 | track->cb_dirty = true; | ||
1305 | break; | ||
1237 | case R_0280A0_CB_COLOR0_INFO: | 1306 | case R_0280A0_CB_COLOR0_INFO: |
1238 | case R_0280A4_CB_COLOR1_INFO: | 1307 | case R_0280A4_CB_COLOR1_INFO: |
1239 | case R_0280A8_CB_COLOR2_INFO: | 1308 | case R_0280A8_CB_COLOR2_INFO: |
@@ -1312,16 +1381,21 @@ static int r600_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
1312 | dev_err(p->dev, "Broken old userspace ? no cb_color0_base supplied before trying to write 0x%08X\n", reg); | 1381 | dev_err(p->dev, "Broken old userspace ? no cb_color0_base supplied before trying to write 0x%08X\n", reg); |
1313 | return -EINVAL; | 1382 | return -EINVAL; |
1314 | } | 1383 | } |
1315 | ib[idx] = track->cb_color_base_last[tmp]; | ||
1316 | track->cb_color_frag_bo[tmp] = track->cb_color_bo[tmp]; | 1384 | track->cb_color_frag_bo[tmp] = track->cb_color_bo[tmp]; |
1385 | track->cb_color_frag_offset[tmp] = track->cb_color_bo_offset[tmp]; | ||
1386 | ib[idx] = track->cb_color_base_last[tmp]; | ||
1317 | } else { | 1387 | } else { |
1318 | r = r600_cs_packet_next_reloc(p, &reloc); | 1388 | r = r600_cs_packet_next_reloc(p, &reloc); |
1319 | if (r) { | 1389 | if (r) { |
1320 | dev_err(p->dev, "bad SET_CONTEXT_REG 0x%04X\n", reg); | 1390 | dev_err(p->dev, "bad SET_CONTEXT_REG 0x%04X\n", reg); |
1321 | return -EINVAL; | 1391 | return -EINVAL; |
1322 | } | 1392 | } |
1323 | ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | ||
1324 | track->cb_color_frag_bo[tmp] = reloc->robj; | 1393 | track->cb_color_frag_bo[tmp] = reloc->robj; |
1394 | track->cb_color_frag_offset[tmp] = (u64)ib[idx] << 8; | ||
1395 | ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | ||
1396 | } | ||
1397 | if (G_0280A0_TILE_MODE(track->cb_color_info[tmp])) { | ||
1398 | track->cb_dirty = true; | ||
1325 | } | 1399 | } |
1326 | break; | 1400 | break; |
1327 | case R_0280C0_CB_COLOR0_TILE: | 1401 | case R_0280C0_CB_COLOR0_TILE: |
@@ -1338,16 +1412,35 @@ static int r600_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
1338 | dev_err(p->dev, "Broken old userspace ? no cb_color0_base supplied before trying to write 0x%08X\n", reg); | 1412 | dev_err(p->dev, "Broken old userspace ? no cb_color0_base supplied before trying to write 0x%08X\n", reg); |
1339 | return -EINVAL; | 1413 | return -EINVAL; |
1340 | } | 1414 | } |
1341 | ib[idx] = track->cb_color_base_last[tmp]; | ||
1342 | track->cb_color_tile_bo[tmp] = track->cb_color_bo[tmp]; | 1415 | track->cb_color_tile_bo[tmp] = track->cb_color_bo[tmp]; |
1416 | track->cb_color_tile_offset[tmp] = track->cb_color_bo_offset[tmp]; | ||
1417 | ib[idx] = track->cb_color_base_last[tmp]; | ||
1343 | } else { | 1418 | } else { |
1344 | r = r600_cs_packet_next_reloc(p, &reloc); | 1419 | r = r600_cs_packet_next_reloc(p, &reloc); |
1345 | if (r) { | 1420 | if (r) { |
1346 | dev_err(p->dev, "bad SET_CONTEXT_REG 0x%04X\n", reg); | 1421 | dev_err(p->dev, "bad SET_CONTEXT_REG 0x%04X\n", reg); |
1347 | return -EINVAL; | 1422 | return -EINVAL; |
1348 | } | 1423 | } |
1349 | ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | ||
1350 | track->cb_color_tile_bo[tmp] = reloc->robj; | 1424 | track->cb_color_tile_bo[tmp] = reloc->robj; |
1425 | track->cb_color_tile_offset[tmp] = (u64)ib[idx] << 8; | ||
1426 | ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | ||
1427 | } | ||
1428 | if (G_0280A0_TILE_MODE(track->cb_color_info[tmp])) { | ||
1429 | track->cb_dirty = true; | ||
1430 | } | ||
1431 | break; | ||
1432 | case R_028100_CB_COLOR0_MASK: | ||
1433 | case R_028104_CB_COLOR1_MASK: | ||
1434 | case R_028108_CB_COLOR2_MASK: | ||
1435 | case R_02810C_CB_COLOR3_MASK: | ||
1436 | case R_028110_CB_COLOR4_MASK: | ||
1437 | case R_028114_CB_COLOR5_MASK: | ||
1438 | case R_028118_CB_COLOR6_MASK: | ||
1439 | case R_02811C_CB_COLOR7_MASK: | ||
1440 | tmp = (reg - R_028100_CB_COLOR0_MASK) / 4; | ||
1441 | track->cb_color_mask[tmp] = radeon_get_ib_value(p, idx); | ||
1442 | if (G_0280A0_TILE_MODE(track->cb_color_info[tmp])) { | ||
1443 | track->cb_dirty = true; | ||
1351 | } | 1444 | } |
1352 | break; | 1445 | break; |
1353 | case CB_COLOR0_BASE: | 1446 | case CB_COLOR0_BASE: |
@@ -1492,7 +1585,7 @@ unsigned r600_mip_minify(unsigned size, unsigned level) | |||
1492 | } | 1585 | } |
1493 | 1586 | ||
1494 | static void r600_texture_size(unsigned nfaces, unsigned blevel, unsigned llevel, | 1587 | static void r600_texture_size(unsigned nfaces, unsigned blevel, unsigned llevel, |
1495 | unsigned w0, unsigned h0, unsigned d0, unsigned format, | 1588 | unsigned w0, unsigned h0, unsigned d0, unsigned nsamples, unsigned format, |
1496 | unsigned block_align, unsigned height_align, unsigned base_align, | 1589 | unsigned block_align, unsigned height_align, unsigned base_align, |
1497 | unsigned *l0_size, unsigned *mipmap_size) | 1590 | unsigned *l0_size, unsigned *mipmap_size) |
1498 | { | 1591 | { |
@@ -1520,7 +1613,7 @@ static void r600_texture_size(unsigned nfaces, unsigned blevel, unsigned llevel, | |||
1520 | 1613 | ||
1521 | depth = r600_mip_minify(d0, i); | 1614 | depth = r600_mip_minify(d0, i); |
1522 | 1615 | ||
1523 | size = nbx * nby * blocksize; | 1616 | size = nbx * nby * blocksize * nsamples; |
1524 | if (nfaces) | 1617 | if (nfaces) |
1525 | size *= nfaces; | 1618 | size *= nfaces; |
1526 | else | 1619 | else |
@@ -1672,7 +1765,7 @@ static int r600_check_texture_resource(struct radeon_cs_parser *p, u32 idx, | |||
1672 | 1765 | ||
1673 | nfaces = larray - barray + 1; | 1766 | nfaces = larray - barray + 1; |
1674 | } | 1767 | } |
1675 | r600_texture_size(nfaces, blevel, llevel, w0, h0, d0, format, | 1768 | r600_texture_size(nfaces, blevel, llevel, w0, h0, d0, array_check.nsamples, format, |
1676 | pitch_align, height_align, base_align, | 1769 | pitch_align, height_align, base_align, |
1677 | &l0_size, &mipmap_size); | 1770 | &l0_size, &mipmap_size); |
1678 | /* using get ib will give us the offset into the texture bo */ | 1771 | /* using get ib will give us the offset into the texture bo */ |
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index fd328f4c3ea8..fa6f37099ba9 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h | |||
@@ -66,6 +66,14 @@ | |||
66 | #define CC_RB_BACKEND_DISABLE 0x98F4 | 66 | #define CC_RB_BACKEND_DISABLE 0x98F4 |
67 | #define BACKEND_DISABLE(x) ((x) << 16) | 67 | #define BACKEND_DISABLE(x) ((x) << 16) |
68 | 68 | ||
69 | #define R_028808_CB_COLOR_CONTROL 0x28808 | ||
70 | #define S_028808_SPECIAL_OP(x) (((x) & 0x7) << 4) | ||
71 | #define G_028808_SPECIAL_OP(x) (((x) >> 4) & 0x7) | ||
72 | #define C_028808_SPECIAL_OP 0xFFFFFF8F | ||
73 | #define V_028808_SPECIAL_NORMAL 0x00 | ||
74 | #define V_028808_SPECIAL_DISABLE 0x01 | ||
75 | #define V_028808_SPECIAL_RESOLVE_BOX 0x07 | ||
76 | |||
69 | #define CB_COLOR0_BASE 0x28040 | 77 | #define CB_COLOR0_BASE 0x28040 |
70 | #define CB_COLOR1_BASE 0x28044 | 78 | #define CB_COLOR1_BASE 0x28044 |
71 | #define CB_COLOR2_BASE 0x28048 | 79 | #define CB_COLOR2_BASE 0x28048 |
@@ -92,6 +100,20 @@ | |||
92 | #define R_028094_CB_COLOR5_VIEW 0x028094 | 100 | #define R_028094_CB_COLOR5_VIEW 0x028094 |
93 | #define R_028098_CB_COLOR6_VIEW 0x028098 | 101 | #define R_028098_CB_COLOR6_VIEW 0x028098 |
94 | #define R_02809C_CB_COLOR7_VIEW 0x02809C | 102 | #define R_02809C_CB_COLOR7_VIEW 0x02809C |
103 | #define R_028100_CB_COLOR0_MASK 0x028100 | ||
104 | #define S_028100_CMASK_BLOCK_MAX(x) (((x) & 0xFFF) << 0) | ||
105 | #define G_028100_CMASK_BLOCK_MAX(x) (((x) >> 0) & 0xFFF) | ||
106 | #define C_028100_CMASK_BLOCK_MAX 0xFFFFF000 | ||
107 | #define S_028100_FMASK_TILE_MAX(x) (((x) & 0xFFFFF) << 12) | ||
108 | #define G_028100_FMASK_TILE_MAX(x) (((x) >> 12) & 0xFFFFF) | ||
109 | #define C_028100_FMASK_TILE_MAX 0x00000FFF | ||
110 | #define R_028104_CB_COLOR1_MASK 0x028104 | ||
111 | #define R_028108_CB_COLOR2_MASK 0x028108 | ||
112 | #define R_02810C_CB_COLOR3_MASK 0x02810C | ||
113 | #define R_028110_CB_COLOR4_MASK 0x028110 | ||
114 | #define R_028114_CB_COLOR5_MASK 0x028114 | ||
115 | #define R_028118_CB_COLOR6_MASK 0x028118 | ||
116 | #define R_02811C_CB_COLOR7_MASK 0x02811C | ||
95 | #define CB_COLOR0_INFO 0x280a0 | 117 | #define CB_COLOR0_INFO 0x280a0 |
96 | # define CB_FORMAT(x) ((x) << 2) | 118 | # define CB_FORMAT(x) ((x) << 2) |
97 | # define CB_ARRAY_MODE(x) ((x) << 8) | 119 | # define CB_ARRAY_MODE(x) ((x) << 8) |
@@ -1400,6 +1422,9 @@ | |||
1400 | #define S_0280A0_TILE_MODE(x) (((x) & 0x3) << 18) | 1422 | #define S_0280A0_TILE_MODE(x) (((x) & 0x3) << 18) |
1401 | #define G_0280A0_TILE_MODE(x) (((x) >> 18) & 0x3) | 1423 | #define G_0280A0_TILE_MODE(x) (((x) >> 18) & 0x3) |
1402 | #define C_0280A0_TILE_MODE 0xFFF3FFFF | 1424 | #define C_0280A0_TILE_MODE 0xFFF3FFFF |
1425 | #define V_0280A0_TILE_DISABLE 0 | ||
1426 | #define V_0280A0_CLEAR_ENABLE 1 | ||
1427 | #define V_0280A0_FRAG_ENABLE 2 | ||
1403 | #define S_0280A0_BLEND_CLAMP(x) (((x) & 0x1) << 20) | 1428 | #define S_0280A0_BLEND_CLAMP(x) (((x) & 0x1) << 20) |
1404 | #define G_0280A0_BLEND_CLAMP(x) (((x) >> 20) & 0x1) | 1429 | #define G_0280A0_BLEND_CLAMP(x) (((x) >> 20) & 0x1) |
1405 | #define C_0280A0_BLEND_CLAMP 0xFFEFFFFF | 1430 | #define C_0280A0_BLEND_CLAMP 0xFFEFFFFF |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 99304194a65c..59a15315ae9f 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -142,21 +142,6 @@ struct radeon_device; | |||
142 | /* | 142 | /* |
143 | * BIOS. | 143 | * BIOS. |
144 | */ | 144 | */ |
145 | #define ATRM_BIOS_PAGE 4096 | ||
146 | |||
147 | #if defined(CONFIG_VGA_SWITCHEROO) | ||
148 | bool radeon_atrm_supported(struct pci_dev *pdev); | ||
149 | int radeon_atrm_get_bios_chunk(uint8_t *bios, int offset, int len); | ||
150 | #else | ||
151 | static inline bool radeon_atrm_supported(struct pci_dev *pdev) | ||
152 | { | ||
153 | return false; | ||
154 | } | ||
155 | |||
156 | static inline int radeon_atrm_get_bios_chunk(uint8_t *bios, int offset, int len){ | ||
157 | return -EINVAL; | ||
158 | } | ||
159 | #endif | ||
160 | bool radeon_get_bios(struct radeon_device *rdev); | 145 | bool radeon_get_bios(struct radeon_device *rdev); |
161 | 146 | ||
162 | /* | 147 | /* |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index f9c21f9d16bc..d67d4f3eb6f4 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -452,7 +452,7 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, | |||
452 | } | 452 | } |
453 | 453 | ||
454 | /* Fujitsu D3003-S2 board lists DVI-I as DVI-D and VGA */ | 454 | /* Fujitsu D3003-S2 board lists DVI-I as DVI-D and VGA */ |
455 | if ((dev->pdev->device == 0x9802) && | 455 | if (((dev->pdev->device == 0x9802) || (dev->pdev->device == 0x9806)) && |
456 | (dev->pdev->subsystem_vendor == 0x1734) && | 456 | (dev->pdev->subsystem_vendor == 0x1734) && |
457 | (dev->pdev->subsystem_device == 0x11bd)) { | 457 | (dev->pdev->subsystem_device == 0x11bd)) { |
458 | if (*connector_type == DRM_MODE_CONNECTOR_VGA) { | 458 | if (*connector_type == DRM_MODE_CONNECTOR_VGA) { |
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c index 98724fcb0088..2a2cf0b88a28 100644 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c | |||
@@ -30,57 +30,8 @@ static struct radeon_atpx_priv { | |||
30 | /* handle for device - and atpx */ | 30 | /* handle for device - and atpx */ |
31 | acpi_handle dhandle; | 31 | acpi_handle dhandle; |
32 | acpi_handle atpx_handle; | 32 | acpi_handle atpx_handle; |
33 | acpi_handle atrm_handle; | ||
34 | } radeon_atpx_priv; | 33 | } radeon_atpx_priv; |
35 | 34 | ||
36 | /* retrieve the ROM in 4k blocks */ | ||
37 | static int radeon_atrm_call(acpi_handle atrm_handle, uint8_t *bios, | ||
38 | int offset, int len) | ||
39 | { | ||
40 | acpi_status status; | ||
41 | union acpi_object atrm_arg_elements[2], *obj; | ||
42 | struct acpi_object_list atrm_arg; | ||
43 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL}; | ||
44 | |||
45 | atrm_arg.count = 2; | ||
46 | atrm_arg.pointer = &atrm_arg_elements[0]; | ||
47 | |||
48 | atrm_arg_elements[0].type = ACPI_TYPE_INTEGER; | ||
49 | atrm_arg_elements[0].integer.value = offset; | ||
50 | |||
51 | atrm_arg_elements[1].type = ACPI_TYPE_INTEGER; | ||
52 | atrm_arg_elements[1].integer.value = len; | ||
53 | |||
54 | status = acpi_evaluate_object(atrm_handle, NULL, &atrm_arg, &buffer); | ||
55 | if (ACPI_FAILURE(status)) { | ||
56 | printk("failed to evaluate ATRM got %s\n", acpi_format_exception(status)); | ||
57 | return -ENODEV; | ||
58 | } | ||
59 | |||
60 | obj = (union acpi_object *)buffer.pointer; | ||
61 | memcpy(bios+offset, obj->buffer.pointer, obj->buffer.length); | ||
62 | len = obj->buffer.length; | ||
63 | kfree(buffer.pointer); | ||
64 | return len; | ||
65 | } | ||
66 | |||
67 | bool radeon_atrm_supported(struct pci_dev *pdev) | ||
68 | { | ||
69 | /* get the discrete ROM only via ATRM */ | ||
70 | if (!radeon_atpx_priv.atpx_detected) | ||
71 | return false; | ||
72 | |||
73 | if (radeon_atpx_priv.dhandle == DEVICE_ACPI_HANDLE(&pdev->dev)) | ||
74 | return false; | ||
75 | return true; | ||
76 | } | ||
77 | |||
78 | |||
79 | int radeon_atrm_get_bios_chunk(uint8_t *bios, int offset, int len) | ||
80 | { | ||
81 | return radeon_atrm_call(radeon_atpx_priv.atrm_handle, bios, offset, len); | ||
82 | } | ||
83 | |||
84 | static int radeon_atpx_get_version(acpi_handle handle) | 35 | static int radeon_atpx_get_version(acpi_handle handle) |
85 | { | 36 | { |
86 | acpi_status status; | 37 | acpi_status status; |
@@ -198,7 +149,7 @@ static int radeon_atpx_power_state(enum vga_switcheroo_client_id id, | |||
198 | 149 | ||
199 | static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) | 150 | static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) |
200 | { | 151 | { |
201 | acpi_handle dhandle, atpx_handle, atrm_handle; | 152 | acpi_handle dhandle, atpx_handle; |
202 | acpi_status status; | 153 | acpi_status status; |
203 | 154 | ||
204 | dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); | 155 | dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); |
@@ -209,13 +160,8 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) | |||
209 | if (ACPI_FAILURE(status)) | 160 | if (ACPI_FAILURE(status)) |
210 | return false; | 161 | return false; |
211 | 162 | ||
212 | status = acpi_get_handle(dhandle, "ATRM", &atrm_handle); | ||
213 | if (ACPI_FAILURE(status)) | ||
214 | return false; | ||
215 | |||
216 | radeon_atpx_priv.dhandle = dhandle; | 163 | radeon_atpx_priv.dhandle = dhandle; |
217 | radeon_atpx_priv.atpx_handle = atpx_handle; | 164 | radeon_atpx_priv.atpx_handle = atpx_handle; |
218 | radeon_atpx_priv.atrm_handle = atrm_handle; | ||
219 | return true; | 165 | return true; |
220 | } | 166 | } |
221 | 167 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c index 501f4881e5aa..d306cc8fdeaa 100644 --- a/drivers/gpu/drm/radeon/radeon_bios.c +++ b/drivers/gpu/drm/radeon/radeon_bios.c | |||
@@ -32,6 +32,7 @@ | |||
32 | 32 | ||
33 | #include <linux/vga_switcheroo.h> | 33 | #include <linux/vga_switcheroo.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/acpi.h> | ||
35 | /* | 36 | /* |
36 | * BIOS. | 37 | * BIOS. |
37 | */ | 38 | */ |
@@ -98,16 +99,81 @@ static bool radeon_read_bios(struct radeon_device *rdev) | |||
98 | return true; | 99 | return true; |
99 | } | 100 | } |
100 | 101 | ||
102 | #ifdef CONFIG_ACPI | ||
101 | /* ATRM is used to get the BIOS on the discrete cards in | 103 | /* ATRM is used to get the BIOS on the discrete cards in |
102 | * dual-gpu systems. | 104 | * dual-gpu systems. |
103 | */ | 105 | */ |
106 | /* retrieve the ROM in 4k blocks */ | ||
107 | #define ATRM_BIOS_PAGE 4096 | ||
108 | /** | ||
109 | * radeon_atrm_call - fetch a chunk of the vbios | ||
110 | * | ||
111 | * @atrm_handle: acpi ATRM handle | ||
112 | * @bios: vbios image pointer | ||
113 | * @offset: offset of vbios image data to fetch | ||
114 | * @len: length of vbios image data to fetch | ||
115 | * | ||
116 | * Executes ATRM to fetch a chunk of the discrete | ||
117 | * vbios image on PX systems (all asics). | ||
118 | * Returns the length of the buffer fetched. | ||
119 | */ | ||
120 | static int radeon_atrm_call(acpi_handle atrm_handle, uint8_t *bios, | ||
121 | int offset, int len) | ||
122 | { | ||
123 | acpi_status status; | ||
124 | union acpi_object atrm_arg_elements[2], *obj; | ||
125 | struct acpi_object_list atrm_arg; | ||
126 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL}; | ||
127 | |||
128 | atrm_arg.count = 2; | ||
129 | atrm_arg.pointer = &atrm_arg_elements[0]; | ||
130 | |||
131 | atrm_arg_elements[0].type = ACPI_TYPE_INTEGER; | ||
132 | atrm_arg_elements[0].integer.value = offset; | ||
133 | |||
134 | atrm_arg_elements[1].type = ACPI_TYPE_INTEGER; | ||
135 | atrm_arg_elements[1].integer.value = len; | ||
136 | |||
137 | status = acpi_evaluate_object(atrm_handle, NULL, &atrm_arg, &buffer); | ||
138 | if (ACPI_FAILURE(status)) { | ||
139 | printk("failed to evaluate ATRM got %s\n", acpi_format_exception(status)); | ||
140 | return -ENODEV; | ||
141 | } | ||
142 | |||
143 | obj = (union acpi_object *)buffer.pointer; | ||
144 | memcpy(bios+offset, obj->buffer.pointer, obj->buffer.length); | ||
145 | len = obj->buffer.length; | ||
146 | kfree(buffer.pointer); | ||
147 | return len; | ||
148 | } | ||
149 | |||
104 | static bool radeon_atrm_get_bios(struct radeon_device *rdev) | 150 | static bool radeon_atrm_get_bios(struct radeon_device *rdev) |
105 | { | 151 | { |
106 | int ret; | 152 | int ret; |
107 | int size = 256 * 1024; | 153 | int size = 256 * 1024; |
108 | int i; | 154 | int i; |
155 | struct pci_dev *pdev = NULL; | ||
156 | acpi_handle dhandle, atrm_handle; | ||
157 | acpi_status status; | ||
158 | bool found = false; | ||
159 | |||
160 | /* ATRM is for the discrete card only */ | ||
161 | if (rdev->flags & RADEON_IS_IGP) | ||
162 | return false; | ||
163 | |||
164 | while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) { | ||
165 | dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); | ||
166 | if (!dhandle) | ||
167 | continue; | ||
168 | |||
169 | status = acpi_get_handle(dhandle, "ATRM", &atrm_handle); | ||
170 | if (!ACPI_FAILURE(status)) { | ||
171 | found = true; | ||
172 | break; | ||
173 | } | ||
174 | } | ||
109 | 175 | ||
110 | if (!radeon_atrm_supported(rdev->pdev)) | 176 | if (!found) |
111 | return false; | 177 | return false; |
112 | 178 | ||
113 | rdev->bios = kmalloc(size, GFP_KERNEL); | 179 | rdev->bios = kmalloc(size, GFP_KERNEL); |
@@ -117,9 +183,10 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev) | |||
117 | } | 183 | } |
118 | 184 | ||
119 | for (i = 0; i < size / ATRM_BIOS_PAGE; i++) { | 185 | for (i = 0; i < size / ATRM_BIOS_PAGE; i++) { |
120 | ret = radeon_atrm_get_bios_chunk(rdev->bios, | 186 | ret = radeon_atrm_call(atrm_handle, |
121 | (i * ATRM_BIOS_PAGE), | 187 | rdev->bios, |
122 | ATRM_BIOS_PAGE); | 188 | (i * ATRM_BIOS_PAGE), |
189 | ATRM_BIOS_PAGE); | ||
123 | if (ret < ATRM_BIOS_PAGE) | 190 | if (ret < ATRM_BIOS_PAGE) |
124 | break; | 191 | break; |
125 | } | 192 | } |
@@ -130,6 +197,12 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev) | |||
130 | } | 197 | } |
131 | return true; | 198 | return true; |
132 | } | 199 | } |
200 | #else | ||
201 | static inline bool radeon_atrm_get_bios(struct radeon_device *rdev) | ||
202 | { | ||
203 | return false; | ||
204 | } | ||
205 | #endif | ||
133 | 206 | ||
134 | static bool ni_read_disabled_bios(struct radeon_device *rdev) | 207 | static bool ni_read_disabled_bios(struct radeon_device *rdev) |
135 | { | 208 | { |
@@ -476,6 +549,61 @@ static bool radeon_read_disabled_bios(struct radeon_device *rdev) | |||
476 | return legacy_read_disabled_bios(rdev); | 549 | return legacy_read_disabled_bios(rdev); |
477 | } | 550 | } |
478 | 551 | ||
552 | #ifdef CONFIG_ACPI | ||
553 | static bool radeon_acpi_vfct_bios(struct radeon_device *rdev) | ||
554 | { | ||
555 | bool ret = false; | ||
556 | struct acpi_table_header *hdr; | ||
557 | acpi_size tbl_size; | ||
558 | UEFI_ACPI_VFCT *vfct; | ||
559 | GOP_VBIOS_CONTENT *vbios; | ||
560 | VFCT_IMAGE_HEADER *vhdr; | ||
561 | |||
562 | if (!ACPI_SUCCESS(acpi_get_table_with_size("VFCT", 1, &hdr, &tbl_size))) | ||
563 | return false; | ||
564 | if (tbl_size < sizeof(UEFI_ACPI_VFCT)) { | ||
565 | DRM_ERROR("ACPI VFCT table present but broken (too short #1)\n"); | ||
566 | goto out_unmap; | ||
567 | } | ||
568 | |||
569 | vfct = (UEFI_ACPI_VFCT *)hdr; | ||
570 | if (vfct->VBIOSImageOffset + sizeof(VFCT_IMAGE_HEADER) > tbl_size) { | ||
571 | DRM_ERROR("ACPI VFCT table present but broken (too short #2)\n"); | ||
572 | goto out_unmap; | ||
573 | } | ||
574 | |||
575 | vbios = (GOP_VBIOS_CONTENT *)((char *)hdr + vfct->VBIOSImageOffset); | ||
576 | vhdr = &vbios->VbiosHeader; | ||
577 | DRM_INFO("ACPI VFCT contains a BIOS for %02x:%02x.%d %04x:%04x, size %d\n", | ||
578 | vhdr->PCIBus, vhdr->PCIDevice, vhdr->PCIFunction, | ||
579 | vhdr->VendorID, vhdr->DeviceID, vhdr->ImageLength); | ||
580 | |||
581 | if (vhdr->PCIBus != rdev->pdev->bus->number || | ||
582 | vhdr->PCIDevice != PCI_SLOT(rdev->pdev->devfn) || | ||
583 | vhdr->PCIFunction != PCI_FUNC(rdev->pdev->devfn) || | ||
584 | vhdr->VendorID != rdev->pdev->vendor || | ||
585 | vhdr->DeviceID != rdev->pdev->device) { | ||
586 | DRM_INFO("ACPI VFCT table is not for this card\n"); | ||
587 | goto out_unmap; | ||
588 | }; | ||
589 | |||
590 | if (vfct->VBIOSImageOffset + sizeof(VFCT_IMAGE_HEADER) + vhdr->ImageLength > tbl_size) { | ||
591 | DRM_ERROR("ACPI VFCT image truncated\n"); | ||
592 | goto out_unmap; | ||
593 | } | ||
594 | |||
595 | rdev->bios = kmemdup(&vbios->VbiosContent, vhdr->ImageLength, GFP_KERNEL); | ||
596 | ret = !!rdev->bios; | ||
597 | |||
598 | out_unmap: | ||
599 | return ret; | ||
600 | } | ||
601 | #else | ||
602 | static inline bool radeon_acpi_vfct_bios(struct radeon_device *rdev) | ||
603 | { | ||
604 | return false; | ||
605 | } | ||
606 | #endif | ||
479 | 607 | ||
480 | bool radeon_get_bios(struct radeon_device *rdev) | 608 | bool radeon_get_bios(struct radeon_device *rdev) |
481 | { | 609 | { |
@@ -484,6 +612,8 @@ bool radeon_get_bios(struct radeon_device *rdev) | |||
484 | 612 | ||
485 | r = radeon_atrm_get_bios(rdev); | 613 | r = radeon_atrm_get_bios(rdev); |
486 | if (r == false) | 614 | if (r == false) |
615 | r = radeon_acpi_vfct_bios(rdev); | ||
616 | if (r == false) | ||
487 | r = igp_read_bios_from_vram(rdev); | 617 | r = igp_read_bios_from_vram(rdev); |
488 | if (r == false) | 618 | if (r == false) |
489 | r = radeon_read_bios(rdev); | 619 | r = radeon_read_bios(rdev); |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index d2e243867ac6..7a3daebd732d 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -1051,7 +1051,7 @@ int radeon_device_init(struct radeon_device *rdev, | |||
1051 | if (rdev->flags & RADEON_IS_AGP) | 1051 | if (rdev->flags & RADEON_IS_AGP) |
1052 | rdev->need_dma32 = true; | 1052 | rdev->need_dma32 = true; |
1053 | if ((rdev->flags & RADEON_IS_PCI) && | 1053 | if ((rdev->flags & RADEON_IS_PCI) && |
1054 | (rdev->family < CHIP_RS400)) | 1054 | (rdev->family <= CHIP_RS740)) |
1055 | rdev->need_dma32 = true; | 1055 | rdev->need_dma32 = true; |
1056 | 1056 | ||
1057 | dma_bits = rdev->need_dma32 ? 32 : 40; | 1057 | dma_bits = rdev->need_dma32 ? 32 : 40; |
@@ -1346,12 +1346,15 @@ retry: | |||
1346 | for (i = 0; i < RADEON_NUM_RINGS; ++i) { | 1346 | for (i = 0; i < RADEON_NUM_RINGS; ++i) { |
1347 | radeon_ring_restore(rdev, &rdev->ring[i], | 1347 | radeon_ring_restore(rdev, &rdev->ring[i], |
1348 | ring_sizes[i], ring_data[i]); | 1348 | ring_sizes[i], ring_data[i]); |
1349 | ring_sizes[i] = 0; | ||
1350 | ring_data[i] = NULL; | ||
1349 | } | 1351 | } |
1350 | 1352 | ||
1351 | r = radeon_ib_ring_tests(rdev); | 1353 | r = radeon_ib_ring_tests(rdev); |
1352 | if (r) { | 1354 | if (r) { |
1353 | dev_err(rdev->dev, "ib ring test failed (%d).\n", r); | 1355 | dev_err(rdev->dev, "ib ring test failed (%d).\n", r); |
1354 | if (saved) { | 1356 | if (saved) { |
1357 | saved = false; | ||
1355 | radeon_suspend(rdev); | 1358 | radeon_suspend(rdev); |
1356 | goto retry; | 1359 | goto retry; |
1357 | } | 1360 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index d7269f48d37c..8c593ea82c41 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -62,9 +62,11 @@ | |||
62 | * 2.18.0 - r600-eg: allow "invalid" DB formats | 62 | * 2.18.0 - r600-eg: allow "invalid" DB formats |
63 | * 2.19.0 - r600-eg: MSAA textures | 63 | * 2.19.0 - r600-eg: MSAA textures |
64 | * 2.20.0 - r600-si: RADEON_INFO_TIMESTAMP query | 64 | * 2.20.0 - r600-si: RADEON_INFO_TIMESTAMP query |
65 | * 2.21.0 - r600-r700: FMASK and CMASK | ||
66 | * 2.22.0 - r600 only: RESOLVE_BOX allowed | ||
65 | */ | 67 | */ |
66 | #define KMS_DRIVER_MAJOR 2 | 68 | #define KMS_DRIVER_MAJOR 2 |
67 | #define KMS_DRIVER_MINOR 20 | 69 | #define KMS_DRIVER_MINOR 22 |
68 | #define KMS_DRIVER_PATCHLEVEL 0 | 70 | #define KMS_DRIVER_PATCHLEVEL 0 |
69 | int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); | 71 | int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); |
70 | int radeon_driver_unload_kms(struct drm_device *dev); | 72 | int radeon_driver_unload_kms(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 1cb014b571ab..9024e7222839 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -132,6 +132,7 @@ int radeon_bo_create(struct radeon_device *rdev, | |||
132 | acc_size = ttm_bo_dma_acc_size(&rdev->mman.bdev, size, | 132 | acc_size = ttm_bo_dma_acc_size(&rdev->mman.bdev, size, |
133 | sizeof(struct radeon_bo)); | 133 | sizeof(struct radeon_bo)); |
134 | 134 | ||
135 | retry: | ||
135 | bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL); | 136 | bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL); |
136 | if (bo == NULL) | 137 | if (bo == NULL) |
137 | return -ENOMEM; | 138 | return -ENOMEM; |
@@ -145,8 +146,6 @@ int radeon_bo_create(struct radeon_device *rdev, | |||
145 | bo->surface_reg = -1; | 146 | bo->surface_reg = -1; |
146 | INIT_LIST_HEAD(&bo->list); | 147 | INIT_LIST_HEAD(&bo->list); |
147 | INIT_LIST_HEAD(&bo->va); | 148 | INIT_LIST_HEAD(&bo->va); |
148 | |||
149 | retry: | ||
150 | radeon_ttm_placement_from_domain(bo, domain); | 149 | radeon_ttm_placement_from_domain(bo, domain); |
151 | /* Kernel allocation are uninterruptible */ | 150 | /* Kernel allocation are uninterruptible */ |
152 | down_read(&rdev->pm.mclk_lock); | 151 | down_read(&rdev->pm.mclk_lock); |
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index ec79b3750430..43c431a2686d 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c | |||
@@ -706,6 +706,7 @@ int radeon_ring_init(struct radeon_device *rdev, struct radeon_ring *ring, unsig | |||
706 | if (radeon_debugfs_ring_init(rdev, ring)) { | 706 | if (radeon_debugfs_ring_init(rdev, ring)) { |
707 | DRM_ERROR("Failed to register debugfs file for rings !\n"); | 707 | DRM_ERROR("Failed to register debugfs file for rings !\n"); |
708 | } | 708 | } |
709 | radeon_ring_lockup_update(ring); | ||
709 | return 0; | 710 | return 0; |
710 | } | 711 | } |
711 | 712 | ||
diff --git a/drivers/gpu/drm/radeon/reg_srcs/r600 b/drivers/gpu/drm/radeon/reg_srcs/r600 index 5e659b034d9a..20bfbda7b3f1 100644 --- a/drivers/gpu/drm/radeon/reg_srcs/r600 +++ b/drivers/gpu/drm/radeon/reg_srcs/r600 | |||
@@ -744,15 +744,6 @@ r600 0x9400 | |||
744 | 0x00028C38 CB_CLRCMP_DST | 744 | 0x00028C38 CB_CLRCMP_DST |
745 | 0x00028C3C CB_CLRCMP_MSK | 745 | 0x00028C3C CB_CLRCMP_MSK |
746 | 0x00028C34 CB_CLRCMP_SRC | 746 | 0x00028C34 CB_CLRCMP_SRC |
747 | 0x00028100 CB_COLOR0_MASK | ||
748 | 0x00028104 CB_COLOR1_MASK | ||
749 | 0x00028108 CB_COLOR2_MASK | ||
750 | 0x0002810C CB_COLOR3_MASK | ||
751 | 0x00028110 CB_COLOR4_MASK | ||
752 | 0x00028114 CB_COLOR5_MASK | ||
753 | 0x00028118 CB_COLOR6_MASK | ||
754 | 0x0002811C CB_COLOR7_MASK | ||
755 | 0x00028808 CB_COLOR_CONTROL | ||
756 | 0x0002842C CB_FOG_BLUE | 747 | 0x0002842C CB_FOG_BLUE |
757 | 0x00028428 CB_FOG_GREEN | 748 | 0x00028428 CB_FOG_GREEN |
758 | 0x00028424 CB_FOG_RED | 749 | 0x00028424 CB_FOG_RED |
diff --git a/drivers/gpu/drm/udl/Kconfig b/drivers/gpu/drm/udl/Kconfig index 0b5e096d39a6..56e0bf31d425 100644 --- a/drivers/gpu/drm/udl/Kconfig +++ b/drivers/gpu/drm/udl/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config DRM_UDL | 1 | config DRM_UDL |
2 | tristate "DisplayLink" | 2 | tristate "DisplayLink" |
3 | depends on DRM && EXPERIMENTAL | 3 | depends on DRM && EXPERIMENTAL |
4 | depends on USB_ARCH_HAS_HCD | ||
4 | select DRM_USB | 5 | select DRM_USB |
5 | select FB_SYS_FILLRECT | 6 | select FB_SYS_FILLRECT |
6 | select FB_SYS_COPYAREA | 7 | select FB_SYS_COPYAREA |
diff --git a/drivers/gpu/drm/udl/udl_modeset.c b/drivers/gpu/drm/udl/udl_modeset.c index f5dd89e891de..9159d48d1dfd 100644 --- a/drivers/gpu/drm/udl/udl_modeset.c +++ b/drivers/gpu/drm/udl/udl_modeset.c | |||
@@ -354,8 +354,7 @@ static int udl_crtc_mode_set(struct drm_crtc *crtc, | |||
354 | 354 | ||
355 | static void udl_crtc_disable(struct drm_crtc *crtc) | 355 | static void udl_crtc_disable(struct drm_crtc *crtc) |
356 | { | 356 | { |
357 | 357 | udl_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); | |
358 | |||
359 | } | 358 | } |
360 | 359 | ||
361 | static void udl_crtc_destroy(struct drm_crtc *crtc) | 360 | static void udl_crtc_destroy(struct drm_crtc *crtc) |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index 6b0078ffa763..c50724bd30f6 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
@@ -1688,15 +1688,19 @@ int vmw_du_page_flip(struct drm_crtc *crtc, | |||
1688 | struct vmw_private *dev_priv = vmw_priv(crtc->dev); | 1688 | struct vmw_private *dev_priv = vmw_priv(crtc->dev); |
1689 | struct drm_framebuffer *old_fb = crtc->fb; | 1689 | struct drm_framebuffer *old_fb = crtc->fb; |
1690 | struct vmw_framebuffer *vfb = vmw_framebuffer_to_vfb(fb); | 1690 | struct vmw_framebuffer *vfb = vmw_framebuffer_to_vfb(fb); |
1691 | struct drm_file *file_priv = event->base.file_priv; | 1691 | struct drm_file *file_priv ; |
1692 | struct vmw_fence_obj *fence = NULL; | 1692 | struct vmw_fence_obj *fence = NULL; |
1693 | struct drm_clip_rect clips; | 1693 | struct drm_clip_rect clips; |
1694 | int ret; | 1694 | int ret; |
1695 | 1695 | ||
1696 | if (event == NULL) | ||
1697 | return -EINVAL; | ||
1698 | |||
1696 | /* require ScreenObject support for page flipping */ | 1699 | /* require ScreenObject support for page flipping */ |
1697 | if (!dev_priv->sou_priv) | 1700 | if (!dev_priv->sou_priv) |
1698 | return -ENOSYS; | 1701 | return -ENOSYS; |
1699 | 1702 | ||
1703 | file_priv = event->base.file_priv; | ||
1700 | if (!vmw_kms_screen_object_flippable(dev_priv, crtc)) | 1704 | if (!vmw_kms_screen_object_flippable(dev_priv, crtc)) |
1701 | return -EINVAL; | 1705 | return -EINVAL; |
1702 | 1706 | ||
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c index 5b3c7d135dc9..e25cf31faab2 100644 --- a/drivers/gpu/vga/vga_switcheroo.c +++ b/drivers/gpu/vga/vga_switcheroo.c | |||
@@ -70,27 +70,12 @@ static struct vgasr_priv vgasr_priv = { | |||
70 | .clients = LIST_HEAD_INIT(vgasr_priv.clients), | 70 | .clients = LIST_HEAD_INIT(vgasr_priv.clients), |
71 | }; | 71 | }; |
72 | 72 | ||
73 | int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) | 73 | static bool vga_switcheroo_ready(void) |
74 | { | ||
75 | mutex_lock(&vgasr_mutex); | ||
76 | if (vgasr_priv.handler) { | ||
77 | mutex_unlock(&vgasr_mutex); | ||
78 | return -EINVAL; | ||
79 | } | ||
80 | |||
81 | vgasr_priv.handler = handler; | ||
82 | mutex_unlock(&vgasr_mutex); | ||
83 | return 0; | ||
84 | } | ||
85 | EXPORT_SYMBOL(vga_switcheroo_register_handler); | ||
86 | |||
87 | void vga_switcheroo_unregister_handler(void) | ||
88 | { | 74 | { |
89 | mutex_lock(&vgasr_mutex); | 75 | /* we're ready if we get two clients + handler */ |
90 | vgasr_priv.handler = NULL; | 76 | return !vgasr_priv.active && |
91 | mutex_unlock(&vgasr_mutex); | 77 | vgasr_priv.registered_clients == 2 && vgasr_priv.handler; |
92 | } | 78 | } |
93 | EXPORT_SYMBOL(vga_switcheroo_unregister_handler); | ||
94 | 79 | ||
95 | static void vga_switcheroo_enable(void) | 80 | static void vga_switcheroo_enable(void) |
96 | { | 81 | { |
@@ -98,7 +83,8 @@ static void vga_switcheroo_enable(void) | |||
98 | struct vga_switcheroo_client *client; | 83 | struct vga_switcheroo_client *client; |
99 | 84 | ||
100 | /* call the handler to init */ | 85 | /* call the handler to init */ |
101 | vgasr_priv.handler->init(); | 86 | if (vgasr_priv.handler->init) |
87 | vgasr_priv.handler->init(); | ||
102 | 88 | ||
103 | list_for_each_entry(client, &vgasr_priv.clients, list) { | 89 | list_for_each_entry(client, &vgasr_priv.clients, list) { |
104 | if (client->id != -1) | 90 | if (client->id != -1) |
@@ -113,6 +99,37 @@ static void vga_switcheroo_enable(void) | |||
113 | vgasr_priv.active = true; | 99 | vgasr_priv.active = true; |
114 | } | 100 | } |
115 | 101 | ||
102 | int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) | ||
103 | { | ||
104 | mutex_lock(&vgasr_mutex); | ||
105 | if (vgasr_priv.handler) { | ||
106 | mutex_unlock(&vgasr_mutex); | ||
107 | return -EINVAL; | ||
108 | } | ||
109 | |||
110 | vgasr_priv.handler = handler; | ||
111 | if (vga_switcheroo_ready()) { | ||
112 | printk(KERN_INFO "vga_switcheroo: enabled\n"); | ||
113 | vga_switcheroo_enable(); | ||
114 | } | ||
115 | mutex_unlock(&vgasr_mutex); | ||
116 | return 0; | ||
117 | } | ||
118 | EXPORT_SYMBOL(vga_switcheroo_register_handler); | ||
119 | |||
120 | void vga_switcheroo_unregister_handler(void) | ||
121 | { | ||
122 | mutex_lock(&vgasr_mutex); | ||
123 | vgasr_priv.handler = NULL; | ||
124 | if (vgasr_priv.active) { | ||
125 | pr_info("vga_switcheroo: disabled\n"); | ||
126 | vga_switcheroo_debugfs_fini(&vgasr_priv); | ||
127 | vgasr_priv.active = false; | ||
128 | } | ||
129 | mutex_unlock(&vgasr_mutex); | ||
130 | } | ||
131 | EXPORT_SYMBOL(vga_switcheroo_unregister_handler); | ||
132 | |||
116 | static int register_client(struct pci_dev *pdev, | 133 | static int register_client(struct pci_dev *pdev, |
117 | const struct vga_switcheroo_client_ops *ops, | 134 | const struct vga_switcheroo_client_ops *ops, |
118 | int id, bool active) | 135 | int id, bool active) |
@@ -134,9 +151,7 @@ static int register_client(struct pci_dev *pdev, | |||
134 | if (client_is_vga(client)) | 151 | if (client_is_vga(client)) |
135 | vgasr_priv.registered_clients++; | 152 | vgasr_priv.registered_clients++; |
136 | 153 | ||
137 | /* if we get two clients + handler */ | 154 | if (vga_switcheroo_ready()) { |
138 | if (!vgasr_priv.active && | ||
139 | vgasr_priv.registered_clients == 2 && vgasr_priv.handler) { | ||
140 | printk(KERN_INFO "vga_switcheroo: enabled\n"); | 155 | printk(KERN_INFO "vga_switcheroo: enabled\n"); |
141 | vga_switcheroo_enable(); | 156 | vga_switcheroo_enable(); |
142 | } | 157 | } |