Skip to content

Commit 52b820d

Browse files
committed
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Pull intel DRM fixes from Dave Airlie: "Just intel fixes, including getting the Ironlake systems back to the state they were in for 3.6." * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: drm/i915: Revert shrinker changes from "Track unbound pages" drm/i915: Use pixel size for computing linear offsets into a sprite drm/i915: Add DEBUG messages to all intel_create_user_framebuffer error paths drm/i915: The sprite scaler on Ironlake also support YUV planes drm: Only evict the blocks required to create the requested hole drm/i915: Treat crtc->mode.clock == 0 as disabled Revert "drm/i915: no lvds quirk for Zotac ZDBOX SD ID12/ID13" drm/i915; Only increment the user-pin-count after successfully pinning the bo
2 parents 47ecfcb + 82ba789 commit 52b820d

File tree

7 files changed

+81
-67
lines changed

7 files changed

+81
-67
lines changed

drivers/gpu/drm/drm_mm.c

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,13 @@ static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node,
221221

222222
BUG_ON(!hole_node->hole_follows || node->allocated);
223223

224-
if (mm->color_adjust)
225-
mm->color_adjust(hole_node, color, &adj_start, &adj_end);
226-
227224
if (adj_start < start)
228225
adj_start = start;
226+
if (adj_end > end)
227+
adj_end = end;
228+
229+
if (mm->color_adjust)
230+
mm->color_adjust(hole_node, color, &adj_start, &adj_end);
229231

230232
if (alignment) {
231233
unsigned tmp = adj_start % alignment;
@@ -506,7 +508,7 @@ void drm_mm_init_scan(struct drm_mm *mm,
506508
mm->scan_size = size;
507509
mm->scanned_blocks = 0;
508510
mm->scan_hit_start = 0;
509-
mm->scan_hit_size = 0;
511+
mm->scan_hit_end = 0;
510512
mm->scan_check_range = 0;
511513
mm->prev_scanned_node = NULL;
512514
}
@@ -533,7 +535,7 @@ void drm_mm_init_scan_with_range(struct drm_mm *mm,
533535
mm->scan_size = size;
534536
mm->scanned_blocks = 0;
535537
mm->scan_hit_start = 0;
536-
mm->scan_hit_size = 0;
538+
mm->scan_hit_end = 0;
537539
mm->scan_start = start;
538540
mm->scan_end = end;
539541
mm->scan_check_range = 1;
@@ -552,8 +554,7 @@ int drm_mm_scan_add_block(struct drm_mm_node *node)
552554
struct drm_mm *mm = node->mm;
553555
struct drm_mm_node *prev_node;
554556
unsigned long hole_start, hole_end;
555-
unsigned long adj_start;
556-
unsigned long adj_end;
557+
unsigned long adj_start, adj_end;
557558

558559
mm->scanned_blocks++;
559560

@@ -570,14 +571,8 @@ int drm_mm_scan_add_block(struct drm_mm_node *node)
570571
node->node_list.next = &mm->prev_scanned_node->node_list;
571572
mm->prev_scanned_node = node;
572573

573-
hole_start = drm_mm_hole_node_start(prev_node);
574-
hole_end = drm_mm_hole_node_end(prev_node);
575-
576-
adj_start = hole_start;
577-
adj_end = hole_end;
578-
579-
if (mm->color_adjust)
580-
mm->color_adjust(prev_node, mm->scan_color, &adj_start, &adj_end);
574+
adj_start = hole_start = drm_mm_hole_node_start(prev_node);
575+
adj_end = hole_end = drm_mm_hole_node_end(prev_node);
581576

582577
if (mm->scan_check_range) {
583578
if (adj_start < mm->scan_start)
@@ -586,11 +581,14 @@ int drm_mm_scan_add_block(struct drm_mm_node *node)
586581
adj_end = mm->scan_end;
587582
}
588583

584+
if (mm->color_adjust)
585+
mm->color_adjust(prev_node, mm->scan_color,
586+
&adj_start, &adj_end);
587+
589588
if (check_free_hole(adj_start, adj_end,
590589
mm->scan_size, mm->scan_alignment)) {
591590
mm->scan_hit_start = hole_start;
592-
mm->scan_hit_size = hole_end;
593-
591+
mm->scan_hit_end = hole_end;
594592
return 1;
595593
}
596594

@@ -626,19 +624,10 @@ int drm_mm_scan_remove_block(struct drm_mm_node *node)
626624
node_list);
627625

628626
prev_node->hole_follows = node->scanned_preceeds_hole;
629-
INIT_LIST_HEAD(&node->node_list);
630627
list_add(&node->node_list, &prev_node->node_list);
631628

632-
/* Only need to check for containement because start&size for the
633-
* complete resulting free block (not just the desired part) is
634-
* stored. */
635-
if (node->start >= mm->scan_hit_start &&
636-
node->start + node->size
637-
<= mm->scan_hit_start + mm->scan_hit_size) {
638-
return 1;
639-
}
640-
641-
return 0;
629+
return (drm_mm_hole_node_end(node) > mm->scan_hit_start &&
630+
node->start < mm->scan_hit_end);
642631
}
643632
EXPORT_SYMBOL(drm_mm_scan_remove_block);
644633

