Skip to content

Commit 46fe37b

Browse files
committed
Merge tag 'drm-intel-next-queued-2020-11-27' of git://anongit.freedesktop.org/drm/drm-intel into drm-next
drm/i915 features for v5.11: Highlights: - Enable big joiner to join two pipes to one port to overcome pipe restrictions (Manasi, Ville, Maarten) Display: - More DG1 enabling (Lucas, Aditya) - Fixes to cases without display (Lucas, José, Jani) - Initial PSR state improvements (José) - JSL eDP vswing updates (Tejas) - Handle EDID declared max 16 bpc (Ville) - Display refactoring (Ville) Other: - GVT features - Backmerge Signed-off-by: Dave Airlie <airlied@redhat.com> From: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/87czzzkk1s.fsf@intel.com
2 parents 22f8c80 + b3bf99d commit 46fe37b

44 files changed

Lines changed: 2263 additions & 937 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/gpu/drm/i915/display/icl_dsi.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,11 +1492,10 @@ static void gen11_dsi_get_config(struct intel_encoder *encoder,
14921492
struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc);
14931493
struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
14941494

1495-
intel_dsc_get_config(encoder, pipe_config);
1496-
14971495
/* FIXME: adapt icl_ddi_clock_get() for DSI and use that? */
14981496
pipe_config->port_clock = intel_dpll_get_freq(i915,
1499-
pipe_config->shared_dpll);
1497+
pipe_config->shared_dpll,
1498+
&pipe_config->dpll_hw_state);
15001499

15011500
pipe_config->hw.adjusted_mode.crtc_clock = intel_dsi->pclk;
15021501
if (intel_dsi->dual_link)

‎drivers/gpu/drm/i915/display/intel_atomic.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
133133
struct drm_crtc_state *crtc_state;
134134

135135
intel_hdcp_atomic_check(conn, old_state, new_state);
136-
intel_psr_atomic_check(conn, old_state, new_state);
137136

138137
if (!new_state->crtc)
139138
return 0;
@@ -270,14 +269,15 @@ void intel_crtc_free_hw_state(struct intel_crtc_state *crtc_state)
270269
intel_crtc_put_color_blobs(crtc_state);
271270
}
272271

273-
void intel_crtc_copy_color_blobs(struct intel_crtc_state *crtc_state)
272+
void intel_crtc_copy_color_blobs(struct intel_crtc_state *crtc_state,
273+
const struct intel_crtc_state *from_crtc_state)
274274
{
275275
drm_property_replace_blob(&crtc_state->hw.degamma_lut,
276-
crtc_state->uapi.degamma_lut);
276+
from_crtc_state->uapi.degamma_lut);
277277
drm_property_replace_blob(&crtc_state->hw.gamma_lut,
278-
crtc_state->uapi.gamma_lut);
278+
from_crtc_state->uapi.gamma_lut);
279279
drm_property_replace_blob(&crtc_state->hw.ctm,
280-
crtc_state->uapi.ctm);
280+
from_crtc_state->uapi.ctm);
281281
}
282282

