Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit def9ba9c authored by Alex Deucher's avatar Alex Deucher Committed by Dave Airlie
Browse files

drm/radeon/kms: add gui_idle callback



Check to see if the GUI engine and related blocks
(2D, 3D, CP, etc) are idle or not.  There are a number
of cases when we need to know if the drawing engine
is busy.

Signed-off-by: default avatarAlex Deucher <alexdeucher@gmail.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 1d42bbc8
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -67,6 +67,14 @@ MODULE_FIRMWARE(FIRMWARE_R520);
 * r100,rv100,rs100,rv200,rs200,r200,rv250,rs300,rv280
 */

bool r100_gui_idle(struct radeon_device *rdev)
{
	if (RREG32(RADEON_RBBM_STATUS) & RADEON_RBBM_ACTIVE)
		return false;
	else
		return true;
}

/* hpd for digital panel detect/disconnect */
bool r100_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd)
{
+8 −0
Original line number Diff line number Diff line
@@ -92,6 +92,14 @@ void r600_gpu_init(struct radeon_device *rdev);
void r600_fini(struct radeon_device *rdev);
void r600_irq_disable(struct radeon_device *rdev);

bool r600_gui_idle(struct radeon_device *rdev)
{
	if (RREG32(GRBM_STATUS) & GUI_ACTIVE)
		return false;
	else
		return true;
}

/* hpd for digital panel detect/disconnect */
bool r600_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd)
{
+2 −0
Original line number Diff line number Diff line
@@ -803,6 +803,7 @@ struct radeon_asic {
	 * through ring.
	 */
	void (*ioctl_wait_idle)(struct radeon_device *rdev, struct radeon_bo *bo);
	bool (*gui_idle)(struct radeon_device *rdev);
};

/*
@@ -1209,6 +1210,7 @@ static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v)
#define radeon_hpd_fini(rdev) (rdev)->asic->hpd_fini((rdev))
#define radeon_hpd_sense(rdev, hpd) (rdev)->asic->hpd_sense((rdev), (hpd))
#define radeon_hpd_set_polarity(rdev, hpd) (rdev)->asic->hpd_set_polarity((rdev), (hpd))
#define radeon_gui_idle(rdev) (rdev)->asic->gui_idle((rdev))

/* Common functions */
/* AGP */
+14 −0
Original line number Diff line number Diff line
@@ -165,6 +165,7 @@ static struct radeon_asic r100_asic = {
	.hpd_sense = &r100_hpd_sense,
	.hpd_set_polarity = &r100_hpd_set_polarity,
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
};

static struct radeon_asic r200_asic = {
@@ -203,6 +204,7 @@ static struct radeon_asic r200_asic = {
	.hpd_sense = &r100_hpd_sense,
	.hpd_set_polarity = &r100_hpd_set_polarity,
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
};

static struct radeon_asic r300_asic = {
@@ -242,6 +244,7 @@ static struct radeon_asic r300_asic = {
	.hpd_sense = &r100_hpd_sense,
	.hpd_set_polarity = &r100_hpd_set_polarity,
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
};

static struct radeon_asic r300_asic_pcie = {
@@ -280,6 +283,7 @@ static struct radeon_asic r300_asic_pcie = {
	.hpd_sense = &r100_hpd_sense,
	.hpd_set_polarity = &r100_hpd_set_polarity,
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
};

static struct radeon_asic r420_asic = {
@@ -319,6 +323,7 @@ static struct radeon_asic r420_asic = {
	.hpd_sense = &r100_hpd_sense,
	.hpd_set_polarity = &r100_hpd_set_polarity,
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
};

static struct radeon_asic rs400_asic = {
@@ -358,6 +363,7 @@ static struct radeon_asic rs400_asic = {
	.hpd_sense = &r100_hpd_sense,
	.hpd_set_polarity = &r100_hpd_set_polarity,
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
};

static struct radeon_asic rs600_asic = {
@@ -397,6 +403,7 @@ static struct radeon_asic rs600_asic = {
	.hpd_sense = &rs600_hpd_sense,
	.hpd_set_polarity = &rs600_hpd_set_polarity,
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
};

static struct radeon_asic rs690_asic = {
@@ -436,6 +443,7 @@ static struct radeon_asic rs690_asic = {
	.hpd_sense = &rs600_hpd_sense,
	.hpd_set_polarity = &rs600_hpd_set_polarity,
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
};

static struct radeon_asic rv515_asic = {
@@ -475,6 +483,7 @@ static struct radeon_asic rv515_asic = {
	.hpd_sense = &rs600_hpd_sense,
	.hpd_set_polarity = &rs600_hpd_set_polarity,
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
};

static struct radeon_asic r520_asic = {
@@ -514,6 +523,7 @@ static struct radeon_asic r520_asic = {
	.hpd_sense = &rs600_hpd_sense,
	.hpd_set_polarity = &rs600_hpd_set_polarity,
	.ioctl_wait_idle = NULL,
	.gui_idle = &r100_gui_idle,
};

static struct radeon_asic r600_asic = {
@@ -552,6 +562,7 @@ static struct radeon_asic r600_asic = {
	.hpd_sense = &r600_hpd_sense,
	.hpd_set_polarity = &r600_hpd_set_polarity,
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
};

static struct radeon_asic rs780_asic = {
@@ -590,6 +601,7 @@ static struct radeon_asic rs780_asic = {
	.hpd_sense = &r600_hpd_sense,
	.hpd_set_polarity = &r600_hpd_set_polarity,
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
};

static struct radeon_asic rv770_asic = {
@@ -628,6 +640,7 @@ static struct radeon_asic rv770_asic = {
	.hpd_sense = &r600_hpd_sense,
	.hpd_set_polarity = &r600_hpd_set_polarity,
	.ioctl_wait_idle = r600_ioctl_wait_idle,
	.gui_idle = &r600_gui_idle,
};

static struct radeon_asic evergreen_asic = {
@@ -664,6 +677,7 @@ static struct radeon_asic evergreen_asic = {
	.hpd_fini = &evergreen_hpd_fini,
	.hpd_sense = &evergreen_hpd_sense,
	.hpd_set_polarity = &evergreen_hpd_set_polarity,
	.gui_idle = &r600_gui_idle,
};

int radeon_asic_init(struct radeon_device *rdev)
+2 −0
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ int r100_cs_packet_parse(struct radeon_cs_parser *p,
void r100_enable_bm(struct radeon_device *rdev);
void r100_set_common_regs(struct radeon_device *rdev);
void r100_bm_disable(struct radeon_device *rdev);
extern bool r100_gui_idle(struct radeon_device *rdev);
/*
 * r200,rv250,rs300,rv280
 */
@@ -269,6 +270,7 @@ bool r600_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd);
void r600_hpd_set_polarity(struct radeon_device *rdev,
			   enum radeon_hpd_id hpd);
extern void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo);
extern bool r600_gui_idle(struct radeon_device *rdev);

/*
 * rv770,rv730,rv710,rv740