drm/amd/display: programing surface flip by dmcub.
Programming surface flip addresses via dmcub uC for optimizing the data flush. Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com> Reviewed-by: Tony Cheng <Tony.Cheng@amd.com> Acked-by: Harry Wentland <harry.wentland@amd.com> Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:

zatwierdzone przez
Alex Deucher

rodzic
2c1a180ac1
commit
8c0192533c
@@ -30,12 +30,13 @@
|
||||
#include "dmub_cmd_dal.h"
|
||||
#include "dmub_cmd_vbios.h"
|
||||
#include "atomfirmware.h"
|
||||
|
||||
#include "dc_hw_types.h"
|
||||
#define DMUB_RB_CMD_SIZE 64
|
||||
#define DMUB_RB_MAX_ENTRY 128
|
||||
#define DMUB_RB_SIZE (DMUB_RB_CMD_SIZE * DMUB_RB_MAX_ENTRY)
|
||||
#define REG_SET_MASK 0xFFFF
|
||||
|
||||
|
||||
/*
|
||||
* Command IDs should be treated as stable ABI.
|
||||
* Do not reuse or modify IDs.
|
||||
@@ -47,6 +48,7 @@ enum dmub_cmd_type {
|
||||
DMUB_CMD__REG_SEQ_FIELD_UPDATE_SEQ = 2,
|
||||
DMUB_CMD__REG_SEQ_BURST_WRITE = 3,
|
||||
DMUB_CMD__REG_REG_WAIT = 4,
|
||||
DMUB_CMD__SURFACE_FLIP = 5,
|
||||
DMUB_CMD__PSR = 64,
|
||||
DMUB_CMD__VBIOS = 128,
|
||||
};
|
||||
@@ -145,6 +147,37 @@ struct dmub_rb_cmd_reg_wait {
|
||||
struct dmub_cmd_reg_wait_data reg_wait;
|
||||
};
|
||||
|
||||
#ifndef PHYSICAL_ADDRESS_LOC
|
||||
#define PHYSICAL_ADDRESS_LOC union large_integer
|
||||
#endif
|
||||
|
||||
struct dmub_cmd_surface_flip {
|
||||
uint32_t DCSURF_SURFACE_CONTROL;
|
||||
uint32_t DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH;
|
||||
uint32_t DCSURF_PRIMARY_META_SURFACE_ADDRESS;
|
||||
uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH;
|
||||
uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS;
|
||||
uint32_t DCSURF_PRIMARY_META_SURFACE_ADDRESS_HIGH_C;
|
||||
uint32_t DCSURF_PRIMARY_META_SURFACE_ADDRESS_C;
|
||||
uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH_C;
|
||||
uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS_C;
|
||||
uint32_t DCSURF_SECONDARY_META_SURFACE_ADDRESS_HIGH;
|
||||
uint32_t DCSURF_SECONDARY_META_SURFACE_ADDRESS;
|
||||
uint32_t DCSURF_SECONDARY_SURFACE_ADDRESS_HIGH;
|
||||
uint32_t DCSURF_SECONDARY_SURFACE_ADDRESS;
|
||||
enum dc_plane_addr_type addr_type;
|
||||
uint8_t hubp_inst;
|
||||
bool tmz_surface;
|
||||
bool immediate;
|
||||
uint8_t vmid;
|
||||
bool grph_stereo;
|
||||
};
|
||||
|
||||
struct dmub_rb_cmd_flip {
|
||||
struct dmub_cmd_header header;
|
||||
struct dmub_cmd_surface_flip flip;
|
||||
};
|
||||
|
||||
struct dmub_cmd_digx_encoder_control_data {
|
||||
union dig_encoder_control_parameters_v1_5 dig;
|
||||
};
|
||||
@@ -262,6 +295,7 @@ union dmub_rb_cmd {
|
||||
struct dmub_rb_cmd_psr_enable psr_enable;
|
||||
struct dmub_rb_cmd_psr_copy_settings psr_copy_settings;
|
||||
struct dmub_rb_cmd_psr_set_level psr_set_level;
|
||||
struct dmub_rb_cmd_flip surface_flip;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
@@ -73,12 +73,17 @@ static inline bool dmub_rb_full(struct dmub_rb *rb)
|
||||
static inline bool dmub_rb_push_front(struct dmub_rb *rb,
|
||||
const struct dmub_cmd_header *cmd)
|
||||
{
|
||||
uint8_t *wt_ptr = (uint8_t *)(rb->base_address) + rb->wrpt;
|
||||
uint64_t volatile *dst = (uint64_t volatile *)(rb->base_address) + rb->wrpt / sizeof(uint64_t);
|
||||
const uint64_t *src = (const uint64_t *)cmd;
|
||||
int i;
|
||||
|
||||
if (dmub_rb_full(rb))
|
||||
return false;
|
||||
|
||||
dmub_memcpy(wt_ptr, cmd, DMUB_RB_CMD_SIZE);
|
||||
// copying data
|
||||
for (i = 0; i < DMUB_RB_CMD_SIZE / sizeof(uint64_t); i++)
|
||||
*dst++ = *src++;
|
||||
|
||||
rb->wrpt += DMUB_RB_CMD_SIZE;
|
||||
|
||||
if (rb->wrpt >= rb->capacity)
|
||||
@@ -115,14 +120,17 @@ static inline bool dmub_rb_pop_front(struct dmub_rb *rb)
|
||||
|
||||
static inline void dmub_rb_flush_pending(const struct dmub_rb *rb)
|
||||
{
|
||||
uint8_t buf[DMUB_RB_CMD_SIZE];
|
||||
uint32_t rptr = rb->rptr;
|
||||
uint32_t wptr = rb->wrpt;
|
||||
|
||||
while (rptr != wptr) {
|
||||
const uint8_t *data = (const uint8_t *)rb->base_address + rptr;
|
||||
uint64_t volatile *data = (uint64_t volatile *)rb->base_address + rptr / sizeof(uint64_t);
|
||||
//uint64_t volatile *p = (uint64_t volatile *)data;
|
||||
uint64_t temp;
|
||||
int i;
|
||||
|
||||
dmub_memcpy(buf, data, DMUB_RB_CMD_SIZE);
|
||||
for (i = 0; i < DMUB_RB_CMD_SIZE / sizeof(uint64_t); i++)
|
||||
temp = *data++;
|
||||
|
||||
rptr += DMUB_RB_CMD_SIZE;
|
||||
if (rptr >= rb->capacity)
|
||||
|
Reference in New Issue
Block a user