283283
/**

‎drivers/gpu/drm/i915/display/intel_atomic.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ struct drm_crtc_state *intel_crtc_duplicate_state(struct drm_crtc *crtc);
4343
void intel_crtc_destroy_state(struct drm_crtc *crtc,
4444
struct drm_crtc_state *state);
4545
void intel_crtc_free_hw_state(struct intel_crtc_state *crtc_state);
46-
void intel_crtc_copy_color_blobs(struct intel_crtc_state *crtc_state);
46+
void intel_crtc_copy_color_blobs(struct intel_crtc_state *crtc_state,
47+
const struct intel_crtc_state *from_crtc_state);
4748
struct drm_atomic_state *intel_atomic_state_alloc(struct drm_device *dev);
4849
void intel_atomic_state_free(struct drm_atomic_state *state);
4950
void intel_atomic_state_clear(struct drm_atomic_state *state);

‎drivers/gpu/drm/i915/display/intel_atomic_plane.c‎

Lines changed: 113 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,19 @@ static void intel_plane_clear_hw_state(struct intel_plane_state *plane_state)
247247
}
248248

249249
void intel_plane_copy_uapi_to_hw_state(struct intel_plane_state *plane_state,
250-
const struct intel_plane_state *from_plane_state)
250+
const struct intel_plane_state *from_plane_state,
251+
struct intel_crtc *crtc)
251252
{
252253
intel_plane_clear_hw_state(plane_state);
253254

254-
plane_state->hw.crtc = from_plane_state->uapi.crtc;
255+
/*
256+
* For the bigjoiner slave uapi.crtc will point at
257+
* the master crtc. So we explicitly assign the right
258+
* slave crtc to hw.crtc. uapi.crtc!=NULL simply indicates
259+
* the plane is logically enabled on the uapi level.
260+
*/
261+
plane_state->hw.crtc = from_plane_state->uapi.crtc ? &crtc->base : NULL;
262+
255263
plane_state->hw.fb = from_plane_state->uapi.fb;
256264
if (plane_state->hw.fb)
257265
drm_framebuffer_get(plane_state->hw.fb);
@@ -263,6 +271,21 @@ void intel_plane_copy_uapi_to_hw_state(struct intel_plane_state *plane_state,
263271
plane_state->hw.color_encoding = from_plane_state->uapi.color_encoding;
264272
plane_state->hw.color_range = from_plane_state->uapi.color_range;
265273
plane_state->hw.scaling_filter = from_plane_state->uapi.scaling_filter;
274+
275+
plane_state->uapi.src = drm_plane_state_src(&from_plane_state->uapi);
276+
plane_state->uapi.dst = drm_plane_state_dest(&from_plane_state->uapi);
277+
}
278+
279+
void intel_plane_copy_hw_state(struct intel_plane_state *plane_state,
280+
const struct intel_plane_state *from_plane_state)
281+
{
282+
intel_plane_clear_hw_state(plane_state);
283+
284+
memcpy(&plane_state->hw, &from_plane_state->hw,
285+
sizeof(plane_state->hw));
286+
287+
if (plane_state->hw.fb)
288+
drm_framebuffer_get(plane_state->hw.fb);
266289
}
267290

268291
void intel_plane_set_invisible(struct intel_crtc_state *crtc_state,
@@ -319,39 +342,54 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
319342
old_plane_state, new_plane_state);
320343
}
321344

322-
static struct intel_crtc *
323-
get_crtc_from_states(const struct intel_plane_state *old_plane_state,
324-
const struct intel_plane_state *new_plane_state)
345+
static struct intel_plane *
346+
intel_crtc_get_plane(struct intel_crtc *crtc, enum plane_id plane_id)
325347
{
326-
if (new_plane_state->uapi.crtc)
327-
return to_intel_crtc(new_plane_state->uapi.crtc);
348+
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
349+
struct intel_plane *plane;
328350

329-
if (old_plane_state->uapi.crtc)
330-
return to_intel_crtc(old_plane_state->uapi.crtc);
351+
for_each_intel_plane_on_crtc(&i915->drm, crtc, plane) {
352+
if (plane->id == plane_id)
353+
return plane;
354+
}
331355

332356
return NULL;
333357
}
334358

