Commit 5d945cbc authored by Rodrigo Siqueira's avatar Rodrigo Siqueira Committed by Alex Deucher
Browse files

drm/amd/display: Create a file dedicated to planes



[Why]
The amdgpu_dm file contains most of the code that works as an interface
between DRM API and DC. As a result, this file becomes very large since
it comprises multiple abstractions such as plane manipulation.

[How]
This commit extracts the plane code to its specific file named
amdgpu_dm_plane. This change does not change anything inside the
functions; the only exception is converting some static functions to a
global function.

Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Reviewed-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Acked-by: default avatarAlan Liu <HaoPing.Liu@amd.com>
Signed-off-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 25f7cde8
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -25,7 +25,12 @@



AMDGPUDM = amdgpu_dm.o amdgpu_dm_irq.o amdgpu_dm_mst_types.o amdgpu_dm_color.o
AMDGPUDM = \
	amdgpu_dm.o \
	amdgpu_dm_plane.o \
	amdgpu_dm_irq.o \
	amdgpu_dm_mst_types.o \
	amdgpu_dm_color.o

ifdef CONFIG_DRM_AMD_DC_DCN
AMDGPUDM += dc_fpu.o
+379 −1841

File changed.

Preview size limit exceeded, changes collapsed.

+1645 −0

File added.

Preview size limit exceeded, changes collapsed.

+73 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: MIT
/*
 * Copyright 2022 Advanced Micro Devices, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Authors: AMD
 *
 */

#ifndef __AMDGPU_DM_PLANE_H__
#define __AMDGPU_DM_PLANE_H__

#include "dc.h"

void handle_cursor_update(struct drm_plane *plane,
			  struct drm_plane_state *old_plane_state);

int fill_dc_scaling_info(struct amdgpu_device *adev,
			 const struct drm_plane_state *state,
			 struct dc_scaling_info *scaling_info);

void get_min_max_dc_plane_scaling(struct drm_device *dev,
				  struct drm_framebuffer *fb,
				  int *min_downscale, int *max_upscale);

int dm_plane_helper_check_state(struct drm_plane_state *state,
				struct drm_crtc_state *new_crtc_state);

bool modifier_has_dcc(uint64_t modifier);

unsigned int modifier_gfx9_swizzle_mode(uint64_t modifier);

int fill_plane_buffer_attributes(struct amdgpu_device *adev,
				 const struct amdgpu_framebuffer *afb,
				 const enum surface_pixel_format format,
				 const enum dc_rotation_angle rotation,
				 const uint64_t tiling_flags,
				 union dc_tiling_info *tiling_info,
				 struct plane_size *plane_size,
				 struct dc_plane_dcc_param *dcc,
				 struct dc_plane_address *address,
				 bool tmz_surface,
				 bool force_disable_dcc);

int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
			 struct drm_plane *plane,
			 unsigned long possible_crtcs,
			 const struct dc_plane_cap *plane_cap);

const struct drm_format_info *amd_get_format_info(const struct drm_mode_fb_cmd2 *cmd);

void fill_blending_from_plane_state(const struct drm_plane_state *plane_state,
				    bool *per_pixel_alpha, bool *pre_multiplied_alpha,
				    bool *global_alpha, int *global_alpha_value);

#endif