Merge remote-tracking branch 'airlied/drm-next' into drm-misc-next
Backmerge v4.9-rc8 to get at
commit e94bd1736f
Author: Michel Dänzer <michel.daenzer@amd.com>
Date: Wed Nov 30 17:30:01 2016 +0900
drm: Don't call drm_for_each_crtc with a non-KMS driver
so I can apply Michel's follow-up patch.
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
This commit is contained in:
@@ -578,7 +578,7 @@ int qxl_hw_surface_dealloc(struct qxl_device *qdev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int qxl_update_surface(struct qxl_device *qdev, struct qxl_bo *surf)
|
||||
static int qxl_update_surface(struct qxl_device *qdev, struct qxl_bo *surf)
|
||||
{
|
||||
struct qxl_rect rect;
|
||||
int ret;
|
||||
|
@@ -36,7 +36,7 @@ static bool qxl_head_enabled(struct qxl_head *head)
|
||||
return head->width && head->height;
|
||||
}
|
||||
|
||||
void qxl_alloc_client_monitors_config(struct qxl_device *qdev, unsigned count)
|
||||
static void qxl_alloc_client_monitors_config(struct qxl_device *qdev, unsigned count)
|
||||
{
|
||||
if (qdev->client_monitors_config &&
|
||||
count > qdev->client_monitors_config->count) {
|
||||
@@ -57,11 +57,18 @@ void qxl_alloc_client_monitors_config(struct qxl_device *qdev, unsigned count)
|
||||
qdev->client_monitors_config->count = count;
|
||||
}
|
||||
|
||||
enum {
|
||||
MONITORS_CONFIG_MODIFIED,
|
||||
MONITORS_CONFIG_UNCHANGED,
|
||||
MONITORS_CONFIG_BAD_CRC,
|
||||
};
|
||||
|
||||
static int qxl_display_copy_rom_client_monitors_config(struct qxl_device *qdev)
|
||||
{
|
||||
int i;
|
||||
int num_monitors;
|
||||
uint32_t crc;
|
||||
int status = MONITORS_CONFIG_UNCHANGED;
|
||||
|
||||
num_monitors = qdev->rom->client_monitors_config.count;
|
||||
crc = crc32(0, (const uint8_t *)&qdev->rom->client_monitors_config,
|
||||
@@ -70,7 +77,7 @@ static int qxl_display_copy_rom_client_monitors_config(struct qxl_device *qdev)
|
||||
qxl_io_log(qdev, "crc mismatch: have %X (%zd) != %X\n", crc,
|
||||
sizeof(qdev->rom->client_monitors_config),
|
||||
qdev->rom->client_monitors_config_crc);
|
||||
return 1;
|
||||
return MONITORS_CONFIG_BAD_CRC;
|
||||
}
|
||||
if (num_monitors > qdev->monitors_config->max_allowed) {
|
||||
DRM_DEBUG_KMS("client monitors list will be truncated: %d < %d\n",
|
||||
@@ -79,6 +86,10 @@ static int qxl_display_copy_rom_client_monitors_config(struct qxl_device *qdev)
|
||||
} else {
|
||||
num_monitors = qdev->rom->client_monitors_config.count;
|
||||
}
|
||||
if (qdev->client_monitors_config
|
||||
&& (num_monitors != qdev->client_monitors_config->count)) {
|
||||
status = MONITORS_CONFIG_MODIFIED;
|
||||
}
|
||||
qxl_alloc_client_monitors_config(qdev, num_monitors);
|
||||
/* we copy max from the client but it isn't used */
|
||||
qdev->client_monitors_config->max_allowed =
|
||||
@@ -88,17 +99,39 @@ static int qxl_display_copy_rom_client_monitors_config(struct qxl_device *qdev)
|
||||
&qdev->rom->client_monitors_config.heads[i];
|
||||
struct qxl_head *client_head =
|
||||
&qdev->client_monitors_config->heads[i];
|
||||
client_head->x = c_rect->left;
|
||||
client_head->y = c_rect->top;
|
||||
client_head->width = c_rect->right - c_rect->left;
|
||||
client_head->height = c_rect->bottom - c_rect->top;
|
||||
client_head->surface_id = 0;
|
||||
client_head->id = i;
|
||||
client_head->flags = 0;
|
||||
if (client_head->x != c_rect->left) {
|
||||
client_head->x = c_rect->left;
|
||||
status = MONITORS_CONFIG_MODIFIED;
|
||||
}
|
||||
if (client_head->y != c_rect->top) {
|
||||
client_head->y = c_rect->top;
|
||||
status = MONITORS_CONFIG_MODIFIED;
|
||||
}
|
||||
if (client_head->width != c_rect->right - c_rect->left) {
|
||||
client_head->width = c_rect->right - c_rect->left;
|
||||
status = MONITORS_CONFIG_MODIFIED;
|
||||
}
|
||||
if (client_head->height != c_rect->bottom - c_rect->top) {
|
||||
client_head->height = c_rect->bottom - c_rect->top;
|
||||
status = MONITORS_CONFIG_MODIFIED;
|
||||
}
|
||||
if (client_head->surface_id != 0) {
|
||||
client_head->surface_id = 0;
|
||||
status = MONITORS_CONFIG_MODIFIED;
|
||||
}
|
||||
if (client_head->id != i) {
|
||||
client_head->id = i;
|
||||
status = MONITORS_CONFIG_MODIFIED;
|
||||
}
|
||||
if (client_head->flags != 0) {
|
||||
client_head->flags = 0;
|
||||
status = MONITORS_CONFIG_MODIFIED;
|
||||
}
|
||||
DRM_DEBUG_KMS("read %dx%d+%d+%d\n", client_head->width, client_head->height,
|
||||
client_head->x, client_head->y);
|
||||
}
|
||||
return 0;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static void qxl_update_offset_props(struct qxl_device *qdev)
|
||||
@@ -124,9 +157,18 @@ void qxl_display_read_client_monitors_config(struct qxl_device *qdev)
|
||||
{
|
||||
|
||||
struct drm_device *dev = qdev->ddev;
|
||||
while (qxl_display_copy_rom_client_monitors_config(qdev)) {
|
||||
int status;
|
||||
|
||||
status = qxl_display_copy_rom_client_monitors_config(qdev);
|
||||
while (status == MONITORS_CONFIG_BAD_CRC) {
|
||||
qxl_io_log(qdev, "failed crc check for client_monitors_config,"
|
||||
" retrying\n");
|
||||
status = qxl_display_copy_rom_client_monitors_config(qdev);
|
||||
}
|
||||
if (status == MONITORS_CONFIG_UNCHANGED) {
|
||||
qxl_io_log(qdev, "config unchanged\n");
|
||||
DRM_DEBUG("ignoring unchanged client monitors config");
|
||||
return;
|
||||
}
|
||||
|
||||
drm_modeset_lock_all(dev);
|
||||
@@ -157,6 +199,9 @@ static int qxl_add_monitors_config_modes(struct drm_connector *connector,
|
||||
mode = drm_cvt_mode(dev, head->width, head->height, 60, false, false,
|
||||
false);
|
||||
mode->type |= DRM_MODE_TYPE_PREFERRED;
|
||||
mode->hdisplay = head->width;
|
||||
mode->vdisplay = head->height;
|
||||
drm_mode_set_name(mode);
|
||||
*pwidth = head->width;
|
||||
*pheight = head->height;
|
||||
drm_mode_probed_add(connector, mode);
|
||||
@@ -607,7 +652,7 @@ static bool qxl_crtc_mode_fixup(struct drm_crtc *crtc,
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
qxl_send_monitors_config(struct qxl_device *qdev)
|
||||
{
|
||||
int i;
|
||||
|
@@ -395,16 +395,11 @@ qxl_framebuffer_init(struct drm_device *dev,
|
||||
struct drm_gem_object *obj,
|
||||
const struct drm_framebuffer_funcs *funcs);
|
||||
void qxl_display_read_client_monitors_config(struct qxl_device *qdev);
|
||||
void qxl_send_monitors_config(struct qxl_device *qdev);
|
||||
int qxl_create_monitors_object(struct qxl_device *qdev);
|
||||
int qxl_destroy_monitors_object(struct qxl_device *qdev);
|
||||
|
||||
/* used by qxl_debugfs only */
|
||||
void qxl_crtc_set_from_monitors_config(struct qxl_device *qdev);
|
||||
void qxl_alloc_client_monitors_config(struct qxl_device *qdev, unsigned count);
|
||||
|
||||
/* qxl_gem.c */
|
||||
int qxl_gem_init(struct qxl_device *qdev);
|
||||
void qxl_gem_init(struct qxl_device *qdev);
|
||||
void qxl_gem_fini(struct qxl_device *qdev);
|
||||
int qxl_gem_object_create(struct qxl_device *qdev, int size,
|
||||
int alignment, int initial_domain,
|
||||
@@ -574,6 +569,5 @@ int qxl_bo_check_id(struct qxl_device *qdev, struct qxl_bo *bo);
|
||||
struct qxl_drv_surface *
|
||||
qxl_surface_lookup(struct drm_device *dev, int surface_id);
|
||||
void qxl_surface_evict(struct qxl_device *qdev, struct qxl_bo *surf, bool freeing);
|
||||
int qxl_update_surface(struct qxl_device *qdev, struct qxl_bo *surf);
|
||||
|
||||
#endif
|
||||
|
@@ -191,7 +191,7 @@ static int qxlfb_framebuffer_dirty(struct drm_framebuffer *fb,
|
||||
/*
|
||||
* we are using a shadow draw buffer, at qdev->surface0_shadow
|
||||
*/
|
||||
qxl_io_log(qdev, "dirty x[%d, %d], y[%d, %d]", clips->x1, clips->x2,
|
||||
qxl_io_log(qdev, "dirty x[%d, %d], y[%d, %d]\n", clips->x1, clips->x2,
|
||||
clips->y1, clips->y2);
|
||||
image->dx = clips->x1;
|
||||
image->dy = clips->y1;
|
||||
|
@@ -111,10 +111,9 @@ void qxl_gem_object_close(struct drm_gem_object *obj,
|
||||
{
|
||||
}
|
||||
|
||||
int qxl_gem_init(struct qxl_device *qdev)
|
||||
void qxl_gem_init(struct qxl_device *qdev)
|
||||
{
|
||||
INIT_LIST_HEAD(&qdev->gem.objects);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void qxl_gem_fini(struct qxl_device *qdev)
|
||||
|
@@ -131,7 +131,7 @@ static int qxl_device_init(struct qxl_device *qdev,
|
||||
mutex_init(&qdev->update_area_mutex);
|
||||
mutex_init(&qdev->release_mutex);
|
||||
mutex_init(&qdev->surf_evict_mutex);
|
||||
INIT_LIST_HEAD(&qdev->gem.objects);
|
||||
qxl_gem_init(qdev);
|
||||
|
||||
qdev->rom_base = pci_resource_start(pdev, 2);
|
||||
qdev->rom_size = pci_resource_len(pdev, 2);
|
||||
@@ -273,6 +273,7 @@ static void qxl_device_fini(struct qxl_device *qdev)
|
||||
qxl_ring_free(qdev->command_ring);
|
||||
qxl_ring_free(qdev->cursor_ring);
|
||||
qxl_ring_free(qdev->release_ring);
|
||||
qxl_gem_fini(qdev);
|
||||
qxl_bo_fini(qdev);
|
||||
io_mapping_free(qdev->surface_mapping);
|
||||
io_mapping_free(qdev->vram_mapping);
|
||||
|
Reference in New Issue
Block a user