#include <drm/amdgpu_drm.h>
#include "amdgpu.h"
#include "amdgpu_i2c.h"
#include "atom.h"
#include "amdgpu_connectors.h"
#include "amdgpu_display.h"
#include "soc15_common.h"
#include "gc/gc_11_0_0_offset.h"
#include "gc/gc_11_0_0_sh_mask.h"
#include <asm/div64.h>
#include <linux/pci.h>
#include <linux/pm_runtime.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_damage_helper.h>
#include <drm/drm_drv.h>
#include <drm/drm_edid.h>
#include <drm/drm_fb_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_modeset_helper.h>
#include <drm/drm_vblank.h>
void amdgpu_display_hotplug_work_func(struct work_struct *work)
{ … }
static int amdgpu_display_framebuffer_init(struct drm_device *dev,
struct amdgpu_framebuffer *rfb,
const struct drm_mode_fb_cmd2 *mode_cmd,
struct drm_gem_object *obj);
static void amdgpu_display_flip_callback(struct dma_fence *f,
struct dma_fence_cb *cb)
{ … }
static bool amdgpu_display_flip_handle_fence(struct amdgpu_flip_work *work,
struct dma_fence **f)
{ … }
static void amdgpu_display_flip_work_func(struct work_struct *__work)
{ … }
static void amdgpu_display_unpin_work_func(struct work_struct *__work)
{ … }
int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc,
struct drm_framebuffer *fb,
struct drm_pending_vblank_event *event,
uint32_t page_flip_flags, uint32_t target,
struct drm_modeset_acquire_ctx *ctx)
{ … }
int amdgpu_display_crtc_set_config(struct drm_mode_set *set,
struct drm_modeset_acquire_ctx *ctx)
{ … }
static const char *encoder_names[41] = …;
static const char *hpd_names[6] = …;
void amdgpu_display_print_display_setup(struct drm_device *dev)
{ … }
bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,
bool use_aux)
{ … }
static int amdgpu_dirtyfb(struct drm_framebuffer *fb, struct drm_file *file,
unsigned int flags, unsigned int color,
struct drm_clip_rect *clips, unsigned int num_clips)
{ … }
static const struct drm_framebuffer_funcs amdgpu_fb_funcs = …;
static const struct drm_framebuffer_funcs amdgpu_fb_funcs_atomic = …;
uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev,
uint64_t bo_flags)
{ … }
static const struct drm_format_info dcc_formats[] = …;
static const struct drm_format_info dcc_retile_formats[] = …;
static const struct drm_format_info *
lookup_format_info(const struct drm_format_info formats[],
int num_formats, u32 format)
{ … }
const struct drm_format_info *
amdgpu_lookup_format_info(u32 format, uint64_t modifier)
{ … }
static int
extract_render_dcc_offset(struct amdgpu_device *adev,
struct drm_gem_object *obj,
uint64_t *offset)
{ … }
static int convert_tiling_flags_to_modifier_gfx12(struct amdgpu_framebuffer *afb)
{ … }
static int convert_tiling_flags_to_modifier(struct amdgpu_framebuffer *afb)
{ … }
static int check_tiling_flags_gfx6(struct amdgpu_framebuffer *afb)
{ … }
static void get_block_dimensions(unsigned int block_log2, unsigned int cpp,
unsigned int *width, unsigned int *height)
{ … }
static unsigned int get_dcc_block_size(uint64_t modifier, bool rb_aligned,
bool pipe_aligned)
{ … }
static int amdgpu_display_verify_plane(struct amdgpu_framebuffer *rfb, int plane,
const struct drm_format_info *format,
unsigned int block_width, unsigned int block_height,
unsigned int block_size_log2)
{ … }
static int amdgpu_display_verify_sizes(struct amdgpu_framebuffer *rfb)
{ … }
static int amdgpu_display_get_fb_info(const struct amdgpu_framebuffer *amdgpu_fb,
uint64_t *tiling_flags, bool *tmz_surface,
bool *gfx12_dcc)
{ … }
static int amdgpu_display_gem_fb_verify_and_init(struct drm_device *dev,
struct amdgpu_framebuffer *rfb,
struct drm_file *file_priv,
const struct drm_mode_fb_cmd2 *mode_cmd,
struct drm_gem_object *obj)
{ … }
static int amdgpu_display_framebuffer_init(struct drm_device *dev,
struct amdgpu_framebuffer *rfb,
const struct drm_mode_fb_cmd2 *mode_cmd,
struct drm_gem_object *obj)
{ … }
struct drm_framebuffer *
amdgpu_display_user_framebuffer_create(struct drm_device *dev,
struct drm_file *file_priv,
const struct drm_mode_fb_cmd2 *mode_cmd)
{ … }
const struct drm_mode_config_funcs amdgpu_mode_funcs = …;
static const struct drm_prop_enum_list amdgpu_underscan_enum_list[] = …;
static const struct drm_prop_enum_list amdgpu_audio_enum_list[] = …;
static const struct drm_prop_enum_list amdgpu_dither_enum_list[] = …;
int amdgpu_display_modeset_create_props(struct amdgpu_device *adev)
{ … }
void amdgpu_display_update_priority(struct amdgpu_device *adev)
{ … }
static bool amdgpu_display_is_hdtv_mode(const struct drm_display_mode *mode)
{ … }
bool amdgpu_display_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{ … }
int amdgpu_display_get_crtc_scanoutpos(struct drm_device *dev,
unsigned int pipe, unsigned int flags, int *vpos,
int *hpos, ktime_t *stime, ktime_t *etime,
const struct drm_display_mode *mode)
{ … }
int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc)
{ … }
bool amdgpu_crtc_get_scanout_position(struct drm_crtc *crtc,
bool in_vblank_irq, int *vpos,
int *hpos, ktime_t *stime, ktime_t *etime,
const struct drm_display_mode *mode)
{ … }
static bool
amdgpu_display_robj_is_fb(struct amdgpu_device *adev, struct amdgpu_bo *robj)
{ … }
int amdgpu_display_suspend_helper(struct amdgpu_device *adev)
{ … }
int amdgpu_display_resume_helper(struct amdgpu_device *adev)
{ … }