Commit a228062c authored by Brian Starkey's avatar Brian Starkey Committed by Liviu Dudau

drm: mali-dp: Add pitch alignment check function

Different hardware versions have different requirements when it comes to
pitch alignment. Add a function which can be used to check pitch
alignment for a device.
Signed-off-by: default avatarBrian Starkey <brian.starkey@arm.com>
Signed-off-by: default avatarLiviu Dudau <Liviu.Dudau@arm.com>
parent a6a7b9a2
...@@ -436,6 +436,7 @@ const struct malidp_hw_device malidp_device[MALIDP_MAX_DEVICES] = { ...@@ -436,6 +436,7 @@ const struct malidp_hw_device malidp_device[MALIDP_MAX_DEVICES] = {
}, },
.input_formats = malidp500_de_formats, .input_formats = malidp500_de_formats,
.n_input_formats = ARRAY_SIZE(malidp500_de_formats), .n_input_formats = ARRAY_SIZE(malidp500_de_formats),
.bus_align_bytes = 8,
}, },
.query_hw = malidp500_query_hw, .query_hw = malidp500_query_hw,
.enter_config_mode = malidp500_enter_config_mode, .enter_config_mode = malidp500_enter_config_mode,
...@@ -468,6 +469,7 @@ const struct malidp_hw_device malidp_device[MALIDP_MAX_DEVICES] = { ...@@ -468,6 +469,7 @@ const struct malidp_hw_device malidp_device[MALIDP_MAX_DEVICES] = {
}, },
.input_formats = malidp550_de_formats, .input_formats = malidp550_de_formats,
.n_input_formats = ARRAY_SIZE(malidp550_de_formats), .n_input_formats = ARRAY_SIZE(malidp550_de_formats),
.bus_align_bytes = 8,
}, },
.query_hw = malidp550_query_hw, .query_hw = malidp550_query_hw,
.enter_config_mode = malidp550_enter_config_mode, .enter_config_mode = malidp550_enter_config_mode,
...@@ -501,6 +503,7 @@ const struct malidp_hw_device malidp_device[MALIDP_MAX_DEVICES] = { ...@@ -501,6 +503,7 @@ const struct malidp_hw_device malidp_device[MALIDP_MAX_DEVICES] = {
}, },
.input_formats = malidp550_de_formats, .input_formats = malidp550_de_formats,
.n_input_formats = ARRAY_SIZE(malidp550_de_formats), .n_input_formats = ARRAY_SIZE(malidp550_de_formats),
.bus_align_bytes = 16,
}, },
.query_hw = malidp650_query_hw, .query_hw = malidp650_query_hw,
.enter_config_mode = malidp550_enter_config_mode, .enter_config_mode = malidp550_enter_config_mode,
......
...@@ -88,6 +88,9 @@ struct malidp_hw_regmap { ...@@ -88,6 +88,9 @@ struct malidp_hw_regmap {
/* list of supported input formats for each layer */ /* list of supported input formats for each layer */
const struct malidp_input_format *input_formats; const struct malidp_input_format *input_formats;
const u8 n_input_formats; const u8 n_input_formats;
/* pitch alignment requirement in bytes */
const u8 bus_align_bytes;
}; };
struct malidp_hw_device { struct malidp_hw_device {
...@@ -229,6 +232,12 @@ void malidp_se_irq_fini(struct drm_device *drm); ...@@ -229,6 +232,12 @@ void malidp_se_irq_fini(struct drm_device *drm);
u8 malidp_hw_get_format_id(const struct malidp_hw_regmap *map, u8 malidp_hw_get_format_id(const struct malidp_hw_regmap *map,
u8 layer_id, u32 format); u8 layer_id, u32 format);
static inline bool malidp_hw_pitch_valid(struct malidp_hw_device *hwdev,
unsigned int pitch)
{
return !(pitch & (hwdev->map.bus_align_bytes - 1));
}
/* /*
* background color components are defined as 12bits values, * background color components are defined as 12bits values,
* they will be shifted right when stored on hardware that * they will be shifted right when stored on hardware that
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment