Commit 98da4b99 authored by Thomas Zimmermann's avatar Thomas Zimmermann
Browse files

drm/mgag200: Store maximum resolution and memory bandwidth in device info



The maximum resolution and memory bandwidth are model-specific limits.
Both are used during display-mode validation. Store the values in struct
mgag200_device_info and simplify the validation code.

v2:
	* 'bandwith' -> 'bandwidth' in commit message

Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJocelyn Falempe <jfalempe@redhat.com>
Tested-by: default avatarJocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220601112522.5774-9-tzimmermann@suse.de
parent 21e74bf9
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -191,6 +191,15 @@ enum mga_type {
#define IS_G200_SE(mdev) (mdev->type == G200_SE_A || mdev->type == G200_SE_B)

struct mgag200_device_info {
	u16 max_hdisplay;
	u16 max_vdisplay;

	/*
	 * Maximum memory bandwidth (MiB/sec). Setting this to zero disables
	 * the rsp test during mode validation.
	 */
	unsigned long max_mem_bandwidth;

	/*
	 * HW does not handle 'startadd' register correctly. Always set
	 * it's value to 0.
@@ -198,8 +207,12 @@ struct mgag200_device_info {
	bool bug_no_startadd:1;
};

#define MGAG200_DEVICE_INFO_INIT(_bug_no_startadd) \
#define MGAG200_DEVICE_INFO_INIT(_max_hdisplay, _max_vdisplay, _max_mem_bandwidth, \
				 _bug_no_startadd) \
	{ \
		.max_hdisplay = (_max_hdisplay), \
		.max_vdisplay = (_max_vdisplay), \
		.max_mem_bandwidth = (_max_mem_bandwidth), \
		.bug_no_startadd = (_bug_no_startadd), \
	}

+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ static int mgag200_g200_init_pci_options(struct pci_dev *pdev)
 */

static const struct mgag200_device_info mgag200_g200_device_info =
	MGAG200_DEVICE_INFO_INIT(false);
	MGAG200_DEVICE_INFO_INIT(2048, 2048, 0, false);

static void mgag200_g200_interpret_bios(struct mgag200_g200_device *g200,
					const unsigned char *bios, size_t size)
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@
 */

static const struct mgag200_device_info mgag200_g200eh_device_info =
	MGAG200_DEVICE_INFO_INIT(false);
	MGAG200_DEVICE_INFO_INIT(2048, 2048, 37500, false);

struct mga_device *mgag200_g200eh_device_create(struct pci_dev *pdev, const struct drm_driver *drv,
						enum mga_type type)
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@
 */

static const struct mgag200_device_info mgag200_g200eh3_device_info =
	MGAG200_DEVICE_INFO_INIT(false);
	MGAG200_DEVICE_INFO_INIT(2048, 2048, 0, false);

struct mga_device *mgag200_g200eh3_device_create(struct pci_dev *pdev,
						 const struct drm_driver *drv,
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@
 */

static const struct mgag200_device_info mgag200_g200er_device_info =
	MGAG200_DEVICE_INFO_INIT(false);
	MGAG200_DEVICE_INFO_INIT(2048, 2048, 55000, false);

struct mga_device *mgag200_g200er_device_create(struct pci_dev *pdev, const struct drm_driver *drv,
						enum mga_type type)
Loading