335359
int intel_plane_atomic_check(struct intel_atomic_state *state,
336360
struct intel_plane *plane)
337361
{
362+
struct drm_i915_private *i915 = to_i915(state->base.dev);
338363
struct intel_plane_state *new_plane_state =
339364
intel_atomic_get_new_plane_state(state, plane);
340365
const struct intel_plane_state *old_plane_state =
341366
intel_atomic_get_old_plane_state(state, plane);
342-
struct intel_crtc *crtc =
343-
get_crtc_from_states(old_plane_state, new_plane_state);
344-
const struct intel_crtc_state *old_crtc_state;
345-
struct intel_crtc_state *new_crtc_state;
367+
const struct intel_plane_state *new_master_plane_state;
368+
struct intel_crtc *crtc = intel_get_crtc_for_pipe(i915, plane->pipe);
369+
const struct intel_crtc_state *old_crtc_state =
370+
intel_atomic_get_old_crtc_state(state, crtc);
371+
struct intel_crtc_state *new_crtc_state =
372+
intel_atomic_get_new_crtc_state(state, crtc);
373+
374+
if (new_crtc_state && new_crtc_state->bigjoiner_slave) {
375+
struct intel_plane *master_plane =
376+
intel_crtc_get_plane(new_crtc_state->bigjoiner_linked_crtc,
377+
plane->id);
378+
379+
new_master_plane_state =
380+
intel_atomic_get_new_plane_state(state, master_plane);
381+
} else {
382+
new_master_plane_state = new_plane_state;
383+
}
384+
385+
intel_plane_copy_uapi_to_hw_state(new_plane_state,
386+
new_master_plane_state,
387+
crtc);
346388

347-
intel_plane_copy_uapi_to_hw_state(new_plane_state, new_plane_state);
348389
new_plane_state->uapi.visible = false;
349-
if (!crtc)
390+
if (!new_crtc_state)
350391
return 0;
351392

352-
old_crtc_state = intel_atomic_get_old_crtc_state(state, crtc);
353-
new_crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
354-
355393
return intel_plane_atomic_check_with_state(old_crtc_state,
356394
new_crtc_state,
357395
old_plane_state,
@@ -479,6 +517,63 @@ void i9xx_update_planes_on_crtc(struct intel_atomic_state *state,
479517
}
480518
}
481519

520+
int intel_atomic_plane_check_clipping(struct intel_plane_state *plane_state,
521+
struct intel_crtc_state *crtc_state,
522+
int min_scale, int max_scale,
523+
bool can_position)
524+
{
525+
struct drm_framebuffer *fb = plane_state->hw.fb;
526+
struct drm_rect *src = &plane_state->uapi.src;
527+
struct drm_rect *dst = &plane_state->uapi.dst;
528+
unsigned int rotation = plane_state->hw.rotation;
529+
struct drm_rect clip = {};
530+
int hscale, vscale;
531+
532+
if (!fb) {
533+
plane_state->uapi.visible = false;
534+
return 0;
535+
}
536+
537+
drm_rect_rotate(src, fb->width << 16, fb->height << 16, rotation);
538+
539+
/* Check scaling */
540+
hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale);
541+
vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale);
542+
if (hscale < 0 || vscale < 0) {
543+
DRM_DEBUG_KMS("Invalid scaling of plane\n");
544+
drm_rect_debug_print("src: ", src, true);
545+
drm_rect_debug_print("dst: ", dst, false);
546+
return -ERANGE;
547+
}
548+
549+
if (crtc_state->hw.enable) {
550+
clip.x2 = crtc_state->pipe_src_w;
551+
clip.y2 = crtc_state->pipe_src_h;
552+
}
553+
554+
/* right side of the image is on the slave crtc, adjust dst to match */
555+
if (crtc_state->bigjoiner_slave)
556+
drm_rect_translate(dst, -crtc_state->pipe_src_w, 0);
557+
558+
/*
559+
* FIXME: This might need further adjustment for seamless scaling
560+
* with phase information, for the 2p2 and 2p1 scenarios.
561+
*/
562+
plane_state->uapi.visible = drm_rect_clip_scaled(src, dst, &clip);
563+
564+
drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation);
565+
566+
if (!can_position && plane_state->uapi.visible &&
567+
!drm_rect_equals(dst, &clip)) {
568+
DRM_DEBUG_KMS("Plane must cover entire CRTC\n");
569+
drm_rect_debug_print("dst: ", dst, false);
570+
drm_rect_debug_print("clip: ", &clip, false);
571+
return -EINVAL;
572+
}
573+
574+
return 0;
575+
}
576+
482577
const struct drm_plane_helper_funcs intel_plane_helper_funcs = {
483578
.prepare_fb = intel_prepare_plane_fb,
484579
.cleanup_fb = intel_cleanup_plane_fb,

‎drivers/gpu/drm/i915/display/intel_atomic_plane.h‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ unsigned int intel_plane_pixel_rate(const struct intel_crtc_state *crtc_state,
2424
unsigned int intel_plane_data_rate(const struct intel_crtc_state *crtc_state,
2525
const struct intel_plane_state *plane_state);
2626
void intel_plane_copy_uapi_to_hw_state(struct intel_plane_state *plane_state,
27-
const struct intel_plane_state *from_plane_state);
27+
const struct intel_plane_state *from_plane_state,
28+
struct intel_crtc *crtc);
29+
void intel_plane_copy_hw_state(struct intel_plane_state *plane_state,
30+
const struct intel_plane_state *from_plane_state);
2831
void intel_update_plane(struct intel_plane *plane,
2932
const struct intel_crtc_state *crtc_state,
3033
const struct intel_plane_state *plane_state);
@@ -52,6 +55,10 @@ int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_stat
5255
int intel_plane_calc_min_cdclk(struct intel_atomic_state *state,
5356
struct intel_plane *plane,
5457
bool *need_cdclk_calc);
58+
int intel_atomic_plane_check_clipping(struct intel_plane_state *plane_state,
59+
struct intel_crtc_state *crtc_state,
60+
int min_scale, int max_scale,
61+
bool can_position);
5562
void intel_plane_set_invisible(struct intel_crtc_state *crtc_state,
5663
struct intel_plane_state *plane_state);
5764

0 commit comments

Comments
 (0)