Commit 3be5262e authored by Harry Wentland's avatar Harry Wentland Committed by Alex Deucher

drm/amd/display: Rename more dc_surface stuff to plane_state

Signed-off-by: default avatarHarry Wentland <harry.wentland@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 0971c40e
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
#include "i2caux_interface.h" #include "i2caux_interface.h"
static enum drm_plane_type dm_surfaces_type_default[AMDGPU_MAX_PLANES] = { static enum drm_plane_type dm_plane_type_default[AMDGPU_MAX_PLANES] = {
DRM_PLANE_TYPE_PRIMARY, DRM_PLANE_TYPE_PRIMARY,
DRM_PLANE_TYPE_PRIMARY, DRM_PLANE_TYPE_PRIMARY,
DRM_PLANE_TYPE_PRIMARY, DRM_PLANE_TYPE_PRIMARY,
...@@ -79,14 +79,14 @@ static enum drm_plane_type dm_surfaces_type_default[AMDGPU_MAX_PLANES] = { ...@@ -79,14 +79,14 @@ static enum drm_plane_type dm_surfaces_type_default[AMDGPU_MAX_PLANES] = {
DRM_PLANE_TYPE_PRIMARY, DRM_PLANE_TYPE_PRIMARY,
}; };
static enum drm_plane_type dm_surfaces_type_carizzo[AMDGPU_MAX_PLANES] = { static enum drm_plane_type dm_plane_type_carizzo[AMDGPU_MAX_PLANES] = {
DRM_PLANE_TYPE_PRIMARY, DRM_PLANE_TYPE_PRIMARY,
DRM_PLANE_TYPE_PRIMARY, DRM_PLANE_TYPE_PRIMARY,
DRM_PLANE_TYPE_PRIMARY, DRM_PLANE_TYPE_PRIMARY,
DRM_PLANE_TYPE_OVERLAY,/* YUV Capable Underlay */ DRM_PLANE_TYPE_OVERLAY,/* YUV Capable Underlay */
}; };
static enum drm_plane_type dm_surfaces_type_stoney[AMDGPU_MAX_PLANES] = { static enum drm_plane_type dm_plane_type_stoney[AMDGPU_MAX_PLANES] = {
DRM_PLANE_TYPE_PRIMARY, DRM_PLANE_TYPE_PRIMARY,
DRM_PLANE_TYPE_PRIMARY, DRM_PLANE_TYPE_PRIMARY,
DRM_PLANE_TYPE_OVERLAY, /* YUV Capable Underlay */ DRM_PLANE_TYPE_OVERLAY, /* YUV Capable Underlay */
...@@ -1285,11 +1285,11 @@ int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) ...@@ -1285,11 +1285,11 @@ int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
return -1; return -1;
} }
for (i = 0; i < dm->dc->caps.max_surfaces; i++) { for (i = 0; i < dm->dc->caps.max_planes; i++) {
mode_info->planes[i] = kzalloc(sizeof(struct amdgpu_plane), mode_info->planes[i] = kzalloc(sizeof(struct amdgpu_plane),
GFP_KERNEL); GFP_KERNEL);
if (!mode_info->planes[i]) { if (!mode_info->planes[i]) {
DRM_ERROR("KMS: Failed to allocate surface\n"); DRM_ERROR("KMS: Failed to allocate plane\n");
goto fail_free_planes; goto fail_free_planes;
} }
mode_info->planes[i]->base.type = mode_info->plane_type[i]; mode_info->planes[i]->base.type = mode_info->plane_type[i];
...@@ -1389,7 +1389,7 @@ int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) ...@@ -1389,7 +1389,7 @@ int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
fail_free_connector: fail_free_connector:
kfree(aconnector); kfree(aconnector);
fail_free_planes: fail_free_planes:
for (i = 0; i < dm->dc->caps.max_surfaces; i++) for (i = 0; i < dm->dc->caps.max_planes; i++)
kfree(mode_info->planes[i]); kfree(mode_info->planes[i]);
return -1; return -1;
} }
...@@ -1518,52 +1518,52 @@ static int dm_early_init(void *handle) ...@@ -1518,52 +1518,52 @@ static int dm_early_init(void *handle)
adev->mode_info.num_crtc = 6; adev->mode_info.num_crtc = 6;
adev->mode_info.num_hpd = 6; adev->mode_info.num_hpd = 6;
adev->mode_info.num_dig = 6; adev->mode_info.num_dig = 6;
adev->mode_info.plane_type = dm_surfaces_type_default; adev->mode_info.plane_type = dm_plane_type_default;
break; break;
case CHIP_FIJI: case CHIP_FIJI:
case CHIP_TONGA: case CHIP_TONGA:
adev->mode_info.num_crtc = 6; adev->mode_info.num_crtc = 6;
adev->mode_info.num_hpd = 6; adev->mode_info.num_hpd = 6;
adev->mode_info.num_dig = 7; adev->mode_info.num_dig = 7;
adev->mode_info.plane_type = dm_surfaces_type_default; adev->mode_info.plane_type = dm_plane_type_default;
break; break;
case CHIP_CARRIZO: case CHIP_CARRIZO:
adev->mode_info.num_crtc = 3; adev->mode_info.num_crtc = 3;
adev->mode_info.num_hpd = 6; adev->mode_info.num_hpd = 6;
adev->mode_info.num_dig = 9; adev->mode_info.num_dig = 9;
adev->mode_info.plane_type = dm_surfaces_type_carizzo; adev->mode_info.plane_type = dm_plane_type_carizzo;
break; break;
case CHIP_STONEY: case CHIP_STONEY:
adev->mode_info.num_crtc = 2; adev->mode_info.num_crtc = 2;
adev->mode_info.num_hpd = 6; adev->mode_info.num_hpd = 6;
adev->mode_info.num_dig = 9; adev->mode_info.num_dig = 9;
adev->mode_info.plane_type = dm_surfaces_type_stoney; adev->mode_info.plane_type = dm_plane_type_stoney;
break; break;
case CHIP_POLARIS11: case CHIP_POLARIS11:
case CHIP_POLARIS12: case CHIP_POLARIS12:
adev->mode_info.num_crtc = 5; adev->mode_info.num_crtc = 5;
adev->mode_info.num_hpd = 5; adev->mode_info.num_hpd = 5;
adev->mode_info.num_dig = 5; adev->mode_info.num_dig = 5;
adev->mode_info.plane_type = dm_surfaces_type_default; adev->mode_info.plane_type = dm_plane_type_default;
break; break;
case CHIP_POLARIS10: case CHIP_POLARIS10:
adev->mode_info.num_crtc = 6; adev->mode_info.num_crtc = 6;
adev->mode_info.num_hpd = 6; adev->mode_info.num_hpd = 6;
adev->mode_info.num_dig = 6; adev->mode_info.num_dig = 6;
adev->mode_info.plane_type = dm_surfaces_type_default; adev->mode_info.plane_type = dm_plane_type_default;
break; break;
case CHIP_VEGA10: case CHIP_VEGA10:
adev->mode_info.num_crtc = 6; adev->mode_info.num_crtc = 6;
adev->mode_info.num_hpd = 6; adev->mode_info.num_hpd = 6;
adev->mode_info.num_dig = 6; adev->mode_info.num_dig = 6;
adev->mode_info.plane_type = dm_surfaces_type_default; adev->mode_info.plane_type = dm_plane_type_default;
break; break;
#if defined(CONFIG_DRM_AMD_DC_DCN1_0) #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
case CHIP_RAVEN: case CHIP_RAVEN:
adev->mode_info.num_crtc = 4; adev->mode_info.num_crtc = 4;
adev->mode_info.num_hpd = 4; adev->mode_info.num_hpd = 4;
adev->mode_info.num_dig = 4; adev->mode_info.num_dig = 4;
adev->mode_info.plane_type = dm_surfaces_type_default; adev->mode_info.plane_type = dm_plane_type_default;
break; break;
#endif #endif
default: default:
...@@ -1821,50 +1821,50 @@ static int dm_crtc_cursor_move(struct drm_crtc *crtc, ...@@ -1821,50 +1821,50 @@ static int dm_crtc_cursor_move(struct drm_crtc *crtc,
static bool fill_rects_from_plane_state( static bool fill_rects_from_plane_state(
const struct drm_plane_state *state, const struct drm_plane_state *state,
struct dc_plane_state *surface) struct dc_plane_state *plane_state)
{ {
surface->src_rect.x = state->src_x >> 16; plane_state->src_rect.x = state->src_x >> 16;
surface->src_rect.y = state->src_y >> 16; plane_state->src_rect.y = state->src_y >> 16;
/*we ignore for now mantissa and do not to deal with floating pixels :(*/ /*we ignore for now mantissa and do not to deal with floating pixels :(*/
surface->src_rect.width = state->src_w >> 16; plane_state->src_rect.width = state->src_w >> 16;
if (surface->src_rect.width == 0) if (plane_state->src_rect.width == 0)
return false; return false;
surface->src_rect.height = state->src_h >> 16; plane_state->src_rect.height = state->src_h >> 16;
if (surface->src_rect.height == 0) if (plane_state->src_rect.height == 0)
return false; return false;
surface->dst_rect.x = state->crtc_x; plane_state->dst_rect.x = state->crtc_x;
surface->dst_rect.y = state->crtc_y; plane_state->dst_rect.y = state->crtc_y;
if (state->crtc_w == 0) if (state->crtc_w == 0)
return false; return false;
surface->dst_rect.width = state->crtc_w; plane_state->dst_rect.width = state->crtc_w;
if (state->crtc_h == 0) if (state->crtc_h == 0)
return false; return false;
surface->dst_rect.height = state->crtc_h; plane_state->dst_rect.height = state->crtc_h;
surface->clip_rect = surface->dst_rect; plane_state->clip_rect = plane_state->dst_rect;
switch (state->rotation & DRM_MODE_ROTATE_MASK) { switch (state->rotation & DRM_MODE_ROTATE_MASK) {
case DRM_MODE_ROTATE_0: case DRM_MODE_ROTATE_0:
surface->rotation = ROTATION_ANGLE_0; plane_state->rotation = ROTATION_ANGLE_0;
break; break;
case DRM_MODE_ROTATE_90: case DRM_MODE_ROTATE_90:
surface->rotation = ROTATION_ANGLE_90; plane_state->rotation = ROTATION_ANGLE_90;
break; break;
case DRM_MODE_ROTATE_180: case DRM_MODE_ROTATE_180:
surface->rotation = ROTATION_ANGLE_180; plane_state->rotation = ROTATION_ANGLE_180;
break; break;
case DRM_MODE_ROTATE_270: case DRM_MODE_ROTATE_270:
surface->rotation = ROTATION_ANGLE_270; plane_state->rotation = ROTATION_ANGLE_270;
break; break;
default: default:
surface->rotation = ROTATION_ANGLE_0; plane_state->rotation = ROTATION_ANGLE_0;
break; break;
} }
...@@ -1896,7 +1896,7 @@ static int get_fb_info( ...@@ -1896,7 +1896,7 @@ static int get_fb_info(
static int fill_plane_attributes_from_fb( static int fill_plane_attributes_from_fb(
struct amdgpu_device *adev, struct amdgpu_device *adev,
struct dc_plane_state *surface, struct dc_plane_state *plane_state,
const struct amdgpu_framebuffer *amdgpu_fb, bool addReq) const struct amdgpu_framebuffer *amdgpu_fb, bool addReq)
{ {
uint64_t tiling_flags; uint64_t tiling_flags;
...@@ -1916,28 +1916,28 @@ static int fill_plane_attributes_from_fb( ...@@ -1916,28 +1916,28 @@ static int fill_plane_attributes_from_fb(
switch (fb->format->format) { switch (fb->format->format) {
case DRM_FORMAT_C8: case DRM_FORMAT_C8:
surface->format = SURFACE_PIXEL_FORMAT_GRPH_PALETA_256_COLORS; plane_state->format = SURFACE_PIXEL_FORMAT_GRPH_PALETA_256_COLORS;
break; break;
case DRM_FORMAT_RGB565: case DRM_FORMAT_RGB565:
surface->format = SURFACE_PIXEL_FORMAT_GRPH_RGB565; plane_state->format = SURFACE_PIXEL_FORMAT_GRPH_RGB565;
break; break;
case DRM_FORMAT_XRGB8888: case DRM_FORMAT_XRGB8888:
case DRM_FORMAT_ARGB8888: case DRM_FORMAT_ARGB8888:
surface->format = SURFACE_PIXEL_FORMAT_GRPH_ARGB8888; plane_state->format = SURFACE_PIXEL_FORMAT_GRPH_ARGB8888;
break; break;
case DRM_FORMAT_XRGB2101010: case DRM_FORMAT_XRGB2101010:
case DRM_FORMAT_ARGB2101010: case DRM_FORMAT_ARGB2101010:
surface->format = SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010; plane_state->format = SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010;
break; break;
case DRM_FORMAT_XBGR2101010: case DRM_FORMAT_XBGR2101010:
case DRM_FORMAT_ABGR2101010: case DRM_FORMAT_ABGR2101010:
surface->format = SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010; plane_state->format = SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010;
break; break;
case DRM_FORMAT_NV21: case DRM_FORMAT_NV21:
surface->format = SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr; plane_state->format = SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr;
break; break;
case DRM_FORMAT_NV12: case DRM_FORMAT_NV12:
surface->format = SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb; plane_state->format = SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb;
break; break;
default: default:
DRM_ERROR("Unsupported screen format %s\n", DRM_ERROR("Unsupported screen format %s\n",
...@@ -1945,45 +1945,45 @@ static int fill_plane_attributes_from_fb( ...@@ -1945,45 +1945,45 @@ static int fill_plane_attributes_from_fb(
return -EINVAL; return -EINVAL;
} }
if (surface->format < SURFACE_PIXEL_FORMAT_VIDEO_BEGIN) { if (plane_state->format < SURFACE_PIXEL_FORMAT_VIDEO_BEGIN) {
surface->address.type = PLN_ADDR_TYPE_GRAPHICS; plane_state->address.type = PLN_ADDR_TYPE_GRAPHICS;
surface->address.grph.addr.low_part = lower_32_bits(fb_location); plane_state->address.grph.addr.low_part = lower_32_bits(fb_location);
surface->address.grph.addr.high_part = upper_32_bits(fb_location); plane_state->address.grph.addr.high_part = upper_32_bits(fb_location);
surface->plane_size.grph.surface_size.x = 0; plane_state->plane_size.grph.surface_size.x = 0;
surface->plane_size.grph.surface_size.y = 0; plane_state->plane_size.grph.surface_size.y = 0;
surface->plane_size.grph.surface_size.width = fb->width; plane_state->plane_size.grph.surface_size.width = fb->width;
surface->plane_size.grph.surface_size.height = fb->height; plane_state->plane_size.grph.surface_size.height = fb->height;
surface->plane_size.grph.surface_pitch = plane_state->plane_size.grph.surface_pitch =
fb->pitches[0] / fb->format->cpp[0]; fb->pitches[0] / fb->format->cpp[0];
/* TODO: unhardcode */ /* TODO: unhardcode */
surface->color_space = COLOR_SPACE_SRGB; plane_state->color_space = COLOR_SPACE_SRGB;
} else { } else {
awidth = ALIGN(fb->width, 64); awidth = ALIGN(fb->width, 64);
surface->address.type = PLN_ADDR_TYPE_VIDEO_PROGRESSIVE; plane_state->address.type = PLN_ADDR_TYPE_VIDEO_PROGRESSIVE;
surface->address.video_progressive.luma_addr.low_part plane_state->address.video_progressive.luma_addr.low_part
= lower_32_bits(fb_location); = lower_32_bits(fb_location);
surface->address.video_progressive.chroma_addr.low_part plane_state->address.video_progressive.chroma_addr.low_part
= lower_32_bits(fb_location) + = lower_32_bits(fb_location) +
(awidth * fb->height); (awidth * fb->height);
surface->plane_size.video.luma_size.x = 0; plane_state->plane_size.video.luma_size.x = 0;
surface->plane_size.video.luma_size.y = 0; plane_state->plane_size.video.luma_size.y = 0;
surface->plane_size.video.luma_size.width = awidth; plane_state->plane_size.video.luma_size.width = awidth;
surface->plane_size.video.luma_size.height = fb->height; plane_state->plane_size.video.luma_size.height = fb->height;
/* TODO: unhardcode */ /* TODO: unhardcode */
surface->plane_size.video.luma_pitch = awidth; plane_state->plane_size.video.luma_pitch = awidth;
surface->plane_size.video.chroma_size.x = 0; plane_state->plane_size.video.chroma_size.x = 0;
surface->plane_size.video.chroma_size.y = 0; plane_state->plane_size.video.chroma_size.y = 0;
surface->plane_size.video.chroma_size.width = awidth; plane_state->plane_size.video.chroma_size.width = awidth;
surface->plane_size.video.chroma_size.height = fb->height; plane_state->plane_size.video.chroma_size.height = fb->height;
surface->plane_size.video.chroma_pitch = awidth / 2; plane_state->plane_size.video.chroma_pitch = awidth / 2;
/* TODO: unhardcode */ /* TODO: unhardcode */
surface->color_space = COLOR_SPACE_YCBCR709; plane_state->color_space = COLOR_SPACE_YCBCR709;
} }
memset(&surface->tiling_info, 0, sizeof(surface->tiling_info)); memset(&plane_state->tiling_info, 0, sizeof(plane_state->tiling_info));
/* Fill GFX8 params */ /* Fill GFX8 params */
if (AMDGPU_TILING_GET(tiling_flags, ARRAY_MODE) == DC_ARRAY_2D_TILED_THIN1) { if (AMDGPU_TILING_GET(tiling_flags, ARRAY_MODE) == DC_ARRAY_2D_TILED_THIN1) {
...@@ -1996,51 +1996,51 @@ static int fill_plane_attributes_from_fb( ...@@ -1996,51 +1996,51 @@ static int fill_plane_attributes_from_fb(
num_banks = AMDGPU_TILING_GET(tiling_flags, NUM_BANKS); num_banks = AMDGPU_TILING_GET(tiling_flags, NUM_BANKS);
/* XXX fix me for VI */ /* XXX fix me for VI */
surface->tiling_info.gfx8.num_banks = num_banks; plane_state->tiling_info.gfx8.num_banks = num_banks;
surface->tiling_info.gfx8.array_mode = plane_state->tiling_info.gfx8.array_mode =
DC_ARRAY_2D_TILED_THIN1; DC_ARRAY_2D_TILED_THIN1;
surface->tiling_info.gfx8.tile_split = tile_split; plane_state->tiling_info.gfx8.tile_split = tile_split;
surface->tiling_info.gfx8.bank_width = bankw; plane_state->tiling_info.gfx8.bank_width = bankw;
surface->tiling_info.gfx8.bank_height = bankh; plane_state->tiling_info.gfx8.bank_height = bankh;
surface->tiling_info.gfx8.tile_aspect = mtaspect; plane_state->tiling_info.gfx8.tile_aspect = mtaspect;
surface->tiling_info.gfx8.tile_mode = plane_state->tiling_info.gfx8.tile_mode =
DC_ADDR_SURF_MICRO_TILING_DISPLAY; DC_ADDR_SURF_MICRO_TILING_DISPLAY;
} else if (AMDGPU_TILING_GET(tiling_flags, ARRAY_MODE) } else if (AMDGPU_TILING_GET(tiling_flags, ARRAY_MODE)
== DC_ARRAY_1D_TILED_THIN1) { == DC_ARRAY_1D_TILED_THIN1) {
surface->tiling_info.gfx8.array_mode = DC_ARRAY_1D_TILED_THIN1; plane_state->tiling_info.gfx8.array_mode = DC_ARRAY_1D_TILED_THIN1;
} }
surface->tiling_info.gfx8.pipe_config = plane_state->tiling_info.gfx8.pipe_config =
AMDGPU_TILING_GET(tiling_flags, PIPE_CONFIG); AMDGPU_TILING_GET(tiling_flags, PIPE_CONFIG);
if (adev->asic_type == CHIP_VEGA10 || if (adev->asic_type == CHIP_VEGA10 ||
adev->asic_type == CHIP_RAVEN) { adev->asic_type == CHIP_RAVEN) {
/* Fill GFX9 params */ /* Fill GFX9 params */
surface->tiling_info.gfx9.num_pipes = plane_state->tiling_info.gfx9.num_pipes =
adev->gfx.config.gb_addr_config_fields.num_pipes; adev->gfx.config.gb_addr_config_fields.num_pipes;
surface->tiling_info.gfx9.num_banks = plane_state->tiling_info.gfx9.num_banks =
adev->gfx.config.gb_addr_config_fields.num_banks; adev->gfx.config.gb_addr_config_fields.num_banks;
surface->tiling_info.gfx9.pipe_interleave = plane_state->tiling_info.gfx9.pipe_interleave =
adev->gfx.config.gb_addr_config_fields.pipe_interleave_size; adev->gfx.config.gb_addr_config_fields.pipe_interleave_size;
surface->tiling_info.gfx9.num_shader_engines = plane_state->tiling_info.gfx9.num_shader_engines =
adev->gfx.config.gb_addr_config_fields.num_se; adev->gfx.config.gb_addr_config_fields.num_se;
surface->tiling_info.gfx9.max_compressed_frags = plane_state->tiling_info.gfx9.max_compressed_frags =
adev->gfx.config.gb_addr_config_fields.max_compress_frags; adev->gfx.config.gb_addr_config_fields.max_compress_frags;
surface->tiling_info.gfx9.num_rb_per_se = plane_state->tiling_info.gfx9.num_rb_per_se =
adev->gfx.config.gb_addr_config_fields.num_rb_per_se; adev->gfx.config.gb_addr_config_fields.num_rb_per_se;
surface->tiling_info.gfx9.swizzle = plane_state->tiling_info.gfx9.swizzle =
AMDGPU_TILING_GET(tiling_flags, SWIZZLE_MODE); AMDGPU_TILING_GET(tiling_flags, SWIZZLE_MODE);
surface->tiling_info.gfx9.shaderEnable = 1; plane_state->tiling_info.gfx9.shaderEnable = 1;
} }
surface->visible = true; plane_state->visible = true;
surface->scaling_quality.h_taps_c = 0; plane_state->scaling_quality.h_taps_c = 0;
surface->scaling_quality.v_taps_c = 0; plane_state->scaling_quality.v_taps_c = 0;
/* is this needed? is surface zeroed at allocation? */ /* is this needed? is plane_state zeroed at allocation? */
surface->scaling_quality.h_taps = 0; plane_state->scaling_quality.h_taps = 0;
surface->scaling_quality.v_taps = 0; plane_state->scaling_quality.v_taps = 0;
surface->stereo_format = PLANE_STEREO_FORMAT_NONE; plane_state->stereo_format = PLANE_STEREO_FORMAT_NONE;
return ret; return ret;
...@@ -2050,7 +2050,7 @@ static int fill_plane_attributes_from_fb( ...@@ -2050,7 +2050,7 @@ static int fill_plane_attributes_from_fb(
static void fill_gamma_from_crtc_state( static void fill_gamma_from_crtc_state(
const struct drm_crtc_state *crtc_state, const struct drm_crtc_state *crtc_state,
struct dc_plane_state *dc_surface) struct dc_plane_state *plane_state)
{ {
int i; int i;
struct dc_gamma *gamma; struct dc_gamma *gamma;
...@@ -2069,12 +2069,12 @@ static void fill_gamma_from_crtc_state( ...@@ -2069,12 +2069,12 @@ static void fill_gamma_from_crtc_state(
gamma->blue[i] = lut[i].blue; gamma->blue[i] = lut[i].blue;
} }
dc_surface->gamma_correction = gamma; plane_state->gamma_correction = gamma;
} }
static int fill_plane_attributes( static int fill_plane_attributes(
struct amdgpu_device *adev, struct amdgpu_device *adev,
struct dc_plane_state *surface, struct dc_plane_state *dc_plane_state,
struct drm_plane_state *plane_state, struct drm_plane_state *plane_state,
struct drm_crtc_state *crtc_state, struct drm_crtc_state *crtc_state,
bool addrReq) bool addrReq)
...@@ -2085,12 +2085,12 @@ static int fill_plane_attributes( ...@@ -2085,12 +2085,12 @@ static int fill_plane_attributes(
struct dc_transfer_func *input_tf; struct dc_transfer_func *input_tf;
int ret = 0; int ret = 0;
if (!fill_rects_from_plane_state(plane_state, surface)) if (!fill_rects_from_plane_state(plane_state, dc_plane_state))
return -EINVAL; return -EINVAL;
ret = fill_plane_attributes_from_fb( ret = fill_plane_attributes_from_fb(
crtc->dev->dev_private, crtc->dev->dev_private,
surface, dc_plane_state,
amdgpu_fb, amdgpu_fb,
addrReq); addrReq);
...@@ -2105,11 +2105,11 @@ static int fill_plane_attributes( ...@@ -2105,11 +2105,11 @@ static int fill_plane_attributes(
input_tf->type = TF_TYPE_PREDEFINED; input_tf->type = TF_TYPE_PREDEFINED;
input_tf->tf = TRANSFER_FUNCTION_SRGB; input_tf->tf = TRANSFER_FUNCTION_SRGB;
surface->in_transfer_func = input_tf; dc_plane_state->in_transfer_func = input_tf;
/* In case of gamma set, update gamma value */ /* In case of gamma set, update gamma value */
if (crtc_state->gamma_lut) if (crtc_state->gamma_lut)
fill_gamma_from_crtc_state(crtc_state, surface); fill_gamma_from_crtc_state(crtc_state, dc_plane_state);
return ret; return ret;
} }
...@@ -2991,9 +2991,9 @@ dm_drm_plane_duplicate_state(struct drm_plane *plane) ...@@ -2991,9 +2991,9 @@ dm_drm_plane_duplicate_state(struct drm_plane *plane)
__drm_atomic_helper_plane_duplicate_state(plane, &dm_plane_state->base); __drm_atomic_helper_plane_duplicate_state(plane, &dm_plane_state->base);
if (old_dm_plane_state->surface) { if (old_dm_plane_state->dc_state) {
dm_plane_state->surface = old_dm_plane_state->surface; dm_plane_state->dc_state = old_dm_plane_state->dc_state;
dc_surface_retain(dm_plane_state->surface); dc_plane_state_retain(dm_plane_state->dc_state);
} }
return &dm_plane_state->base; return &dm_plane_state->base;
...@@ -3004,8 +3004,8 @@ void dm_drm_plane_destroy_state(struct drm_plane *plane, ...@@ -3004,8 +3004,8 @@ void dm_drm_plane_destroy_state(struct drm_plane *plane,
{ {
struct dm_plane_state *dm_plane_state = to_dm_plane_state(state); struct dm_plane_state *dm_plane_state = to_dm_plane_state(state);
if (dm_plane_state->surface) if (dm_plane_state->dc_state)
dc_surface_release(dm_plane_state->surface); dc_plane_state_release(dm_plane_state->dc_state);
__drm_atomic_helper_plane_destroy_state(state); __drm_atomic_helper_plane_destroy_state(state);
kfree(dm_plane_state); kfree(dm_plane_state);
...@@ -3059,18 +3059,18 @@ static int dm_plane_helper_prepare_fb( ...@@ -3059,18 +3059,18 @@ static int dm_plane_helper_prepare_fb(
amdgpu_bo_ref(rbo); amdgpu_bo_ref(rbo);
if (dm_plane_state_new->surface && if (dm_plane_state_new->dc_state &&
dm_plane_state_old->surface != dm_plane_state_new->surface) { dm_plane_state_old->dc_state != dm_plane_state_new->dc_state) {
struct dc_plane_state *surface = dm_plane_state_new->surface; struct dc_plane_state *plane_state = dm_plane_state_new->dc_state;
if (surface->format < SURFACE_PIXEL_FORMAT_VIDEO_BEGIN) { if (plane_state->format < SURFACE_PIXEL_FORMAT_VIDEO_BEGIN) {
surface->address.grph.addr.low_part = lower_32_bits(afb->address); plane_state->address.grph.addr.low_part = lower_32_bits(afb->address);
surface->address.grph.addr.high_part = upper_32_bits(afb->address); plane_state->address.grph.addr.high_part = upper_32_bits(afb->address);
} else { } else {
awidth = ALIGN(new_state->fb->width, 64); awidth = ALIGN(new_state->fb->width, 64);
surface->address.video_progressive.luma_addr.low_part plane_state->address.video_progressive.luma_addr.low_part
= lower_32_bits(afb->address); = lower_32_bits(afb->address);
surface->address.video_progressive.chroma_addr.low_part plane_state->address.video_progressive.chroma_addr.low_part
= lower_32_bits(afb->address) + = lower_32_bits(afb->address) +
(awidth * new_state->fb->height); (awidth * new_state->fb->height);
} }
...@@ -3159,10 +3159,10 @@ int dm_plane_atomic_check(struct drm_plane *plane, ...@@ -3159,10 +3159,10 @@ int dm_plane_atomic_check(struct drm_plane *plane,
struct dc *dc = adev->dm.dc; struct dc *dc = adev->dm.dc;
struct dm_plane_state *dm_plane_state = to_dm_plane_state(state); struct dm_plane_state *dm_plane_state = to_dm_plane_state(state);
if (!dm_plane_state->surface) if (!dm_plane_state->dc_state)
return true; return true;
if (dc_validate_plane(dc, dm_plane_state->surface)) if (dc_validate_plane(dc, dm_plane_state->dc_state))
return 0; return 0;
return -EINVAL; return -EINVAL;
...@@ -3848,6 +3848,7 @@ static void amdgpu_dm_do_flip( ...@@ -3848,6 +3848,7 @@ static void amdgpu_dm_do_flip(
struct amdgpu_device *adev = crtc->dev->dev_private; struct amdgpu_device *adev = crtc->dev->dev_private;
bool async_flip = (acrtc->flip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0; bool async_flip = (acrtc->flip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0;
struct dc_flip_addrs addr = { {0} }; struct dc_flip_addrs addr = { {0} };
/* TODO eliminate or rename surface_update */
struct dc_surface_update surface_updates[1] = { {0} }; struct dc_surface_update surface_updates[1] = { {0} };
struct dm_crtc_state *acrtc_state = to_dm_crtc_state(crtc->state); struct dm_crtc_state *acrtc_state = to_dm_crtc_state(crtc->state);
...@@ -3903,11 +3904,11 @@ static void amdgpu_dm_do_flip( ...@@ -3903,11 +3904,11 @@ static void amdgpu_dm_do_flip(
if (acrtc->base.state->event) if (acrtc->base.state->event)
prepare_flip_isr(acrtc); prepare_flip_isr(acrtc);
surface_updates->surface = dc_stream_get_status(acrtc_state->stream)->surfaces[0]; surface_updates->surface = dc_stream_get_status(acrtc_state->stream)->plane_states[0];
surface_updates->flip_addr = &addr; surface_updates->flip_addr = &addr;
dc_update_surfaces_and_stream(adev->dm.dc, surface_updates, 1, acrtc_state->stream, NULL); dc_update_planes_and_stream(adev->dm.dc, surface_updates, 1, acrtc_state->stream, NULL);
DRM_DEBUG_DRIVER("%s Flipping to hi: 0x%x, low: 0x%x \n", DRM_DEBUG_DRIVER("%s Flipping to hi: 0x%x, low: 0x%x \n",
__func__, __func__,
...@@ -3918,7 +3919,7 @@ static void amdgpu_dm_do_flip( ...@@ -3918,7 +3919,7 @@ static void amdgpu_dm_do_flip(
spin_unlock_irqrestore(&crtc->dev->event_lock, flags); spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
} }
static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state, static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
struct drm_device *dev, struct drm_device *dev,
struct amdgpu_display_manager *dm, struct amdgpu_display_manager *dm,
struct drm_crtc *pcrtc, struct drm_crtc *pcrtc,
...@@ -3928,7 +3929,7 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state, ...@@ -3928,7 +3929,7 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state,
struct drm_plane *plane; struct drm_plane *plane;
struct drm_plane_state *old_plane_state; struct drm_plane_state *old_plane_state;
struct dc_stream_state *dc_stream_attach; struct dc_stream_state *dc_stream_attach;
struct dc_plane_state *dc_surfaces_constructed[MAX_SURFACES]; struct dc_plane_state *plane_states_constructed[MAX_SURFACES];
struct amdgpu_crtc *acrtc_attach = to_amdgpu_crtc(pcrtc); struct amdgpu_crtc *acrtc_attach = to_amdgpu_crtc(pcrtc);
struct dm_crtc_state *acrtc_state = to_dm_crtc_state(pcrtc->state); struct dm_crtc_state *acrtc_state = to_dm_crtc_state(pcrtc->state);
int planes_count = 0; int planes_count = 0;
...@@ -3956,8 +3957,9 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state, ...@@ -3956,8 +3957,9 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state,
spin_lock_irqsave(&crtc->dev->event_lock, flags); spin_lock_irqsave(&crtc->dev->event_lock, flags);
if (acrtc_attach->pflip_status != AMDGPU_FLIP_NONE) { if (acrtc_attach->pflip_status != AMDGPU_FLIP_NONE) {
DRM_ERROR("add_surface: acrtc %d, already busy\n", DRM_ERROR("%s: acrtc %d, already busy\n",
acrtc_attach->crtc_id); __func__,
acrtc_attach->crtc_id);
spin_unlock_irqrestore(&crtc->dev->event_lock, flags); spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
/* In commit tail framework this cannot happen */ /* In commit tail framework this cannot happen */
WARN_ON(1); WARN_ON(1);
...@@ -3965,9 +3967,9 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state, ...@@ -3965,9 +3967,9 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state,
spin_unlock_irqrestore(&crtc->dev->event_lock, flags); spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
if (!pflip_needed) { if (!pflip_needed) {
WARN_ON(!dm_plane_state->surface); WARN_ON(!dm_plane_state->dc_state);
dc_surfaces_constructed[planes_count] = dm_plane_state->surface; plane_states_constructed[planes_count] = dm_plane_state->dc_state;
dc_stream_attach = acrtc_state->stream; dc_stream_attach = acrtc_state->stream;
planes_count++; planes_count++;
...@@ -4010,11 +4012,11 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state, ...@@ -4010,11 +4012,11 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state,
spin_unlock_irqrestore(&pcrtc->dev->event_lock, flags); spin_unlock_irqrestore(&pcrtc->dev->event_lock, flags);
} }
if (false == dc_commit_surfaces_to_stream(dm->dc, if (false == dc_commit_planes_to_stream(dm->dc,
dc_surfaces_constructed, plane_states_constructed,
planes_count, planes_count,
dc_stream_attach)) dc_stream_attach))
dm_error("%s: Failed to attach surface!\n", __func__); dm_error("%s: Failed to attach plane!\n", __func__);
} else { } else {
/*TODO BUG Here should go disable planes on CRTC. */ /*TODO BUG Here should go disable planes on CRTC. */
} }
...@@ -4226,16 +4228,16 @@ void amdgpu_dm_atomic_commit_tail( ...@@ -4226,16 +4228,16 @@ void amdgpu_dm_atomic_commit_tail(
status = dc_stream_get_status(new_acrtc_state->stream); status = dc_stream_get_status(new_acrtc_state->stream);
WARN_ON(!status); WARN_ON(!status);
WARN_ON(!status->surface_count); WARN_ON(!status->plane_count);
if (!new_acrtc_state->stream) if (!new_acrtc_state->stream)
continue; continue;
/*TODO How it works with MPO ?*/ /*TODO How it works with MPO ?*/
if (!dc_commit_surfaces_to_stream( if (!dc_commit_planes_to_stream(
dm->dc, dm->dc,
status->surfaces, status->plane_states,
status->surface_count, status->plane_count,
new_acrtc_state->stream)) new_acrtc_state->stream))
dm_error("%s: Failed to update stream scaling!\n", __func__); dm_error("%s: Failed to update stream scaling!\n", __func__);
} }
...@@ -4260,7 +4262,7 @@ void amdgpu_dm_atomic_commit_tail( ...@@ -4260,7 +4262,7 @@ void amdgpu_dm_atomic_commit_tail(
new_acrtc_state = to_dm_crtc_state(pcrtc->state); new_acrtc_state = to_dm_crtc_state(pcrtc->state);
if (new_acrtc_state->stream) if (new_acrtc_state->stream)
amdgpu_dm_commit_surfaces(state, dev, dm, pcrtc, &wait_for_vblank); amdgpu_dm_commit_planes(state, dev, dm, pcrtc, &wait_for_vblank);
} }
...@@ -4375,27 +4377,27 @@ void dm_restore_drm_connector_state(struct drm_device *dev, struct drm_connector ...@@ -4375,27 +4377,27 @@ void dm_restore_drm_connector_state(struct drm_device *dev, struct drm_connector
dm_force_atomic_commit(&aconnector->base); dm_force_atomic_commit(&aconnector->base);
} }
static uint32_t add_val_sets_surface( static uint32_t add_val_sets_plane(
struct dc_validation_set *val_sets, struct dc_validation_set *val_sets,
uint32_t set_count, uint32_t set_count,
const struct dc_stream_state *stream, const struct dc_stream_state *stream,
struct dc_plane_state *surface) struct dc_plane_state *plane_state)
{ {
uint32_t i = 0, j = 0; uint32_t i = 0, j = 0;
while (i < set_count) { while (i < set_count) {
if (val_sets[i].stream == stream) { if (val_sets[i].stream == stream) {
while (val_sets[i].surfaces[j]) while (val_sets[i].plane_states[j])
j++; j++;
break; break;
} }
++i; ++i;
} }
val_sets[i].surfaces[j] = surface; val_sets[i].plane_states[j] = plane_state;
val_sets[i].surface_count++; val_sets[i].plane_count++;
return val_sets[i].surface_count; return val_sets[i].plane_count;
} }
static uint32_t update_in_val_sets_stream( static uint32_t update_in_val_sets_stream(
...@@ -4516,7 +4518,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -4516,7 +4518,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
/* /*
* This bool will be set for true for any modeset/reset * This bool will be set for true for any modeset/reset
* or surface update which implies non fast surface update. * or plane update which implies non fast surface update.
*/ */
bool lock_and_validation_needed = false; bool lock_and_validation_needed = false;
...@@ -4701,13 +4703,13 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -4701,13 +4703,13 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
pflip_needed = !state->allow_modeset; pflip_needed = !state->allow_modeset;
if (!pflip_needed) { if (!pflip_needed) {
struct dc_plane_state *surface; struct dc_plane_state *dc_plane_state;
surface = dc_create_surface(dc); dc_plane_state = dc_create_plane_state(dc);
ret = fill_plane_attributes( ret = fill_plane_attributes(
plane_crtc->dev->dev_private, plane_crtc->dev->dev_private,
surface, dc_plane_state,
plane_state, plane_state,
crtc_state, crtc_state,
false); false);
...@@ -4715,15 +4717,15 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -4715,15 +4717,15 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
goto fail; goto fail;
if (dm_plane_state->surface) if (dm_plane_state->dc_state)
dc_surface_release(dm_plane_state->surface); dc_plane_state_release(dm_plane_state->dc_state);
dm_plane_state->surface = surface; dm_plane_state->dc_state = dc_plane_state;
add_val_sets_surface(set, add_val_sets_plane(set,
set_count, set_count,
new_acrtc_state->stream, new_acrtc_state->stream,
surface); dc_plane_state);
lock_and_validation_needed = true; lock_and_validation_needed = true;
} }
......
...@@ -196,7 +196,7 @@ struct dc_stream; ...@@ -196,7 +196,7 @@ struct dc_stream;
struct dm_plane_state { struct dm_plane_state {
struct drm_plane_state base; struct drm_plane_state base;
struct dc_plane_state *surface; struct dc_plane_state *dc_state;
}; };
struct dm_crtc_state { struct dm_crtc_state {
......
...@@ -2594,15 +2594,15 @@ static void populate_initial_data( ...@@ -2594,15 +2594,15 @@ static void populate_initial_data(
if (!pipe[i].stream || !pipe[i].bottom_pipe) if (!pipe[i].stream || !pipe[i].bottom_pipe)
continue; continue;
ASSERT(pipe[i].surface); ASSERT(pipe[i].plane_state);
if (num_displays == 0) { if (num_displays == 0) {
if (!pipe[i].surface->visible) if (!pipe[i].plane_state->visible)
data->d0_underlay_mode = bw_def_underlay_only; data->d0_underlay_mode = bw_def_underlay_only;
else else
data->d0_underlay_mode = bw_def_blend; data->d0_underlay_mode = bw_def_blend;
} else { } else {
if (!pipe[i].surface->visible) if (!pipe[i].plane_state->visible)
data->d1_underlay_mode = bw_def_underlay_only; data->d1_underlay_mode = bw_def_underlay_only;
else else
data->d1_underlay_mode = bw_def_blend; data->d1_underlay_mode = bw_def_blend;
...@@ -2620,7 +2620,7 @@ static void populate_initial_data( ...@@ -2620,7 +2620,7 @@ static void populate_initial_data(
data->v_taps[num_displays + 4] = bw_int_to_fixed(pipe[i].scl_data.taps.v_taps); data->v_taps[num_displays + 4] = bw_int_to_fixed(pipe[i].scl_data.taps.v_taps);
data->h_scale_ratio[num_displays + 4] = fixed31_32_to_bw_fixed(pipe[i].scl_data.ratios.horz.value); data->h_scale_ratio[num_displays + 4] = fixed31_32_to_bw_fixed(pipe[i].scl_data.ratios.horz.value);
data->v_scale_ratio[num_displays + 4] = fixed31_32_to_bw_fixed(pipe[i].scl_data.ratios.vert.value); data->v_scale_ratio[num_displays + 4] = fixed31_32_to_bw_fixed(pipe[i].scl_data.ratios.vert.value);
switch (pipe[i].surface->rotation) { switch (pipe[i].plane_state->rotation) {
case ROTATION_ANGLE_0: case ROTATION_ANGLE_0:
data->rotation_angle[num_displays + 4] = bw_int_to_fixed(0); data->rotation_angle[num_displays + 4] = bw_int_to_fixed(0);
break; break;
...@@ -2636,7 +2636,7 @@ static void populate_initial_data( ...@@ -2636,7 +2636,7 @@ static void populate_initial_data(
default: default:
break; break;
} }
switch (pipe[i].surface->format) { switch (pipe[i].plane_state->format) {
case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr: case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr:
case SURFACE_PIXEL_FORMAT_GRPH_ARGB1555: case SURFACE_PIXEL_FORMAT_GRPH_ARGB1555:
case SURFACE_PIXEL_FORMAT_GRPH_RGB565: case SURFACE_PIXEL_FORMAT_GRPH_RGB565:
...@@ -2670,14 +2670,14 @@ static void populate_initial_data( ...@@ -2670,14 +2670,14 @@ static void populate_initial_data(
data->src_height[num_displays * 2 + j] = bw_int_to_fixed(pipe[i].bottom_pipe->scl_data.viewport.height); data->src_height[num_displays * 2 + j] = bw_int_to_fixed(pipe[i].bottom_pipe->scl_data.viewport.height);
data->src_width[num_displays * 2 + j] = bw_int_to_fixed(pipe[i].bottom_pipe->scl_data.viewport.width); data->src_width[num_displays * 2 + j] = bw_int_to_fixed(pipe[i].bottom_pipe->scl_data.viewport.width);
data->pitch_in_pixels[num_displays * 2 + j] = bw_int_to_fixed( data->pitch_in_pixels[num_displays * 2 + j] = bw_int_to_fixed(
pipe[i].bottom_pipe->surface->plane_size.grph.surface_pitch); pipe[i].bottom_pipe->plane_state->plane_size.grph.surface_pitch);
data->h_taps[num_displays * 2 + j] = bw_int_to_fixed(pipe[i].bottom_pipe->scl_data.taps.h_taps); data->h_taps[num_displays * 2 + j] = bw_int_to_fixed(pipe[i].bottom_pipe->scl_data.taps.h_taps);
data->v_taps[num_displays * 2 + j] = bw_int_to_fixed(pipe[i].bottom_pipe->scl_data.taps.v_taps); data->v_taps[num_displays * 2 + j] = bw_int_to_fixed(pipe[i].bottom_pipe->scl_data.taps.v_taps);
data->h_scale_ratio[num_displays * 2 + j] = fixed31_32_to_bw_fixed( data->h_scale_ratio[num_displays * 2 + j] = fixed31_32_to_bw_fixed(
pipe[i].bottom_pipe->scl_data.ratios.horz.value); pipe[i].bottom_pipe->scl_data.ratios.horz.value);
data->v_scale_ratio[num_displays * 2 + j] = fixed31_32_to_bw_fixed( data->v_scale_ratio[num_displays * 2 + j] = fixed31_32_to_bw_fixed(
pipe[i].bottom_pipe->scl_data.ratios.vert.value); pipe[i].bottom_pipe->scl_data.ratios.vert.value);
switch (pipe[i].bottom_pipe->surface->rotation) { switch (pipe[i].bottom_pipe->plane_state->rotation) {
case ROTATION_ANGLE_0: case ROTATION_ANGLE_0:
data->rotation_angle[num_displays * 2 + j] = bw_int_to_fixed(0); data->rotation_angle[num_displays * 2 + j] = bw_int_to_fixed(0);
break; break;
...@@ -2710,7 +2710,7 @@ static void populate_initial_data( ...@@ -2710,7 +2710,7 @@ static void populate_initial_data(
data->h_total[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->timing.h_total); data->h_total[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->timing.h_total);
data->v_total[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->timing.v_total); data->v_total[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->timing.v_total);
data->pixel_rate[num_displays + 4] = bw_frc_to_fixed(pipe[i].stream->timing.pix_clk_khz, 1000); data->pixel_rate[num_displays + 4] = bw_frc_to_fixed(pipe[i].stream->timing.pix_clk_khz, 1000);
if (pipe[i].surface) { if (pipe[i].plane_state) {
data->src_width[num_displays + 4] = bw_int_to_fixed(pipe[i].scl_data.viewport.width); data->src_width[num_displays + 4] = bw_int_to_fixed(pipe[i].scl_data.viewport.width);
data->pitch_in_pixels[num_displays + 4] = data->src_width[num_displays + 4]; data->pitch_in_pixels[num_displays + 4] = data->src_width[num_displays + 4];
data->src_height[num_displays + 4] = bw_int_to_fixed(pipe[i].scl_data.viewport.height); data->src_height[num_displays + 4] = bw_int_to_fixed(pipe[i].scl_data.viewport.height);
...@@ -2718,7 +2718,7 @@ static void populate_initial_data( ...@@ -2718,7 +2718,7 @@ static void populate_initial_data(
data->v_taps[num_displays + 4] = bw_int_to_fixed(pipe[i].scl_data.taps.v_taps); data->v_taps[num_displays + 4] = bw_int_to_fixed(pipe[i].scl_data.taps.v_taps);
data->h_scale_ratio[num_displays + 4] = fixed31_32_to_bw_fixed(pipe[i].scl_data.ratios.horz.value); data->h_scale_ratio[num_displays + 4] = fixed31_32_to_bw_fixed(pipe[i].scl_data.ratios.horz.value);
data->v_scale_ratio[num_displays + 4] = fixed31_32_to_bw_fixed(pipe[i].scl_data.ratios.vert.value); data->v_scale_ratio[num_displays + 4] = fixed31_32_to_bw_fixed(pipe[i].scl_data.ratios.vert.value);
switch (pipe[i].surface->rotation) { switch (pipe[i].plane_state->rotation) {
case ROTATION_ANGLE_0: case ROTATION_ANGLE_0:
data->rotation_angle[num_displays + 4] = bw_int_to_fixed(0); data->rotation_angle[num_displays + 4] = bw_int_to_fixed(0);
break; break;
...@@ -2734,7 +2734,7 @@ static void populate_initial_data( ...@@ -2734,7 +2734,7 @@ static void populate_initial_data(
default: default:
break; break;
} }
switch (pipe[i].surface->format) { switch (pipe[i].plane_state->format) {
case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr: case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr:
case SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb: case SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb:
case SURFACE_PIXEL_FORMAT_GRPH_ARGB1555: case SURFACE_PIXEL_FORMAT_GRPH_ARGB1555:
......
...@@ -233,16 +233,16 @@ static void pipe_ctx_to_e2e_pipe_params ( ...@@ -233,16 +233,16 @@ static void pipe_ctx_to_e2e_pipe_params (
struct _vcs_dpi_display_pipe_params_st *input) struct _vcs_dpi_display_pipe_params_st *input)
{ {
input->src.is_hsplit = false; input->src.is_hsplit = false;
if (pipe->top_pipe != NULL && pipe->top_pipe->surface == pipe->surface) if (pipe->top_pipe != NULL && pipe->top_pipe->plane_state == pipe->plane_state)
input->src.is_hsplit = true; input->src.is_hsplit = true;
else if (pipe->bottom_pipe != NULL && pipe->bottom_pipe->surface == pipe->surface) else if (pipe->bottom_pipe != NULL && pipe->bottom_pipe->plane_state == pipe->plane_state)
input->src.is_hsplit = true; input->src.is_hsplit = true;
input->src.dcc = pipe->surface->dcc.enable; input->src.dcc = pipe->plane_state->dcc.enable;
input->src.dcc_rate = 1; input->src.dcc_rate = 1;
input->src.meta_pitch = pipe->surface->dcc.grph.meta_pitch; input->src.meta_pitch = pipe->plane_state->dcc.grph.meta_pitch;
input->src.source_scan = dm_horz; input->src.source_scan = dm_horz;
input->src.sw_mode = pipe->surface->tiling_info.gfx9.swizzle; input->src.sw_mode = pipe->plane_state->tiling_info.gfx9.swizzle;
input->src.viewport_width = pipe->scl_data.viewport.width; input->src.viewport_width = pipe->scl_data.viewport.width;
input->src.viewport_height = pipe->scl_data.viewport.height; input->src.viewport_height = pipe->scl_data.viewport.height;
...@@ -251,7 +251,7 @@ static void pipe_ctx_to_e2e_pipe_params ( ...@@ -251,7 +251,7 @@ static void pipe_ctx_to_e2e_pipe_params (
input->src.cur0_src_width = 128; /* TODO: Cursor calcs, not curently stored */ input->src.cur0_src_width = 128; /* TODO: Cursor calcs, not curently stored */
input->src.cur0_bpp = 32; input->src.cur0_bpp = 32;
switch (pipe->surface->tiling_info.gfx9.swizzle) { switch (pipe->plane_state->tiling_info.gfx9.swizzle) {
/* for 4/8/16 high tiles */ /* for 4/8/16 high tiles */
case DC_SW_LINEAR: case DC_SW_LINEAR:
input->src.is_display_sw = 1; input->src.is_display_sw = 1;
...@@ -299,7 +299,7 @@ static void pipe_ctx_to_e2e_pipe_params ( ...@@ -299,7 +299,7 @@ static void pipe_ctx_to_e2e_pipe_params (
break; break;
} }
switch (pipe->surface->rotation) { switch (pipe->plane_state->rotation) {
case ROTATION_ANGLE_0: case ROTATION_ANGLE_0:
case ROTATION_ANGLE_180: case ROTATION_ANGLE_180:
input->src.source_scan = dm_horz; input->src.source_scan = dm_horz;
...@@ -314,7 +314,7 @@ static void pipe_ctx_to_e2e_pipe_params ( ...@@ -314,7 +314,7 @@ static void pipe_ctx_to_e2e_pipe_params (
} }
/* TODO: Fix pixel format mappings */ /* TODO: Fix pixel format mappings */
switch (pipe->surface->format) { switch (pipe->plane_state->format) {
case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr: case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr:
case SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb: case SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb:
input->src.source_format = dm_420_8; input->src.source_format = dm_420_8;
...@@ -455,7 +455,7 @@ static void dcn_bw_calc_rq_dlg_ttu( ...@@ -455,7 +455,7 @@ static void dcn_bw_calc_rq_dlg_ttu(
true, true,
true, true,
v->pte_enable == dcn_bw_yes, v->pte_enable == dcn_bw_yes,
pipe->surface->flip_immediate); pipe->plane_state->flip_immediate);
} }
static void dcn_dml_wm_override( static void dcn_dml_wm_override(
...@@ -478,7 +478,7 @@ static void dcn_dml_wm_override( ...@@ -478,7 +478,7 @@ static void dcn_dml_wm_override(
for (i = 0, in_idx = 0; i < pool->pipe_count; i++) { for (i = 0, in_idx = 0; i < pool->pipe_count; i++) {
struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i]; struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
if (!pipe->stream || !pipe->surface) if (!pipe->stream || !pipe->plane_state)
continue; continue;
input[in_idx].clks_cfg.dcfclk_mhz = v->dcfclk; input[in_idx].clks_cfg.dcfclk_mhz = v->dcfclk;
...@@ -516,7 +516,7 @@ static void dcn_dml_wm_override( ...@@ -516,7 +516,7 @@ static void dcn_dml_wm_override(
for (i = 0, in_idx = 0; i < pool->pipe_count; i++) { for (i = 0, in_idx = 0; i < pool->pipe_count; i++) {
struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i]; struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
if (!pipe->stream || !pipe->surface) if (!pipe->stream || !pipe->plane_state)
continue; continue;
dml_rq_dlg_get_dlg_reg(dml, dml_rq_dlg_get_dlg_reg(dml,
...@@ -527,7 +527,7 @@ static void dcn_dml_wm_override( ...@@ -527,7 +527,7 @@ static void dcn_dml_wm_override(
true, true,
true, true,
v->pte_enable == dcn_bw_yes, v->pte_enable == dcn_bw_yes,
pipe->surface->flip_immediate); pipe->plane_state->flip_immediate);
in_idx++; in_idx++;
} }
dm_free(input); dm_free(input);
...@@ -541,7 +541,7 @@ static void split_stream_across_pipes( ...@@ -541,7 +541,7 @@ static void split_stream_across_pipes(
{ {
int pipe_idx = secondary_pipe->pipe_idx; int pipe_idx = secondary_pipe->pipe_idx;
if (!primary_pipe->surface) if (!primary_pipe->plane_state)
return; return;
*secondary_pipe = *primary_pipe; *secondary_pipe = *primary_pipe;
...@@ -843,7 +843,7 @@ bool dcn_validate_bandwidth( ...@@ -843,7 +843,7 @@ bool dcn_validate_bandwidth(
if (!pipe->stream) if (!pipe->stream)
continue; continue;
/* skip all but first of split pipes */ /* skip all but first of split pipes */
if (pipe->top_pipe && pipe->top_pipe->surface == pipe->surface) if (pipe->top_pipe && pipe->top_pipe->plane_state == pipe->plane_state)
continue; continue;
v->underscan_output[input_idx] = false; /* taken care of in recout already*/ v->underscan_output[input_idx] = false; /* taken care of in recout already*/
...@@ -869,7 +869,7 @@ bool dcn_validate_bandwidth( ...@@ -869,7 +869,7 @@ bool dcn_validate_bandwidth(
} }
} }
if (!pipe->surface){ if (!pipe->plane_state) {
v->dcc_enable[input_idx] = dcn_bw_yes; v->dcc_enable[input_idx] = dcn_bw_yes;
v->source_pixel_format[input_idx] = dcn_bw_rgb_sub_32; v->source_pixel_format[input_idx] = dcn_bw_rgb_sub_32;
v->source_surface_mode[input_idx] = dcn_bw_sw_4_kb_s; v->source_surface_mode[input_idx] = dcn_bw_sw_4_kb_s;
...@@ -889,8 +889,8 @@ bool dcn_validate_bandwidth( ...@@ -889,8 +889,8 @@ bool dcn_validate_bandwidth(
v->viewport_width[input_idx] = pipe->scl_data.viewport.width; v->viewport_width[input_idx] = pipe->scl_data.viewport.width;
v->scaler_rec_out_width[input_idx] = pipe->scl_data.recout.width; v->scaler_rec_out_width[input_idx] = pipe->scl_data.recout.width;
v->scaler_recout_height[input_idx] = pipe->scl_data.recout.height; v->scaler_recout_height[input_idx] = pipe->scl_data.recout.height;
if (pipe->bottom_pipe && pipe->bottom_pipe->surface == pipe->surface) { if (pipe->bottom_pipe && pipe->bottom_pipe->plane_state == pipe->plane_state) {
if (pipe->surface->rotation % 2 == 0) { if (pipe->plane_state->rotation % 2 == 0) {
int viewport_end = pipe->scl_data.viewport.width int viewport_end = pipe->scl_data.viewport.width
+ pipe->scl_data.viewport.x; + pipe->scl_data.viewport.x;
int viewport_b_end = pipe->bottom_pipe->scl_data.viewport.width int viewport_b_end = pipe->bottom_pipe->scl_data.viewport.width
...@@ -919,17 +919,17 @@ bool dcn_validate_bandwidth( ...@@ -919,17 +919,17 @@ bool dcn_validate_bandwidth(
+ pipe->bottom_pipe->scl_data.recout.width; + pipe->bottom_pipe->scl_data.recout.width;
} }
v->dcc_enable[input_idx] = pipe->surface->dcc.enable ? dcn_bw_yes : dcn_bw_no; v->dcc_enable[input_idx] = pipe->plane_state->dcc.enable ? dcn_bw_yes : dcn_bw_no;
v->source_pixel_format[input_idx] = tl_pixel_format_to_bw_defs( v->source_pixel_format[input_idx] = tl_pixel_format_to_bw_defs(
pipe->surface->format); pipe->plane_state->format);
v->source_surface_mode[input_idx] = tl_sw_mode_to_bw_defs( v->source_surface_mode[input_idx] = tl_sw_mode_to_bw_defs(
pipe->surface->tiling_info.gfx9.swizzle); pipe->plane_state->tiling_info.gfx9.swizzle);
v->lb_bit_per_pixel[input_idx] = tl_lb_bpp_to_int(pipe->scl_data.lb_params.depth); v->lb_bit_per_pixel[input_idx] = tl_lb_bpp_to_int(pipe->scl_data.lb_params.depth);
v->override_hta_ps[input_idx] = pipe->scl_data.taps.h_taps; v->override_hta_ps[input_idx] = pipe->scl_data.taps.h_taps;
v->override_vta_ps[input_idx] = pipe->scl_data.taps.v_taps; v->override_vta_ps[input_idx] = pipe->scl_data.taps.v_taps;
v->override_hta_pschroma[input_idx] = pipe->scl_data.taps.h_taps_c; v->override_hta_pschroma[input_idx] = pipe->scl_data.taps.h_taps_c;
v->override_vta_pschroma[input_idx] = pipe->scl_data.taps.v_taps_c; v->override_vta_pschroma[input_idx] = pipe->scl_data.taps.v_taps_c;
v->source_scan[input_idx] = (pipe->surface->rotation % 2) ? dcn_bw_vert : dcn_bw_hor; v->source_scan[input_idx] = (pipe->plane_state->rotation % 2) ? dcn_bw_vert : dcn_bw_hor;
} }
if (v->is_line_buffer_bpp_fixed == dcn_bw_yes) if (v->is_line_buffer_bpp_fixed == dcn_bw_yes)
v->lb_bit_per_pixel[input_idx] = v->line_buffer_fixed_bpp; v->lb_bit_per_pixel[input_idx] = v->line_buffer_fixed_bpp;
...@@ -996,7 +996,7 @@ bool dcn_validate_bandwidth( ...@@ -996,7 +996,7 @@ bool dcn_validate_bandwidth(
if (!pipe->stream) if (!pipe->stream)
continue; continue;
/* skip all but first of split pipes */ /* skip all but first of split pipes */
if (pipe->top_pipe && pipe->top_pipe->surface == pipe->surface) if (pipe->top_pipe && pipe->top_pipe->plane_state == pipe->plane_state)
continue; continue;
pipe->pipe_dlg_param.vupdate_width = v->v_update_width[input_idx]; pipe->pipe_dlg_param.vupdate_width = v->v_update_width[input_idx];
...@@ -1024,7 +1024,7 @@ bool dcn_validate_bandwidth( ...@@ -1024,7 +1024,7 @@ bool dcn_validate_bandwidth(
pipe->pipe_dlg_param.vblank_start = asic_blank_start; pipe->pipe_dlg_param.vblank_start = asic_blank_start;
pipe->pipe_dlg_param.vblank_end = asic_blank_end; pipe->pipe_dlg_param.vblank_end = asic_blank_end;
if (pipe->surface) { if (pipe->plane_state) {
struct pipe_ctx *hsplit_pipe = pipe->bottom_pipe; struct pipe_ctx *hsplit_pipe = pipe->bottom_pipe;
if (v->dpp_per_plane[input_idx] == 2 || if (v->dpp_per_plane[input_idx] == 2 ||
...@@ -1036,7 +1036,7 @@ bool dcn_validate_bandwidth( ...@@ -1036,7 +1036,7 @@ bool dcn_validate_bandwidth(
TIMING_3D_FORMAT_TOP_AND_BOTTOM || TIMING_3D_FORMAT_TOP_AND_BOTTOM ||
pipe->stream->timing.timing_3d_format == pipe->stream->timing.timing_3d_format ==
TIMING_3D_FORMAT_SIDE_BY_SIDE))) { TIMING_3D_FORMAT_SIDE_BY_SIDE))) {
if (hsplit_pipe && hsplit_pipe->surface == pipe->surface) { if (hsplit_pipe && hsplit_pipe->plane_state == pipe->plane_state) {
/* update previously split pipe */ /* update previously split pipe */
hsplit_pipe->pipe_dlg_param.vupdate_width = v->v_update_width[input_idx]; hsplit_pipe->pipe_dlg_param.vupdate_width = v->v_update_width[input_idx];
hsplit_pipe->pipe_dlg_param.vupdate_offset = v->v_update_offset[input_idx]; hsplit_pipe->pipe_dlg_param.vupdate_offset = v->v_update_offset[input_idx];
...@@ -1057,12 +1057,12 @@ bool dcn_validate_bandwidth( ...@@ -1057,12 +1057,12 @@ bool dcn_validate_bandwidth(
} }
dcn_bw_calc_rq_dlg_ttu(dc, v, hsplit_pipe); dcn_bw_calc_rq_dlg_ttu(dc, v, hsplit_pipe);
} else if (hsplit_pipe && hsplit_pipe->surface == pipe->surface) { } else if (hsplit_pipe && hsplit_pipe->plane_state == pipe->plane_state) {
/* merge previously split pipe */ /* merge previously split pipe */
pipe->bottom_pipe = hsplit_pipe->bottom_pipe; pipe->bottom_pipe = hsplit_pipe->bottom_pipe;
if (hsplit_pipe->bottom_pipe) if (hsplit_pipe->bottom_pipe)
hsplit_pipe->bottom_pipe->top_pipe = pipe; hsplit_pipe->bottom_pipe->top_pipe = pipe;
hsplit_pipe->surface = NULL; hsplit_pipe->plane_state = NULL;
hsplit_pipe->stream = NULL; hsplit_pipe->stream = NULL;
hsplit_pipe->top_pipe = NULL; hsplit_pipe->top_pipe = NULL;
hsplit_pipe->bottom_pipe = NULL; hsplit_pipe->bottom_pipe = NULL;
......
...@@ -639,21 +639,21 @@ static bool is_validation_required( ...@@ -639,21 +639,21 @@ static bool is_validation_required(
for (i = 0; i < set_count; i++) { for (i = 0; i < set_count; i++) {
if (set[i].surface_count != context->stream_status[i].surface_count) if (set[i].plane_count != context->stream_status[i].plane_count)
return true; return true;
if (!dc_is_stream_unchanged(set[i].stream, context->streams[i])) if (!dc_is_stream_unchanged(set[i].stream, context->streams[i]))
return true; return true;
for (j = 0; j < set[i].surface_count; j++) { for (j = 0; j < set[i].plane_count; j++) {
struct dc_plane_state temp_surf; struct dc_plane_state temp_plane;
memset(&temp_surf, 0, sizeof(temp_surf)); memset(&temp_plane, 0, sizeof(temp_plane));
temp_surf = *context->stream_status[i].surfaces[j]; temp_plane = *context->stream_status[i].plane_states[j];
temp_surf.clip_rect = set[i].surfaces[j]->clip_rect; temp_plane.clip_rect = set[i].plane_states[j]->clip_rect;
temp_surf.dst_rect.x = set[i].surfaces[j]->dst_rect.x; temp_plane.dst_rect.x = set[i].plane_states[j]->dst_rect.x;
temp_surf.dst_rect.y = set[i].surfaces[j]->dst_rect.y; temp_plane.dst_rect.y = set[i].plane_states[j]->dst_rect.y;
if (memcmp(&temp_surf, set[i].surfaces[j], sizeof(temp_surf)) != 0) if (memcmp(&temp_plane, set[i].plane_states[j], sizeof(temp_plane)) != 0)
return true; return true;
} }
} }
...@@ -683,8 +683,8 @@ static bool validate_surfaces( ...@@ -683,8 +683,8 @@ static bool validate_surfaces(
int i, j; int i, j;
for (i = 0; i < set_count; i++) for (i = 0; i < set_count; i++)
for (j = 0; j < set[i].surface_count; j++) for (j = 0; j < set[i].plane_count; j++)
if (!dc_validate_plane(dc, set[i].surfaces[j])) if (!dc_validate_plane(dc, set[i].plane_states[j]))
return false; return false;
return true; return true;
...@@ -977,11 +977,11 @@ static bool dc_commit_context_no_check(struct dc *dc, struct validate_context *c ...@@ -977,11 +977,11 @@ static bool dc_commit_context_no_check(struct dc *dc, struct validate_context *c
for (i = 0; i < context->stream_count; i++) { for (i = 0; i < context->stream_count; i++) {
const struct dc_sink *sink = context->streams[i]->sink; const struct dc_sink *sink = context->streams[i]->sink;
for (j = 0; j < context->stream_status[i].surface_count; j++) { for (j = 0; j < context->stream_status[i].plane_count; j++) {
const struct dc_plane_state *surface = const struct dc_plane_state *plane_state =
context->stream_status[i].surfaces[j]; context->stream_status[i].plane_states[j];
core_dc->hwss.apply_ctx_for_surface(core_dc, surface, context); core_dc->hwss.apply_ctx_for_surface(core_dc, plane_state, context);
/* /*
* enable stereo * enable stereo
...@@ -1073,9 +1073,9 @@ bool dc_commit_streams( ...@@ -1073,9 +1073,9 @@ bool dc_commit_streams(
set[i].stream = stream; set[i].stream = stream;
if (status) { if (status) {
set[i].surface_count = status->surface_count; set[i].plane_count = status->plane_count;
for (j = 0; j < status->surface_count; j++) for (j = 0; j < status->plane_count; j++)
set[i].surfaces[j] = status->surfaces[j]; set[i].plane_states[j] = status->plane_states[j];
} }
} }
...@@ -1122,7 +1122,7 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc) ...@@ -1122,7 +1122,7 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)
for (i = 0; i < core_dc->res_pool->pipe_count; i++) for (i = 0; i < core_dc->res_pool->pipe_count; i++)
if (context->res_ctx.pipe_ctx[i].stream == NULL if (context->res_ctx.pipe_ctx[i].stream == NULL
|| context->res_ctx.pipe_ctx[i].surface == NULL) || context->res_ctx.pipe_ctx[i].plane_state == NULL)
core_dc->hwss.power_down_front_end(core_dc, i); core_dc->hwss.power_down_front_end(core_dc, i);
/* 3rd param should be true, temp w/a for RV*/ /* 3rd param should be true, temp w/a for RV*/
...@@ -1134,10 +1134,10 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc) ...@@ -1134,10 +1134,10 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)
return true; return true;
} }
bool dc_commit_surfaces_to_stream( bool dc_commit_planes_to_stream(
struct dc *dc, struct dc *dc,
struct dc_plane_state **new_surfaces, struct dc_plane_state **plane_states,
uint8_t new_surface_count, uint8_t new_plane_count,
struct dc_stream_state *dc_stream) struct dc_stream_state *dc_stream)
{ {
struct dc_surface_update updates[MAX_SURFACES]; struct dc_surface_update updates[MAX_SURFACES];
...@@ -1162,37 +1162,37 @@ bool dc_commit_surfaces_to_stream( ...@@ -1162,37 +1162,37 @@ bool dc_commit_surfaces_to_stream(
stream_update->dst = dc_stream->dst; stream_update->dst = dc_stream->dst;
stream_update->out_transfer_func = dc_stream->out_transfer_func; stream_update->out_transfer_func = dc_stream->out_transfer_func;
for (i = 0; i < new_surface_count; i++) { for (i = 0; i < new_plane_count; i++) {
updates[i].surface = new_surfaces[i]; updates[i].surface = plane_states[i];
updates[i].gamma = updates[i].gamma =
(struct dc_gamma *)new_surfaces[i]->gamma_correction; (struct dc_gamma *)plane_states[i]->gamma_correction;
updates[i].in_transfer_func = new_surfaces[i]->in_transfer_func; updates[i].in_transfer_func = plane_states[i]->in_transfer_func;
flip_addr[i].address = new_surfaces[i]->address; flip_addr[i].address = plane_states[i]->address;
flip_addr[i].flip_immediate = new_surfaces[i]->flip_immediate; flip_addr[i].flip_immediate = plane_states[i]->flip_immediate;
plane_info[i].color_space = new_surfaces[i]->color_space; plane_info[i].color_space = plane_states[i]->color_space;
plane_info[i].format = new_surfaces[i]->format; plane_info[i].format = plane_states[i]->format;
plane_info[i].plane_size = new_surfaces[i]->plane_size; plane_info[i].plane_size = plane_states[i]->plane_size;
plane_info[i].rotation = new_surfaces[i]->rotation; plane_info[i].rotation = plane_states[i]->rotation;
plane_info[i].horizontal_mirror = new_surfaces[i]->horizontal_mirror; plane_info[i].horizontal_mirror = plane_states[i]->horizontal_mirror;
plane_info[i].stereo_format = new_surfaces[i]->stereo_format; plane_info[i].stereo_format = plane_states[i]->stereo_format;
plane_info[i].tiling_info = new_surfaces[i]->tiling_info; plane_info[i].tiling_info = plane_states[i]->tiling_info;
plane_info[i].visible = new_surfaces[i]->visible; plane_info[i].visible = plane_states[i]->visible;
plane_info[i].per_pixel_alpha = new_surfaces[i]->per_pixel_alpha; plane_info[i].per_pixel_alpha = plane_states[i]->per_pixel_alpha;
plane_info[i].dcc = new_surfaces[i]->dcc; plane_info[i].dcc = plane_states[i]->dcc;
scaling_info[i].scaling_quality = new_surfaces[i]->scaling_quality; scaling_info[i].scaling_quality = plane_states[i]->scaling_quality;
scaling_info[i].src_rect = new_surfaces[i]->src_rect; scaling_info[i].src_rect = plane_states[i]->src_rect;
scaling_info[i].dst_rect = new_surfaces[i]->dst_rect; scaling_info[i].dst_rect = plane_states[i]->dst_rect;
scaling_info[i].clip_rect = new_surfaces[i]->clip_rect; scaling_info[i].clip_rect = plane_states[i]->clip_rect;
updates[i].flip_addr = &flip_addr[i]; updates[i].flip_addr = &flip_addr[i];
updates[i].plane_info = &plane_info[i]; updates[i].plane_info = &plane_info[i];
updates[i].scaling_info = &scaling_info[i]; updates[i].scaling_info = &scaling_info[i];
} }
dc_update_surfaces_and_stream( dc_update_planes_and_stream(
dc, dc,
updates, updates,
new_surface_count, new_plane_count,
dc_stream, stream_update); dc_stream, stream_update);
dc_post_update_surfaces_to_stream(dc); dc_post_update_surfaces_to_stream(dc);
...@@ -1220,14 +1220,14 @@ void dc_release_validate_context(struct validate_context *context) ...@@ -1220,14 +1220,14 @@ void dc_release_validate_context(struct validate_context *context)
static bool is_surface_in_context( static bool is_surface_in_context(
const struct validate_context *context, const struct validate_context *context,
const struct dc_plane_state *surface) const struct dc_plane_state *plane_state)
{ {
int j; int j;
for (j = 0; j < MAX_PIPES; j++) { for (j = 0; j < MAX_PIPES; j++) {
const struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j]; const struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
if (surface == pipe_ctx->surface) { if (plane_state == pipe_ctx->plane_state) {
return true; return true;
} }
} }
...@@ -1371,7 +1371,7 @@ enum surface_update_type dc_check_update_surfaces_for_stream( ...@@ -1371,7 +1371,7 @@ enum surface_update_type dc_check_update_surfaces_for_stream(
int i; int i;
enum surface_update_type overall_type = UPDATE_TYPE_FAST; enum surface_update_type overall_type = UPDATE_TYPE_FAST;
if (stream_status == NULL || stream_status->surface_count != surface_count) if (stream_status == NULL || stream_status->plane_count != surface_count)
return UPDATE_TYPE_FULL; return UPDATE_TYPE_FULL;
if (stream_update) if (stream_update)
...@@ -1393,7 +1393,7 @@ enum surface_update_type dc_check_update_surfaces_for_stream( ...@@ -1393,7 +1393,7 @@ enum surface_update_type dc_check_update_surfaces_for_stream(
enum surface_update_type update_surface_trace_level = UPDATE_TYPE_FULL; enum surface_update_type update_surface_trace_level = UPDATE_TYPE_FULL;
void dc_update_surfaces_and_stream(struct dc *dc, void dc_update_planes_and_stream(struct dc *dc,
struct dc_surface_update *srf_updates, int surface_count, struct dc_surface_update *srf_updates, int surface_count,
struct dc_stream_state *stream, struct dc_stream_state *stream,
struct dc_stream_update *stream_update) struct dc_stream_update *stream_update)
...@@ -1470,10 +1470,10 @@ void dc_update_surfaces_and_stream(struct dc *dc, ...@@ -1470,10 +1470,10 @@ void dc_update_surfaces_and_stream(struct dc *dc,
update_surface_trace(dc, srf_updates, surface_count); update_surface_trace(dc, srf_updates, surface_count);
if (update_type >= UPDATE_TYPE_FULL) { if (update_type >= UPDATE_TYPE_FULL) {
struct dc_plane_state *new_surfaces[MAX_SURFACES] = {0}; struct dc_plane_state *new_planes[MAX_SURFACES] = {0};
for (i = 0; i < surface_count; i++) for (i = 0; i < surface_count; i++)
new_surfaces[i] = srf_updates[i].surface; new_planes[i] = srf_updates[i].surface;
/* initialize scratch memory for building context */ /* initialize scratch memory for building context */
context = dm_alloc(sizeof(*context)); context = dm_alloc(sizeof(*context));
...@@ -1487,7 +1487,7 @@ void dc_update_surfaces_and_stream(struct dc *dc, ...@@ -1487,7 +1487,7 @@ void dc_update_surfaces_and_stream(struct dc *dc,
/* add surface to context */ /* add surface to context */
if (!resource_attach_surfaces_to_context( if (!resource_attach_surfaces_to_context(
new_surfaces, surface_count, stream, new_planes, surface_count, stream,
context, core_dc->res_pool)) { context, core_dc->res_pool)) {
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
goto fail; goto fail;
...@@ -1542,7 +1542,7 @@ void dc_update_surfaces_and_stream(struct dc *dc, ...@@ -1542,7 +1542,7 @@ void dc_update_surfaces_and_stream(struct dc *dc,
for (j = 0; j < core_dc->res_pool->pipe_count; j++) { for (j = 0; j < core_dc->res_pool->pipe_count; j++) {
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j]; struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
if (pipe_ctx->surface != surface) if (pipe_ctx->plane_state != surface)
continue; continue;
resource_build_scaling_params(pipe_ctx); resource_build_scaling_params(pipe_ctx);
...@@ -1599,14 +1599,14 @@ void dc_update_surfaces_and_stream(struct dc *dc, ...@@ -1599,14 +1599,14 @@ void dc_update_surfaces_and_stream(struct dc *dc,
/* Lock pipes for provided surfaces, or all active if full update*/ /* Lock pipes for provided surfaces, or all active if full update*/
for (i = 0; i < surface_count; i++) { for (i = 0; i < surface_count; i++) {
struct dc_plane_state *surface = srf_updates[i].surface; struct dc_plane_state *plane_state = srf_updates[i].surface;
for (j = 0; j < core_dc->res_pool->pipe_count; j++) { for (j = 0; j < core_dc->res_pool->pipe_count; j++) {
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j]; struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
if (update_type != UPDATE_TYPE_FULL && pipe_ctx->surface != surface) if (update_type != UPDATE_TYPE_FULL && pipe_ctx->plane_state != plane_state)
continue; continue;
if (!pipe_ctx->surface || pipe_ctx->top_pipe) if (!pipe_ctx->plane_state || pipe_ctx->top_pipe)
continue; continue;
core_dc->hwss.pipe_control_lock( core_dc->hwss.pipe_control_lock(
...@@ -1622,15 +1622,15 @@ void dc_update_surfaces_and_stream(struct dc *dc, ...@@ -1622,15 +1622,15 @@ void dc_update_surfaces_and_stream(struct dc *dc,
for (j = 0; j < core_dc->res_pool->pipe_count; j++) { for (j = 0; j < core_dc->res_pool->pipe_count; j++) {
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j]; struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
struct pipe_ctx *cur_pipe_ctx = &core_dc->current_context->res_ctx.pipe_ctx[j]; struct pipe_ctx *cur_pipe_ctx = &core_dc->current_context->res_ctx.pipe_ctx[j];
bool is_new_pipe_surface = cur_pipe_ctx->surface != pipe_ctx->surface; bool is_new_pipe_surface = cur_pipe_ctx->plane_state != pipe_ctx->plane_state;
struct dc_cursor_position position = { 0 }; struct dc_cursor_position position = { 0 };
if (update_type != UPDATE_TYPE_FULL || !pipe_ctx->surface) if (update_type != UPDATE_TYPE_FULL || !pipe_ctx->plane_state)
continue; continue;
if (!pipe_ctx->top_pipe) if (!pipe_ctx->top_pipe)
core_dc->hwss.apply_ctx_for_surface( core_dc->hwss.apply_ctx_for_surface(
core_dc, pipe_ctx->surface, context); core_dc, pipe_ctx->plane_state, context);
/* TODO: this is a hack w/a for switching from mpo to pipe split */ /* TODO: this is a hack w/a for switching from mpo to pipe split */
dc_stream_set_cursor_position(pipe_ctx->stream, &position); dc_stream_set_cursor_position(pipe_ctx->stream, &position);
...@@ -1638,7 +1638,7 @@ void dc_update_surfaces_and_stream(struct dc *dc, ...@@ -1638,7 +1638,7 @@ void dc_update_surfaces_and_stream(struct dc *dc,
if (is_new_pipe_surface) { if (is_new_pipe_surface) {
core_dc->hwss.update_plane_addr(core_dc, pipe_ctx); core_dc->hwss.update_plane_addr(core_dc, pipe_ctx);
core_dc->hwss.set_input_transfer_func( core_dc->hwss.set_input_transfer_func(
pipe_ctx, pipe_ctx->surface); pipe_ctx, pipe_ctx->plane_state);
core_dc->hwss.set_output_transfer_func( core_dc->hwss.set_output_transfer_func(
pipe_ctx, pipe_ctx->stream); pipe_ctx, pipe_ctx->stream);
} }
...@@ -1649,16 +1649,16 @@ void dc_update_surfaces_and_stream(struct dc *dc, ...@@ -1649,16 +1649,16 @@ void dc_update_surfaces_and_stream(struct dc *dc,
/* Perform requested Updates */ /* Perform requested Updates */
for (i = 0; i < surface_count; i++) { for (i = 0; i < surface_count; i++) {
struct dc_plane_state *surface = srf_updates[i].surface; struct dc_plane_state *plane_state = srf_updates[i].surface;
if (update_type == UPDATE_TYPE_MED) if (update_type == UPDATE_TYPE_MED)
core_dc->hwss.apply_ctx_for_surface( core_dc->hwss.apply_ctx_for_surface(
core_dc, surface, context); core_dc, plane_state, context);
for (j = 0; j < core_dc->res_pool->pipe_count; j++) { for (j = 0; j < core_dc->res_pool->pipe_count; j++) {
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j]; struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
if (pipe_ctx->surface != surface) if (pipe_ctx->plane_state != plane_state)
continue; continue;
if (srf_updates[i].flip_addr) if (srf_updates[i].flip_addr)
...@@ -1669,7 +1669,7 @@ void dc_update_surfaces_and_stream(struct dc *dc, ...@@ -1669,7 +1669,7 @@ void dc_update_surfaces_and_stream(struct dc *dc,
if (srf_updates[i].in_transfer_func) if (srf_updates[i].in_transfer_func)
core_dc->hwss.set_input_transfer_func( core_dc->hwss.set_input_transfer_func(
pipe_ctx, pipe_ctx->surface); pipe_ctx, pipe_ctx->plane_state);
if (stream_update != NULL && if (stream_update != NULL &&
stream_update->out_transfer_func != NULL) { stream_update->out_transfer_func != NULL) {
...@@ -1690,9 +1690,9 @@ void dc_update_surfaces_and_stream(struct dc *dc, ...@@ -1690,9 +1690,9 @@ void dc_update_surfaces_and_stream(struct dc *dc,
for (j = 0; j < surface_count; j++) { for (j = 0; j < surface_count; j++) {
if (update_type != UPDATE_TYPE_FULL && if (update_type != UPDATE_TYPE_FULL &&
srf_updates[j].surface != pipe_ctx->surface) srf_updates[j].surface != pipe_ctx->plane_state)
continue; continue;
if (!pipe_ctx->surface || pipe_ctx->top_pipe) if (!pipe_ctx->plane_state || pipe_ctx->top_pipe)
continue; continue;
core_dc->hwss.pipe_control_lock( core_dc->hwss.pipe_control_lock(
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
void pre_surface_trace( void pre_surface_trace(
const struct dc *dc, const struct dc *dc,
const struct dc_plane_state *const *surfaces, const struct dc_plane_state *const *plane_states,
int surface_count) int surface_count)
{ {
int i; int i;
...@@ -46,111 +46,111 @@ void pre_surface_trace( ...@@ -46,111 +46,111 @@ void pre_surface_trace(
struct dal_logger *logger = core_dc->ctx->logger; struct dal_logger *logger = core_dc->ctx->logger;
for (i = 0; i < surface_count; i++) { for (i = 0; i < surface_count; i++) {
const struct dc_plane_state *surface = surfaces[i]; const struct dc_plane_state *plane_state = plane_states[i];
SURFACE_TRACE("Surface %d:\n", i); SURFACE_TRACE("Planes %d:\n", i);
SURFACE_TRACE( SURFACE_TRACE(
"surface->visible = %d;\n" "plane_state->visible = %d;\n"
"surface->flip_immediate = %d;\n" "plane_state->flip_immediate = %d;\n"
"surface->address.type = %d;\n" "plane_state->address.type = %d;\n"
"surface->address.grph.addr.quad_part = 0x%X;\n" "plane_state->address.grph.addr.quad_part = 0x%X;\n"
"surface->address.grph.meta_addr.quad_part = 0x%X;\n" "plane_state->address.grph.meta_addr.quad_part = 0x%X;\n"
"surface->scaling_quality.h_taps = %d;\n" "plane_state->scaling_quality.h_taps = %d;\n"
"surface->scaling_quality.v_taps = %d;\n" "plane_state->scaling_quality.v_taps = %d;\n"
"surface->scaling_quality.h_taps_c = %d;\n" "plane_state->scaling_quality.h_taps_c = %d;\n"
"surface->scaling_quality.v_taps_c = %d;\n", "plane_state->scaling_quality.v_taps_c = %d;\n",
surface->visible, plane_state->visible,
surface->flip_immediate, plane_state->flip_immediate,
surface->address.type, plane_state->address.type,
surface->address.grph.addr.quad_part, plane_state->address.grph.addr.quad_part,
surface->address.grph.meta_addr.quad_part, plane_state->address.grph.meta_addr.quad_part,
surface->scaling_quality.h_taps, plane_state->scaling_quality.h_taps,
surface->scaling_quality.v_taps, plane_state->scaling_quality.v_taps,
surface->scaling_quality.h_taps_c, plane_state->scaling_quality.h_taps_c,
surface->scaling_quality.v_taps_c); plane_state->scaling_quality.v_taps_c);
SURFACE_TRACE( SURFACE_TRACE(
"surface->src_rect.x = %d;\n" "plane_state->src_rect.x = %d;\n"
"surface->src_rect.y = %d;\n" "plane_state->src_rect.y = %d;\n"
"surface->src_rect.width = %d;\n" "plane_state->src_rect.width = %d;\n"
"surface->src_rect.height = %d;\n" "plane_state->src_rect.height = %d;\n"
"surface->dst_rect.x = %d;\n" "plane_state->dst_rect.x = %d;\n"
"surface->dst_rect.y = %d;\n" "plane_state->dst_rect.y = %d;\n"
"surface->dst_rect.width = %d;\n" "plane_state->dst_rect.width = %d;\n"
"surface->dst_rect.height = %d;\n" "plane_state->dst_rect.height = %d;\n"
"surface->clip_rect.x = %d;\n" "plane_state->clip_rect.x = %d;\n"
"surface->clip_rect.y = %d;\n" "plane_state->clip_rect.y = %d;\n"
"surface->clip_rect.width = %d;\n" "plane_state->clip_rect.width = %d;\n"
"surface->clip_rect.height = %d;\n", "plane_state->clip_rect.height = %d;\n",
surface->src_rect.x, plane_state->src_rect.x,
surface->src_rect.y, plane_state->src_rect.y,
surface->src_rect.width, plane_state->src_rect.width,
surface->src_rect.height, plane_state->src_rect.height,
surface->dst_rect.x, plane_state->dst_rect.x,
surface->dst_rect.y, plane_state->dst_rect.y,
surface->dst_rect.width, plane_state->dst_rect.width,
surface->dst_rect.height, plane_state->dst_rect.height,
surface->clip_rect.x, plane_state->clip_rect.x,
surface->clip_rect.y, plane_state->clip_rect.y,
surface->clip_rect.width, plane_state->clip_rect.width,
surface->clip_rect.height); plane_state->clip_rect.height);
SURFACE_TRACE( SURFACE_TRACE(
"surface->plane_size.grph.surface_size.x = %d;\n" "plane_state->plane_size.grph.surface_size.x = %d;\n"
"surface->plane_size.grph.surface_size.y = %d;\n" "plane_state->plane_size.grph.surface_size.y = %d;\n"
"surface->plane_size.grph.surface_size.width = %d;\n" "plane_state->plane_size.grph.surface_size.width = %d;\n"
"surface->plane_size.grph.surface_size.height = %d;\n" "plane_state->plane_size.grph.surface_size.height = %d;\n"
"surface->plane_size.grph.surface_pitch = %d;\n", "plane_state->plane_size.grph.surface_pitch = %d;\n",
surface->plane_size.grph.surface_size.x, plane_state->plane_size.grph.surface_size.x,
surface->plane_size.grph.surface_size.y, plane_state->plane_size.grph.surface_size.y,
surface->plane_size.grph.surface_size.width, plane_state->plane_size.grph.surface_size.width,
surface->plane_size.grph.surface_size.height, plane_state->plane_size.grph.surface_size.height,
surface->plane_size.grph.surface_pitch); plane_state->plane_size.grph.surface_pitch);
SURFACE_TRACE( SURFACE_TRACE(
"surface->tiling_info.gfx8.num_banks = %d;\n" "plane_state->tiling_info.gfx8.num_banks = %d;\n"
"surface->tiling_info.gfx8.bank_width = %d;\n" "plane_state->tiling_info.gfx8.bank_width = %d;\n"
"surface->tiling_info.gfx8.bank_width_c = %d;\n" "plane_state->tiling_info.gfx8.bank_width_c = %d;\n"
"surface->tiling_info.gfx8.bank_height = %d;\n" "plane_state->tiling_info.gfx8.bank_height = %d;\n"
"surface->tiling_info.gfx8.bank_height_c = %d;\n" "plane_state->tiling_info.gfx8.bank_height_c = %d;\n"
"surface->tiling_info.gfx8.tile_aspect = %d;\n" "plane_state->tiling_info.gfx8.tile_aspect = %d;\n"
"surface->tiling_info.gfx8.tile_aspect_c = %d;\n" "plane_state->tiling_info.gfx8.tile_aspect_c = %d;\n"
"surface->tiling_info.gfx8.tile_split = %d;\n" "plane_state->tiling_info.gfx8.tile_split = %d;\n"
"surface->tiling_info.gfx8.tile_split_c = %d;\n" "plane_state->tiling_info.gfx8.tile_split_c = %d;\n"
"surface->tiling_info.gfx8.tile_mode = %d;\n" "plane_state->tiling_info.gfx8.tile_mode = %d;\n"
"surface->tiling_info.gfx8.tile_mode_c = %d;\n", "plane_state->tiling_info.gfx8.tile_mode_c = %d;\n",
surface->tiling_info.gfx8.num_banks, plane_state->tiling_info.gfx8.num_banks,
surface->tiling_info.gfx8.bank_width, plane_state->tiling_info.gfx8.bank_width,
surface->tiling_info.gfx8.bank_width_c, plane_state->tiling_info.gfx8.bank_width_c,
surface->tiling_info.gfx8.bank_height, plane_state->tiling_info.gfx8.bank_height,
surface->tiling_info.gfx8.bank_height_c, plane_state->tiling_info.gfx8.bank_height_c,
surface->tiling_info.gfx8.tile_aspect, plane_state->tiling_info.gfx8.tile_aspect,
surface->tiling_info.gfx8.tile_aspect_c, plane_state->tiling_info.gfx8.tile_aspect_c,
surface->tiling_info.gfx8.tile_split, plane_state->tiling_info.gfx8.tile_split,
surface->tiling_info.gfx8.tile_split_c, plane_state->tiling_info.gfx8.tile_split_c,
surface->tiling_info.gfx8.tile_mode, plane_state->tiling_info.gfx8.tile_mode,
surface->tiling_info.gfx8.tile_mode_c); plane_state->tiling_info.gfx8.tile_mode_c);
SURFACE_TRACE( SURFACE_TRACE(
"surface->tiling_info.gfx8.pipe_config = %d;\n" "plane_state->tiling_info.gfx8.pipe_config = %d;\n"
"surface->tiling_info.gfx8.array_mode = %d;\n" "plane_state->tiling_info.gfx8.array_mode = %d;\n"
"surface->color_space = %d;\n" "plane_state->color_space = %d;\n"
"surface->dcc.enable = %d;\n" "plane_state->dcc.enable = %d;\n"
"surface->format = %d;\n" "plane_state->format = %d;\n"
"surface->rotation = %d;\n" "plane_state->rotation = %d;\n"
"surface->stereo_format = %d;\n", "plane_state->stereo_format = %d;\n",
surface->tiling_info.gfx8.pipe_config, plane_state->tiling_info.gfx8.pipe_config,
surface->tiling_info.gfx8.array_mode, plane_state->tiling_info.gfx8.array_mode,
surface->color_space, plane_state->color_space,
surface->dcc.enable, plane_state->dcc.enable,
surface->format, plane_state->format,
surface->rotation, plane_state->rotation,
surface->stereo_format); plane_state->stereo_format);
SURFACE_TRACE("surface->tiling_info.gfx9.swizzle = %d;\n", SURFACE_TRACE("plane_state->tiling_info.gfx9.swizzle = %d;\n",
surface->tiling_info.gfx9.swizzle); plane_state->tiling_info.gfx9.swizzle);
SURFACE_TRACE("\n"); SURFACE_TRACE("\n");
} }
......
...@@ -430,17 +430,17 @@ static void rect_swap_helper(struct rect *rect) ...@@ -430,17 +430,17 @@ static void rect_swap_helper(struct rect *rect)
static void calculate_viewport(struct pipe_ctx *pipe_ctx) static void calculate_viewport(struct pipe_ctx *pipe_ctx)
{ {
const struct dc_plane_state *surface = pipe_ctx->surface; const struct dc_plane_state *plane_state = pipe_ctx->plane_state;
const struct dc_stream_state *stream = pipe_ctx->stream; const struct dc_stream_state *stream = pipe_ctx->stream;
struct scaler_data *data = &pipe_ctx->scl_data; struct scaler_data *data = &pipe_ctx->scl_data;
struct rect surf_src = surface->src_rect; struct rect surf_src = plane_state->src_rect;
struct rect clip = { 0 }; struct rect clip = { 0 };
int vpc_div = (data->format == PIXEL_FORMAT_420BPP8 int vpc_div = (data->format == PIXEL_FORMAT_420BPP8
|| data->format == PIXEL_FORMAT_420BPP10) ? 2 : 1; || data->format == PIXEL_FORMAT_420BPP10) ? 2 : 1;
bool pri_split = pipe_ctx->bottom_pipe && bool pri_split = pipe_ctx->bottom_pipe &&
pipe_ctx->bottom_pipe->surface == pipe_ctx->surface; pipe_ctx->bottom_pipe->plane_state == pipe_ctx->plane_state;
bool sec_split = pipe_ctx->top_pipe && bool sec_split = pipe_ctx->top_pipe &&
pipe_ctx->top_pipe->surface == pipe_ctx->surface; pipe_ctx->top_pipe->plane_state == pipe_ctx->plane_state;
if (stream->view_format == VIEW_3D_FORMAT_SIDE_BY_SIDE || if (stream->view_format == VIEW_3D_FORMAT_SIDE_BY_SIDE ||
stream->view_format == VIEW_3D_FORMAT_TOP_AND_BOTTOM) { stream->view_format == VIEW_3D_FORMAT_TOP_AND_BOTTOM) {
...@@ -448,41 +448,41 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx) ...@@ -448,41 +448,41 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx)
sec_split = false; sec_split = false;
} }
if (pipe_ctx->surface->rotation == ROTATION_ANGLE_90 || if (pipe_ctx->plane_state->rotation == ROTATION_ANGLE_90 ||
pipe_ctx->surface->rotation == ROTATION_ANGLE_270) pipe_ctx->plane_state->rotation == ROTATION_ANGLE_270)
rect_swap_helper(&surf_src); rect_swap_helper(&surf_src);
/* The actual clip is an intersection between stream /* The actual clip is an intersection between stream
* source and surface clip * source and surface clip
*/ */
clip.x = stream->src.x > surface->clip_rect.x ? clip.x = stream->src.x > plane_state->clip_rect.x ?
stream->src.x : surface->clip_rect.x; stream->src.x : plane_state->clip_rect.x;
clip.width = stream->src.x + stream->src.width < clip.width = stream->src.x + stream->src.width <
surface->clip_rect.x + surface->clip_rect.width ? plane_state->clip_rect.x + plane_state->clip_rect.width ?
stream->src.x + stream->src.width - clip.x : stream->src.x + stream->src.width - clip.x :
surface->clip_rect.x + surface->clip_rect.width - clip.x ; plane_state->clip_rect.x + plane_state->clip_rect.width - clip.x ;
clip.y = stream->src.y > surface->clip_rect.y ? clip.y = stream->src.y > plane_state->clip_rect.y ?
stream->src.y : surface->clip_rect.y; stream->src.y : plane_state->clip_rect.y;
clip.height = stream->src.y + stream->src.height < clip.height = stream->src.y + stream->src.height <
surface->clip_rect.y + surface->clip_rect.height ? plane_state->clip_rect.y + plane_state->clip_rect.height ?
stream->src.y + stream->src.height - clip.y : stream->src.y + stream->src.height - clip.y :
surface->clip_rect.y + surface->clip_rect.height - clip.y ; plane_state->clip_rect.y + plane_state->clip_rect.height - clip.y ;
/* offset = surf_src.ofs + (clip.ofs - surface->dst_rect.ofs) * scl_ratio /* offset = surf_src.ofs + (clip.ofs - surface->dst_rect.ofs) * scl_ratio
* num_pixels = clip.num_pix * scl_ratio * num_pixels = clip.num_pix * scl_ratio
*/ */
data->viewport.x = surf_src.x + (clip.x - surface->dst_rect.x) * data->viewport.x = surf_src.x + (clip.x - plane_state->dst_rect.x) *
surf_src.width / surface->dst_rect.width; surf_src.width / plane_state->dst_rect.width;
data->viewport.width = clip.width * data->viewport.width = clip.width *
surf_src.width / surface->dst_rect.width; surf_src.width / plane_state->dst_rect.width;
data->viewport.y = surf_src.y + (clip.y - surface->dst_rect.y) * data->viewport.y = surf_src.y + (clip.y - plane_state->dst_rect.y) *
surf_src.height / surface->dst_rect.height; surf_src.height / plane_state->dst_rect.height;
data->viewport.height = clip.height * data->viewport.height = clip.height *
surf_src.height / surface->dst_rect.height; surf_src.height / plane_state->dst_rect.height;
/* Round down, compensate in init */ /* Round down, compensate in init */
data->viewport_c.x = data->viewport.x / vpc_div; data->viewport_c.x = data->viewport.x / vpc_div;
...@@ -498,13 +498,13 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx) ...@@ -498,13 +498,13 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx)
/* Handle hsplit */ /* Handle hsplit */
if (pri_split || sec_split) { if (pri_split || sec_split) {
/* HMirror XOR Secondary_pipe XOR Rotation_180 */ /* HMirror XOR Secondary_pipe XOR Rotation_180 */
bool right_view = (sec_split != surface->horizontal_mirror) != bool right_view = (sec_split != plane_state->horizontal_mirror) !=
(surface->rotation == ROTATION_ANGLE_180); (plane_state->rotation == ROTATION_ANGLE_180);
if (surface->rotation == ROTATION_ANGLE_90 if (plane_state->rotation == ROTATION_ANGLE_90
|| surface->rotation == ROTATION_ANGLE_270) || plane_state->rotation == ROTATION_ANGLE_270)
/* Secondary_pipe XOR Rotation_270 */ /* Secondary_pipe XOR Rotation_270 */
right_view = (surface->rotation == ROTATION_ANGLE_270) != sec_split; right_view = (plane_state->rotation == ROTATION_ANGLE_270) != sec_split;
if (right_view) { if (right_view) {
data->viewport.width /= 2; data->viewport.width /= 2;
...@@ -520,8 +520,8 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx) ...@@ -520,8 +520,8 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx)
} }
} }
if (surface->rotation == ROTATION_ANGLE_90 || if (plane_state->rotation == ROTATION_ANGLE_90 ||
surface->rotation == ROTATION_ANGLE_270) { plane_state->rotation == ROTATION_ANGLE_270) {
rect_swap_helper(&data->viewport_c); rect_swap_helper(&data->viewport_c);
rect_swap_helper(&data->viewport); rect_swap_helper(&data->viewport);
} }
...@@ -529,14 +529,14 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx) ...@@ -529,14 +529,14 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx)
static void calculate_recout(struct pipe_ctx *pipe_ctx, struct view *recout_skip) static void calculate_recout(struct pipe_ctx *pipe_ctx, struct view *recout_skip)
{ {
const struct dc_plane_state *surface = pipe_ctx->surface; const struct dc_plane_state *plane_state = pipe_ctx->plane_state;
const struct dc_stream_state *stream = pipe_ctx->stream; const struct dc_stream_state *stream = pipe_ctx->stream;
struct rect surf_src = surface->src_rect; struct rect surf_src = plane_state->src_rect;
struct rect surf_clip = surface->clip_rect; struct rect surf_clip = plane_state->clip_rect;
int recout_full_x, recout_full_y; int recout_full_x, recout_full_y;
if (pipe_ctx->surface->rotation == ROTATION_ANGLE_90 || if (pipe_ctx->plane_state->rotation == ROTATION_ANGLE_90 ||
pipe_ctx->surface->rotation == ROTATION_ANGLE_270) pipe_ctx->plane_state->rotation == ROTATION_ANGLE_270)
rect_swap_helper(&surf_src); rect_swap_helper(&surf_src);
pipe_ctx->scl_data.recout.x = stream->dst.x; pipe_ctx->scl_data.recout.x = stream->dst.x;
...@@ -568,8 +568,8 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx, struct view *recout_skip ...@@ -568,8 +568,8 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx, struct view *recout_skip
- pipe_ctx->scl_data.recout.y; - pipe_ctx->scl_data.recout.y;
/* Handle h & vsplit */ /* Handle h & vsplit */
if (pipe_ctx->top_pipe && pipe_ctx->top_pipe->surface == if (pipe_ctx->top_pipe && pipe_ctx->top_pipe->plane_state ==
pipe_ctx->surface) { pipe_ctx->plane_state) {
if (stream->view_format == VIEW_3D_FORMAT_TOP_AND_BOTTOM) { if (stream->view_format == VIEW_3D_FORMAT_TOP_AND_BOTTOM) {
pipe_ctx->scl_data.recout.height /= 2; pipe_ctx->scl_data.recout.height /= 2;
pipe_ctx->scl_data.recout.y += pipe_ctx->scl_data.recout.height; pipe_ctx->scl_data.recout.y += pipe_ctx->scl_data.recout.height;
...@@ -581,7 +581,7 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx, struct view *recout_skip ...@@ -581,7 +581,7 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx, struct view *recout_skip
pipe_ctx->scl_data.recout.width += pipe_ctx->scl_data.recout.width % 2; pipe_ctx->scl_data.recout.width += pipe_ctx->scl_data.recout.width % 2;
} }
} else if (pipe_ctx->bottom_pipe && } else if (pipe_ctx->bottom_pipe &&
pipe_ctx->bottom_pipe->surface == pipe_ctx->surface) { pipe_ctx->bottom_pipe->plane_state == pipe_ctx->plane_state) {
if (stream->view_format == VIEW_3D_FORMAT_TOP_AND_BOTTOM) if (stream->view_format == VIEW_3D_FORMAT_TOP_AND_BOTTOM)
pipe_ctx->scl_data.recout.height /= 2; pipe_ctx->scl_data.recout.height /= 2;
else else
...@@ -592,13 +592,13 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx, struct view *recout_skip ...@@ -592,13 +592,13 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx, struct view *recout_skip
* * 1/ stream scaling ratio) - (surf surf_src offset * 1/ full scl * * 1/ stream scaling ratio) - (surf surf_src offset * 1/ full scl
* ratio) * ratio)
*/ */
recout_full_x = stream->dst.x + (surface->dst_rect.x - stream->src.x) recout_full_x = stream->dst.x + (plane_state->dst_rect.x - stream->src.x)
* stream->dst.width / stream->src.width - * stream->dst.width / stream->src.width -
surf_src.x * surface->dst_rect.width / surf_src.width surf_src.x * plane_state->dst_rect.width / surf_src.width
* stream->dst.width / stream->src.width; * stream->dst.width / stream->src.width;
recout_full_y = stream->dst.y + (surface->dst_rect.y - stream->src.y) recout_full_y = stream->dst.y + (plane_state->dst_rect.y - stream->src.y)
* stream->dst.height / stream->src.height - * stream->dst.height / stream->src.height -
surf_src.y * surface->dst_rect.height / surf_src.height surf_src.y * plane_state->dst_rect.height / surf_src.height
* stream->dst.height / stream->src.height; * stream->dst.height / stream->src.height;
recout_skip->width = pipe_ctx->scl_data.recout.x - recout_full_x; recout_skip->width = pipe_ctx->scl_data.recout.x - recout_full_x;
...@@ -607,24 +607,24 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx, struct view *recout_skip ...@@ -607,24 +607,24 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx, struct view *recout_skip
static void calculate_scaling_ratios(struct pipe_ctx *pipe_ctx) static void calculate_scaling_ratios(struct pipe_ctx *pipe_ctx)
{ {
const struct dc_plane_state *surface = pipe_ctx->surface; const struct dc_plane_state *plane_state = pipe_ctx->plane_state;
const struct dc_stream_state *stream = pipe_ctx->stream; const struct dc_stream_state *stream = pipe_ctx->stream;
struct rect surf_src = surface->src_rect; struct rect surf_src = plane_state->src_rect;
const int in_w = stream->src.width; const int in_w = stream->src.width;
const int in_h = stream->src.height; const int in_h = stream->src.height;
const int out_w = stream->dst.width; const int out_w = stream->dst.width;
const int out_h = stream->dst.height; const int out_h = stream->dst.height;
if (pipe_ctx->surface->rotation == ROTATION_ANGLE_90 || if (pipe_ctx->plane_state->rotation == ROTATION_ANGLE_90 ||
pipe_ctx->surface->rotation == ROTATION_ANGLE_270) pipe_ctx->plane_state->rotation == ROTATION_ANGLE_270)
rect_swap_helper(&surf_src); rect_swap_helper(&surf_src);
pipe_ctx->scl_data.ratios.horz = dal_fixed31_32_from_fraction( pipe_ctx->scl_data.ratios.horz = dal_fixed31_32_from_fraction(
surf_src.width, surf_src.width,
surface->dst_rect.width); plane_state->dst_rect.width);
pipe_ctx->scl_data.ratios.vert = dal_fixed31_32_from_fraction( pipe_ctx->scl_data.ratios.vert = dal_fixed31_32_from_fraction(
surf_src.height, surf_src.height,
surface->dst_rect.height); plane_state->dst_rect.height);
if (stream->view_format == VIEW_3D_FORMAT_SIDE_BY_SIDE) if (stream->view_format == VIEW_3D_FORMAT_SIDE_BY_SIDE)
pipe_ctx->scl_data.ratios.horz.value *= 2; pipe_ctx->scl_data.ratios.horz.value *= 2;
...@@ -649,13 +649,13 @@ static void calculate_scaling_ratios(struct pipe_ctx *pipe_ctx) ...@@ -649,13 +649,13 @@ static void calculate_scaling_ratios(struct pipe_ctx *pipe_ctx)
static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *recout_skip) static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *recout_skip)
{ {
struct scaler_data *data = &pipe_ctx->scl_data; struct scaler_data *data = &pipe_ctx->scl_data;
struct rect src = pipe_ctx->surface->src_rect; struct rect src = pipe_ctx->plane_state->src_rect;
int vpc_div = (data->format == PIXEL_FORMAT_420BPP8 int vpc_div = (data->format == PIXEL_FORMAT_420BPP8
|| data->format == PIXEL_FORMAT_420BPP10) ? 2 : 1; || data->format == PIXEL_FORMAT_420BPP10) ? 2 : 1;
if (pipe_ctx->surface->rotation == ROTATION_ANGLE_90 || if (pipe_ctx->plane_state->rotation == ROTATION_ANGLE_90 ||
pipe_ctx->surface->rotation == ROTATION_ANGLE_270) { pipe_ctx->plane_state->rotation == ROTATION_ANGLE_270) {
rect_swap_helper(&src); rect_swap_helper(&src);
rect_swap_helper(&data->viewport_c); rect_swap_helper(&data->viewport_c);
rect_swap_helper(&data->viewport); rect_swap_helper(&data->viewport);
...@@ -805,8 +805,8 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r ...@@ -805,8 +805,8 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r
data->inits.v_bot = dal_fixed31_32_add(data->inits.v, data->ratios.vert); data->inits.v_bot = dal_fixed31_32_add(data->inits.v, data->ratios.vert);
data->inits.v_c_bot = dal_fixed31_32_add(data->inits.v_c, data->ratios.vert_c); data->inits.v_c_bot = dal_fixed31_32_add(data->inits.v_c, data->ratios.vert_c);
if (pipe_ctx->surface->rotation == ROTATION_ANGLE_90 || if (pipe_ctx->plane_state->rotation == ROTATION_ANGLE_90 ||
pipe_ctx->surface->rotation == ROTATION_ANGLE_270) { pipe_ctx->plane_state->rotation == ROTATION_ANGLE_270) {
rect_swap_helper(&data->viewport_c); rect_swap_helper(&data->viewport_c);
rect_swap_helper(&data->viewport); rect_swap_helper(&data->viewport);
} }
...@@ -814,7 +814,7 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r ...@@ -814,7 +814,7 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r
bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx) bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx)
{ {
const struct dc_plane_state *surface = pipe_ctx->surface; const struct dc_plane_state *plane_state = pipe_ctx->plane_state;
struct dc_crtc_timing *timing = &pipe_ctx->stream->timing; struct dc_crtc_timing *timing = &pipe_ctx->stream->timing;
struct view recout_skip = { 0 }; struct view recout_skip = { 0 };
bool res = false; bool res = false;
...@@ -824,7 +824,7 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx) ...@@ -824,7 +824,7 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx)
* Inits require viewport, taps, ratios and recout of split pipe * Inits require viewport, taps, ratios and recout of split pipe
*/ */
pipe_ctx->scl_data.format = convert_pixel_format_to_dalsurface( pipe_ctx->scl_data.format = convert_pixel_format_to_dalsurface(
pipe_ctx->surface->format); pipe_ctx->plane_state->format);
calculate_scaling_ratios(pipe_ctx); calculate_scaling_ratios(pipe_ctx);
...@@ -846,14 +846,14 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx) ...@@ -846,14 +846,14 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx)
/* Taps calculations */ /* Taps calculations */
res = pipe_ctx->xfm->funcs->transform_get_optimal_number_of_taps( res = pipe_ctx->xfm->funcs->transform_get_optimal_number_of_taps(
pipe_ctx->xfm, &pipe_ctx->scl_data, &surface->scaling_quality); pipe_ctx->xfm, &pipe_ctx->scl_data, &plane_state->scaling_quality);
if (!res) { if (!res) {
/* Try 24 bpp linebuffer */ /* Try 24 bpp linebuffer */
pipe_ctx->scl_data.lb_params.depth = LB_PIXEL_DEPTH_24BPP; pipe_ctx->scl_data.lb_params.depth = LB_PIXEL_DEPTH_24BPP;
res = pipe_ctx->xfm->funcs->transform_get_optimal_number_of_taps( res = pipe_ctx->xfm->funcs->transform_get_optimal_number_of_taps(
pipe_ctx->xfm, &pipe_ctx->scl_data, &surface->scaling_quality); pipe_ctx->xfm, &pipe_ctx->scl_data, &plane_state->scaling_quality);
} }
if (res) if (res)
...@@ -869,10 +869,10 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx) ...@@ -869,10 +869,10 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx)
pipe_ctx->scl_data.viewport.width, pipe_ctx->scl_data.viewport.width,
pipe_ctx->scl_data.viewport.x, pipe_ctx->scl_data.viewport.x,
pipe_ctx->scl_data.viewport.y, pipe_ctx->scl_data.viewport.y,
surface->dst_rect.height, plane_state->dst_rect.height,
surface->dst_rect.width, plane_state->dst_rect.width,
surface->dst_rect.x, plane_state->dst_rect.x,
surface->dst_rect.y); plane_state->dst_rect.y);
return res; return res;
} }
...@@ -885,7 +885,7 @@ enum dc_status resource_build_scaling_params_for_context( ...@@ -885,7 +885,7 @@ enum dc_status resource_build_scaling_params_for_context(
int i; int i;
for (i = 0; i < MAX_PIPES; i++) { for (i = 0; i < MAX_PIPES; i++) {
if (context->res_ctx.pipe_ctx[i].surface != NULL && if (context->res_ctx.pipe_ctx[i].plane_state != NULL &&
context->res_ctx.pipe_ctx[i].stream != NULL) context->res_ctx.pipe_ctx[i].stream != NULL)
if (!resource_build_scaling_params(&context->res_ctx.pipe_ctx[i])) if (!resource_build_scaling_params(&context->res_ctx.pipe_ctx[i]))
return DC_FAIL_SCALING; return DC_FAIL_SCALING;
...@@ -954,13 +954,13 @@ static struct pipe_ctx *acquire_free_pipe_for_stream( ...@@ -954,13 +954,13 @@ static struct pipe_ctx *acquire_free_pipe_for_stream(
if (!head_pipe) if (!head_pipe)
ASSERT(0); ASSERT(0);
if (!head_pipe->surface) if (!head_pipe->plane_state)
return head_pipe; return head_pipe;
/* Re-use pipe already acquired for this stream if available*/ /* Re-use pipe already acquired for this stream if available*/
for (i = pool->pipe_count - 1; i >= 0; i--) { for (i = pool->pipe_count - 1; i >= 0; i--) {
if (res_ctx->pipe_ctx[i].stream == stream && if (res_ctx->pipe_ctx[i].stream == stream &&
!res_ctx->pipe_ctx[i].surface) { !res_ctx->pipe_ctx[i].plane_state) {
return &res_ctx->pipe_ctx[i]; return &res_ctx->pipe_ctx[i];
} }
} }
...@@ -987,7 +987,7 @@ static void release_free_pipes_for_stream( ...@@ -987,7 +987,7 @@ static void release_free_pipes_for_stream(
/* never release the topmost pipe*/ /* never release the topmost pipe*/
if (res_ctx->pipe_ctx[i].stream == stream && if (res_ctx->pipe_ctx[i].stream == stream &&
res_ctx->pipe_ctx[i].top_pipe && res_ctx->pipe_ctx[i].top_pipe &&
!res_ctx->pipe_ctx[i].surface) { !res_ctx->pipe_ctx[i].plane_state) {
memset(&res_ctx->pipe_ctx[i], 0, sizeof(struct pipe_ctx)); memset(&res_ctx->pipe_ctx[i], 0, sizeof(struct pipe_ctx));
} }
} }
...@@ -1005,7 +1005,7 @@ static int acquire_first_split_pipe( ...@@ -1005,7 +1005,7 @@ static int acquire_first_split_pipe(
struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i]; struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i];
if (pipe_ctx->top_pipe && if (pipe_ctx->top_pipe &&
pipe_ctx->top_pipe->surface == pipe_ctx->surface) { pipe_ctx->top_pipe->plane_state == pipe_ctx->plane_state) {
pipe_ctx->top_pipe->bottom_pipe = pipe_ctx->bottom_pipe; pipe_ctx->top_pipe->bottom_pipe = pipe_ctx->bottom_pipe;
if (pipe_ctx->bottom_pipe) if (pipe_ctx->bottom_pipe)
pipe_ctx->bottom_pipe->top_pipe = pipe_ctx->top_pipe; pipe_ctx->bottom_pipe->top_pipe = pipe_ctx->top_pipe;
...@@ -1028,7 +1028,7 @@ static int acquire_first_split_pipe( ...@@ -1028,7 +1028,7 @@ static int acquire_first_split_pipe(
#endif #endif
bool resource_attach_surfaces_to_context( bool resource_attach_surfaces_to_context(
struct dc_plane_state * const *surfaces, struct dc_plane_state * const *plane_states,
int surface_count, int surface_count,
struct dc_stream_state *stream, struct dc_stream_state *stream,
struct validate_context *context, struct validate_context *context,
...@@ -1057,25 +1057,25 @@ bool resource_attach_surfaces_to_context( ...@@ -1057,25 +1057,25 @@ bool resource_attach_surfaces_to_context(
/* retain new surfaces */ /* retain new surfaces */
for (i = 0; i < surface_count; i++) for (i = 0; i < surface_count; i++)
dc_surface_retain(surfaces[i]); dc_plane_state_retain(plane_states[i]);
/* detach surfaces from pipes */ /* detach surfaces from pipes */
for (i = 0; i < pool->pipe_count; i++) for (i = 0; i < pool->pipe_count; i++)
if (context->res_ctx.pipe_ctx[i].stream == stream) { if (context->res_ctx.pipe_ctx[i].stream == stream) {
context->res_ctx.pipe_ctx[i].surface = NULL; context->res_ctx.pipe_ctx[i].plane_state = NULL;
context->res_ctx.pipe_ctx[i].bottom_pipe = NULL; context->res_ctx.pipe_ctx[i].bottom_pipe = NULL;
} }
/* release existing surfaces*/ /* release existing surfaces*/
for (i = 0; i < stream_status->surface_count; i++) for (i = 0; i < stream_status->plane_count; i++)
dc_surface_release(stream_status->surfaces[i]); dc_plane_state_release(stream_status->plane_states[i]);
for (i = surface_count; i < stream_status->surface_count; i++) for (i = surface_count; i < stream_status->plane_count; i++)
stream_status->surfaces[i] = NULL; stream_status->plane_states[i] = NULL;
tail_pipe = NULL; tail_pipe = NULL;
for (i = 0; i < surface_count; i++) { for (i = 0; i < surface_count; i++) {
struct dc_plane_state *surface = surfaces[i]; struct dc_plane_state *plane_state = plane_states[i];
struct pipe_ctx *free_pipe = acquire_free_pipe_for_stream( struct pipe_ctx *free_pipe = acquire_free_pipe_for_stream(
context, pool, stream); context, pool, stream);
...@@ -1087,11 +1087,11 @@ bool resource_attach_surfaces_to_context( ...@@ -1087,11 +1087,11 @@ bool resource_attach_surfaces_to_context(
} }
#endif #endif
if (!free_pipe) { if (!free_pipe) {
stream_status->surfaces[i] = NULL; stream_status->plane_states[i] = NULL;
return false; return false;
} }
free_pipe->surface = surface; free_pipe->plane_state = plane_state;
if (tail_pipe) { if (tail_pipe) {
free_pipe->tg = tail_pipe->tg; free_pipe->tg = tail_pipe->tg;
...@@ -1110,9 +1110,9 @@ bool resource_attach_surfaces_to_context( ...@@ -1110,9 +1110,9 @@ bool resource_attach_surfaces_to_context(
/* assign new surfaces*/ /* assign new surfaces*/
for (i = 0; i < surface_count; i++) for (i = 0; i < surface_count; i++)
stream_status->surfaces[i] = surfaces[i]; stream_status->plane_states[i] = plane_states[i];
stream_status->surface_count = surface_count; stream_status->plane_count = surface_count;
return true; return true;
} }
...@@ -1180,17 +1180,17 @@ bool resource_validate_attach_surfaces( ...@@ -1180,17 +1180,17 @@ bool resource_validate_attach_surfaces(
old_context->streams[j], old_context->streams[j],
context->streams[i])) { context->streams[i])) {
if (!resource_attach_surfaces_to_context( if (!resource_attach_surfaces_to_context(
old_context->stream_status[j].surfaces, old_context->stream_status[j].plane_states,
old_context->stream_status[j].surface_count, old_context->stream_status[j].plane_count,
context->streams[i], context->streams[i],
context, pool)) context, pool))
return false; return false;
context->stream_status[i] = old_context->stream_status[j]; context->stream_status[i] = old_context->stream_status[j];
} }
if (set[i].surface_count != 0) if (set[i].plane_count != 0)
if (!resource_attach_surfaces_to_context( if (!resource_attach_surfaces_to_context(
set[i].surfaces, set[i].plane_states,
set[i].surface_count, set[i].plane_count,
context->streams[i], context->streams[i],
context, pool)) context, pool))
return false; return false;
...@@ -1351,13 +1351,13 @@ bool resource_is_stream_unchanged( ...@@ -1351,13 +1351,13 @@ bool resource_is_stream_unchanged(
static void copy_pipe_ctx( static void copy_pipe_ctx(
const struct pipe_ctx *from_pipe_ctx, struct pipe_ctx *to_pipe_ctx) const struct pipe_ctx *from_pipe_ctx, struct pipe_ctx *to_pipe_ctx)
{ {
struct dc_plane_state *surface = to_pipe_ctx->surface; struct dc_plane_state *plane_state = to_pipe_ctx->plane_state;
struct dc_stream_state *stream = to_pipe_ctx->stream; struct dc_stream_state *stream = to_pipe_ctx->stream;
*to_pipe_ctx = *from_pipe_ctx; *to_pipe_ctx = *from_pipe_ctx;
to_pipe_ctx->stream = stream; to_pipe_ctx->stream = stream;
if (surface != NULL) if (plane_state != NULL)
to_pipe_ctx->surface = surface; to_pipe_ctx->plane_state = plane_state;
} }
static struct dc_stream_state *find_pll_sharable_stream( static struct dc_stream_state *find_pll_sharable_stream(
...@@ -2055,7 +2055,7 @@ static void set_spd_info_packet( ...@@ -2055,7 +2055,7 @@ static void set_spd_info_packet(
static void set_hdr_static_info_packet( static void set_hdr_static_info_packet(
struct encoder_info_packet *info_packet, struct encoder_info_packet *info_packet,
struct dc_plane_state *surface, struct dc_plane_state *plane_state,
struct dc_stream_state *stream) struct dc_stream_state *stream)
{ {
uint16_t i = 0; uint16_t i = 0;
...@@ -2063,10 +2063,10 @@ static void set_hdr_static_info_packet( ...@@ -2063,10 +2063,10 @@ static void set_hdr_static_info_packet(
struct dc_hdr_static_metadata hdr_metadata; struct dc_hdr_static_metadata hdr_metadata;
uint32_t data; uint32_t data;
if (!surface) if (!plane_state)
return; return;
hdr_metadata = surface->hdr_static_ctx; hdr_metadata = plane_state->hdr_static_ctx;
if (!hdr_metadata.hdr_supported) if (!hdr_metadata.hdr_supported)
return; return;
...@@ -2204,11 +2204,11 @@ void dc_resource_validate_ctx_destruct(struct validate_context *context) ...@@ -2204,11 +2204,11 @@ void dc_resource_validate_ctx_destruct(struct validate_context *context)
int i, j; int i, j;
for (i = 0; i < context->stream_count; i++) { for (i = 0; i < context->stream_count; i++) {
for (j = 0; j < context->stream_status[i].surface_count; j++) for (j = 0; j < context->stream_status[i].plane_count; j++)
dc_surface_release( dc_plane_state_release(
context->stream_status[i].surfaces[j]); context->stream_status[i].plane_states[j]);
context->stream_status[i].surface_count = 0; context->stream_status[i].plane_count = 0;
dc_stream_release(context->streams[i]); dc_stream_release(context->streams[i]);
context->streams[i] = NULL; context->streams[i] = NULL;
} }
...@@ -2240,9 +2240,9 @@ void dc_resource_validate_ctx_copy_construct( ...@@ -2240,9 +2240,9 @@ void dc_resource_validate_ctx_copy_construct(
for (i = 0; i < dst_ctx->stream_count; i++) { for (i = 0; i < dst_ctx->stream_count; i++) {
dc_stream_retain(dst_ctx->streams[i]); dc_stream_retain(dst_ctx->streams[i]);
for (j = 0; j < dst_ctx->stream_status[i].surface_count; j++) for (j = 0; j < dst_ctx->stream_status[i].plane_count; j++)
dc_surface_retain( dc_plane_state_retain(
dst_ctx->stream_status[i].surfaces[j]); dst_ctx->stream_status[i].plane_states[j]);
} }
/* context refcount should not be overridden */ /* context refcount should not be overridden */
...@@ -2288,7 +2288,7 @@ void resource_build_info_frame(struct pipe_ctx *pipe_ctx) ...@@ -2288,7 +2288,7 @@ void resource_build_info_frame(struct pipe_ctx *pipe_ctx)
set_spd_info_packet(&info->spd, pipe_ctx->stream); set_spd_info_packet(&info->spd, pipe_ctx->stream);
set_hdr_static_info_packet(&info->hdrsmd, set_hdr_static_info_packet(&info->hdrsmd,
pipe_ctx->surface, pipe_ctx->stream); pipe_ctx->plane_state, pipe_ctx->stream);
} else if (dc_is_dp_signal(signal)) { } else if (dc_is_dp_signal(signal)) {
set_vsc_info_packet(&info->vsc, pipe_ctx->stream); set_vsc_info_packet(&info->vsc, pipe_ctx->stream);
...@@ -2296,7 +2296,7 @@ void resource_build_info_frame(struct pipe_ctx *pipe_ctx) ...@@ -2296,7 +2296,7 @@ void resource_build_info_frame(struct pipe_ctx *pipe_ctx)
set_spd_info_packet(&info->spd, pipe_ctx->stream); set_spd_info_packet(&info->spd, pipe_ctx->stream);
set_hdr_static_info_packet(&info->hdrsmd, set_hdr_static_info_packet(&info->hdrsmd,
pipe_ctx->surface, pipe_ctx->stream); pipe_ctx->plane_state, pipe_ctx->stream);
} }
patch_gamut_packet_checksum(&info->gamut); patch_gamut_packet_checksum(&info->gamut);
......
...@@ -185,7 +185,7 @@ bool dc_stream_set_cursor_attributes( ...@@ -185,7 +185,7 @@ bool dc_stream_set_cursor_attributes(
if (pipe_ctx->stream != stream || !pipe_ctx->ipp) if (pipe_ctx->stream != stream || !pipe_ctx->ipp)
continue; continue;
if (pipe_ctx->top_pipe && pipe_ctx->surface != pipe_ctx->top_pipe->surface) if (pipe_ctx->top_pipe && pipe_ctx->plane_state != pipe_ctx->top_pipe->plane_state)
continue; continue;
pipe_ctx->ipp->funcs->ipp_cursor_set_attributes( pipe_ctx->ipp->funcs->ipp_cursor_set_attributes(
...@@ -229,14 +229,14 @@ bool dc_stream_set_cursor_position( ...@@ -229,14 +229,14 @@ bool dc_stream_set_cursor_position(
}; };
if (pipe_ctx->stream != stream || if (pipe_ctx->stream != stream ||
!pipe_ctx->ipp || !pipe_ctx->surface) !pipe_ctx->ipp || !pipe_ctx->plane_state)
continue; continue;
if (pipe_ctx->surface->address.type if (pipe_ctx->plane_state->address.type
== PLN_ADDR_TYPE_VIDEO_PROGRESSIVE) == PLN_ADDR_TYPE_VIDEO_PROGRESSIVE)
pos_cpy.enable = false; pos_cpy.enable = false;
if (pipe_ctx->top_pipe && pipe_ctx->surface != pipe_ctx->top_pipe->surface) if (pipe_ctx->top_pipe && pipe_ctx->plane_state != pipe_ctx->top_pipe->plane_state)
pos_cpy.enable = false; pos_cpy.enable = false;
ipp->funcs->ipp_cursor_set_position(ipp, &pos_cpy, &param); ipp->funcs->ipp_cursor_set_position(ipp, &pos_cpy, &param);
......
...@@ -34,75 +34,75 @@ ...@@ -34,75 +34,75 @@
/******************************************************************************* /*******************************************************************************
* Private functions * Private functions
******************************************************************************/ ******************************************************************************/
static bool construct(struct dc_context *ctx, struct dc_plane_state *surface) static bool construct(struct dc_context *ctx, struct dc_plane_state *plane_state)
{ {
surface->ctx = ctx; plane_state->ctx = ctx;
memset(&surface->hdr_static_ctx, memset(&plane_state->hdr_static_ctx,
0, sizeof(struct dc_hdr_static_metadata)); 0, sizeof(struct dc_hdr_static_metadata));
return true; return true;
} }
static void destruct(struct dc_plane_state *surface) static void destruct(struct dc_plane_state *plane_state)
{ {
if (surface->gamma_correction != NULL) { if (plane_state->gamma_correction != NULL) {
dc_gamma_release(&surface->gamma_correction); dc_gamma_release(&plane_state->gamma_correction);
} }
if (surface->in_transfer_func != NULL) { if (plane_state->in_transfer_func != NULL) {
dc_transfer_func_release( dc_transfer_func_release(
surface->in_transfer_func); plane_state->in_transfer_func);
surface->in_transfer_func = NULL; plane_state->in_transfer_func = NULL;
} }
} }
/******************************************************************************* /*******************************************************************************
* Public functions * Public functions
******************************************************************************/ ******************************************************************************/
void enable_surface_flip_reporting(struct dc_plane_state *surface, void enable_surface_flip_reporting(struct dc_plane_state *plane_state,
uint32_t controller_id) uint32_t controller_id)
{ {
surface->irq_source = controller_id + DC_IRQ_SOURCE_PFLIP1 - 1; plane_state->irq_source = controller_id + DC_IRQ_SOURCE_PFLIP1 - 1;
/*register_flip_interrupt(surface);*/ /*register_flip_interrupt(surface);*/
} }
struct dc_plane_state *dc_create_surface(const struct dc *dc) struct dc_plane_state *dc_create_plane_state(const struct dc *dc)
{ {
struct core_dc *core_dc = DC_TO_CORE(dc); struct core_dc *core_dc = DC_TO_CORE(dc);
struct dc_plane_state *surface = dm_alloc(sizeof(*surface)); struct dc_plane_state *plane_state = dm_alloc(sizeof(*plane_state));
if (NULL == surface) if (NULL == plane_state)
goto alloc_fail; goto alloc_fail;
if (false == construct(core_dc->ctx, surface)) if (false == construct(core_dc->ctx, plane_state))
goto construct_fail; goto construct_fail;
++surface->ref_count; ++plane_state->ref_count;
return surface; return plane_state;
construct_fail: construct_fail:
dm_free(surface); dm_free(plane_state);
alloc_fail: alloc_fail:
return NULL; return NULL;
} }
const struct dc_surface_status *dc_surface_get_status( const struct dc_plane_status *dc_plane_get_status(
const struct dc_plane_state *dc_surface) const struct dc_plane_state *plane_state)
{ {
const struct dc_surface_status *surface_status; const struct dc_plane_status *plane_status;
struct core_dc *core_dc; struct core_dc *core_dc;
int i; int i;
if (!dc_surface || if (!plane_state ||
!dc_surface->ctx || !plane_state->ctx ||
!dc_surface->ctx->dc) { !plane_state->ctx->dc) {
ASSERT(0); ASSERT(0);
return NULL; /* remove this if above assert never hit */ return NULL; /* remove this if above assert never hit */
} }
surface_status = &dc_surface->status; plane_status = &plane_state->status;
core_dc = DC_TO_CORE(dc_surface->ctx->dc); core_dc = DC_TO_CORE(plane_state->ctx->dc);
if (core_dc->current_context == NULL) if (core_dc->current_context == NULL)
return NULL; return NULL;
...@@ -111,29 +111,29 @@ const struct dc_surface_status *dc_surface_get_status( ...@@ -111,29 +111,29 @@ const struct dc_surface_status *dc_surface_get_status(
struct pipe_ctx *pipe_ctx = struct pipe_ctx *pipe_ctx =
&core_dc->current_context->res_ctx.pipe_ctx[i]; &core_dc->current_context->res_ctx.pipe_ctx[i];
if (pipe_ctx->surface != dc_surface) if (pipe_ctx->plane_state != plane_state)
continue; continue;
core_dc->hwss.update_pending_status(pipe_ctx); core_dc->hwss.update_pending_status(pipe_ctx);
} }
return surface_status; return plane_status;
} }
void dc_surface_retain(struct dc_plane_state *surface) void dc_plane_state_retain(struct dc_plane_state *plane_state)
{ {
ASSERT(surface->ref_count > 0); ASSERT(plane_state->ref_count > 0);
++surface->ref_count; ++plane_state->ref_count;
} }
void dc_surface_release(struct dc_plane_state *surface) void dc_plane_state_release(struct dc_plane_state *plane_state)
{ {
ASSERT(surface->ref_count > 0); ASSERT(plane_state->ref_count > 0);
--surface->ref_count; --plane_state->ref_count;
if (surface->ref_count == 0) { if (plane_state->ref_count == 0) {
destruct(surface); destruct(plane_state);
dm_free(surface); dm_free(plane_state);
} }
} }
......
...@@ -47,7 +47,7 @@ struct dc_caps { ...@@ -47,7 +47,7 @@ struct dc_caps {
uint32_t max_links; uint32_t max_links;
uint32_t max_audios; uint32_t max_audios;
uint32_t max_slave_planes; uint32_t max_slave_planes;
uint32_t max_surfaces; uint32_t max_planes;
uint32_t max_downscale_ratio; uint32_t max_downscale_ratio;
uint32_t i2c_speed_in_khz; uint32_t i2c_speed_in_khz;
...@@ -303,7 +303,7 @@ struct dc_transfer_func { ...@@ -303,7 +303,7 @@ struct dc_transfer_func {
* the last requested address and the currently active address so the called * the last requested address and the currently active address so the called
* can determine if there are any outstanding flips * can determine if there are any outstanding flips
*/ */
struct dc_surface_status { struct dc_plane_status {
struct dc_plane_address requested_address; struct dc_plane_address requested_address;
struct dc_plane_address current_address; struct dc_plane_address current_address;
bool is_flip_pending; bool is_flip_pending;
...@@ -338,7 +338,7 @@ struct dc_plane_state { ...@@ -338,7 +338,7 @@ struct dc_plane_state {
bool horizontal_mirror; bool horizontal_mirror;
/* private to DC core */ /* private to DC core */
struct dc_surface_status status; struct dc_plane_status status;
struct dc_context *ctx; struct dc_context *ctx;
/* private to dc_surface.c */ /* private to dc_surface.c */
...@@ -385,12 +385,12 @@ struct dc_surface_update { ...@@ -385,12 +385,12 @@ struct dc_surface_update {
/* /*
* Create a new surface with default parameters; * Create a new surface with default parameters;
*/ */
struct dc_plane_state *dc_create_surface(const struct dc *dc); struct dc_plane_state *dc_create_plane_state(const struct dc *dc);
const struct dc_surface_status *dc_surface_get_status( const struct dc_plane_status *dc_plane_get_status(
const struct dc_plane_state *dc_surface); const struct dc_plane_state *plane_state);
void dc_surface_retain(struct dc_plane_state *dc_surface); void dc_plane_state_retain(struct dc_plane_state *plane_state);
void dc_surface_release(struct dc_plane_state *dc_surface); void dc_plane_state_release(struct dc_plane_state *plane_state);
void dc_gamma_retain(struct dc_gamma *dc_gamma); void dc_gamma_retain(struct dc_gamma *dc_gamma);
void dc_gamma_release(struct dc_gamma **dc_gamma); void dc_gamma_release(struct dc_gamma **dc_gamma);
...@@ -422,10 +422,10 @@ struct dc_flip_addrs { ...@@ -422,10 +422,10 @@ struct dc_flip_addrs {
* This does not trigger a flip. No surface address is programmed. * This does not trigger a flip. No surface address is programmed.
*/ */
bool dc_commit_surfaces_to_stream( bool dc_commit_planes_to_stream(
struct dc *dc, struct dc *dc,
struct dc_plane_state **dc_surfaces, struct dc_plane_state **plane_states,
uint8_t surface_count, uint8_t new_plane_count,
struct dc_stream_state *stream); struct dc_stream_state *stream);
bool dc_post_update_surfaces_to_stream( bool dc_post_update_surfaces_to_stream(
...@@ -469,8 +469,8 @@ enum surface_update_type { ...@@ -469,8 +469,8 @@ enum surface_update_type {
struct dc_stream_status { struct dc_stream_status {
int primary_otg_inst; int primary_otg_inst;
int surface_count; int plane_count;
struct dc_plane_state *surfaces[MAX_SURFACE_NUM]; struct dc_plane_state *plane_states[MAX_SURFACE_NUM];
/* /*
* link this stream passes through * link this stream passes through
...@@ -546,7 +546,7 @@ bool dc_is_stream_unchanged( ...@@ -546,7 +546,7 @@ bool dc_is_stream_unchanged(
* *
*/ */
void dc_update_surfaces_and_stream(struct dc *dc, void dc_update_planes_and_stream(struct dc *dc,
struct dc_surface_update *surface_updates, int surface_count, struct dc_surface_update *surface_updates, int surface_count,
struct dc_stream_state *dc_stream, struct dc_stream_state *dc_stream,
struct dc_stream_update *stream_update); struct dc_stream_update *stream_update);
...@@ -582,8 +582,8 @@ bool dc_stream_get_scanoutpos(const struct dc_stream_state *stream, ...@@ -582,8 +582,8 @@ bool dc_stream_get_scanoutpos(const struct dc_stream_state *stream,
*/ */
struct dc_validation_set { struct dc_validation_set {
struct dc_stream_state *stream; struct dc_stream_state *stream;
struct dc_plane_state *surfaces[MAX_SURFACES]; struct dc_plane_state *plane_states[MAX_SURFACES];
uint8_t surface_count; uint8_t plane_count;
}; };
bool dc_validate_stream(const struct dc *dc, struct dc_stream_state *stream); bool dc_validate_stream(const struct dc *dc, struct dc_stream_state *stream);
......
...@@ -197,9 +197,9 @@ void dce_crtc_switch_to_clk_src(struct dce_hwseq *hws, ...@@ -197,9 +197,9 @@ void dce_crtc_switch_to_clk_src(struct dce_hwseq *hws,
} }
/* Only use LUT for 8 bit formats */ /* Only use LUT for 8 bit formats */
bool dce_use_lut(const struct dc_plane_state *surface) bool dce_use_lut(const struct dc_plane_state *plane_state)
{ {
switch (surface->format) { switch (plane_state->format) {
case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888: case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888:
case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888: case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
return true; return true;
......
...@@ -552,5 +552,5 @@ void dce_crtc_switch_to_clk_src(struct dce_hwseq *hws, ...@@ -552,5 +552,5 @@ void dce_crtc_switch_to_clk_src(struct dce_hwseq *hws,
struct clock_source *clk_src, struct clock_source *clk_src,
unsigned int tg_inst); unsigned int tg_inst);
bool dce_use_lut(const struct dc_plane_state *surface); bool dce_use_lut(const struct dc_plane_state *plane_state);
#endif /*__DCE_HWSEQ_H__*/ #endif /*__DCE_HWSEQ_H__*/
...@@ -705,13 +705,13 @@ static bool dce100_validate_surface_sets( ...@@ -705,13 +705,13 @@ static bool dce100_validate_surface_sets(
int i; int i;
for (i = 0; i < set_count; i++) { for (i = 0; i < set_count; i++) {
if (set[i].surface_count == 0) if (set[i].plane_count == 0)
continue; continue;
if (set[i].surface_count > 1) if (set[i].plane_count > 1)
return false; return false;
if (set[i].surfaces[0]->format if (set[i].plane_states[0]->format
>= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN) >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)
return false; return false;
} }
...@@ -958,7 +958,7 @@ static bool construct( ...@@ -958,7 +958,7 @@ static bool construct(
} }
} }
dc->public.caps.max_surfaces = pool->base.pipe_count; dc->public.caps.max_planes = pool->base.pipe_count;
if (!resource_construct(num_virtual_links, dc, &pool->base, if (!resource_construct(num_virtual_links, dc, &pool->base,
&res_create_funcs)) &res_create_funcs))
......
...@@ -215,11 +215,11 @@ static bool dce110_enable_display_power_gating( ...@@ -215,11 +215,11 @@ static bool dce110_enable_display_power_gating(
} }
static void build_prescale_params(struct ipp_prescale_params *prescale_params, static void build_prescale_params(struct ipp_prescale_params *prescale_params,
const struct dc_plane_state *surface) const struct dc_plane_state *plane_state)
{ {
prescale_params->mode = IPP_PRESCALE_MODE_FIXED_UNSIGNED; prescale_params->mode = IPP_PRESCALE_MODE_FIXED_UNSIGNED;
switch (surface->format) { switch (plane_state->format) {
case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888: case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888:
case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888: case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
prescale_params->scale = 0x2020; prescale_params->scale = 0x2020;
...@@ -240,7 +240,7 @@ static void build_prescale_params(struct ipp_prescale_params *prescale_params, ...@@ -240,7 +240,7 @@ static void build_prescale_params(struct ipp_prescale_params *prescale_params,
static bool dce110_set_input_transfer_func( static bool dce110_set_input_transfer_func(
struct pipe_ctx *pipe_ctx, struct pipe_ctx *pipe_ctx,
const struct dc_plane_state *surface) const struct dc_plane_state *plane_state)
{ {
struct input_pixel_processor *ipp = pipe_ctx->ipp; struct input_pixel_processor *ipp = pipe_ctx->ipp;
const struct dc_transfer_func *tf = NULL; const struct dc_transfer_func *tf = NULL;
...@@ -250,14 +250,14 @@ static bool dce110_set_input_transfer_func( ...@@ -250,14 +250,14 @@ static bool dce110_set_input_transfer_func(
if (ipp == NULL) if (ipp == NULL)
return false; return false;
if (surface->in_transfer_func) if (plane_state->in_transfer_func)
tf = surface->in_transfer_func; tf = plane_state->in_transfer_func;
build_prescale_params(&prescale_params, surface); build_prescale_params(&prescale_params, plane_state);
ipp->funcs->ipp_program_prescale(ipp, &prescale_params); ipp->funcs->ipp_program_prescale(ipp, &prescale_params);
if (surface->gamma_correction && dce_use_lut(surface)) if (plane_state->gamma_correction && dce_use_lut(plane_state))
ipp->funcs->ipp_program_input_lut(ipp, surface->gamma_correction); ipp->funcs->ipp_program_input_lut(ipp, plane_state->gamma_correction);
if (tf == NULL) { if (tf == NULL) {
/* Default case if no input transfer function specified */ /* Default case if no input transfer function specified */
...@@ -1119,7 +1119,7 @@ static enum dc_status apply_single_controller_ctx_to_hw( ...@@ -1119,7 +1119,7 @@ static enum dc_status apply_single_controller_ctx_to_hw(
if ((!pipe_ctx_old || if ((!pipe_ctx_old ||
memcmp(&pipe_ctx_old->scl_data, &pipe_ctx->scl_data, memcmp(&pipe_ctx_old->scl_data, &pipe_ctx->scl_data,
sizeof(struct scaler_data)) != 0) && sizeof(struct scaler_data)) != 0) &&
pipe_ctx->surface) { pipe_ctx->plane_state) {
program_scaler(dc, pipe_ctx); program_scaler(dc, pipe_ctx);
} }
...@@ -1916,11 +1916,11 @@ static void set_default_colors(struct pipe_ctx *pipe_ctx) ...@@ -1916,11 +1916,11 @@ static void set_default_colors(struct pipe_ctx *pipe_ctx)
struct default_adjustment default_adjust = { 0 }; struct default_adjustment default_adjust = { 0 };
default_adjust.force_hw_default = false; default_adjust.force_hw_default = false;
if (pipe_ctx->surface == NULL) if (pipe_ctx->plane_state == NULL)
default_adjust.in_color_space = COLOR_SPACE_SRGB; default_adjust.in_color_space = COLOR_SPACE_SRGB;
else else
default_adjust.in_color_space = default_adjust.in_color_space =
pipe_ctx->surface->color_space; pipe_ctx->plane_state->color_space;
if (pipe_ctx->stream == NULL) if (pipe_ctx->stream == NULL)
default_adjust.out_color_space = COLOR_SPACE_SRGB; default_adjust.out_color_space = COLOR_SPACE_SRGB;
else else
...@@ -1971,16 +1971,16 @@ static void program_surface_visibility(const struct core_dc *dc, ...@@ -1971,16 +1971,16 @@ static void program_surface_visibility(const struct core_dc *dc,
/* For now we are supporting only two pipes */ /* For now we are supporting only two pipes */
ASSERT(pipe_ctx->bottom_pipe->bottom_pipe == NULL); ASSERT(pipe_ctx->bottom_pipe->bottom_pipe == NULL);
if (pipe_ctx->bottom_pipe->surface->visible) { if (pipe_ctx->bottom_pipe->plane_state->visible) {
if (pipe_ctx->surface->visible) if (pipe_ctx->plane_state->visible)
blender_mode = BLND_MODE_BLENDING; blender_mode = BLND_MODE_BLENDING;
else else
blender_mode = BLND_MODE_OTHER_PIPE; blender_mode = BLND_MODE_OTHER_PIPE;
} else if (!pipe_ctx->surface->visible) } else if (!pipe_ctx->plane_state->visible)
blank_target = true; blank_target = true;
} else if (!pipe_ctx->surface->visible) } else if (!pipe_ctx->plane_state->visible)
blank_target = true; blank_target = true;
dce_set_blender_mode(dc->hwseq, pipe_ctx->pipe_idx, blender_mode); dce_set_blender_mode(dc->hwseq, pipe_ctx->pipe_idx, blender_mode);
...@@ -2038,7 +2038,7 @@ static void set_plane_config( ...@@ -2038,7 +2038,7 @@ static void set_plane_config(
struct resource_context *res_ctx) struct resource_context *res_ctx)
{ {
struct mem_input *mi = pipe_ctx->mi; struct mem_input *mi = pipe_ctx->mi;
struct dc_plane_state *surface = pipe_ctx->surface; struct dc_plane_state *plane_state = pipe_ctx->plane_state;
struct xfm_grph_csc_adjustment adjust; struct xfm_grph_csc_adjustment adjust;
struct out_csc_color_matrix tbl_entry; struct out_csc_color_matrix tbl_entry;
unsigned int i; unsigned int i;
...@@ -2103,57 +2103,57 @@ static void set_plane_config( ...@@ -2103,57 +2103,57 @@ static void set_plane_config(
mi->funcs->mem_input_program_surface_config( mi->funcs->mem_input_program_surface_config(
mi, mi,
surface->format, plane_state->format,
&surface->tiling_info, &plane_state->tiling_info,
&surface->plane_size, &plane_state->plane_size,
surface->rotation, plane_state->rotation,
NULL, NULL,
false); false);
if (mi->funcs->set_blank) if (mi->funcs->set_blank)
mi->funcs->set_blank(mi, pipe_ctx->surface->visible); mi->funcs->set_blank(mi, pipe_ctx->plane_state->visible);
if (dc->public.config.gpu_vm_support) if (dc->public.config.gpu_vm_support)
mi->funcs->mem_input_program_pte_vm( mi->funcs->mem_input_program_pte_vm(
pipe_ctx->mi, pipe_ctx->mi,
surface->format, plane_state->format,
&surface->tiling_info, &plane_state->tiling_info,
surface->rotation); plane_state->rotation);
} }
static void update_plane_addr(const struct core_dc *dc, static void update_plane_addr(const struct core_dc *dc,
struct pipe_ctx *pipe_ctx) struct pipe_ctx *pipe_ctx)
{ {
struct dc_plane_state *surface = pipe_ctx->surface; struct dc_plane_state *plane_state = pipe_ctx->plane_state;
if (surface == NULL) if (plane_state == NULL)
return; return;
pipe_ctx->mi->funcs->mem_input_program_surface_flip_and_addr( pipe_ctx->mi->funcs->mem_input_program_surface_flip_and_addr(
pipe_ctx->mi, pipe_ctx->mi,
&surface->address, &plane_state->address,
surface->flip_immediate); plane_state->flip_immediate);
surface->status.requested_address = surface->address; plane_state->status.requested_address = plane_state->address;
} }
void dce110_update_pending_status(struct pipe_ctx *pipe_ctx) void dce110_update_pending_status(struct pipe_ctx *pipe_ctx)
{ {
struct dc_plane_state *surface = pipe_ctx->surface; struct dc_plane_state *plane_state = pipe_ctx->plane_state;
if (surface == NULL) if (plane_state == NULL)
return; return;
surface->status.is_flip_pending = plane_state->status.is_flip_pending =
pipe_ctx->mi->funcs->mem_input_is_flip_pending( pipe_ctx->mi->funcs->mem_input_is_flip_pending(
pipe_ctx->mi); pipe_ctx->mi);
if (surface->status.is_flip_pending && !surface->visible) if (plane_state->status.is_flip_pending && !plane_state->visible)
pipe_ctx->mi->current_address = pipe_ctx->mi->request_address; pipe_ctx->mi->current_address = pipe_ctx->mi->request_address;
surface->status.current_address = pipe_ctx->mi->current_address; plane_state->status.current_address = pipe_ctx->mi->current_address;
if (pipe_ctx->mi->current_address.type == PLN_ADDR_TYPE_GRPH_STEREO && if (pipe_ctx->mi->current_address.type == PLN_ADDR_TYPE_GRPH_STEREO &&
pipe_ctx->tg->funcs->is_stereo_left_eye) { pipe_ctx->tg->funcs->is_stereo_left_eye) {
surface->status.is_right_eye =\ plane_state->status.is_right_eye =\
!pipe_ctx->tg->funcs->is_stereo_left_eye(pipe_ctx->tg); !pipe_ctx->tg->funcs->is_stereo_left_eye(pipe_ctx->tg);
} }
} }
...@@ -2490,7 +2490,7 @@ static void dce110_program_front_end_for_pipe( ...@@ -2490,7 +2490,7 @@ static void dce110_program_front_end_for_pipe(
{ {
struct mem_input *mi = pipe_ctx->mi; struct mem_input *mi = pipe_ctx->mi;
struct pipe_ctx *old_pipe = NULL; struct pipe_ctx *old_pipe = NULL;
struct dc_plane_state *surface = pipe_ctx->surface; struct dc_plane_state *plane_state = pipe_ctx->plane_state;
struct xfm_grph_csc_adjustment adjust; struct xfm_grph_csc_adjustment adjust;
struct out_csc_color_matrix tbl_entry; struct out_csc_color_matrix tbl_entry;
unsigned int i; unsigned int i;
...@@ -2558,21 +2558,21 @@ static void dce110_program_front_end_for_pipe( ...@@ -2558,21 +2558,21 @@ static void dce110_program_front_end_for_pipe(
mi->funcs->mem_input_program_surface_config( mi->funcs->mem_input_program_surface_config(
mi, mi,
surface->format, plane_state->format,
&surface->tiling_info, &plane_state->tiling_info,
&surface->plane_size, &plane_state->plane_size,
surface->rotation, plane_state->rotation,
NULL, NULL,
false); false);
if (mi->funcs->set_blank) if (mi->funcs->set_blank)
mi->funcs->set_blank(mi, pipe_ctx->surface->visible); mi->funcs->set_blank(mi, pipe_ctx->plane_state->visible);
if (dc->public.config.gpu_vm_support) if (dc->public.config.gpu_vm_support)
mi->funcs->mem_input_program_pte_vm( mi->funcs->mem_input_program_pte_vm(
pipe_ctx->mi, pipe_ctx->mi,
surface->format, plane_state->format,
&surface->tiling_info, &plane_state->tiling_info,
surface->rotation); plane_state->rotation);
dm_logger_write(dc->ctx->logger, LOG_SURFACE, dm_logger_write(dc->ctx->logger, LOG_SURFACE,
"Pipe:%d 0x%x: addr hi:0x%x, " "Pipe:%d 0x%x: addr hi:0x%x, "
...@@ -2581,21 +2581,21 @@ static void dce110_program_front_end_for_pipe( ...@@ -2581,21 +2581,21 @@ static void dce110_program_front_end_for_pipe(
" %d; dst: %d, %d, %d, %d;" " %d; dst: %d, %d, %d, %d;"
"clip: %d, %d, %d, %d\n", "clip: %d, %d, %d, %d\n",
pipe_ctx->pipe_idx, pipe_ctx->pipe_idx,
pipe_ctx->surface, pipe_ctx->plane_state,
pipe_ctx->surface->address.grph.addr.high_part, pipe_ctx->plane_state->address.grph.addr.high_part,
pipe_ctx->surface->address.grph.addr.low_part, pipe_ctx->plane_state->address.grph.addr.low_part,
pipe_ctx->surface->src_rect.x, pipe_ctx->plane_state->src_rect.x,
pipe_ctx->surface->src_rect.y, pipe_ctx->plane_state->src_rect.y,
pipe_ctx->surface->src_rect.width, pipe_ctx->plane_state->src_rect.width,
pipe_ctx->surface->src_rect.height, pipe_ctx->plane_state->src_rect.height,
pipe_ctx->surface->dst_rect.x, pipe_ctx->plane_state->dst_rect.x,
pipe_ctx->surface->dst_rect.y, pipe_ctx->plane_state->dst_rect.y,
pipe_ctx->surface->dst_rect.width, pipe_ctx->plane_state->dst_rect.width,
pipe_ctx->surface->dst_rect.height, pipe_ctx->plane_state->dst_rect.height,
pipe_ctx->surface->clip_rect.x, pipe_ctx->plane_state->clip_rect.x,
pipe_ctx->surface->clip_rect.y, pipe_ctx->plane_state->clip_rect.y,
pipe_ctx->surface->clip_rect.width, pipe_ctx->plane_state->clip_rect.width,
pipe_ctx->surface->clip_rect.height); pipe_ctx->plane_state->clip_rect.height);
dm_logger_write(dc->ctx->logger, LOG_SURFACE, dm_logger_write(dc->ctx->logger, LOG_SURFACE,
"Pipe %d: width, height, x, y\n" "Pipe %d: width, height, x, y\n"
...@@ -2614,19 +2614,18 @@ static void dce110_program_front_end_for_pipe( ...@@ -2614,19 +2614,18 @@ static void dce110_program_front_end_for_pipe(
static void dce110_apply_ctx_for_surface( static void dce110_apply_ctx_for_surface(
struct core_dc *dc, struct core_dc *dc,
const struct dc_plane_state *surface, const struct dc_plane_state *plane_state,
struct validate_context *context) struct validate_context *context)
{ {
int i; int i;
/* TODO remove when removing the surface reset workaroud*/ if (!plane_state)
if (!surface)
return; return;
for (i = 0; i < dc->res_pool->pipe_count; i++) { for (i = 0; i < dc->res_pool->pipe_count; i++) {
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
if (pipe_ctx->surface != surface) if (pipe_ctx->plane_state != plane_state)
continue; continue;
dce110_program_front_end_for_pipe(dc, pipe_ctx); dce110_program_front_end_for_pipe(dc, pipe_ctx);
......
...@@ -764,9 +764,9 @@ static bool is_surface_pixel_format_supported(struct pipe_ctx *pipe_ctx, unsigne ...@@ -764,9 +764,9 @@ static bool is_surface_pixel_format_supported(struct pipe_ctx *pipe_ctx, unsigne
{ {
if (pipe_ctx->pipe_idx != underlay_idx) if (pipe_ctx->pipe_idx != underlay_idx)
return true; return true;
if (!pipe_ctx->surface) if (!pipe_ctx->plane_state)
return false; return false;
if (pipe_ctx->surface->format < SURFACE_PIXEL_FORMAT_VIDEO_BEGIN) if (pipe_ctx->plane_state->format < SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)
return false; return false;
return true; return true;
} }
...@@ -901,22 +901,22 @@ static bool dce110_validate_surface_sets( ...@@ -901,22 +901,22 @@ static bool dce110_validate_surface_sets(
int i; int i;
for (i = 0; i < set_count; i++) { for (i = 0; i < set_count; i++) {
if (set[i].surface_count == 0) if (set[i].plane_count == 0)
continue; continue;
if (set[i].surface_count > 2) if (set[i].plane_count > 2)
return false; return false;
if (set[i].surfaces[0]->format if (set[i].plane_states[0]->format
>= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN) >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)
return false; return false;
if (set[i].surface_count == 2) { if (set[i].plane_count == 2) {
if (set[i].surfaces[1]->format if (set[i].plane_states[1]->format
< SURFACE_PIXEL_FORMAT_VIDEO_BEGIN) < SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)
return false; return false;
if (set[i].surfaces[1]->src_rect.width > 1920 if (set[i].plane_states[1]->src_rect.width > 1920
|| set[i].surfaces[1]->src_rect.height > 1080) || set[i].plane_states[1]->src_rect.height > 1080)
return false; return false;
if (set[i].stream->timing.pixel_encoding != PIXEL_ENCODING_RGB) if (set[i].stream->timing.pixel_encoding != PIXEL_ENCODING_RGB)
...@@ -1351,7 +1351,7 @@ static bool construct( ...@@ -1351,7 +1351,7 @@ static bool construct(
if (!dce110_hw_sequencer_construct(dc)) if (!dce110_hw_sequencer_construct(dc))
goto res_create_fail; goto res_create_fail;
dc->public.caps.max_surfaces = pool->base.pipe_count; dc->public.caps.max_planes = pool->base.pipe_count;
bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, dc->ctx->asic_id); bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, dc->ctx->asic_id);
......
...@@ -889,13 +889,13 @@ static bool dce112_validate_surface_sets( ...@@ -889,13 +889,13 @@ static bool dce112_validate_surface_sets(
int i; int i;
for (i = 0; i < set_count; i++) { for (i = 0; i < set_count; i++) {
if (set[i].surface_count == 0) if (set[i].plane_count == 0)
continue; continue;
if (set[i].surface_count > 1) if (set[i].plane_count > 1)
return false; return false;
if (set[i].surfaces[0]->format if (set[i].plane_states[0]->format
>= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN) >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)
return false; return false;
} }
...@@ -1319,7 +1319,7 @@ static bool construct( ...@@ -1319,7 +1319,7 @@ static bool construct(
&res_create_funcs)) &res_create_funcs))
goto res_create_fail; goto res_create_fail;
dc->public.caps.max_surfaces = pool->base.pipe_count; dc->public.caps.max_planes = pool->base.pipe_count;
/* Create hardware sequencer */ /* Create hardware sequencer */
if (!dce112_hw_sequencer_construct(dc)) if (!dce112_hw_sequencer_construct(dc))
......
...@@ -982,7 +982,7 @@ static bool construct( ...@@ -982,7 +982,7 @@ static bool construct(
if (!dce120_hw_sequencer_create(dc)) if (!dce120_hw_sequencer_create(dc))
goto controller_create_fail; goto controller_create_fail;
dc->public.caps.max_surfaces = pool->base.pipe_count; dc->public.caps.max_planes = pool->base.pipe_count;
bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, dc->ctx->asic_id); bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, dc->ctx->asic_id);
......
...@@ -722,13 +722,13 @@ static bool dce80_validate_surface_sets( ...@@ -722,13 +722,13 @@ static bool dce80_validate_surface_sets(
int i; int i;
for (i = 0; i < set_count; i++) { for (i = 0; i < set_count; i++) {
if (set[i].surface_count == 0) if (set[i].plane_count == 0)
continue; continue;
if (set[i].surface_count > 1) if (set[i].plane_count > 1)
return false; return false;
if (set[i].surfaces[0]->format if (set[i].plane_states[0]->format
>= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN) >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)
return false; return false;
} }
...@@ -959,7 +959,7 @@ static bool construct( ...@@ -959,7 +959,7 @@ static bool construct(
} }
} }
dc->public.caps.max_surfaces = pool->base.pipe_count; dc->public.caps.max_planes = pool->base.pipe_count;
if (!resource_construct(num_virtual_links, dc, &pool->base, if (!resource_construct(num_virtual_links, dc, &pool->base,
&res_create_funcs)) &res_create_funcs))
......
...@@ -986,7 +986,7 @@ static void reset_hw_ctx_wrap( ...@@ -986,7 +986,7 @@ static void reset_hw_ctx_wrap(
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
if (!pipe_ctx->stream || if (!pipe_ctx->stream ||
!pipe_ctx->surface || !pipe_ctx->plane_state ||
pipe_need_reprogram(pipe_ctx_old, pipe_ctx)) { pipe_need_reprogram(pipe_ctx_old, pipe_ctx)) {
plane_atomic_disconnect(dc, i); plane_atomic_disconnect(dc, i);
...@@ -1010,13 +1010,13 @@ static void reset_hw_ctx_wrap( ...@@ -1010,13 +1010,13 @@ static void reset_hw_ctx_wrap(
/*if (!pipe_ctx_old->stream) /*if (!pipe_ctx_old->stream)
continue;*/ continue;*/
if (pipe_ctx->stream && pipe_ctx->surface if (pipe_ctx->stream && pipe_ctx->plane_state
&& !pipe_need_reprogram(pipe_ctx_old, pipe_ctx)) && !pipe_need_reprogram(pipe_ctx_old, pipe_ctx))
continue; continue;
plane_atomic_disable(dc, i); plane_atomic_disable(dc, i);
if (!pipe_ctx->stream || !pipe_ctx->surface) if (!pipe_ctx->stream || !pipe_ctx->plane_state)
plane_atomic_power_down(dc, i); plane_atomic_power_down(dc, i);
} }
...@@ -1038,24 +1038,24 @@ static void reset_hw_ctx_wrap( ...@@ -1038,24 +1038,24 @@ static void reset_hw_ctx_wrap(
static bool patch_address_for_sbs_tb_stereo( static bool patch_address_for_sbs_tb_stereo(
struct pipe_ctx *pipe_ctx, PHYSICAL_ADDRESS_LOC *addr) struct pipe_ctx *pipe_ctx, PHYSICAL_ADDRESS_LOC *addr)
{ {
struct dc_plane_state *surface = pipe_ctx->surface; struct dc_plane_state *plane_state = pipe_ctx->plane_state;
bool sec_split = pipe_ctx->top_pipe && bool sec_split = pipe_ctx->top_pipe &&
pipe_ctx->top_pipe->surface == pipe_ctx->surface; pipe_ctx->top_pipe->plane_state == pipe_ctx->plane_state;
if (sec_split && surface->address.type == PLN_ADDR_TYPE_GRPH_STEREO && if (sec_split && plane_state->address.type == PLN_ADDR_TYPE_GRPH_STEREO &&
(pipe_ctx->stream->timing.timing_3d_format == (pipe_ctx->stream->timing.timing_3d_format ==
TIMING_3D_FORMAT_SIDE_BY_SIDE || TIMING_3D_FORMAT_SIDE_BY_SIDE ||
pipe_ctx->stream->timing.timing_3d_format == pipe_ctx->stream->timing.timing_3d_format ==
TIMING_3D_FORMAT_TOP_AND_BOTTOM)) { TIMING_3D_FORMAT_TOP_AND_BOTTOM)) {
*addr = surface->address.grph_stereo.left_addr; *addr = plane_state->address.grph_stereo.left_addr;
surface->address.grph_stereo.left_addr = plane_state->address.grph_stereo.left_addr =
surface->address.grph_stereo.right_addr; plane_state->address.grph_stereo.right_addr;
return true; return true;
} else { } else {
if (pipe_ctx->stream->view_format != VIEW_3D_FORMAT_NONE && if (pipe_ctx->stream->view_format != VIEW_3D_FORMAT_NONE &&
surface->address.type != PLN_ADDR_TYPE_GRPH_STEREO) { plane_state->address.type != PLN_ADDR_TYPE_GRPH_STEREO) {
surface->address.type = PLN_ADDR_TYPE_GRPH_STEREO; plane_state->address.type = PLN_ADDR_TYPE_GRPH_STEREO;
surface->address.grph_stereo.right_addr = plane_state->address.grph_stereo.right_addr =
surface->address.grph_stereo.left_addr; plane_state->address.grph_stereo.left_addr;
} }
} }
return false; return false;
...@@ -1065,22 +1065,22 @@ static void update_plane_addr(const struct core_dc *dc, struct pipe_ctx *pipe_ct ...@@ -1065,22 +1065,22 @@ static void update_plane_addr(const struct core_dc *dc, struct pipe_ctx *pipe_ct
{ {
bool addr_patched = false; bool addr_patched = false;
PHYSICAL_ADDRESS_LOC addr; PHYSICAL_ADDRESS_LOC addr;
struct dc_plane_state *surface = pipe_ctx->surface; struct dc_plane_state *plane_state = pipe_ctx->plane_state;
if (surface == NULL) if (plane_state == NULL)
return; return;
addr_patched = patch_address_for_sbs_tb_stereo(pipe_ctx, &addr); addr_patched = patch_address_for_sbs_tb_stereo(pipe_ctx, &addr);
pipe_ctx->mi->funcs->mem_input_program_surface_flip_and_addr( pipe_ctx->mi->funcs->mem_input_program_surface_flip_and_addr(
pipe_ctx->mi, pipe_ctx->mi,
&surface->address, &plane_state->address,
surface->flip_immediate); plane_state->flip_immediate);
surface->status.requested_address = surface->address; plane_state->status.requested_address = plane_state->address;
if (addr_patched) if (addr_patched)
pipe_ctx->surface->address.grph_stereo.left_addr = addr; pipe_ctx->plane_state->address.grph_stereo.left_addr = addr;
} }
static bool dcn10_set_input_transfer_func( static bool dcn10_set_input_transfer_func(
struct pipe_ctx *pipe_ctx, const struct dc_plane_state *surface) struct pipe_ctx *pipe_ctx, const struct dc_plane_state *plane_state)
{ {
struct input_pixel_processor *ipp = pipe_ctx->ipp; struct input_pixel_processor *ipp = pipe_ctx->ipp;
const struct dc_transfer_func *tf = NULL; const struct dc_transfer_func *tf = NULL;
...@@ -1089,12 +1089,12 @@ static bool dcn10_set_input_transfer_func( ...@@ -1089,12 +1089,12 @@ static bool dcn10_set_input_transfer_func(
if (ipp == NULL) if (ipp == NULL)
return false; return false;
if (surface->in_transfer_func) if (plane_state->in_transfer_func)
tf = surface->in_transfer_func; tf = plane_state->in_transfer_func;
if (surface->gamma_correction && dce_use_lut(surface)) if (plane_state->gamma_correction && dce_use_lut(plane_state))
ipp->funcs->ipp_program_input_lut(ipp, ipp->funcs->ipp_program_input_lut(ipp,
surface->gamma_correction); plane_state->gamma_correction);
if (tf == NULL) if (tf == NULL)
ipp->funcs->ipp_set_degamma(ipp, IPP_DEGAMMA_MODE_BYPASS); ipp->funcs->ipp_set_degamma(ipp, IPP_DEGAMMA_MODE_BYPASS);
...@@ -1689,7 +1689,7 @@ static void dcn10_power_on_fe( ...@@ -1689,7 +1689,7 @@ static void dcn10_power_on_fe(
struct pipe_ctx *pipe_ctx, struct pipe_ctx *pipe_ctx,
struct validate_context *context) struct validate_context *context)
{ {
struct dc_plane_state *dc_surface = pipe_ctx->surface; struct dc_plane_state *plane_state = pipe_ctx->plane_state;
struct dce_hwseq *hws = dc->hwseq; struct dce_hwseq *hws = dc->hwseq;
power_on_plane(dc->hwseq, power_on_plane(dc->hwseq,
...@@ -1704,24 +1704,24 @@ static void dcn10_power_on_fe( ...@@ -1704,24 +1704,24 @@ static void dcn10_power_on_fe(
OPP_PIPE_CLOCK_EN, 1); OPP_PIPE_CLOCK_EN, 1);
/*TODO: REG_UPDATE(DENTIST_DISPCLK_CNTL, DENTIST_DPPCLK_WDIVIDER, 0x1f);*/ /*TODO: REG_UPDATE(DENTIST_DISPCLK_CNTL, DENTIST_DPPCLK_WDIVIDER, 0x1f);*/
if (dc_surface) { if (plane_state) {
dm_logger_write(dc->ctx->logger, LOG_DC, dm_logger_write(dc->ctx->logger, LOG_DC,
"Pipe:%d 0x%x: addr hi:0x%x, " "Pipe:%d 0x%x: addr hi:0x%x, "
"addr low:0x%x, " "addr low:0x%x, "
"src: %d, %d, %d," "src: %d, %d, %d,"
" %d; dst: %d, %d, %d, %d;\n", " %d; dst: %d, %d, %d, %d;\n",
pipe_ctx->pipe_idx, pipe_ctx->pipe_idx,
dc_surface, plane_state,
dc_surface->address.grph.addr.high_part, plane_state->address.grph.addr.high_part,
dc_surface->address.grph.addr.low_part, plane_state->address.grph.addr.low_part,
dc_surface->src_rect.x, plane_state->src_rect.x,
dc_surface->src_rect.y, plane_state->src_rect.y,
dc_surface->src_rect.width, plane_state->src_rect.width,
dc_surface->src_rect.height, plane_state->src_rect.height,
dc_surface->dst_rect.x, plane_state->dst_rect.x,
dc_surface->dst_rect.y, plane_state->dst_rect.y,
dc_surface->dst_rect.width, plane_state->dst_rect.width,
dc_surface->dst_rect.height); plane_state->dst_rect.height);
dm_logger_write(dc->ctx->logger, LOG_HW_SET_MODE, dm_logger_write(dc->ctx->logger, LOG_HW_SET_MODE,
"Pipe %d: width, height, x, y\n" "Pipe %d: width, height, x, y\n"
...@@ -1805,7 +1805,7 @@ static void program_csc_matrix(struct pipe_ctx *pipe_ctx, ...@@ -1805,7 +1805,7 @@ static void program_csc_matrix(struct pipe_ctx *pipe_ctx,
} }
static bool is_lower_pipe_tree_visible(struct pipe_ctx *pipe_ctx) static bool is_lower_pipe_tree_visible(struct pipe_ctx *pipe_ctx)
{ {
if (pipe_ctx->surface->visible) if (pipe_ctx->plane_state->visible)
return true; return true;
if (pipe_ctx->bottom_pipe && is_lower_pipe_tree_visible(pipe_ctx->bottom_pipe)) if (pipe_ctx->bottom_pipe && is_lower_pipe_tree_visible(pipe_ctx->bottom_pipe))
return true; return true;
...@@ -1814,7 +1814,7 @@ static bool is_lower_pipe_tree_visible(struct pipe_ctx *pipe_ctx) ...@@ -1814,7 +1814,7 @@ static bool is_lower_pipe_tree_visible(struct pipe_ctx *pipe_ctx)
static bool is_upper_pipe_tree_visible(struct pipe_ctx *pipe_ctx) static bool is_upper_pipe_tree_visible(struct pipe_ctx *pipe_ctx)
{ {
if (pipe_ctx->surface->visible) if (pipe_ctx->plane_state->visible)
return true; return true;
if (pipe_ctx->top_pipe && is_upper_pipe_tree_visible(pipe_ctx->top_pipe)) if (pipe_ctx->top_pipe && is_upper_pipe_tree_visible(pipe_ctx->top_pipe))
return true; return true;
...@@ -1823,7 +1823,7 @@ static bool is_upper_pipe_tree_visible(struct pipe_ctx *pipe_ctx) ...@@ -1823,7 +1823,7 @@ static bool is_upper_pipe_tree_visible(struct pipe_ctx *pipe_ctx)
static bool is_pipe_tree_visible(struct pipe_ctx *pipe_ctx) static bool is_pipe_tree_visible(struct pipe_ctx *pipe_ctx)
{ {
if (pipe_ctx->surface->visible) if (pipe_ctx->plane_state->visible)
return true; return true;
if (pipe_ctx->top_pipe && is_upper_pipe_tree_visible(pipe_ctx->top_pipe)) if (pipe_ctx->top_pipe && is_upper_pipe_tree_visible(pipe_ctx->top_pipe))
return true; return true;
...@@ -1898,12 +1898,12 @@ static void update_dchubp_dpp( ...@@ -1898,12 +1898,12 @@ static void update_dchubp_dpp(
struct dce_hwseq *hws = dc->hwseq; struct dce_hwseq *hws = dc->hwseq;
struct mem_input *mi = pipe_ctx->mi; struct mem_input *mi = pipe_ctx->mi;
struct input_pixel_processor *ipp = pipe_ctx->ipp; struct input_pixel_processor *ipp = pipe_ctx->ipp;
struct dc_plane_state *surface = pipe_ctx->surface; struct dc_plane_state *plane_state = pipe_ctx->plane_state;
union plane_size size = surface->plane_size; union plane_size size = plane_state->plane_size;
struct default_adjustment ocsc = {0}; struct default_adjustment ocsc = {0};
struct mpcc_cfg mpcc_cfg = {0}; struct mpcc_cfg mpcc_cfg = {0};
struct pipe_ctx *top_pipe; struct pipe_ctx *top_pipe;
bool per_pixel_alpha = surface->per_pixel_alpha && pipe_ctx->bottom_pipe; bool per_pixel_alpha = plane_state->per_pixel_alpha && pipe_ctx->bottom_pipe;
/* TODO: proper fix once fpga works */ /* TODO: proper fix once fpga works */
/* depends on DML calculation, DPP clock value may change dynamically */ /* depends on DML calculation, DPP clock value may change dynamically */
...@@ -1936,12 +1936,12 @@ static void update_dchubp_dpp( ...@@ -1936,12 +1936,12 @@ static void update_dchubp_dpp(
if (dc->public.config.gpu_vm_support) if (dc->public.config.gpu_vm_support)
mi->funcs->mem_input_program_pte_vm( mi->funcs->mem_input_program_pte_vm(
pipe_ctx->mi, pipe_ctx->mi,
surface->format, plane_state->format,
&surface->tiling_info, &plane_state->tiling_info,
surface->rotation); plane_state->rotation);
ipp->funcs->ipp_setup(ipp, ipp->funcs->ipp_setup(ipp,
surface->format, plane_state->format,
1, 1,
IPP_OUTPUT_FORMAT_12_BIT_FIX); IPP_OUTPUT_FORMAT_12_BIT_FIX);
...@@ -1982,12 +1982,12 @@ static void update_dchubp_dpp( ...@@ -1982,12 +1982,12 @@ static void update_dchubp_dpp(
mi->funcs->mem_input_program_surface_config( mi->funcs->mem_input_program_surface_config(
mi, mi,
surface->format, plane_state->format,
&surface->tiling_info, &plane_state->tiling_info,
&size, &size,
surface->rotation, plane_state->rotation,
&surface->dcc, &plane_state->dcc,
surface->horizontal_mirror); plane_state->horizontal_mirror);
mi->funcs->set_blank(mi, !is_pipe_tree_visible(pipe_ctx)); mi->funcs->set_blank(mi, !is_pipe_tree_visible(pipe_ctx));
} }
...@@ -2025,7 +2025,7 @@ static void program_all_pipe_in_tree( ...@@ -2025,7 +2025,7 @@ static void program_all_pipe_in_tree(
pipe_ctx->tg->funcs->set_blank(pipe_ctx->tg, !is_pipe_tree_visible(pipe_ctx)); pipe_ctx->tg->funcs->set_blank(pipe_ctx->tg, !is_pipe_tree_visible(pipe_ctx));
} }
if (pipe_ctx->surface != NULL) { if (pipe_ctx->plane_state != NULL) {
dcn10_power_on_fe(dc, pipe_ctx, context); dcn10_power_on_fe(dc, pipe_ctx, context);
update_dchubp_dpp(dc, pipe_ctx, context); update_dchubp_dpp(dc, pipe_ctx, context);
} }
...@@ -2068,7 +2068,7 @@ static void dcn10_pplib_apply_display_requirements( ...@@ -2068,7 +2068,7 @@ static void dcn10_pplib_apply_display_requirements(
static void dcn10_apply_ctx_for_surface( static void dcn10_apply_ctx_for_surface(
struct core_dc *dc, struct core_dc *dc,
const struct dc_plane_state *surface, const struct dc_plane_state *plane_state,
struct validate_context *context) struct validate_context *context)
{ {
int i, be_idx; int i, be_idx;
...@@ -2076,11 +2076,11 @@ static void dcn10_apply_ctx_for_surface( ...@@ -2076,11 +2076,11 @@ static void dcn10_apply_ctx_for_surface(
if (dc->public.debug.sanity_checks) if (dc->public.debug.sanity_checks)
verify_allow_pstate_change_high(dc->hwseq); verify_allow_pstate_change_high(dc->hwseq);
if (!surface) if (!plane_state)
return; return;
for (be_idx = 0; be_idx < dc->res_pool->pipe_count; be_idx++) for (be_idx = 0; be_idx < dc->res_pool->pipe_count; be_idx++)
if (surface == context->res_ctx.pipe_ctx[be_idx].surface) if (plane_state == context->res_ctx.pipe_ctx[be_idx].plane_state)
break; break;
/* reset unused mpcc */ /* reset unused mpcc */
...@@ -2089,7 +2089,7 @@ static void dcn10_apply_ctx_for_surface( ...@@ -2089,7 +2089,7 @@ static void dcn10_apply_ctx_for_surface(
struct pipe_ctx *old_pipe_ctx = struct pipe_ctx *old_pipe_ctx =
&dc->current_context->res_ctx.pipe_ctx[i]; &dc->current_context->res_ctx.pipe_ctx[i];
if (!pipe_ctx->surface && !old_pipe_ctx->surface) if (!pipe_ctx->plane_state && !old_pipe_ctx->plane_state)
continue; continue;
/* /*
...@@ -2097,7 +2097,7 @@ static void dcn10_apply_ctx_for_surface( ...@@ -2097,7 +2097,7 @@ static void dcn10_apply_ctx_for_surface(
* fairly hacky right now, using opp_id as indicator * fairly hacky right now, using opp_id as indicator
*/ */
if (pipe_ctx->surface && !old_pipe_ctx->surface) { if (pipe_ctx->plane_state && !old_pipe_ctx->plane_state) {
if (pipe_ctx->mi->opp_id != 0xf && pipe_ctx->tg->inst == be_idx) { if (pipe_ctx->mi->opp_id != 0xf && pipe_ctx->tg->inst == be_idx) {
dcn10_power_down_fe(dc, pipe_ctx->pipe_idx); dcn10_power_down_fe(dc, pipe_ctx->pipe_idx);
/* /*
...@@ -2109,7 +2109,7 @@ static void dcn10_apply_ctx_for_surface( ...@@ -2109,7 +2109,7 @@ static void dcn10_apply_ctx_for_surface(
} }
if ((!pipe_ctx->surface && old_pipe_ctx->surface) if ((!pipe_ctx->plane_state && old_pipe_ctx->plane_state)
|| (!pipe_ctx->stream && old_pipe_ctx->stream)) { || (!pipe_ctx->stream && old_pipe_ctx->stream)) {
if (old_pipe_ctx->tg->inst != be_idx) if (old_pipe_ctx->tg->inst != be_idx)
continue; continue;
...@@ -2135,7 +2135,7 @@ static void dcn10_apply_ctx_for_surface( ...@@ -2135,7 +2135,7 @@ static void dcn10_apply_ctx_for_surface(
old_pipe_ctx->top_pipe = NULL; old_pipe_ctx->top_pipe = NULL;
old_pipe_ctx->bottom_pipe = NULL; old_pipe_ctx->bottom_pipe = NULL;
old_pipe_ctx->surface = NULL; old_pipe_ctx->plane_state = NULL;
dm_logger_write(dc->ctx->logger, LOG_DC, dm_logger_write(dc->ctx->logger, LOG_DC,
"Reset mpcc for pipe %d\n", "Reset mpcc for pipe %d\n",
...@@ -2146,7 +2146,7 @@ static void dcn10_apply_ctx_for_surface( ...@@ -2146,7 +2146,7 @@ static void dcn10_apply_ctx_for_surface(
for (i = 0; i < dc->res_pool->pipe_count; i++) { for (i = 0; i < dc->res_pool->pipe_count; i++) {
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
if (pipe_ctx->surface != surface) if (pipe_ctx->plane_state != plane_state)
continue; continue;
/* looking for top pipe to program */ /* looking for top pipe to program */
...@@ -2468,34 +2468,34 @@ static bool dcn10_dummy_display_power_gating( ...@@ -2468,34 +2468,34 @@ static bool dcn10_dummy_display_power_gating(
void dcn10_update_pending_status(struct pipe_ctx *pipe_ctx) void dcn10_update_pending_status(struct pipe_ctx *pipe_ctx)
{ {
struct dc_plane_state *surface = pipe_ctx->surface; struct dc_plane_state *plane_state = pipe_ctx->plane_state;
struct timing_generator *tg = pipe_ctx->tg; struct timing_generator *tg = pipe_ctx->tg;
if (surface->ctx->dc->debug.sanity_checks) { if (plane_state->ctx->dc->debug.sanity_checks) {
struct core_dc *dc = DC_TO_CORE(surface->ctx->dc); struct core_dc *dc = DC_TO_CORE(plane_state->ctx->dc);
verify_allow_pstate_change_high(dc->hwseq); verify_allow_pstate_change_high(dc->hwseq);
} }
if (surface == NULL) if (plane_state == NULL)
return; return;
surface->status.is_flip_pending = plane_state->status.is_flip_pending =
pipe_ctx->mi->funcs->mem_input_is_flip_pending( pipe_ctx->mi->funcs->mem_input_is_flip_pending(
pipe_ctx->mi); pipe_ctx->mi);
/* DCN we read INUSE address in MI, do we still need this wa? */ /* DCN we read INUSE address in MI, do we still need this wa? */
if (surface->status.is_flip_pending && if (plane_state->status.is_flip_pending &&
!surface->visible) { !plane_state->visible) {
pipe_ctx->mi->current_address = pipe_ctx->mi->current_address =
pipe_ctx->mi->request_address; pipe_ctx->mi->request_address;
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
} }
surface->status.current_address = pipe_ctx->mi->current_address; plane_state->status.current_address = pipe_ctx->mi->current_address;
if (pipe_ctx->mi->current_address.type == PLN_ADDR_TYPE_GRPH_STEREO && if (pipe_ctx->mi->current_address.type == PLN_ADDR_TYPE_GRPH_STEREO &&
tg->funcs->is_stereo_left_eye) { tg->funcs->is_stereo_left_eye) {
surface->status.is_right_eye = plane_state->status.is_right_eye =
!tg->funcs->is_stereo_left_eye(pipe_ctx->tg); !tg->funcs->is_stereo_left_eye(pipe_ctx->tg);
} }
} }
......
...@@ -1406,7 +1406,7 @@ static bool construct( ...@@ -1406,7 +1406,7 @@ static bool construct(
goto res_create_fail; goto res_create_fail;
dcn10_hw_sequencer_construct(dc); dcn10_hw_sequencer_construct(dc);
dc->public.caps.max_surfaces = pool->base.pipe_count; dc->public.caps.max_planes = pool->base.pipe_count;
dc->public.cap_funcs = cap_funcs; dc->public.cap_funcs = cap_funcs;
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#define MAX_CLOCK_SOURCES 7 #define MAX_CLOCK_SOURCES 7
void enable_surface_flip_reporting(struct dc_plane_state *dc_surface, void enable_surface_flip_reporting(struct dc_plane_state *plane_state,
uint32_t controller_id); uint32_t controller_id);
#include "grph_object_id.h" #include "grph_object_id.h"
...@@ -153,7 +153,7 @@ struct resource_pool { ...@@ -153,7 +153,7 @@ struct resource_pool {
}; };
struct pipe_ctx { struct pipe_ctx {
struct dc_plane_state *surface; struct dc_plane_state *plane_state;
struct dc_stream_state *stream; struct dc_stream_state *stream;
struct mem_input *mi; struct mem_input *mi;
......
...@@ -59,7 +59,7 @@ struct hw_sequencer_funcs { ...@@ -59,7 +59,7 @@ struct hw_sequencer_funcs {
void (*apply_ctx_for_surface)( void (*apply_ctx_for_surface)(
struct core_dc *dc, struct core_dc *dc,
const struct dc_plane_state *surface, const struct dc_plane_state *plane_state,
struct validate_context *context); struct validate_context *context);
void (*set_plane_config)( void (*set_plane_config)(
...@@ -88,7 +88,7 @@ struct hw_sequencer_funcs { ...@@ -88,7 +88,7 @@ struct hw_sequencer_funcs {
bool (*set_input_transfer_func)( bool (*set_input_transfer_func)(
struct pipe_ctx *pipe_ctx, struct pipe_ctx *pipe_ctx,
const struct dc_plane_state *surface); const struct dc_plane_state *plane_state);
bool (*set_output_transfer_func)( bool (*set_output_transfer_func)(
struct pipe_ctx *pipe_ctx, struct pipe_ctx *pipe_ctx,
......
...@@ -119,7 +119,7 @@ struct pipe_ctx *resource_get_head_pipe_for_stream( ...@@ -119,7 +119,7 @@ struct pipe_ctx *resource_get_head_pipe_for_stream(
struct dc_stream_state *stream); struct dc_stream_state *stream);
bool resource_attach_surfaces_to_context( bool resource_attach_surfaces_to_context(
struct dc_plane_state *const *surfaces, struct dc_plane_state *const *plane_state,
int surface_count, int surface_count,
struct dc_stream_state *dc_stream, struct dc_stream_state *dc_stream,
struct validate_context *context, struct validate_context *context,
......
...@@ -77,7 +77,7 @@ void logger_write(struct dal_logger *logger, ...@@ -77,7 +77,7 @@ void logger_write(struct dal_logger *logger,
void pre_surface_trace( void pre_surface_trace(
const struct dc *dc, const struct dc *dc,
const struct dc_plane_state *const *surfaces, const struct dc_plane_state *const *plane_states,
int surface_count); int surface_count);
void update_surface_trace( void update_surface_trace(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment