Commit 44ef02c2 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm-misc-fixes-2018-05-09' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes

atomic: Clear state pointers on clear (Ville)
vc4: Fix oops in dpi disable (Eric)
omap: Various error-checking + uninitialized var fixes (Tomi)

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>

* tag 'drm-misc-fixes-2018-05-09' of git://anongit.freedesktop.org/drm/drm-misc:
  drm/vc4: Fix scaling of uni-planar formats
  drm/bridge/sii8620: add Kconfig dependency on extcon
  drm/omap: handle alloc failures in omap_connector
  drm/omap: add missing linefeeds to prints
  drm/omap: handle error if scale coefs are not found
  drm/omap: check return value from soc_device_match
  drm/omap: fix possible NULL ref issue in tiler_reserve_2d
  drm/omap: fix uninitialized ret variable
  drm/omap: silence unititialized variable warning
  drm/vc4: Fix oops dereferencing DPI's connector since panel_bridge.
  drm/atomic: Clean private obj old_state/new_state in drm_atomic_state_default_clear()
  drm/atomic: Clean old_state/new_state in drm_atomic_state_default_clear()
parents 03a0a3e5 9a0e9802
...@@ -74,6 +74,7 @@ config DRM_SIL_SII8620 ...@@ -74,6 +74,7 @@ config DRM_SIL_SII8620
tristate "Silicon Image SII8620 HDMI/MHL bridge" tristate "Silicon Image SII8620 HDMI/MHL bridge"
depends on OF && RC_CORE depends on OF && RC_CORE
select DRM_KMS_HELPER select DRM_KMS_HELPER
imply EXTCON
help help
Silicon Image SII8620 HDMI/MHL bridge chip driver. Silicon Image SII8620 HDMI/MHL bridge chip driver.
......
...@@ -155,6 +155,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state) ...@@ -155,6 +155,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state)
state->connectors[i].state); state->connectors[i].state);
state->connectors[i].ptr = NULL; state->connectors[i].ptr = NULL;
state->connectors[i].state = NULL; state->connectors[i].state = NULL;
state->connectors[i].old_state = NULL;
state->connectors[i].new_state = NULL;
drm_connector_put(connector); drm_connector_put(connector);
} }
...@@ -169,6 +171,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state) ...@@ -169,6 +171,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state)
state->crtcs[i].ptr = NULL; state->crtcs[i].ptr = NULL;
state->crtcs[i].state = NULL; state->crtcs[i].state = NULL;
state->crtcs[i].old_state = NULL;
state->crtcs[i].new_state = NULL;
} }
for (i = 0; i < config->num_total_plane; i++) { for (i = 0; i < config->num_total_plane; i++) {
...@@ -181,6 +185,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state) ...@@ -181,6 +185,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state)
state->planes[i].state); state->planes[i].state);
state->planes[i].ptr = NULL; state->planes[i].ptr = NULL;
state->planes[i].state = NULL; state->planes[i].state = NULL;
state->planes[i].old_state = NULL;
state->planes[i].new_state = NULL;
} }
for (i = 0; i < state->num_private_objs; i++) { for (i = 0; i < state->num_private_objs; i++) {
...@@ -190,6 +196,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state) ...@@ -190,6 +196,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state)
state->private_objs[i].state); state->private_objs[i].state);
state->private_objs[i].ptr = NULL; state->private_objs[i].ptr = NULL;
state->private_objs[i].state = NULL; state->private_objs[i].state = NULL;
state->private_objs[i].old_state = NULL;
state->private_objs[i].new_state = NULL;
} }
state->num_private_objs = 0; state->num_private_objs = 0;
......
...@@ -828,6 +828,12 @@ static void dispc_ovl_set_scale_coef(struct dispc_device *dispc, ...@@ -828,6 +828,12 @@ static void dispc_ovl_set_scale_coef(struct dispc_device *dispc,
h_coef = dispc_ovl_get_scale_coef(fir_hinc, true); h_coef = dispc_ovl_get_scale_coef(fir_hinc, true);
v_coef = dispc_ovl_get_scale_coef(fir_vinc, five_taps); v_coef = dispc_ovl_get_scale_coef(fir_vinc, five_taps);
if (!h_coef || !v_coef) {
dev_err(&dispc->pdev->dev, "%s: failed to find scale coefs\n",
__func__);
return;
}
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
u32 h, hv; u32 h, hv;
...@@ -2342,7 +2348,7 @@ static int dispc_ovl_calc_scaling_24xx(struct dispc_device *dispc, ...@@ -2342,7 +2348,7 @@ static int dispc_ovl_calc_scaling_24xx(struct dispc_device *dispc,
} }
if (in_width > maxsinglelinewidth) { if (in_width > maxsinglelinewidth) {
DSSERR("Cannot scale max input width exceeded"); DSSERR("Cannot scale max input width exceeded\n");
return -EINVAL; return -EINVAL;
} }
return 0; return 0;
...@@ -2424,13 +2430,13 @@ static int dispc_ovl_calc_scaling_34xx(struct dispc_device *dispc, ...@@ -2424,13 +2430,13 @@ static int dispc_ovl_calc_scaling_34xx(struct dispc_device *dispc,
} }
if (in_width > (maxsinglelinewidth * 2)) { if (in_width > (maxsinglelinewidth * 2)) {
DSSERR("Cannot setup scaling"); DSSERR("Cannot setup scaling\n");
DSSERR("width exceeds maximum width possible"); DSSERR("width exceeds maximum width possible\n");
return -EINVAL; return -EINVAL;
} }
if (in_width > maxsinglelinewidth && *five_taps) { if (in_width > maxsinglelinewidth && *five_taps) {
DSSERR("cannot setup scaling with five taps"); DSSERR("cannot setup scaling with five taps\n");
return -EINVAL; return -EINVAL;
} }
return 0; return 0;
...@@ -2472,7 +2478,7 @@ static int dispc_ovl_calc_scaling_44xx(struct dispc_device *dispc, ...@@ -2472,7 +2478,7 @@ static int dispc_ovl_calc_scaling_44xx(struct dispc_device *dispc,
in_width > maxsinglelinewidth && ++*decim_x); in_width > maxsinglelinewidth && ++*decim_x);
if (in_width > maxsinglelinewidth) { if (in_width > maxsinglelinewidth) {
DSSERR("Cannot scale width exceeds max line width"); DSSERR("Cannot scale width exceeds max line width\n");
return -EINVAL; return -EINVAL;
} }
...@@ -2490,7 +2496,7 @@ static int dispc_ovl_calc_scaling_44xx(struct dispc_device *dispc, ...@@ -2490,7 +2496,7 @@ static int dispc_ovl_calc_scaling_44xx(struct dispc_device *dispc,
* bandwidth. Despite what theory says this appears to * bandwidth. Despite what theory says this appears to
* be true also for 16-bit color formats. * be true also for 16-bit color formats.
*/ */
DSSERR("Not enough bandwidth, too much downscaling (x-decimation factor %d > 4)", *decim_x); DSSERR("Not enough bandwidth, too much downscaling (x-decimation factor %d > 4)\n", *decim_x);
return -EINVAL; return -EINVAL;
} }
...@@ -4633,7 +4639,7 @@ static int dispc_errata_i734_wa_init(struct dispc_device *dispc) ...@@ -4633,7 +4639,7 @@ static int dispc_errata_i734_wa_init(struct dispc_device *dispc)
i734_buf.size, &i734_buf.paddr, i734_buf.size, &i734_buf.paddr,
GFP_KERNEL); GFP_KERNEL);
if (!i734_buf.vaddr) { if (!i734_buf.vaddr) {
dev_err(&dispc->pdev->dev, "%s: dma_alloc_writecombine failed", dev_err(&dispc->pdev->dev, "%s: dma_alloc_writecombine failed\n",
__func__); __func__);
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -679,7 +679,7 @@ static int hdmi_audio_config(struct device *dev, ...@@ -679,7 +679,7 @@ static int hdmi_audio_config(struct device *dev,
struct omap_dss_audio *dss_audio) struct omap_dss_audio *dss_audio)
{ {
struct omap_hdmi *hd = dev_get_drvdata(dev); struct omap_hdmi *hd = dev_get_drvdata(dev);
int ret; int ret = 0;
mutex_lock(&hd->lock); mutex_lock(&hd->lock);
......
...@@ -922,8 +922,13 @@ int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core) ...@@ -922,8 +922,13 @@ int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
{ {
const struct hdmi4_features *features; const struct hdmi4_features *features;
struct resource *res; struct resource *res;
const struct soc_device_attribute *soc;
features = soc_device_match(hdmi4_soc_devices)->data; soc = soc_device_match(hdmi4_soc_devices);
if (!soc)
return -ENODEV;
features = soc->data;
core->cts_swmode = features->cts_swmode; core->cts_swmode = features->cts_swmode;
core->audio_use_mclk = features->audio_use_mclk; core->audio_use_mclk = features->audio_use_mclk;
......
...@@ -671,7 +671,7 @@ static int hdmi_audio_config(struct device *dev, ...@@ -671,7 +671,7 @@ static int hdmi_audio_config(struct device *dev,
struct omap_dss_audio *dss_audio) struct omap_dss_audio *dss_audio)
{ {
struct omap_hdmi *hd = dev_get_drvdata(dev); struct omap_hdmi *hd = dev_get_drvdata(dev);
int ret; int ret = 0;
mutex_lock(&hd->lock); mutex_lock(&hd->lock);
......
...@@ -121,6 +121,9 @@ static int omap_connector_get_modes(struct drm_connector *connector) ...@@ -121,6 +121,9 @@ static int omap_connector_get_modes(struct drm_connector *connector)
if (dssdrv->read_edid) { if (dssdrv->read_edid) {
void *edid = kzalloc(MAX_EDID, GFP_KERNEL); void *edid = kzalloc(MAX_EDID, GFP_KERNEL);
if (!edid)
return 0;
if ((dssdrv->read_edid(dssdev, edid, MAX_EDID) > 0) && if ((dssdrv->read_edid(dssdev, edid, MAX_EDID) > 0) &&
drm_edid_is_valid(edid)) { drm_edid_is_valid(edid)) {
drm_mode_connector_update_edid_property( drm_mode_connector_update_edid_property(
...@@ -139,6 +142,9 @@ static int omap_connector_get_modes(struct drm_connector *connector) ...@@ -139,6 +142,9 @@ static int omap_connector_get_modes(struct drm_connector *connector)
struct drm_display_mode *mode = drm_mode_create(dev); struct drm_display_mode *mode = drm_mode_create(dev);
struct videomode vm = {0}; struct videomode vm = {0};
if (!mode)
return 0;
dssdrv->get_timings(dssdev, &vm); dssdrv->get_timings(dssdev, &vm);
drm_display_mode_from_videomode(&vm, mode); drm_display_mode_from_videomode(&vm, mode);
...@@ -200,6 +206,10 @@ static int omap_connector_mode_valid(struct drm_connector *connector, ...@@ -200,6 +206,10 @@ static int omap_connector_mode_valid(struct drm_connector *connector,
if (!r) { if (!r) {
/* check if vrefresh is still valid */ /* check if vrefresh is still valid */
new_mode = drm_mode_duplicate(dev, mode); new_mode = drm_mode_duplicate(dev, mode);
if (!new_mode)
return MODE_BAD;
new_mode->clock = vm.pixelclock / 1000; new_mode->clock = vm.pixelclock / 1000;
new_mode->vrefresh = 0; new_mode->vrefresh = 0;
if (mode->vrefresh == drm_mode_vrefresh(new_mode)) if (mode->vrefresh == drm_mode_vrefresh(new_mode))
......
...@@ -401,12 +401,16 @@ int tiler_unpin(struct tiler_block *block) ...@@ -401,12 +401,16 @@ int tiler_unpin(struct tiler_block *block)
struct tiler_block *tiler_reserve_2d(enum tiler_fmt fmt, u16 w, struct tiler_block *tiler_reserve_2d(enum tiler_fmt fmt, u16 w,
u16 h, u16 align) u16 h, u16 align)
{ {
struct tiler_block *block = kzalloc(sizeof(*block), GFP_KERNEL); struct tiler_block *block;
u32 min_align = 128; u32 min_align = 128;
int ret; int ret;
unsigned long flags; unsigned long flags;
u32 slot_bytes; u32 slot_bytes;
block = kzalloc(sizeof(*block), GFP_KERNEL);
if (!block)
return ERR_PTR(-ENOMEM);
BUG_ON(!validfmt(fmt)); BUG_ON(!validfmt(fmt));
/* convert width/height to slots */ /* convert width/height to slots */
......
...@@ -90,7 +90,7 @@ static int l2r_t2b(u16 w, u16 h, u16 a, s16 offset, ...@@ -90,7 +90,7 @@ static int l2r_t2b(u16 w, u16 h, u16 a, s16 offset,
{ {
int i; int i;
unsigned long index; unsigned long index;
bool area_free; bool area_free = false;
unsigned long slots_per_band = PAGE_SIZE / slot_bytes; unsigned long slots_per_band = PAGE_SIZE / slot_bytes;
unsigned long bit_offset = (offset > 0) ? offset / slot_bytes : 0; unsigned long bit_offset = (offset > 0) ? offset / slot_bytes : 0;
unsigned long curr_bit = bit_offset; unsigned long curr_bit = bit_offset;
......
...@@ -96,7 +96,6 @@ struct vc4_dpi { ...@@ -96,7 +96,6 @@ struct vc4_dpi {
struct platform_device *pdev; struct platform_device *pdev;
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct drm_connector *connector;
void __iomem *regs; void __iomem *regs;
...@@ -164,14 +163,31 @@ static void vc4_dpi_encoder_disable(struct drm_encoder *encoder) ...@@ -164,14 +163,31 @@ static void vc4_dpi_encoder_disable(struct drm_encoder *encoder)
static void vc4_dpi_encoder_enable(struct drm_encoder *encoder) static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
{ {
struct drm_device *dev = encoder->dev;
struct drm_display_mode *mode = &encoder->crtc->mode; struct drm_display_mode *mode = &encoder->crtc->mode;
struct vc4_dpi_encoder *vc4_encoder = to_vc4_dpi_encoder(encoder); struct vc4_dpi_encoder *vc4_encoder = to_vc4_dpi_encoder(encoder);
struct vc4_dpi *dpi = vc4_encoder->dpi; struct vc4_dpi *dpi = vc4_encoder->dpi;
struct drm_connector_list_iter conn_iter;
struct drm_connector *connector = NULL, *connector_scan;
u32 dpi_c = DPI_ENABLE | DPI_OUTPUT_ENABLE_MODE; u32 dpi_c = DPI_ENABLE | DPI_OUTPUT_ENABLE_MODE;
int ret; int ret;
if (dpi->connector->display_info.num_bus_formats) { /* Look up the connector attached to DPI so we can get the
u32 bus_format = dpi->connector->display_info.bus_formats[0]; * bus_format. Ideally the bridge would tell us the
* bus_format we want, but it doesn't yet, so assume that it's
* uniform throughout the bridge chain.
*/
drm_connector_list_iter_begin(dev, &conn_iter);
drm_for_each_connector_iter(connector_scan, &conn_iter) {
if (connector_scan->encoder == encoder) {
connector = connector_scan;
break;
}
}
drm_connector_list_iter_end(&conn_iter);
if (connector && connector->display_info.num_bus_formats) {
u32 bus_format = connector->display_info.bus_formats[0];
switch (bus_format) { switch (bus_format) {
case MEDIA_BUS_FMT_RGB888_1X24: case MEDIA_BUS_FMT_RGB888_1X24:
...@@ -199,6 +215,9 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder) ...@@ -199,6 +215,9 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
DRM_ERROR("Unknown media bus format %d\n", bus_format); DRM_ERROR("Unknown media bus format %d\n", bus_format);
break; break;
} }
} else {
/* Default to 24bit if no connector found. */
dpi_c |= VC4_SET_FIELD(DPI_FORMAT_24BIT_888_RGB, DPI_FORMAT);
} }
if (mode->flags & DRM_MODE_FLAG_NHSYNC) if (mode->flags & DRM_MODE_FLAG_NHSYNC)
......
...@@ -503,7 +503,7 @@ static int vc4_plane_mode_set(struct drm_plane *plane, ...@@ -503,7 +503,7 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
* the scl fields here. * the scl fields here.
*/ */
if (num_planes == 1) { if (num_planes == 1) {
scl0 = vc4_get_scl_field(state, 1); scl0 = vc4_get_scl_field(state, 0);
scl1 = scl0; scl1 = scl0;
} else { } else {
scl0 = vc4_get_scl_field(state, 1); scl0 = vc4_get_scl_field(state, 1);
......
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