drivers/gpu/drm/i915/i915_gem.c

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,15 +1717,16 @@ i915_gem_object_put_pages(struct drm_i915_gem_object *obj)
17171717
}
17181718

17191719
static long
1720-
i915_gem_purge(struct drm_i915_private *dev_priv, long target)
1720+
__i915_gem_shrink(struct drm_i915_private *dev_priv, long target,
1721+
bool purgeable_only)
17211722
{
17221723
struct drm_i915_gem_object *obj, *next;
17231724
long count = 0;
17241725

17251726
list_for_each_entry_safe(obj, next,
17261727
&dev_priv->mm.unbound_list,
17271728
gtt_list) {
1728-
if (i915_gem_object_is_purgeable(obj) &&
1729+
if ((i915_gem_object_is_purgeable(obj) || !purgeable_only) &&
17291730
i915_gem_object_put_pages(obj) == 0) {
17301731
count += obj->base.size >> PAGE_SHIFT;
17311732
if (count >= target)
@@ -1736,7 +1737,7 @@ i915_gem_purge(struct drm_i915_private *dev_priv, long target)
17361737
list_for_each_entry_safe(obj, next,
17371738
&dev_priv->mm.inactive_list,
17381739
mm_list) {
1739-
if (i915_gem_object_is_purgeable(obj) &&
1740+
if ((i915_gem_object_is_purgeable(obj) || !purgeable_only) &&
17401741
i915_gem_object_unbind(obj) == 0 &&
17411742
i915_gem_object_put_pages(obj) == 0) {
17421743
count += obj->base.size >> PAGE_SHIFT;
@@ -1748,6 +1749,12 @@ i915_gem_purge(struct drm_i915_private *dev_priv, long target)
17481749
return count;
17491750
}
17501751

1752+
static long
1753+
i915_gem_purge(struct drm_i915_private *dev_priv, long target)
1754+
{
1755+
return __i915_gem_shrink(dev_priv, target, true);
1756+
}
1757+
17511758
static void
17521759
i915_gem_shrink_all(struct drm_i915_private *dev_priv)
17531760
{
@@ -3522,14 +3529,15 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data,
35223529
goto out;
35233530
}
35243531

3525-
obj->user_pin_count++;
3526-
obj->pin_filp = file;
3527-
if (obj->user_pin_count == 1) {
3532+
if (obj->user_pin_count == 0) {
35283533
ret = i915_gem_object_pin(obj, args->alignment, true, false);
35293534
if (ret)
35303535
goto out;
35313536
}
35323537

3538+
obj->user_pin_count++;
3539+
obj->pin_filp = file;
3540+
35333541
/* XXX - flush the CPU caches for pinned objects
35343542
* as the X server doesn't manage domains yet
35353543
*/
@@ -4394,6 +4402,9 @@ i915_gem_inactive_shrink(struct shrinker *shrinker, struct shrink_control *sc)
43944402

43954403
if (nr_to_scan) {
43964404
nr_to_scan -= i915_gem_purge(dev_priv, nr_to_scan);
4405+
if (nr_to_scan > 0)
4406+
nr_to_scan -= __i915_gem_shrink(dev_priv, nr_to_scan,
4407+
false);
43974408
if (nr_to_scan > 0)
43984409
i915_gem_shrink_all(dev_priv);
43994410
}
@@ -4402,7 +4413,7 @@ i915_gem_inactive_shrink(struct shrinker *shrinker, struct shrink_control *sc)
44024413
list_for_each_entry(obj, &dev_priv->mm.unbound_list, gtt_list)
44034414
if (obj->pages_pin_count == 0)
44044415
cnt += obj->base.size >> PAGE_SHIFT;
4405-
list_for_each_entry(obj, &dev_priv->mm.bound_list, gtt_list)
4416+
list_for_each_entry(obj, &dev_priv->mm.inactive_list, gtt_list)
44064417
if (obj->pin_count == 0 && obj->pages_pin_count == 0)
44074418
cnt += obj->base.size >> PAGE_SHIFT;
44084419

drivers/gpu/drm/i915/intel_display.c

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8598,19 +8598,30 @@ int intel_framebuffer_init(struct drm_device *dev,
85988598
{
85998599
int ret;
86008600

8601-
if (obj->tiling_mode == I915_TILING_Y)
8601+
if (obj->tiling_mode == I915_TILING_Y) {
8602+
DRM_DEBUG("hardware does not support tiling Y\n");
86028603
return -EINVAL;
8604+
}
86038605

8604-
if (mode_cmd->pitches[0] & 63)
8606+
if (mode_cmd->pitches[0] & 63) {
8607+
DRM_DEBUG("pitch (%d) must be at least 64 byte aligned\n",
8608+
mode_cmd->pitches[0]);
86058609
return -EINVAL;
8610+
}
86068611

86078612
/* FIXME <= Gen4 stride limits are bit unclear */
8608-
if (mode_cmd->pitches[0] > 32768)
8613+
if (mode_cmd->pitches[0] > 32768) {
8614+
DRM_DEBUG("pitch (%d) must be at less than 32768\n",
8615+
mode_cmd->pitches[0]);
86098616
return -EINVAL;
8617+
}
86108618

86118619
if (obj->tiling_mode != I915_TILING_NONE &&
8612-
mode_cmd->pitches[0] != obj->stride)
8620+
mode_cmd->pitches[0] != obj->stride) {
8621+
DRM_DEBUG("pitch (%d) must match tiling stride (%d)\n",
8622+
mode_cmd->pitches[0], obj->stride);
86138623
return -EINVAL;
8624+
}
86148625

86158626
/* Reject formats not supported by any plane early. */
86168627
switch (mode_cmd->pixel_format) {
@@ -8621,27 +8632,33 @@ int intel_framebuffer_init(struct drm_device *dev,
86218632
break;
86228633
case DRM_FORMAT_XRGB1555:
86238634
case DRM_FORMAT_ARGB1555:
8624-
if (INTEL_INFO(dev)->gen > 3)
8635+
if (INTEL_INFO(dev)->gen > 3) {
8636+
DRM_DEBUG("invalid format: 0x%08x\n", mode_cmd->pixel_format);
86258637
return -EINVAL;
8638+
}
86268639
break;
86278640
case DRM_FORMAT_XBGR8888:
86288641
case DRM_FORMAT_ABGR8888:
86298642
case DRM_FORMAT_XRGB2101010:
86308643
case DRM_FORMAT_ARGB2101010:
86318644
case DRM_FORMAT_XBGR2101010:
86328645
case DRM_FORMAT_ABGR2101010:
8633-
if (INTEL_INFO(dev)->gen < 4)
8646+
if (INTEL_INFO(dev)->gen < 4) {
8647+
DRM_DEBUG("invalid format: 0x%08x\n", mode_cmd->pixel_format);
86348648
return -EINVAL;
8649+
}
86358650
break;
86368651
case DRM_FORMAT_YUYV:
86378652
case DRM_FORMAT_UYVY:
86388653
case DRM_FORMAT_YVYU:
86398654
case DRM_FORMAT_VYUY:
8640-
if (INTEL_INFO(dev)->gen < 6)
8655+
if (INTEL_INFO(dev)->gen < 5) {
8656+
DRM_DEBUG("invalid format: 0x%08x\n", mode_cmd->pixel_format);
86418657
return -EINVAL;
8658+
}
86428659
break;
86438660
default:
8644-
DRM_DEBUG_KMS("unsupported pixel format 0x%08x\n", mode_cmd->pixel_format);
8661+
DRM_DEBUG("unsupported pixel format 0x%08x\n", mode_cmd->pixel_format);
86458662
return -EINVAL;
86468663
}
86478664

drivers/gpu/drm/i915/intel_lvds.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -774,14 +774,6 @@ static const struct dmi_system_id intel_no_lvds[] = {
774774
DMI_MATCH(DMI_BOARD_NAME, "MS-7469"),
775775
},
776776
},
777-
{
778-
.callback = intel_no_lvds_dmi_callback,
779-
.ident = "ZOTAC ZBOXSD-ID12/ID13",
780-
.matches = {
781-
DMI_MATCH(DMI_BOARD_VENDOR, "ZOTAC"),
782-
DMI_MATCH(DMI_BOARD_NAME, "ZBOXSD-ID12/ID13"),
783-
},
784-
},
785777
{
786778
.callback = intel_no_lvds_dmi_callback,
787779
.ident = "Gigabyte GA-D525TUD",

drivers/gpu/drm/i915/intel_pm.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@
4444
* i915.i915_enable_fbc parameter
4545
*/
4646

47+
static bool intel_crtc_active(struct drm_crtc *crtc)
48+
{
49+
/* Be paranoid as we can arrive here with only partial
50+
* state retrieved from the hardware during setup.
51+
*/
52+
return to_intel_crtc(crtc)->active && crtc->fb && crtc->mode.clock;
53+
}
54+
4755
static void i8xx_disable_fbc(struct drm_device *dev)
4856
{
4957
struct drm_i915_private *dev_priv = dev->dev_private;
@@ -405,9 +413,8 @@ void intel_update_fbc(struct drm_device *dev)
405413
* - going to an unsupported config (interlace, pixel multiply, etc.)
406414
*/
407415
list_for_each_entry(tmp_crtc, &dev->mode_config.crtc_list, head) {
408-
if (to_intel_crtc(tmp_crtc)->active &&
409-
!to_intel_crtc(tmp_crtc)->primary_disabled &&
410-
tmp_crtc->fb) {
416+
if (intel_crtc_active(tmp_crtc) &&
417+
!to_intel_crtc(tmp_crtc)->primary_disabled) {
411418
if (crtc) {
412419
DRM_DEBUG_KMS("more than one pipe active, disabling compression\n");
413420
dev_priv->no_fbc_reason = FBC_MULTIPLE_PIPES;
@@ -992,7 +999,7 @@ static struct drm_crtc *single_enabled_crtc(struct drm_device *dev)
992999
struct drm_crtc *crtc, *enabled = NULL;
9931000

9941001
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
995-
if (to_intel_crtc(crtc)->active && crtc->fb) {
1002+
if (intel_crtc_active(crtc)) {
9961003
if (enabled)
9971004
return NULL;
9981005
enabled = crtc;
@@ -1086,7 +1093,7 @@ static bool g4x_compute_wm0(struct drm_device *dev,
10861093
int entries, tlb_miss;
10871094

10881095
crtc = intel_get_crtc_for_plane(dev, plane);
1089-
if (crtc->fb == NULL || !to_intel_crtc(crtc)->active) {
1096+
if (!intel_crtc_active(crtc)) {
10901097
*cursor_wm = cursor->guard_size;
10911098
*plane_wm = display->guard_size;
10921099
return false;
@@ -1215,7 +1222,7 @@ static bool vlv_compute_drain_latency(struct drm_device *dev,
12151222
int entries;
12161223

12171224
crtc = intel_get_crtc_for_plane(dev, plane);
1218-
if (crtc->fb == NULL || !to_intel_crtc(crtc)->active)
1225+
if (!intel_crtc_active(crtc))
12191226
return false;
12201227

12211228
clock = crtc->mode.clock; /* VESA DOT Clock */
@@ -1476,7 +1483,7 @@ static void i9xx_update_wm(struct drm_device *dev)
14761483

14771484
fifo_size = dev_priv->display.get_fifo_size(dev, 0);
14781485
crtc = intel_get_crtc_for_plane(dev, 0);
1479-
if (to_intel_crtc(crtc)->active && crtc->fb) {
1486+
if (intel_crtc_active(crtc)) {
14801487
int cpp = crtc->fb->bits_per_pixel / 8;
14811488
if (IS_GEN2(dev))
14821489
cpp = 4;
@@ -1490,7 +1497,7 @@ static void i9xx_update_wm(struct drm_device *dev)
14901497

14911498
fifo_size = dev_priv->display.get_fifo_size(dev, 1);
14921499
crtc = intel_get_crtc_for_plane(dev, 1);
1493-
if (to_intel_crtc(crtc)->active && crtc->fb) {
1500+
if (intel_crtc_active(crtc)) {
14941501
int cpp = crtc->fb->bits_per_pixel / 8;
14951502
if (IS_GEN2(dev))
14961503
cpp = 4;
@@ -2044,7 +2051,7 @@ sandybridge_compute_sprite_wm(struct drm_device *dev, int plane,
20442051
int entries, tlb_miss;
20452052

20462053
crtc = intel_get_crtc_for_plane(dev, plane);
2047-
if (crtc->fb == NULL || !to_intel_crtc(crtc)->active) {
2054+
if (!intel_crtc_active(crtc)) {
20482055
*sprite_wm = display->guard_size;
20492056
return false;
20502057
}

drivers/gpu/drm/i915/intel_sprite.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,10 @@ ivb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
120120
I915_WRITE(SPRSTRIDE(pipe), fb->pitches[0]);
121121
I915_WRITE(SPRPOS(pipe), (crtc_y << 16) | crtc_x);
122122

123-
linear_offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8);
123+
linear_offset = y * fb->pitches[0] + x * pixel_size;
124124
sprsurf_offset =
125125
intel_gen4_compute_offset_xtiled(&x, &y,
126-
fb->bits_per_pixel / 8,
127-
fb->pitches[0]);
126+
pixel_size, fb->pitches[0]);
128127
linear_offset -= sprsurf_offset;
129128

130129
/* HSW consolidates SPRTILEOFF and SPRLINOFF into a single SPROFFSET
@@ -286,11 +285,10 @@ ilk_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
286285
I915_WRITE(DVSSTRIDE(pipe), fb->pitches[0]);
287286
I915_WRITE(DVSPOS(pipe), (crtc_y << 16) | crtc_x);
288287

289-
linear_offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8);
288+
linear_offset = y * fb->pitches[0] + x * pixel_size;
290289
dvssurf_offset =
291290
intel_gen4_compute_offset_xtiled(&x, &y,
292-
fb->bits_per_pixel / 8,
293-
fb->pitches[0]);
291+
pixel_size, fb->pitches[0]);
294292
linear_offset -= dvssurf_offset;
295293

296294
if (obj->tiling_mode != I915_TILING_NONE)

include/drm/drm_mm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ struct drm_mm {
7070
unsigned long scan_color;
7171
unsigned long scan_size;
7272
unsigned long scan_hit_start;
73-
unsigned scan_hit_size;
73+
unsigned long scan_hit_end;
7474
unsigned scanned_blocks;
7575
unsigned long scan_start;
7676
unsigned long scan_end;

0 commit comments

Comments
 (0)