Commit 72a36970 authored by Daniel Vetter's avatar Daniel Vetter

Merge branch 'topic/core-stuff' into topic/atomic-core

Backmerge my drm-misc branch because of conflicts. Just simple stuff
but better to clear this out before I merge the other atomic patches.

Conflicts:
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_edid.c
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
parents 22b8b13b dafffda0
...@@ -653,10 +653,6 @@ static int armada_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, ...@@ -653,10 +653,6 @@ static int armada_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
return 0; return 0;
} }
static void armada_drm_crtc_load_lut(struct drm_crtc *crtc)
{
}
/* The mode_config.mutex will be held for this call */ /* The mode_config.mutex will be held for this call */
static void armada_drm_crtc_disable(struct drm_crtc *crtc) static void armada_drm_crtc_disable(struct drm_crtc *crtc)
{ {
...@@ -678,7 +674,6 @@ static const struct drm_crtc_helper_funcs armada_crtc_helper_funcs = { ...@@ -678,7 +674,6 @@ static const struct drm_crtc_helper_funcs armada_crtc_helper_funcs = {
.mode_fixup = armada_drm_crtc_mode_fixup, .mode_fixup = armada_drm_crtc_mode_fixup,
.mode_set = armada_drm_crtc_mode_set, .mode_set = armada_drm_crtc_mode_set,
.mode_set_base = armada_drm_crtc_mode_set_base, .mode_set_base = armada_drm_crtc_mode_set_base,
.load_lut = armada_drm_crtc_load_lut,
.disable = armada_drm_crtc_disable, .disable = armada_drm_crtc_disable,
}; };
......
...@@ -18,10 +18,6 @@ MODULE_PARM_DESC(defy, "default y resolution"); ...@@ -18,10 +18,6 @@ MODULE_PARM_DESC(defy, "default y resolution");
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static void bochs_crtc_load_lut(struct drm_crtc *crtc)
{
}
static void bochs_crtc_dpms(struct drm_crtc *crtc, int mode) static void bochs_crtc_dpms(struct drm_crtc *crtc, int mode)
{ {
switch (mode) { switch (mode) {
...@@ -144,7 +140,6 @@ static const struct drm_crtc_helper_funcs bochs_helper_funcs = { ...@@ -144,7 +140,6 @@ static const struct drm_crtc_helper_funcs bochs_helper_funcs = {
.mode_set_base = bochs_crtc_mode_set_base, .mode_set_base = bochs_crtc_mode_set_base,
.prepare = bochs_crtc_prepare, .prepare = bochs_crtc_prepare,
.commit = bochs_crtc_commit, .commit = bochs_crtc_commit,
.load_lut = bochs_crtc_load_lut,
}; };
static void bochs_crtc_init(struct drm_device *dev) static void bochs_crtc_init(struct drm_device *dev)
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <drm/drmP.h> #include <drm/drmP.h>
#if defined(CONFIG_X86) #if defined(CONFIG_X86)
#include <asm/smp.h>
/* /*
* clflushopt is an unordered instruction which needs fencing with mfence or * clflushopt is an unordered instruction which needs fencing with mfence or
...@@ -64,12 +65,6 @@ static void drm_cache_flush_clflush(struct page *pages[], ...@@ -64,12 +65,6 @@ static void drm_cache_flush_clflush(struct page *pages[],
drm_clflush_page(*pages++); drm_clflush_page(*pages++);
mb(); mb();
} }
static void
drm_clflush_ipi_handler(void *null)
{
wbinvd();
}
#endif #endif
void void
...@@ -82,7 +77,7 @@ drm_clflush_pages(struct page *pages[], unsigned long num_pages) ...@@ -82,7 +77,7 @@ drm_clflush_pages(struct page *pages[], unsigned long num_pages)
return; return;
} }
if (on_each_cpu(drm_clflush_ipi_handler, NULL, 1) != 0) if (wbinvd_on_all_cpus())
printk(KERN_ERR "Timed out waiting for cache flush.\n"); printk(KERN_ERR "Timed out waiting for cache flush.\n");
#elif defined(__powerpc__) #elif defined(__powerpc__)
...@@ -121,7 +116,7 @@ drm_clflush_sg(struct sg_table *st) ...@@ -121,7 +116,7 @@ drm_clflush_sg(struct sg_table *st)
return; return;
} }
if (on_each_cpu(drm_clflush_ipi_handler, NULL, 1) != 0) if (wbinvd_on_all_cpus())
printk(KERN_ERR "Timed out waiting for cache flush.\n"); printk(KERN_ERR "Timed out waiting for cache flush.\n");
#else #else
printk(KERN_ERR "Architecture has no drm_cache.c support\n"); printk(KERN_ERR "Architecture has no drm_cache.c support\n");
...@@ -144,7 +139,7 @@ drm_clflush_virt_range(void *addr, unsigned long length) ...@@ -144,7 +139,7 @@ drm_clflush_virt_range(void *addr, unsigned long length)
return; return;
} }
if (on_each_cpu(drm_clflush_ipi_handler, NULL, 1) != 0) if (wbinvd_on_all_cpus())
printk(KERN_ERR "Timed out waiting for cache flush.\n"); printk(KERN_ERR "Timed out waiting for cache flush.\n");
#else #else
printk(KERN_ERR "Architecture has no drm_cache.c support\n"); printk(KERN_ERR "Architecture has no drm_cache.c support\n");
......
...@@ -61,8 +61,8 @@ static struct drm_framebuffer *add_framebuffer_internal(struct drm_device *dev, ...@@ -61,8 +61,8 @@ static struct drm_framebuffer *add_framebuffer_internal(struct drm_device *dev,
/* /*
* Global properties * Global properties
*/ */
static const struct drm_prop_enum_list drm_dpms_enum_list[] = static const struct drm_prop_enum_list drm_dpms_enum_list[] = {
{ { DRM_MODE_DPMS_ON, "On" }, { DRM_MODE_DPMS_ON, "On" },
{ DRM_MODE_DPMS_STANDBY, "Standby" }, { DRM_MODE_DPMS_STANDBY, "Standby" },
{ DRM_MODE_DPMS_SUSPEND, "Suspend" }, { DRM_MODE_DPMS_SUSPEND, "Suspend" },
{ DRM_MODE_DPMS_OFF, "Off" } { DRM_MODE_DPMS_OFF, "Off" }
...@@ -70,8 +70,7 @@ static const struct drm_prop_enum_list drm_dpms_enum_list[] = ...@@ -70,8 +70,7 @@ static const struct drm_prop_enum_list drm_dpms_enum_list[] =
DRM_ENUM_NAME_FN(drm_get_dpms_name, drm_dpms_enum_list) DRM_ENUM_NAME_FN(drm_get_dpms_name, drm_dpms_enum_list)
static const struct drm_prop_enum_list drm_plane_type_enum_list[] = static const struct drm_prop_enum_list drm_plane_type_enum_list[] = {
{
{ DRM_PLANE_TYPE_OVERLAY, "Overlay" }, { DRM_PLANE_TYPE_OVERLAY, "Overlay" },
{ DRM_PLANE_TYPE_PRIMARY, "Primary" }, { DRM_PLANE_TYPE_PRIMARY, "Primary" },
{ DRM_PLANE_TYPE_CURSOR, "Cursor" }, { DRM_PLANE_TYPE_CURSOR, "Cursor" },
...@@ -80,8 +79,7 @@ static const struct drm_prop_enum_list drm_plane_type_enum_list[] = ...@@ -80,8 +79,7 @@ static const struct drm_prop_enum_list drm_plane_type_enum_list[] =
/* /*
* Optional properties * Optional properties
*/ */
static const struct drm_prop_enum_list drm_scaling_mode_enum_list[] = static const struct drm_prop_enum_list drm_scaling_mode_enum_list[] = {
{
{ DRM_MODE_SCALE_NONE, "None" }, { DRM_MODE_SCALE_NONE, "None" },
{ DRM_MODE_SCALE_FULLSCREEN, "Full" }, { DRM_MODE_SCALE_FULLSCREEN, "Full" },
{ DRM_MODE_SCALE_CENTER, "Center" }, { DRM_MODE_SCALE_CENTER, "Center" },
...@@ -97,8 +95,7 @@ static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = { ...@@ -97,8 +95,7 @@ static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = {
/* /*
* Non-global properties, but "required" for certain connectors. * Non-global properties, but "required" for certain connectors.
*/ */
static const struct drm_prop_enum_list drm_dvi_i_select_enum_list[] = static const struct drm_prop_enum_list drm_dvi_i_select_enum_list[] = {
{
{ DRM_MODE_SUBCONNECTOR_Automatic, "Automatic" }, /* DVI-I and TV-out */ { DRM_MODE_SUBCONNECTOR_Automatic, "Automatic" }, /* DVI-I and TV-out */
{ DRM_MODE_SUBCONNECTOR_DVID, "DVI-D" }, /* DVI-I */ { DRM_MODE_SUBCONNECTOR_DVID, "DVI-D" }, /* DVI-I */
{ DRM_MODE_SUBCONNECTOR_DVIA, "DVI-A" }, /* DVI-I */ { DRM_MODE_SUBCONNECTOR_DVIA, "DVI-A" }, /* DVI-I */
...@@ -106,8 +103,7 @@ static const struct drm_prop_enum_list drm_dvi_i_select_enum_list[] = ...@@ -106,8 +103,7 @@ static const struct drm_prop_enum_list drm_dvi_i_select_enum_list[] =
DRM_ENUM_NAME_FN(drm_get_dvi_i_select_name, drm_dvi_i_select_enum_list) DRM_ENUM_NAME_FN(drm_get_dvi_i_select_name, drm_dvi_i_select_enum_list)
static const struct drm_prop_enum_list drm_dvi_i_subconnector_enum_list[] = static const struct drm_prop_enum_list drm_dvi_i_subconnector_enum_list[] = {
{
{ DRM_MODE_SUBCONNECTOR_Unknown, "Unknown" }, /* DVI-I and TV-out */ { DRM_MODE_SUBCONNECTOR_Unknown, "Unknown" }, /* DVI-I and TV-out */
{ DRM_MODE_SUBCONNECTOR_DVID, "DVI-D" }, /* DVI-I */ { DRM_MODE_SUBCONNECTOR_DVID, "DVI-D" }, /* DVI-I */
{ DRM_MODE_SUBCONNECTOR_DVIA, "DVI-A" }, /* DVI-I */ { DRM_MODE_SUBCONNECTOR_DVIA, "DVI-A" }, /* DVI-I */
...@@ -116,8 +112,7 @@ static const struct drm_prop_enum_list drm_dvi_i_subconnector_enum_list[] = ...@@ -116,8 +112,7 @@ static const struct drm_prop_enum_list drm_dvi_i_subconnector_enum_list[] =
DRM_ENUM_NAME_FN(drm_get_dvi_i_subconnector_name, DRM_ENUM_NAME_FN(drm_get_dvi_i_subconnector_name,
drm_dvi_i_subconnector_enum_list) drm_dvi_i_subconnector_enum_list)
static const struct drm_prop_enum_list drm_tv_select_enum_list[] = static const struct drm_prop_enum_list drm_tv_select_enum_list[] = {
{
{ DRM_MODE_SUBCONNECTOR_Automatic, "Automatic" }, /* DVI-I and TV-out */ { DRM_MODE_SUBCONNECTOR_Automatic, "Automatic" }, /* DVI-I and TV-out */
{ DRM_MODE_SUBCONNECTOR_Composite, "Composite" }, /* TV-out */ { DRM_MODE_SUBCONNECTOR_Composite, "Composite" }, /* TV-out */
{ DRM_MODE_SUBCONNECTOR_SVIDEO, "SVIDEO" }, /* TV-out */ { DRM_MODE_SUBCONNECTOR_SVIDEO, "SVIDEO" }, /* TV-out */
...@@ -127,8 +122,7 @@ static const struct drm_prop_enum_list drm_tv_select_enum_list[] = ...@@ -127,8 +122,7 @@ static const struct drm_prop_enum_list drm_tv_select_enum_list[] =
DRM_ENUM_NAME_FN(drm_get_tv_select_name, drm_tv_select_enum_list) DRM_ENUM_NAME_FN(drm_get_tv_select_name, drm_tv_select_enum_list)
static const struct drm_prop_enum_list drm_tv_subconnector_enum_list[] = static const struct drm_prop_enum_list drm_tv_subconnector_enum_list[] = {
{
{ DRM_MODE_SUBCONNECTOR_Unknown, "Unknown" }, /* DVI-I and TV-out */ { DRM_MODE_SUBCONNECTOR_Unknown, "Unknown" }, /* DVI-I and TV-out */
{ DRM_MODE_SUBCONNECTOR_Composite, "Composite" }, /* TV-out */ { DRM_MODE_SUBCONNECTOR_Composite, "Composite" }, /* TV-out */
{ DRM_MODE_SUBCONNECTOR_SVIDEO, "SVIDEO" }, /* TV-out */ { DRM_MODE_SUBCONNECTOR_SVIDEO, "SVIDEO" }, /* TV-out */
...@@ -154,8 +148,8 @@ struct drm_conn_prop_enum_list { ...@@ -154,8 +148,8 @@ struct drm_conn_prop_enum_list {
/* /*
* Connector and encoder types. * Connector and encoder types.
*/ */
static struct drm_conn_prop_enum_list drm_connector_enum_list[] = static struct drm_conn_prop_enum_list drm_connector_enum_list[] = {
{ { DRM_MODE_CONNECTOR_Unknown, "Unknown" }, { DRM_MODE_CONNECTOR_Unknown, "Unknown" },
{ DRM_MODE_CONNECTOR_VGA, "VGA" }, { DRM_MODE_CONNECTOR_VGA, "VGA" },
{ DRM_MODE_CONNECTOR_DVII, "DVI-I" }, { DRM_MODE_CONNECTOR_DVII, "DVI-I" },
{ DRM_MODE_CONNECTOR_DVID, "DVI-D" }, { DRM_MODE_CONNECTOR_DVID, "DVI-D" },
...@@ -174,8 +168,8 @@ static struct drm_conn_prop_enum_list drm_connector_enum_list[] = ...@@ -174,8 +168,8 @@ static struct drm_conn_prop_enum_list drm_connector_enum_list[] =
{ DRM_MODE_CONNECTOR_DSI, "DSI" }, { DRM_MODE_CONNECTOR_DSI, "DSI" },
}; };
static const struct drm_prop_enum_list drm_encoder_enum_list[] = static const struct drm_prop_enum_list drm_encoder_enum_list[] = {
{ { DRM_MODE_ENCODER_NONE, "None" }, { DRM_MODE_ENCODER_NONE, "None" },
{ DRM_MODE_ENCODER_DAC, "DAC" }, { DRM_MODE_ENCODER_DAC, "DAC" },
{ DRM_MODE_ENCODER_TMDS, "TMDS" }, { DRM_MODE_ENCODER_TMDS, "TMDS" },
{ DRM_MODE_ENCODER_LVDS, "LVDS" }, { DRM_MODE_ENCODER_LVDS, "LVDS" },
...@@ -185,8 +179,7 @@ static const struct drm_prop_enum_list drm_encoder_enum_list[] = ...@@ -185,8 +179,7 @@ static const struct drm_prop_enum_list drm_encoder_enum_list[] =
{ DRM_MODE_ENCODER_DPMST, "DP MST" }, { DRM_MODE_ENCODER_DPMST, "DP MST" },
}; };
static const struct drm_prop_enum_list drm_subpixel_enum_list[] = static const struct drm_prop_enum_list drm_subpixel_enum_list[] = {
{
{ SubPixelUnknown, "Unknown" }, { SubPixelUnknown, "Unknown" },
{ SubPixelHorizontalRGB, "Horizontal RGB" }, { SubPixelHorizontalRGB, "Horizontal RGB" },
{ SubPixelHorizontalBGR, "Horizontal BGR" }, { SubPixelHorizontalBGR, "Horizontal BGR" },
...@@ -1142,6 +1135,7 @@ EXPORT_SYMBOL(drm_encoder_init); ...@@ -1142,6 +1135,7 @@ EXPORT_SYMBOL(drm_encoder_init);
void drm_encoder_cleanup(struct drm_encoder *encoder) void drm_encoder_cleanup(struct drm_encoder *encoder)
{ {
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
drm_modeset_lock_all(dev); drm_modeset_lock_all(dev);
drm_mode_object_put(dev, &encoder->base); drm_mode_object_put(dev, &encoder->base);
kfree(encoder->name); kfree(encoder->name);
...@@ -1185,8 +1179,8 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, ...@@ -1185,8 +1179,8 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
plane->base.properties = &plane->properties; plane->base.properties = &plane->properties;
plane->dev = dev; plane->dev = dev;
plane->funcs = funcs; plane->funcs = funcs;
plane->format_types = kmalloc(sizeof(uint32_t) * format_count, plane->format_types = kmalloc_array(format_count, sizeof(uint32_t),
GFP_KERNEL); GFP_KERNEL);
if (!plane->format_types) { if (!plane->format_types) {
DRM_DEBUG_KMS("out of memory when allocating plane\n"); DRM_DEBUG_KMS("out of memory when allocating plane\n");
drm_mode_object_put(dev, &plane->base); drm_mode_object_put(dev, &plane->base);
...@@ -1599,7 +1593,7 @@ static int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *gr ...@@ -1599,7 +1593,7 @@ static int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *gr
total_objects += dev->mode_config.num_encoder; total_objects += dev->mode_config.num_encoder;
total_objects += dev->mode_config.num_bridge; total_objects += dev->mode_config.num_bridge;
group->id_list = kzalloc(total_objects * sizeof(uint32_t), GFP_KERNEL); group->id_list = kcalloc(total_objects, sizeof(uint32_t), GFP_KERNEL);
if (!group->id_list) if (!group->id_list)
return -ENOMEM; return -ENOMEM;
...@@ -1629,7 +1623,8 @@ int drm_mode_group_init_legacy_group(struct drm_device *dev, ...@@ -1629,7 +1623,8 @@ int drm_mode_group_init_legacy_group(struct drm_device *dev,
struct drm_bridge *bridge; struct drm_bridge *bridge;
int ret; int ret;
if ((ret = drm_mode_group_init(dev, group))) ret = drm_mode_group_init(dev, group);
if (ret)
return ret; return ret;
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
...@@ -2045,11 +2040,9 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, ...@@ -2045,11 +2040,9 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
props_count = connector->properties.count; props_count = connector->properties.count;
for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++)
if (connector->encoder_ids[i] != 0) { if (connector->encoder_ids[i] != 0)
encoders_count++; encoders_count++;
}
}
if (out_resp->count_modes == 0) { if (out_resp->count_modes == 0) {
connector->funcs->fill_modes(connector, connector->funcs->fill_modes(connector,
...@@ -2533,7 +2526,7 @@ int drm_mode_setplane(struct drm_device *dev, void *data, ...@@ -2533,7 +2526,7 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
* *
* This is a little helper to wrap internal calls to the ->set_config driver * This is a little helper to wrap internal calls to the ->set_config driver
* interface. The only thing it adds is correct refcounting dance. * interface. The only thing it adds is correct refcounting dance.
* *
* Returns: * Returns:
* Zero on success, negative errno on failure. * Zero on success, negative errno on failure.
*/ */
...@@ -2725,9 +2718,9 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, ...@@ -2725,9 +2718,9 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
goto out; goto out;
} }
connector_set = kmalloc(crtc_req->count_connectors * connector_set = kmalloc_array(crtc_req->count_connectors,
sizeof(struct drm_connector *), sizeof(struct drm_connector *),
GFP_KERNEL); GFP_KERNEL);
if (!connector_set) { if (!connector_set) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
...@@ -2972,6 +2965,7 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev, ...@@ -2972,6 +2965,7 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv) void *data, struct drm_file *file_priv)
{ {
struct drm_mode_cursor2 *req = data; struct drm_mode_cursor2 *req = data;
return drm_mode_cursor_common(dev, req, file_priv); return drm_mode_cursor_common(dev, req, file_priv);
} }
...@@ -3419,7 +3413,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev, ...@@ -3419,7 +3413,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
ret = -EINVAL; ret = -EINVAL;
goto out_err1; goto out_err1;
} }
clips = kzalloc(num_clips * sizeof(*clips), GFP_KERNEL); clips = kcalloc(num_clips, sizeof(*clips), GFP_KERNEL);
if (!clips) { if (!clips) {
ret = -ENOMEM; ret = -ENOMEM;
goto out_err1; goto out_err1;
...@@ -3520,7 +3514,8 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags, ...@@ -3520,7 +3514,8 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags,
property->dev = dev; property->dev = dev;
if (num_values) { if (num_values) {
property->values = kzalloc(sizeof(uint64_t)*num_values, GFP_KERNEL); property->values = kcalloc(num_values, sizeof(uint64_t),
GFP_KERNEL);
if (!property->values) if (!property->values)
goto fail; goto fail;
} }
...@@ -4061,7 +4056,7 @@ int drm_mode_getblob_ioctl(struct drm_device *dev, ...@@ -4061,7 +4056,7 @@ int drm_mode_getblob_ioctl(struct drm_device *dev,
if (out_resp->length == blob->length) { if (out_resp->length == blob->length) {
blob_ptr = (void __user *)(unsigned long)out_resp->data; blob_ptr = (void __user *)(unsigned long)out_resp->data;
if (copy_to_user(blob_ptr, blob->data, blob->length)){ if (copy_to_user(blob_ptr, blob->data, blob->length)) {
ret = -EFAULT; ret = -EFAULT;
goto done; goto done;
} }
...@@ -4208,6 +4203,8 @@ EXPORT_SYMBOL(drm_mode_connector_update_edid_property); ...@@ -4208,6 +4203,8 @@ EXPORT_SYMBOL(drm_mode_connector_update_edid_property);
static bool drm_property_change_valid_get(struct drm_property *property, static bool drm_property_change_valid_get(struct drm_property *property,
uint64_t value, struct drm_mode_object **ref) uint64_t value, struct drm_mode_object **ref)
{ {
int i;
if (property->flags & DRM_MODE_PROP_IMMUTABLE) if (property->flags & DRM_MODE_PROP_IMMUTABLE)
return false; return false;
...@@ -4219,13 +4216,14 @@ static bool drm_property_change_valid_get(struct drm_property *property, ...@@ -4219,13 +4216,14 @@ static bool drm_property_change_valid_get(struct drm_property *property,
return true; return true;
} else if (drm_property_type_is(property, DRM_MODE_PROP_SIGNED_RANGE)) { } else if (drm_property_type_is(property, DRM_MODE_PROP_SIGNED_RANGE)) {
int64_t svalue = U642I64(value); int64_t svalue = U642I64(value);
if (svalue < U642I64(property->values[0]) || if (svalue < U642I64(property->values[0]) ||
svalue > U642I64(property->values[1])) svalue > U642I64(property->values[1]))
return false; return false;
return true; return true;
} else if (drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) { } else if (drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) {
int i;
uint64_t valid_mask = 0; uint64_t valid_mask = 0;
for (i = 0; i < property->num_values; i++) for (i = 0; i < property->num_values; i++)
valid_mask |= (1ULL << property->values[i]); valid_mask |= (1ULL << property->values[i]);
return !(value & ~valid_mask); return !(value & ~valid_mask);
...@@ -4257,6 +4255,11 @@ static bool drm_property_change_valid_get(struct drm_property *property, ...@@ -4257,6 +4255,11 @@ static bool drm_property_change_valid_get(struct drm_property *property,
return true; return true;
return false; return false;
} }
for (i = 0; i < property->num_values; i++)
if (property->values[i] == value)
return true;
return false;
} }
static void drm_property_change_valid_put(struct drm_property *property, static void drm_property_change_valid_put(struct drm_property *property,
...@@ -4564,7 +4567,8 @@ int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, ...@@ -4564,7 +4567,8 @@ int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
{ {
crtc->gamma_size = gamma_size; crtc->gamma_size = gamma_size;
crtc->gamma_store = kzalloc(gamma_size * sizeof(uint16_t) * 3, GFP_KERNEL); crtc->gamma_store = kcalloc(gamma_size, sizeof(uint16_t) * 3,
GFP_KERNEL);
if (!crtc->gamma_store) { if (!crtc->gamma_store) {
crtc->gamma_size = 0; crtc->gamma_size = 0;
return -ENOMEM; return -ENOMEM;
...@@ -4779,23 +4783,23 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, ...@@ -4779,23 +4783,23 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) { if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) {
ret = -ENOMEM; ret = -ENOMEM;
spin_lock_irqsave(&dev->event_lock, flags); spin_lock_irqsave(&dev->event_lock, flags);
if (file_priv->event_space < sizeof e->event) { if (file_priv->event_space < sizeof(e->event)) {
spin_unlock_irqrestore(&dev->event_lock, flags); spin_unlock_irqrestore(&dev->event_lock, flags);
goto out; goto out;
} }
file_priv->event_space -= sizeof e->event; file_priv->event_space -= sizeof(e->event);
spin_unlock_irqrestore(&dev->event_lock, flags); spin_unlock_irqrestore(&dev->event_lock, flags);
e = kzalloc(sizeof *e, GFP_KERNEL); e = kzalloc(sizeof(*e), GFP_KERNEL);
if (e == NULL) { if (e == NULL) {
spin_lock_irqsave(&dev->event_lock, flags); spin_lock_irqsave(&dev->event_lock, flags);
file_priv->event_space += sizeof e->event; file_priv->event_space += sizeof(e->event);
spin_unlock_irqrestore(&dev->event_lock, flags); spin_unlock_irqrestore(&dev->event_lock, flags);
goto out; goto out;
} }
e->event.base.type = DRM_EVENT_FLIP_COMPLETE; e->event.base.type = DRM_EVENT_FLIP_COMPLETE;
e->event.base.length = sizeof e->event; e->event.base.length = sizeof(e->event);
e->event.user_data = page_flip->user_data; e->event.user_data = page_flip->user_data;
e->base.event = &e->event.base; e->base.event = &e->event.base;
e->base.file_priv = file_priv; e->base.file_priv = file_priv;
...@@ -4808,7 +4812,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, ...@@ -4808,7 +4812,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
if (ret) { if (ret) {
if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) { if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) {
spin_lock_irqsave(&dev->event_lock, flags); spin_lock_irqsave(&dev->event_lock, flags);
file_priv->event_space += sizeof e->event; file_priv->event_space += sizeof(e->event);
spin_unlock_irqrestore(&dev->event_lock, flags); spin_unlock_irqrestore(&dev->event_lock, flags);
kfree(e); kfree(e);
} }
......
...@@ -152,30 +152,6 @@ int drm_bufs_info(struct seq_file *m, void *data) ...@@ -152,30 +152,6 @@ int drm_bufs_info(struct seq_file *m, void *data)
return 0; return 0;
} }
/**
* Called when "/proc/dri/.../vblank" is read.
*/
int drm_vblank_info(struct seq_file *m, void *data)
{
struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev;
int crtc;
mutex_lock(&dev->struct_mutex);
for (crtc = 0; crtc < dev->num_crtcs; crtc++) {
seq_printf(m, "CRTC %d enable: %d\n",
crtc, atomic_read(&dev->vblank[crtc].refcount));
seq_printf(m, "CRTC %d counter: %d\n",
crtc, drm_vblank_count(dev, crtc));
seq_printf(m, "CRTC %d last wait: %d\n",
crtc, dev->vblank[crtc].last_wait);
seq_printf(m, "CRTC %d in modeset: %d\n",
crtc, dev->vblank[crtc].inmodeset);
}
mutex_unlock(&dev->struct_mutex);
return 0;
}
/** /**
* Called when "/proc/dri/.../clients" is read. * Called when "/proc/dri/.../clients" is read.
* *
......
...@@ -55,7 +55,6 @@ void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpr ...@@ -55,7 +55,6 @@ void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpr
int drm_name_info(struct seq_file *m, void *data); int drm_name_info(struct seq_file *m, void *data);
int drm_vm_info(struct seq_file *m, void *data); int drm_vm_info(struct seq_file *m, void *data);
int drm_bufs_info(struct seq_file *m, void *data); int drm_bufs_info(struct seq_file *m, void *data);
int drm_vblank_info(struct seq_file *m, void *data);
int drm_clients_info(struct seq_file *m, void* data); int drm_clients_info(struct seq_file *m, void* data);
int drm_gem_name_info(struct seq_file *m, void *data); int drm_gem_name_info(struct seq_file *m, void *data);
......
...@@ -778,7 +778,7 @@ static struct timeval get_drm_timestamp(void) ...@@ -778,7 +778,7 @@ static struct timeval get_drm_timestamp(void)
/** /**
* drm_get_last_vbltimestamp - retrieve raw timestamp for the most recent * drm_get_last_vbltimestamp - retrieve raw timestamp for the most recent
* vblank interval * vblank interval
* @dev: DRM device * @dev: DRM device
* @crtc: which CRTC's vblank timestamp to retrieve * @crtc: which CRTC's vblank timestamp to retrieve
* @tvblank: Pointer to target struct timeval which should receive the timestamp * @tvblank: Pointer to target struct timeval which should receive the timestamp
...@@ -910,6 +910,7 @@ void drm_send_vblank_event(struct drm_device *dev, int crtc, ...@@ -910,6 +910,7 @@ void drm_send_vblank_event(struct drm_device *dev, int crtc,
{ {
struct timeval now; struct timeval now;
unsigned int seq; unsigned int seq;
if (crtc >= 0) { if (crtc >= 0) {
seq = drm_vblank_count_and_time(dev, crtc, &now); seq = drm_vblank_count_and_time(dev, crtc, &now);
} else { } else {
...@@ -1382,7 +1383,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, ...@@ -1382,7 +1383,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
unsigned int seq; unsigned int seq;
int ret; int ret;
e = kzalloc(sizeof *e, GFP_KERNEL); e = kzalloc(sizeof(*e), GFP_KERNEL);
if (e == NULL) { if (e == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto err_put; goto err_put;
...@@ -1391,7 +1392,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, ...@@ -1391,7 +1392,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
e->pipe = pipe; e->pipe = pipe;
e->base.pid = current->pid; e->base.pid = current->pid;
e->event.base.type = DRM_EVENT_VBLANK; e->event.base.type = DRM_EVENT_VBLANK;
e->event.base.length = sizeof e->event; e->event.base.length = sizeof(e->event);
e->event.user_data = vblwait->request.signal; e->event.user_data = vblwait->request.signal;
e->base.event = &e->event.base; e->base.event = &e->event.base;
e->base.file_priv = file_priv; e->base.file_priv = file_priv;
...@@ -1411,12 +1412,12 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, ...@@ -1411,12 +1412,12 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
goto err_unlock; goto err_unlock;
} }
if (file_priv->event_space < sizeof e->event) { if (file_priv->event_space < sizeof(e->event)) {
ret = -EBUSY; ret = -EBUSY;
goto err_unlock; goto err_unlock;
} }
file_priv->event_space -= sizeof e->event; file_priv->event_space -= sizeof(e->event);
seq = drm_vblank_count_and_time(dev, pipe, &now); seq = drm_vblank_count_and_time(dev, pipe, &now);
if ((vblwait->request.type & _DRM_VBLANK_NEXTONMISS) && if ((vblwait->request.type & _DRM_VBLANK_NEXTONMISS) &&
......
...@@ -142,6 +142,17 @@ int drm_plane_helper_check_update(struct drm_plane *plane, ...@@ -142,6 +142,17 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
{ {
int hscale, vscale; int hscale, vscale;
if (!fb) {
*visible = false;
return 0;
}
/* crtc should only be NULL when disabling (i.e., !fb) */
if (WARN_ON(!crtc)) {
*visible = false;
return 0;
}
if (!crtc->enabled && !can_update_disabled) { if (!crtc->enabled && !can_update_disabled) {
DRM_DEBUG_KMS("Cannot update plane of a disabled CRTC.\n"); DRM_DEBUG_KMS("Cannot update plane of a disabled CRTC.\n");
return -EINVAL; return -EINVAL;
...@@ -155,11 +166,6 @@ int drm_plane_helper_check_update(struct drm_plane *plane, ...@@ -155,11 +166,6 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
return -ERANGE; return -ERANGE;
} }
if (!fb) {
*visible = false;
return 0;
}
*visible = drm_rect_clip_scaled(src, dest, clip, hscale, vscale); *visible = drm_rect_clip_scaled(src, dest, clip, hscale, vscale);
if (!*visible) if (!*visible)
/* /*
......
...@@ -323,10 +323,6 @@ static void mdp4_crtc_commit(struct drm_crtc *crtc) ...@@ -323,10 +323,6 @@ static void mdp4_crtc_commit(struct drm_crtc *crtc)
drm_crtc_vblank_put(crtc); drm_crtc_vblank_put(crtc);
} }
static void mdp4_crtc_load_lut(struct drm_crtc *crtc)
{
}
static int mdp4_crtc_atomic_check(struct drm_crtc *crtc, static int mdp4_crtc_atomic_check(struct drm_crtc *crtc,
struct drm_crtc_state *state) struct drm_crtc_state *state)
{ {
...@@ -524,7 +520,6 @@ static const struct drm_crtc_helper_funcs mdp4_crtc_helper_funcs = { ...@@ -524,7 +520,6 @@ static const struct drm_crtc_helper_funcs mdp4_crtc_helper_funcs = {
.mode_set_base = drm_helper_crtc_mode_set_base, .mode_set_base = drm_helper_crtc_mode_set_base,
.prepare = mdp4_crtc_prepare, .prepare = mdp4_crtc_prepare,
.commit = mdp4_crtc_commit, .commit = mdp4_crtc_commit,
.load_lut = mdp4_crtc_load_lut,
.atomic_check = mdp4_crtc_atomic_check, .atomic_check = mdp4_crtc_atomic_check,
.atomic_begin = mdp4_crtc_atomic_begin, .atomic_begin = mdp4_crtc_atomic_begin,
.atomic_flush = mdp4_crtc_atomic_flush, .atomic_flush = mdp4_crtc_atomic_flush,
......
...@@ -275,10 +275,6 @@ static void mdp5_crtc_commit(struct drm_crtc *crtc) ...@@ -275,10 +275,6 @@ static void mdp5_crtc_commit(struct drm_crtc *crtc)
mdp5_disable(get_kms(crtc)); mdp5_disable(get_kms(crtc));
} }
static void mdp5_crtc_load_lut(struct drm_crtc *crtc)
{
}
struct plane_state { struct plane_state {
struct drm_plane *plane; struct drm_plane *plane;
struct mdp5_plane_state *state; struct mdp5_plane_state *state;
...@@ -407,7 +403,6 @@ static const struct drm_crtc_helper_funcs mdp5_crtc_helper_funcs = { ...@@ -407,7 +403,6 @@ static const struct drm_crtc_helper_funcs mdp5_crtc_helper_funcs = {
.mode_set_base = drm_helper_crtc_mode_set_base, .mode_set_base = drm_helper_crtc_mode_set_base,
.prepare = mdp5_crtc_prepare, .prepare = mdp5_crtc_prepare,
.commit = mdp5_crtc_commit, .commit = mdp5_crtc_commit,
.load_lut = mdp5_crtc_load_lut,
.atomic_check = mdp5_crtc_atomic_check, .atomic_check = mdp5_crtc_atomic_check,
.atomic_begin = mdp5_crtc_atomic_begin, .atomic_begin = mdp5_crtc_atomic_begin,
.atomic_flush = mdp5_crtc_atomic_flush, .atomic_flush = mdp5_crtc_atomic_flush,
......
...@@ -190,11 +190,6 @@ static int sti_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, ...@@ -190,11 +190,6 @@ static int sti_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
return ret; return ret;
} }
static void sti_drm_crtc_load_lut(struct drm_crtc *crtc)
{
/* do nothing */
}
static void sti_drm_crtc_disable(struct drm_crtc *crtc) static void sti_drm_crtc_disable(struct drm_crtc *crtc)
{ {
struct sti_mixer *mixer = to_sti_mixer(crtc); struct sti_mixer *mixer = to_sti_mixer(crtc);
...@@ -249,7 +244,6 @@ static struct drm_crtc_helper_funcs sti_crtc_helper_funcs = { ...@@ -249,7 +244,6 @@ static struct drm_crtc_helper_funcs sti_crtc_helper_funcs = {
.mode_fixup = sti_drm_crtc_mode_fixup, .mode_fixup = sti_drm_crtc_mode_fixup,
.mode_set = sti_drm_crtc_mode_set, .mode_set = sti_drm_crtc_mode_set,
.mode_set_base = sti_drm_crtc_mode_set_base, .mode_set_base = sti_drm_crtc_mode_set_base,
.load_lut = sti_drm_crtc_load_lut,
.disable = sti_drm_crtc_disable, .disable = sti_drm_crtc_disable,
}; };
......
...@@ -1095,10 +1095,6 @@ static void tegra_crtc_commit(struct drm_crtc *crtc) ...@@ -1095,10 +1095,6 @@ static void tegra_crtc_commit(struct drm_crtc *crtc)
tegra_dc_commit(dc); tegra_dc_commit(dc);
} }
static void tegra_crtc_load_lut(struct drm_crtc *crtc)
{
}
static const struct drm_crtc_helper_funcs tegra_crtc_helper_funcs = { static const struct drm_crtc_helper_funcs tegra_crtc_helper_funcs = {
.disable = tegra_crtc_disable, .disable = tegra_crtc_disable,
.mode_fixup = tegra_crtc_mode_fixup, .mode_fixup = tegra_crtc_mode_fixup,
...@@ -1106,7 +1102,6 @@ static const struct drm_crtc_helper_funcs tegra_crtc_helper_funcs = { ...@@ -1106,7 +1102,6 @@ static const struct drm_crtc_helper_funcs tegra_crtc_helper_funcs = {
.mode_set_base = tegra_crtc_mode_set_base, .mode_set_base = tegra_crtc_mode_set_base,
.prepare = tegra_crtc_prepare, .prepare = tegra_crtc_prepare,
.commit = tegra_crtc_commit, .commit = tegra_crtc_commit,
.load_lut = tegra_crtc_load_lut,
}; };
static irqreturn_t tegra_dc_irq(int irq, void *data) static irqreturn_t tegra_dc_irq(int irq, void *data)
......
...@@ -338,7 +338,7 @@ struct drm_mode_fb_cmd2 { ...@@ -338,7 +338,7 @@ struct drm_mode_fb_cmd2 {
/* /*
* In case of planar formats, this ioctl allows up to 4 * In case of planar formats, this ioctl allows up to 4
* buffer objects with offets and pitches per plane. * buffer objects with offsets and pitches per plane.
* The pitch and offset order is dictated by the fourcc, * The pitch and offset order is dictated by the fourcc,
* e.g. NV12 (http://fourcc.org/yuv.php#NV12) is described as: * e.g. NV12 (http://fourcc.org/yuv.php#NV12) is described as:
* *
...@@ -346,9 +346,9 @@ struct drm_mode_fb_cmd2 { ...@@ -346,9 +346,9 @@ struct drm_mode_fb_cmd2 {
* followed by an interleaved U/V plane containing * followed by an interleaved U/V plane containing
* 8 bit 2x2 subsampled colour difference samples. * 8 bit 2x2 subsampled colour difference samples.
* *
* So it would consist of Y as offset[0] and UV as * So it would consist of Y as offsets[0] and UV as
* offeset[1]. Note that offset[0] will generally * offsets[1]. Note that offsets[0] will generally
* be 0. * be 0 (but this is not required).
*/ */
__u32 handles[4]; __u32 handles[4];
__u32 pitches[4]; /* pitch for each plane */ __u32 pitches[4]; /* pitch for each plane */
......
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