Skip to content

Commit 9ba1922

Browse files
committed
drm/i915: Relocate some other plane fb related stuff into intel_fb.c
Move intel_fb_xy_to_linear() and intel_add_fb_offsets() These are technially sitting somewhere between plane vs. fb code, but we do have a bunch of code like that in intel_fb.c anyway. Might need to think about splitting intel_fb.c into pure fb vs. plane->fb related stuff somehow, but dunno if that's even feasible. Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Jani Nikula <[email protected]>
1 parent 2d017fe commit 9ba1922

File tree

4 files changed

+37
-36
lines changed

4 files changed

+37
-36
lines changed

drivers/gpu/drm/i915/display/intel_display.c

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -600,37 +600,6 @@ void intel_disable_transcoder(const struct intel_crtc_state *old_crtc_state)
600600
intel_wait_for_pipe_off(old_crtc_state);
601601
}
602602

603-
/*
604-
* Convert the x/y offsets into a linear offset.
605-
* Only valid with 0/180 degree rotation, which is fine since linear
606-
* offset is only used with linear buffers on pre-hsw and tiled buffers
607-
* with gen2/3, and 90/270 degree rotations isn't supported on any of them.
608-
*/
609-
u32 intel_fb_xy_to_linear(int x, int y,
610-
const struct intel_plane_state *state,
611-
int color_plane)
612-
{
613-
const struct drm_framebuffer *fb = state->hw.fb;
614-
unsigned int cpp = fb->format->cpp[color_plane];
615-
unsigned int pitch = state->view.color_plane[color_plane].mapping_stride;
616-
617-
return y * pitch + x * cpp;
618-
}
619-
620-
/*
621-
* Add the x/y offsets derived from fb->offsets[] to the user
622-
* specified plane src x/y offsets. The resulting x/y offsets
623-
* specify the start of scanout from the beginning of the gtt mapping.
624-
*/
625-
void intel_add_fb_offsets(int *x, int *y,
626-
const struct intel_plane_state *state,
627-
int color_plane)
628-
629-
{
630-
*x += state->view.color_plane[color_plane].x;
631-
*y += state->view.color_plane[color_plane].y;
632-
}
633-
634603
u32 intel_plane_fb_max_stride(struct drm_device *drm,
635604
u32 pixel_format, u64 modifier)
636605
{

drivers/gpu/drm/i915/display/intel_display.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -458,11 +458,6 @@ int vlv_get_cck_clock(struct drm_i915_private *dev_priv,
458458
int vlv_get_cck_clock_hpll(struct drm_i915_private *dev_priv,
459459
const char *name, u32 reg);
460460
void intel_init_display_hooks(struct drm_i915_private *dev_priv);
461-
unsigned int intel_fb_xy_to_linear(int x, int y,
462-
const struct intel_plane_state *state,
463-
int plane);
464-
void intel_add_fb_offsets(int *x, int *y,
465-
const struct intel_plane_state *state, int plane);
466461
bool intel_has_pending_fb_unpin(struct drm_i915_private *dev_priv);
467462
void intel_encoder_destroy(struct drm_encoder *encoder);
468463
struct drm_display_mode *

drivers/gpu/drm/i915/display/intel_fb.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,6 +1938,37 @@ void intel_fb_fill_view(const struct intel_framebuffer *fb, unsigned int rotatio
19381938
*view = fb->normal_view;
19391939
}
19401940

1941+
/*
1942+
* Convert the x/y offsets into a linear offset.
1943+
* Only valid with 0/180 degree rotation, which is fine since linear
1944+
* offset is only used with linear buffers on pre-hsw and tiled buffers
1945+
* with gen2/3, and 90/270 degree rotations isn't supported on any of them.
1946+
*/
1947+
u32 intel_fb_xy_to_linear(int x, int y,
1948+
const struct intel_plane_state *state,
1949+
int color_plane)
1950+
{
1951+
const struct drm_framebuffer *fb = state->hw.fb;
1952+
unsigned int cpp = fb->format->cpp[color_plane];
1953+
unsigned int pitch = state->view.color_plane[color_plane].mapping_stride;
1954+
1955+
return y * pitch + x * cpp;
1956+
}
1957+
1958+
/*
1959+
* Add the x/y offsets derived from fb->offsets[] to the user
1960+
* specified plane src x/y offsets. The resulting x/y offsets
1961+
* specify the start of scanout from the beginning of the gtt mapping.
1962+
*/
1963+
void intel_add_fb_offsets(int *x, int *y,
1964+
const struct intel_plane_state *state,
1965+
int color_plane)
1966+
1967+
{
1968+
*x += state->view.color_plane[color_plane].x;
1969+
*y += state->view.color_plane[color_plane].y;
1970+
}
1971+
19411972
static
19421973
u32 intel_fb_max_stride(struct intel_display *display,
19431974
u32 pixel_format, u64 modifier)

drivers/gpu/drm/i915/display/intel_fb.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ unsigned int intel_fb_view_vtd_guard(const struct drm_framebuffer *fb,
9393
unsigned int rotation);
9494
int intel_plane_compute_gtt(struct intel_plane_state *plane_state);
9595

96+
unsigned int intel_fb_xy_to_linear(int x, int y,
97+
const struct intel_plane_state *state,
98+
int plane);
99+
void intel_add_fb_offsets(int *x, int *y,
100+
const struct intel_plane_state *state, int plane);
101+
96102
int intel_framebuffer_init(struct intel_framebuffer *ifb,
97103
struct drm_gem_object *obj,
98104
struct drm_mode_fb_cmd2 *mode_cmd);

0 commit comments

Comments
 (0)