first and last commit
This commit is contained in:
commit
1bf4efd552
2612 files changed
+636500
No files matched your search
@@ -0,0 +1,407 @@
|
||||
/*
|
||||
* Copyright (C) 2014-2015 Apple Inc. All rights reserved.
|
||||
*
|
||||
* This document is the property of Apple Inc.
|
||||
* It is considered confidential and proprietary.
|
||||
*
|
||||
* This document may not be reproduced or transmitted in any form,
|
||||
* in whole or in part, without the express written permission of
|
||||
* Apple Inc.
|
||||
*/
|
||||
#include "adfe_v2_regs.h"
|
||||
|
||||
#include <debug.h>
|
||||
#include <drivers/display.h>
|
||||
#include <lib/env.h>
|
||||
#include <lib/paint.h>
|
||||
#include <platform.h>
|
||||
#include <platform/chipid.h>
|
||||
#include <platform/clocks.h>
|
||||
#include <platform/int.h>
|
||||
#include <platform/memmap.h>
|
||||
|
||||
#include <platform/soc/hwclocks.h>
|
||||
#include <platform/soc/hwisr.h>
|
||||
#include <sys.h>
|
||||
#include <sys/task.h>
|
||||
|
||||
#include <drivers/adfe_v2/adfe.h>
|
||||
#if TARGET_USES_GP_CM || TARGET_USES_BLEND_CM
|
||||
#include <target/display_gamma_tables.h>
|
||||
#endif //TARGET_USES_GP_CM || TARGET_USES_BLEND_CM
|
||||
#if WITH_SYSCFG
|
||||
#include <lib/syscfg.h>
|
||||
#endif
|
||||
#if WITH_DEVICETREE
|
||||
#include <lib/devicetree.h>
|
||||
#endif
|
||||
|
||||
struct adfe_v2_tuneable {
|
||||
char *name;
|
||||
uint32_t disp_dpcclkcntl;
|
||||
uint32_t disp_dpcclklvl_clock_on_level;
|
||||
uint32_t disp_dpcclklvl_clock_off_level;
|
||||
uint32_t disp_dpcqoscfg;
|
||||
uint32_t disp_dpcqosylvl_yellow_off;
|
||||
uint32_t disp_dpcqosylvl_yellow_on;
|
||||
uint32_t disp_dpcqosrlvl_red_off;
|
||||
uint32_t disp_dpcqosrlvl_red_on;
|
||||
uint32_t disp_dpclinkdown;
|
||||
uint32_t disp_dpgpreqaggr;
|
||||
uint32_t disp_dpcafclkgate; //ADP_VERSION > 1
|
||||
uint32_t disp_dpcenab;
|
||||
};
|
||||
|
||||
#include <platform/soc/display.h>
|
||||
|
||||
#ifndef ADP_VERSION
|
||||
#error ADP_VERSION undefined
|
||||
#endif
|
||||
|
||||
static void adfe_set_pixel_pipe_plane(u_int32_t pixel_pipe, u_int32_t plane_num, struct plane *plane);
|
||||
static void adfe_gp_gamut_adjustment(u_int32_t pixel_pipe);
|
||||
static void adfe_blend_gamut_adjustment(void);
|
||||
|
||||
static uint8_t display_pipe;
|
||||
static uint8_t gen_pixel_pipe = 0;
|
||||
|
||||
static struct adfe_v2_tuneable *adfe_tuneables_info;
|
||||
static const int32_t adfe_tuneables_list_size = sizeof(adfe_tuneables) / sizeof(struct adfe_v2_tuneable);
|
||||
|
||||
static void adfe_irq_handler(void *arg)
|
||||
{
|
||||
int which = (int)arg;
|
||||
dprintf(DEBUG_INFO, "adfe_irq_handler: ADPCIRQ(%d) is 0x%x -- attempting to clear\n", which, rADPCIRQ);
|
||||
rADPCIRQ = rADPCIRQ;
|
||||
}
|
||||
|
||||
void adfe_init(struct display_timing *timing)
|
||||
{
|
||||
const char *env;
|
||||
int32_t cnt;
|
||||
|
||||
env = env_get("adfe-tunables");
|
||||
if (env == 0) env = "default";
|
||||
|
||||
for (cnt = 0; cnt < adfe_tuneables_list_size; cnt++) {
|
||||
if (strcmp(env, adfe_tuneables[cnt].name)) continue;
|
||||
|
||||
adfe_tuneables_info = adfe_tuneables + cnt;
|
||||
}
|
||||
if (adfe_tuneables_info == 0) {
|
||||
panic("Failed to find adfe tunables info, bailing adfe_init()\n");
|
||||
}
|
||||
|
||||
display_pipe = 0;
|
||||
gen_pixel_pipe = 0;
|
||||
|
||||
#ifdef DISP1_BASE_ADDR
|
||||
if (DISPLAYPIPE_BASE_ADDR == DISP1_BASE_ADDR) {
|
||||
display_pipe = 1;
|
||||
gen_pixel_pipe = 0;
|
||||
}
|
||||
#endif //DISP1_BASE_ADDR
|
||||
|
||||
adfe_enable_error_handler();
|
||||
|
||||
// Turn on AutoMode
|
||||
rADPCPFMODE = ADPCPFMODE_AUTOEN | ADPCPFMODE_VBIEN;
|
||||
|
||||
// Set screen size
|
||||
rADPCFRAMESIZE = (timing->h_active << 16) | (timing->v_active << 0);
|
||||
|
||||
// Set the pipes clock gating on level (generic to both pipes)
|
||||
rADPCCLKLVL = adfe_tuneables_info->disp_dpcclklvl_clock_off_level |
|
||||
adfe_tuneables_info->disp_dpcclklvl_clock_on_level;
|
||||
|
||||
// Set the Memory QOS configuration
|
||||
rADPCQOSCFG = adfe_tuneables_info->disp_dpcqoscfg;
|
||||
|
||||
//set output FIFO QOS Yellow level
|
||||
rADPCQOSYLVL = adfe_tuneables_info->disp_dpcqosylvl_yellow_on |
|
||||
adfe_tuneables_info->disp_dpcqosylvl_yellow_off;
|
||||
|
||||
//set output FIFO QOS Red level
|
||||
rADPCQOSRLVL = adfe_tuneables_info->disp_dpcqosrlvl_red_on |
|
||||
adfe_tuneables_info->disp_dpcqosrlvl_red_off;
|
||||
|
||||
rADPCCLKCNTL = adfe_tuneables_info->disp_dpcclkcntl;
|
||||
rADPCLINKDOWN = adfe_tuneables_info->disp_dpclinkdown;
|
||||
|
||||
// Register added in Capri..
|
||||
#if ADP_VERSION > 1
|
||||
rADPCAFCLKGATE = adfe_tuneables_info->disp_dpcafclkgate;
|
||||
#endif
|
||||
|
||||
|
||||
// Disable CSC
|
||||
rADPCCRCCTRL = 0;
|
||||
}
|
||||
|
||||
void adfe_set_axis_flip(uint32_t pixel_pipe, bool flipX, bool flipY)
|
||||
{
|
||||
rADPGPSRCFMT(pixel_pipe) |= ((!!flipX) << 2) | ((!!flipY) << 1);
|
||||
}
|
||||
|
||||
// Algorithm provided by display team to do fixed point rounding.
|
||||
static uint64_t fixed_to_fixed( uint64_t in, int inprec, int outprec )
|
||||
{
|
||||
long long sval = *((long long *) &in);
|
||||
bool neg = sval < 0;
|
||||
|
||||
if( neg ) sval = -sval;
|
||||
if( outprec < inprec ) {
|
||||
sval = ((sval >> (inprec - outprec - 1)) + 1) >> 1;
|
||||
} else {
|
||||
sval <<= outprec - inprec;
|
||||
}
|
||||
|
||||
if( neg ) sval = -sval;
|
||||
return *((uint64_t *) &sval);
|
||||
}
|
||||
|
||||
/*
|
||||
* The ADP has 2 Generic Pixel Pipes. These pipes process pixels from memory before entering the Blend Unit.
|
||||
* A Plane is a single contigous location in memory containing pixel information
|
||||
* No scaling of any component is required (i.e. DDAInitX/DDAInitY are equal to SrcX/SrcY, and all DDA steps are equal to 1).
|
||||
* The Scale Region is equal to the Destination Region.
|
||||
* All pixels in the scale region are also in an Active Region (ARGB formats only).
|
||||
* 2DSN is disabled (YCbCr 4:4:4 formats only).
|
||||
*/
|
||||
void adfe_set_ui_layer(u_int32_t pixel_pipe, enum colorspace color, struct plane *plane0, struct plane *plane1,
|
||||
u_int32_t width, u_int32_t height)
|
||||
{
|
||||
uint8_t num_planes;
|
||||
uint8_t pixel_size, pixel_fmt;
|
||||
uint8_t is_ARGB;
|
||||
uint32_t reg = 0;
|
||||
|
||||
if (pixel_pipe > 1) return;
|
||||
|
||||
switch(color) {
|
||||
case CS_RGB565 :
|
||||
is_ARGB = true;
|
||||
pixel_size = 2;
|
||||
pixel_fmt = 2;
|
||||
num_planes = 1;
|
||||
break;
|
||||
case CS_RGB888 :
|
||||
is_ARGB = true;
|
||||
pixel_size = 1;
|
||||
pixel_fmt = 1;
|
||||
num_planes = 1;
|
||||
break;
|
||||
case CS_ARGB8101010 :
|
||||
is_ARGB = true;
|
||||
pixel_size = 3;
|
||||
pixel_fmt = 0;
|
||||
num_planes = 2;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
RELEASE_ASSERT(plane0 != NULL);
|
||||
if (num_planes > 1) RELEASE_ASSERT(plane1 != NULL);
|
||||
|
||||
|
||||
#if defined(__arm64__)
|
||||
rADPSMMU_BYPASS_ADDR = (((((addr_t)plane0->fb_virt) >> 32) & 0xF) << 8);
|
||||
#endif
|
||||
rADPSMMU_DIAG_BOGUS_ACCESS = 0x20ffff;
|
||||
|
||||
rADPDART_DIAG_CONFIG = 0x100;
|
||||
rADPDART_DIAG_BOGUS_ACCESS = 0x20ffff;
|
||||
rADPDART_FETCH_REQ_CONFIG = 0xe0303;
|
||||
|
||||
// Set displaypixel_pipe color, no swap and linear frame buffer
|
||||
reg = rADPGPSRCFMT(pixel_pipe);
|
||||
//clean up the fields we are about to set
|
||||
reg &= ~((0x3 << 26) | (0x3 << 24) | (1 << 22) | (1 << 21) | (1 << 20) | (0x1f << 4) | (1 << 0));
|
||||
reg |= (pixel_fmt << 26) | (pixel_size << 24) | ((num_planes - 1 ) << 22) | (is_ARGB << 21) | (0 << 4) | (1 << 0);
|
||||
rADPGPSRCFMT(pixel_pipe) = reg;
|
||||
|
||||
adfe_set_pixel_pipe_plane(pixel_pipe, 0, plane0);
|
||||
if (num_planes > 1) {
|
||||
adfe_set_pixel_pipe_plane(pixel_pipe, 1, plane1);
|
||||
}
|
||||
|
||||
// Enable source active region 0
|
||||
rADPGPSRCCFG(pixel_pipe) = (1 << 0);
|
||||
|
||||
// Set the destination frame geometry
|
||||
rADPGPDSTXY(pixel_pipe) = 0;
|
||||
rADPGPDSTWH(pixel_pipe) = (width << 16) | (height << 0);
|
||||
|
||||
//No Scale Mode
|
||||
rADPGPCFG(pixel_pipe) = ADPGPCFG_NO_SCALE;
|
||||
|
||||
//Dithering off
|
||||
rADPGPNOISECFG(pixel_pipe) = 0;
|
||||
|
||||
//No color Space Conversion
|
||||
rADPGPCSCCFG(pixel_pipe)= ADPGPCSCCFG_CSC_BYPASS;
|
||||
|
||||
// No Color Management
|
||||
rADPGPCMCFG(pixel_pipe)= ADPGPCMCFG_CM_BYPASS;
|
||||
|
||||
//Bypass Color space conversion
|
||||
rADPBCSCCFG = ADPBCSCCFG_CSCBYPASS;
|
||||
|
||||
adfe_gp_gamut_adjustment(pixel_pipe);
|
||||
|
||||
// Bypass Blend Color Management
|
||||
rADPBCMCFG = ADPBCMCFG_CMBYPASS;
|
||||
|
||||
//Tunable
|
||||
rADPGPREQAGGR(pixel_pipe, 0) = adfe_tuneables_info->disp_dpgpreqaggr;
|
||||
|
||||
rADPGPREQAGGR(pixel_pipe, 1) = adfe_tuneables_info->disp_dpgpreqaggr;
|
||||
|
||||
//No Need for Blend
|
||||
#define BLEND_BYPASS 1
|
||||
#if BLEND_BYPASS
|
||||
rADPBCFG = ADPBCFG_BLEND_BYPASS;
|
||||
#endif //BLEND_BYPASS
|
||||
rADPBLAYCFG(pixel_pipe) = (1 << 4) | (pixel_pipe << 0);
|
||||
rADPBLAYCFG(1-pixel_pipe) = (0 << 4) | ((1-pixel_pipe) << 0);
|
||||
//rADPBBACKCOLOR = 0xf;
|
||||
|
||||
adfe_blend_gamut_adjustment();
|
||||
|
||||
}
|
||||
|
||||
static void adfe_set_pixel_pipe_plane(u_int32_t pixel_pipe, u_int32_t plane_num, struct plane *plane)
|
||||
{
|
||||
// Set base address of this pixel_pipe (lower 32 bits, in case of 64 bits address)
|
||||
rADPGPSRCBASE(pixel_pipe, plane_num) = (uint32_t)plane->fb_virt;
|
||||
|
||||
// Set burst size and stride bytes
|
||||
rADPGPSRCSTRD(pixel_pipe, plane_num) = plane->stride;
|
||||
|
||||
// Set the source scale region geometry
|
||||
rADPGPSRCXY(pixel_pipe, plane_num) = 0;
|
||||
rADPGPSRCWH(pixel_pipe, plane_num) = (plane->width << 16) | (plane->height << 0);
|
||||
|
||||
//Note that if the pipe is being used in No Scale or Scaler Bypass mode DdaInitX must equal SrcX
|
||||
rADPGPDDAINITX(pixel_pipe, plane_num) = 0;
|
||||
rADPGPDDASTEPX(pixel_pipe, plane_num) = 0x100000;
|
||||
//Note that if the pipe is being used in No Scale or Scaler Bypass mode DdaInitY must equal SrcY
|
||||
rADPGPDDAINITY(pixel_pipe, plane_num) = 0;
|
||||
rADPGPDDASTEPY(pixel_pipe, plane_num) = 0x100000;
|
||||
|
||||
// Set first region for the requested window
|
||||
rADPGPSRCACTXY(pixel_pipe, plane_num) = (0 << 16) | (0 << 0);
|
||||
rADPGPSRCACTWH(pixel_pipe, plane_num) = (plane->width << 16) | (plane->height << 0);
|
||||
}
|
||||
|
||||
void adfe_enable_error_handler(void)
|
||||
{
|
||||
rADPCIRQENAB |= ADPCIRQ_OUTUNDERIRQ;
|
||||
install_int_handler(INT_DISP0, adfe_irq_handler, 0);
|
||||
unmask_int(INT_DISP0);
|
||||
}
|
||||
|
||||
void adfe_disable_error_handler(void)
|
||||
{
|
||||
rADPCIRQENAB &= ~ADPCIRQ_OUTUNDERIRQ;
|
||||
mask_int(INT_DISP0);
|
||||
}
|
||||
|
||||
void adfe_set_background_color(u_int32_t color)
|
||||
{
|
||||
rADPBBACKCOLOR = color;
|
||||
}
|
||||
|
||||
void adfe_activate_window(void)
|
||||
{
|
||||
if (gen_pixel_pipe > 1) return;
|
||||
|
||||
//Set SID to bypass due to
|
||||
//<rdar://problem/13098516> SMMU Configuration Timing
|
||||
// Enable the requested generic pixel pipe
|
||||
rADPCENAB = adfe_tuneables_info->disp_dpcenab | ADPCENAB_SIDSEL_BYPASS | (1 << (gen_pixel_pipe * 4));
|
||||
}
|
||||
|
||||
bool adfe_get_enable(void)
|
||||
{
|
||||
return (rADPCIRQENAB & ADPCIRQ_OUTUNDERIRQ) != 0;
|
||||
}
|
||||
|
||||
static void adfe_blend_gamut_adjustment(void)
|
||||
{
|
||||
#if TARGET_USES_BLEND_CM
|
||||
#if WITH_SYSCFG
|
||||
struct primary_calibration_matrix {
|
||||
uint32_t version;
|
||||
uint32_t matrix[3][3];
|
||||
};
|
||||
|
||||
struct primary_calibration_matrix pcm;
|
||||
|
||||
if (syscfgCopyDataForTag('DPCl', (u_int8_t *)&pcm, sizeof(pcm)) > 0) {
|
||||
|
||||
int row, col;
|
||||
|
||||
//Program degamma LUT
|
||||
for (row = 0; row < ADP_CM_DEGAMMA_PAIRED_LUT_SIZE; row++) {
|
||||
rADPBDEGAMMATABLE(row) = target_blend_degamma_tables[row];
|
||||
}
|
||||
|
||||
//Program Linear Degamma
|
||||
rADPBDEGAMMALINEAR = target_blend_degamma_tables[row];
|
||||
|
||||
for(row = 0; row < 3; row ++) {
|
||||
for(col = 0; col < 3; col++) {
|
||||
// Convert from 8.24 to 4.12
|
||||
rADPBCMCOEF(row, col) = (uint32_t)(fixed_to_fixed( pcm.matrix[row][col], 24, 12 ) & 0xFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
for (row = 0; row < ADP_CM_ENGAMMA_PAIRED_LUT_SIZE; row++) {
|
||||
rADPBGAMMATABLE_R(row) = target_blend_engamma_tables[row];
|
||||
rADPBGAMMATABLE_G(row) = target_blend_engamma_tables[row];
|
||||
rADPBGAMMATABLE_B(row) = target_blend_engamma_tables[row];
|
||||
}
|
||||
|
||||
rADPBGAMMALINEAR_R = target_blend_engamma_tables[row];
|
||||
rADPBGAMMALINEAR_G = target_blend_engamma_tables[row];
|
||||
rADPBGAMMALINEAR_B = target_blend_engamma_tables[row];
|
||||
|
||||
// Turn off Blend Color Management Bypass
|
||||
rADPBCMCFG &= ~ADPBCMCFG_CMBYPASS;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void adfe_gp_gamut_adjustment(u_int32_t pixel_pipe)
|
||||
{
|
||||
#if TARGET_USES_GP_CM
|
||||
int col;
|
||||
int row;
|
||||
|
||||
//Program degamma LUT
|
||||
for (row = 0; row < ADP_CM_DEGAMMA_PAIRED_LUT_SIZE; row++) {
|
||||
rADPGPDEGAMMATABLE(pixel_pipe, row) = target_gp_degamma_tables[row];
|
||||
}
|
||||
|
||||
//Program Linear Degamma
|
||||
rADPGPDEGAMMALINEAR(pixel_pipe) = target_gp_degamma_tables[row];
|
||||
|
||||
for(row = 0; row < 3; row ++ ) {
|
||||
for(col = 0; col < 3; col ++ ) {
|
||||
rADPGPCMCOEF(pixel_pipe, row, col) = target_gp_csc_matrix[row][col];
|
||||
}
|
||||
}
|
||||
|
||||
for (row = 0; row < ADP_CM_ENGAMMA_PAIRED_LUT_SIZE; row++) {
|
||||
rADPGPGAMMATABLE(pixel_pipe, row) = target_gp_engamma_tables[row];
|
||||
}
|
||||
|
||||
rADPGPGAMMALINEAR(pixel_pipe) = target_gp_engamma_tables[row];
|
||||
|
||||
//Unbypass the gamut adjustment block
|
||||
rADPGPCMCFG(pixel_pipe) &= ~ADPGPCMCFG_CM_BYPASS;
|
||||
|
||||
#endif //TARGET_USES_GP_CM
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Apple Inc. All rights reserved.
|
||||
*
|
||||
* This document is the property of Apple Inc.
|
||||
* It is considered confidential and proprietary.
|
||||
*
|
||||
* This document may not be reproduced or transmitted in any form,
|
||||
* in whole or in part, without the express written permission of
|
||||
* Apple Inc.
|
||||
*/
|
||||
#ifndef __APPLE_DISPLAY_FRONTEND_REGS_H
|
||||
#define __APPLE_DISPLAY_FRONTEND_REGS_H
|
||||
|
||||
#include <platform/soc/hwregbase.h>
|
||||
|
||||
//General control registers
|
||||
#define rADPCSPARE (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1000))
|
||||
#define rADPCVERSION (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1018))
|
||||
#define rADPCSTATE (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x101c))
|
||||
#define rADPCGO (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1020))
|
||||
#define rADPCRESTART (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1024))
|
||||
#define rADPCIRQENAB (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1028))
|
||||
#define ADPCIRQ_WBPARTIRQ (1 << 14)
|
||||
#define ADPCIRQ_WBCMPLIRQ (1 << 13)
|
||||
#define ADPCIRQ_WRERRIRQ (1 << 12)
|
||||
#define ADPCIRQ_RDERRIRQ (1 << 1)
|
||||
#define ADPCIRQ_PFPROCIRQ (1 << 10)
|
||||
#define ADPCIRQ_PFOVERIRQ (1 << 9)
|
||||
#define ADPCIRQ_PFHDRIRQ (1 << 8)
|
||||
#define ADPCIRQ_PFEMPTYIRQ (1 << 7)
|
||||
#define ADPCIRQ_PFALIGNIRQ (1 << 6)
|
||||
#define ADPCIRQ_PFREPEATIRQ (1 << 5)
|
||||
#define ADPCIRQ_PFSYNCIRQ (1 << 4)
|
||||
#define ADPCIRQ_PFMISSIRQ (1 << 3)
|
||||
#define ADPCIRQ_PFUNDERIRQ (1 << 2)
|
||||
#define ADPCIRQ_OUTUNDERIRQ (1 << 1)
|
||||
#define ADPCIRQ_VBIIRQ (1 << 0)
|
||||
#define rADPCIRQ (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x102c))
|
||||
#define rADPCFRAMESIZE (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1030))
|
||||
#define rADPCFRMCNT (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1034))
|
||||
#define rADPCENAB (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1038))
|
||||
#define ADPCENAB_IDEAL_ARB_ENAB (1 << 16)
|
||||
#define ADPCENAB_SIDSEL_BYPASS (1 << 12)
|
||||
#define rADPCPFSIZE (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x103c))
|
||||
#define rADPCPFSTAT (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1040))
|
||||
#define rADPCPFHEAD (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1044))
|
||||
#define rADPCPFMODE (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1048))
|
||||
#define ADPCPFMODE_AUTOEN (1 << 0)
|
||||
#define ADPCPFMODE_VBIEN (1 << 4)
|
||||
#define rADPCPFFLUSH (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x104c))
|
||||
#define rADPCCLKCNTL (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1050))
|
||||
#define ADPCCLKCNTL_FLOOR(n) ((n) << 16)
|
||||
#define ADPCCLKCNTL_PIPE_ENABLE (1 << 8)
|
||||
#define ADPCCLKCNTL_LB_ENABLE (1 << 4)
|
||||
#define ADPCCLKCNTL_PIO_GATE_ENABLE (1 << 3)
|
||||
#define ADPCCLKCNTL_STAT_GATE_ENABLE (1 << 2)
|
||||
#define ADPCCLKCNTL_EXT_GATE_ENABLE (1 << 1)
|
||||
#define ADPCCLKCNTL_DYN_GATE_ENABLE (1 << 0)
|
||||
#define rADPCCLKLVL (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1054))
|
||||
#define ADPCCLKLVL_ONLVL(n) ((n) << 16)
|
||||
#define ADPCCLKLVL_OFFLVL(n) ((n) << 0)
|
||||
#define rADPCQOSCFG (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1058))
|
||||
#define ADPCQOSCFG_QOS_TIMER(n) ((n) << 16)
|
||||
#define ADPCQOSCFG_PIPE_ENABLE (1 << 8)
|
||||
#define ADPCQOSCFG_MINLVL_ENABLE (1 << 6)
|
||||
#define ADPCQOSCFG_MON_MODE (1 << 5)
|
||||
#define ADPCQOSCFG_MON_ENABLE (1 << 4)
|
||||
#define ADPCQOSCFG_QOS_ENABLE (1 << 0)
|
||||
#define rADPCQOSYLVL (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x105c))
|
||||
#define ADPCQOSYLVL_YELLOW_OFF(n) ((n) << 16)
|
||||
#define ADPCQOSYLVL_YELLOW_ON(n) ((n) << 0)
|
||||
#define rADPCQOSRLVL (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1060))
|
||||
#define ADPCQOSRLVL_RED_OFF(n) ((n) << 16)
|
||||
#define ADPCQOSRLVL_RED_ON(n) ((n) << 0)
|
||||
#define rADPCQOSGSNAP (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1064))
|
||||
#define rADPCQOSYSNAP (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1068))
|
||||
#define rADPCQOSRSNAP (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x106c))
|
||||
#define rADPCQOSMINLVLSNAP (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1070))
|
||||
#define rADPCCRCCTRL (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1074))
|
||||
#define rADPCLINKDOWN (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1078))
|
||||
#define ADPCLINKDOWN_TEARDOWNNOSCL (1 << 8)
|
||||
#define ADPCLINKDOWN_TEARDOWNAGGR (1 << 4)
|
||||
#define ADPCLINKDOWN_TEARDOWNEN (1 << 0)
|
||||
#if ADP_VERSION > 1
|
||||
#define rADPCAFCLKGATE (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x107C))
|
||||
#define ADPAFIDLECOUNT(n) ((n) << 16)
|
||||
#define ADPAFDYNCLKGATEEN (1 << 0)
|
||||
#endif
|
||||
#define rADPCPFTOP(n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x10c0 + (4 * (n))))
|
||||
|
||||
//Blend Unit registers
|
||||
#define rADPBSPARE (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x2000))
|
||||
#define rADPBCFG (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x2020))
|
||||
#define ADPBCFG_BLEND_BYPASS (1 << 0)
|
||||
#define rADPBBACKCOLOR (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x2024))
|
||||
#define rADPBLAYCFG(n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x2028 + (4 * (n))))
|
||||
#define rADPBCRCDATA (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x2030))
|
||||
#define rADPBCSCCFG (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x2034))
|
||||
#define ADPBCSCCFG_CSCBYPASS (1 << 0)
|
||||
#define rADPBCSCINOFF(n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x2038 + (4 * (n))))
|
||||
#define rADPBCSCCOEF(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x2044 + (12 * (p)) + (4 * (n))))
|
||||
#define rADPBCSCOUTOFF(n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x2068 + (4 * (n))))
|
||||
#define rADPBCMCFG (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x2074))
|
||||
#define ADPBCMCFG_CMBYPASS (1 << 0)
|
||||
#define rADPBDEGAMMALINEAR (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x2078))
|
||||
#define rADPBCMCOEF(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x207c + (12 * (p)) + (4 * (n))))
|
||||
#define rADPBGAMMALINEAR (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x20a0))
|
||||
#define rADPBGAMMALINEAR_R (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x20a0))
|
||||
#define rADPBGAMMALINEAR_G (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x20a4))
|
||||
#define rADPBGAMMALINEAR_B (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x20a8))
|
||||
#define rADPBOUTFIFODEPTH (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x20ac))
|
||||
#define rADPBDEGAMMATABLE(n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x2200 + (4 * (n))))
|
||||
#define rADPBGAMMATABLE(n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x2800 + (4 * (n))))
|
||||
#define rADPBGAMMATABLE_R(n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x2800 + (4 * (n))))
|
||||
#define rADPBGAMMATABLE_G(n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x3000 + (4 * (n))))
|
||||
#define rADPBGAMMATABLE_B(n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x3800 + (4 * (n))))
|
||||
|
||||
//Generic Pipe registers
|
||||
#define rADPGPSPARE(p) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4000 + ((p) * 0x2000)))
|
||||
#define rADPGPCFG(p) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4020 + ((p) * 0x2000)))
|
||||
#define ADPGPCFG_SCALE_BYPASS (1 << 4)
|
||||
#define ADPGPCFG_NO_SCALE (1 << 0)
|
||||
#define rADPGPREQAGGR(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4024 + ((p) * 0x2000) + (4 * (n))))
|
||||
#define ADPGPREQARRG_CACHEHINT_MASK (0x0F0000)
|
||||
#define ADPGPREQAGGR_CACHEHINT(n) ((n) << 16)
|
||||
#define ADPGPREQAGGR_REQAGGRTHRESH(n) ((n) << 4)
|
||||
#define ADPGPREQARRG_OPPORTUNISMENAB (1 << 1)
|
||||
#define ADPGPREQAGGR_REQAGGRENAB (1 << 0)
|
||||
#define rADPGPSRCFMT(p) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x402c + ((p) * 0x2000)))
|
||||
#define rADPGPSRCBASE(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4030 + ((p) * 0x2000) + (4 * (n))))
|
||||
#define rADPGPSRCSTRD(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4038 + ((p) * 0x2000) + (4 * (n))))
|
||||
#define rADPGPSRCXY(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4040 + ((p) * 0x2000) + (4 * (n))))
|
||||
#define rADPGPSRCWH(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4048 + ((p) * 0x2000) + (4 * (n))))
|
||||
#define rADPGPDSTXY(p) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4050 + ((p) * 0x2000)))
|
||||
#define rADPGPDSTWH(p) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4054 + ((p) * 0x2000)))
|
||||
#define rADPGPTBEDGEALPHA(p) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4058 + ((p) * 0x2000)))
|
||||
#define rADPGPLREDGEALPHA(p) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x405c + ((p) * 0x2000)))
|
||||
#define rADPGPTCEDGEALPHA(p) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4060 + ((p) * 0x2000)))
|
||||
#define rADPGPBCEDGEALPHA(p) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4064 + ((p) * 0x2000)))
|
||||
#define rADPGPSRCCFG(p) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4068 + ((p) * 0x2000)))
|
||||
#define rADPGPSRCACTXY(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x406c + ((p) * 0x2000) + (4 * (n))))
|
||||
#define rADPGPSRCACTWH(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x407c + ((p) * 0x2000) + (4 * (n))))
|
||||
#define rADPGPNOISECFG(p) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x408c + ((p) * 0x2000)))
|
||||
#define rADPGPNOISELFSR(p) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4090 + ((p) * 0x2000)))
|
||||
#define rADPGPDDAINITX(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4094 + ((p) * 0x2000) + (4 * (n))))
|
||||
#define rADPGPDDASTEPX(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x409c + ((p) * 0x2000) + (4 * (n))))
|
||||
#define rADPGPDDAINITY(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x40a4 + ((p) * 0x2000) + (4 * (n))))
|
||||
#define rADPGPDDASTEPY(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x40ac + ((p) * 0x2000) + (4 * (n))))
|
||||
|
||||
#define rADPGPCSCCFG(p) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x40b4 + ((p) * 0x2000)))
|
||||
#define ADPGPCSCCFG_CSC_BYPASS (1 << 0)
|
||||
#define rADPGPCSCINOFF(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x40b8 + ((p) * 0x2000) + (4 * (n))))
|
||||
#define rADPGPCSCCOEF(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x40c4 + ((p) * 0x2000) + (4 * (n))))
|
||||
#define rADPGPCSCOUTOFF(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x40e8 + ((p) * 0x2000) + (4 * (n))))
|
||||
|
||||
#define rADPGPCMCFG(p) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x40f4 + ((p) * 0x2000)))
|
||||
#define ADPGPCMCFG_CM_BYPASS (1 << 0)
|
||||
#define rADPGPDEGAMMALINEAR(p) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x40f8 + ((p) * 0x2000)))
|
||||
#define rADPGPCMCOEF(p, r, c) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x40fc + ((p) * 0x2000) + ((r) * 0xc) + (4 * (c))))
|
||||
|
||||
#define rADPGPGAMMALINEAR(p) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4120 + ((p) * 0x2000)))
|
||||
#define rADPGPCRCCTRL(p) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4124 + ((p) * 0x2000)))
|
||||
#define rADPGPCRCDATA(p) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4128 + ((p) * 0x2000)))
|
||||
#define rADPGPINVDDASTEPX(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x412c + ((p) * 0x2000) + (4 * (n))))
|
||||
#define rADPGPDEGAMMATABLE(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4200 + ((p) * 0x2000) + (4 * (n))))
|
||||
#define rADPGPGAMMATABLE(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x4800 + ((p) * 0x2000) + (4 * (n))))
|
||||
#define rADPGPCOEFX(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x5000 + ((p) * 0x2000) + (4 * (n))))
|
||||
#define rADPGPCOEFY(p, n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x5800 + ((p) * 0x2000) + (4 * (n))))
|
||||
|
||||
//DP Noise RAM Registers
|
||||
#define rADPNOISEARRAY(n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x8000 + (4 * (n)))
|
||||
|
||||
//DP Write Back Registers
|
||||
#define rADPWBSPARE (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x9000))
|
||||
#define rADPWBBASE(n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x9020 + (4 * (n))))
|
||||
#define rADPWBSTRD(n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x9028 + (4 * (n))))
|
||||
#define rADPWBCNTL (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x9030))
|
||||
#define rADPWBCHROMADOWN (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x9034))
|
||||
#define rADPWBLINECNT(n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x9038 + (4 * (n))))
|
||||
#define rADP_DITHER_SKEW0 (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x9040))
|
||||
#define rADP_DITHER_SKEW1 (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x9044))
|
||||
#define rADP_DITHER_SKEW2 (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x9048))
|
||||
#define rADP_DITHER_KERNEL (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x904c))
|
||||
|
||||
//SMMU Registers
|
||||
#define rADPSMMU_CONFIG (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x10000c))
|
||||
#define rADPSMMU_ERR_STATUS (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x100010))
|
||||
#define rADPSMMU_ERR_AXI_REQ0 (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x100014))
|
||||
#define rADPSMMU_ERR_AXI_REQ1 (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x100018))
|
||||
#define rADPSMMU_ERR_ADDRESS (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x10001c))
|
||||
#define rADPSMMU_DIAG_CONFIG (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x100020))
|
||||
#define rADPSMMU_DIAG_BOGUS_ACCESS (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x100024))
|
||||
#define rADPSMMU_BYPASS_ADDR (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x10002c))
|
||||
#define rADPSMMU_ERR_STTIDX (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x100030))
|
||||
#define rADPSMMU_REQ_SCOREBOARD(n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x100080 + ((n) * 4))
|
||||
#define rADPSMMU_ACK_SCOREBOARD(n) (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x1000c0 + ((n) * 4))
|
||||
#define rADPSMMU_PERF_CONFIG (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x101000))
|
||||
#define rADPSMMU_CTR (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x101004))
|
||||
#define rADPSMMU_STT_PA_DATA (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x102000))
|
||||
|
||||
//DART Registers
|
||||
#define rADPDART_DIAG_CONFIG (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x104020))
|
||||
#define rADPDART_DIAG_BOGUS_ACCESS (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x104024))
|
||||
#define rADPDART_FETCH_REQ_CONFIG (*(volatile u_int32_t *)(DISPLAYPIPE_BASE_ADDR + 0x104030))
|
||||
|
||||
#endif /* ! __APPLE_DISPLAY_FRONTEND_REGS_H */
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2015 Apple Inc. All rights reserved.
|
||||
*
|
||||
* This document is the property of Apple Inc.
|
||||
* It is considered confidential and proprietary.
|
||||
*
|
||||
* This document may not be reproduced or transmitted in any form,
|
||||
* in whole or in part, without the express written permission of
|
||||
* Apple Inc.
|
||||
*/
|
||||
#ifndef __APPLE_DISPLAY_FRONTEND_H
|
||||
#define __APPLE_DISPLAY_FRONTEND_H
|
||||
|
||||
void adfe_init(struct display_timing *timing);
|
||||
void adfe_set_ui_layer(u_int32_t pixel_pipe, enum colorspace color, struct plane *plane0, struct plane *plane1, u_int32_t width, u_int32_t height);
|
||||
void adfe_enable_error_handler(void);
|
||||
void adfe_disable_error_handler(void);
|
||||
void adfe_set_background_color(u_int32_t color);
|
||||
void adfe_activate_window(void);
|
||||
bool adfe_get_enable(void);
|
||||
void adfe_set_axis_flip(uint32_t pixel_pipe, bool flipX, bool flipY);
|
||||
|
||||
#endif /* __APPLE_DISPLAY_FRONTEND_H */
|
||||
@@ -0,0 +1,18 @@
|
||||
# Copyright (C) 2013 Apple Inc. All rights reserved.
|
||||
#
|
||||
# This document is the property of Apple Inc.
|
||||
# It is considered confidential and proprietary.
|
||||
#
|
||||
# This document may not be reproduced or transmitted in any form,
|
||||
# in whole or in part, without the express written permission of
|
||||
# Apple Inc.
|
||||
#
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
OPTIONS += \
|
||||
WITH_DFE_ADFE_V2=1
|
||||
|
||||
ALL_OBJS += \
|
||||
$(LOCAL_DIR)/adfe_v2.o
|
||||
|
||||
GLOBAL_INCLUDES += $(LOCAL_DIR)/include
|
||||
Reference in new issue
Block a user