Commit 560591f1 authored by Dave Airlie's avatar Dave Airlie

Merge branch 'drm-fixes-3.14' of git://people.freedesktop.org/~agd5f/linux into drm-fixes

Fix for 128x128 cursors, along with some misc fixes.

* 'drm-fixes-3.14' of git://people.freedesktop.org/~agd5f/linux:
  drm/radeon/ni: fix typo in dpm sq ramping setup
  drm/radeon/si: fix typo in dpm sq ramping setup
  drm/radeon: fix CP semaphores on CIK
  drm/radeon: delete a stray tab
  drm/radeon: fix display tiling setup on SI
  drm/radeon/dpm: reduce r7xx vblank mclk threshold to 200
  drm/radeon: fill in DRM_CAPs for cursor size
  drm: add DRM_CAPs for cursor size
  drm/radeon: unify bpc handling
parents c2288d4d 21ed4947
...@@ -296,6 +296,18 @@ int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_priv) ...@@ -296,6 +296,18 @@ int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
case DRM_CAP_ASYNC_PAGE_FLIP: case DRM_CAP_ASYNC_PAGE_FLIP:
req->value = dev->mode_config.async_page_flip; req->value = dev->mode_config.async_page_flip;
break; break;
case DRM_CAP_CURSOR_WIDTH:
if (dev->mode_config.cursor_width)
req->value = dev->mode_config.cursor_width;
else
req->value = 64;
break;
case DRM_CAP_CURSOR_HEIGHT:
if (dev->mode_config.cursor_height)
req->value = dev->mode_config.cursor_height;
else
req->value = 64;
break;
default: default:
return -EINVAL; return -EINVAL;
} }
......
...@@ -559,7 +559,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, ...@@ -559,7 +559,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
u32 adjusted_clock = mode->clock; u32 adjusted_clock = mode->clock;
int encoder_mode = atombios_get_encoder_mode(encoder); int encoder_mode = atombios_get_encoder_mode(encoder);
u32 dp_clock = mode->clock; u32 dp_clock = mode->clock;
int bpc = radeon_get_monitor_bpc(connector); int bpc = radeon_crtc->bpc;
bool is_duallink = radeon_dig_monitor_is_duallink(encoder, mode->clock); bool is_duallink = radeon_dig_monitor_is_duallink(encoder, mode->clock);
/* reset the pll flags */ /* reset the pll flags */
...@@ -1176,7 +1176,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -1176,7 +1176,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
evergreen_tiling_fields(tiling_flags, &bankw, &bankh, &mtaspect, &tile_split); evergreen_tiling_fields(tiling_flags, &bankw, &bankh, &mtaspect, &tile_split);
/* Set NUM_BANKS. */ /* Set NUM_BANKS. */
if (rdev->family >= CHIP_BONAIRE) { if (rdev->family >= CHIP_TAHITI) {
unsigned tileb, index, num_banks, tile_split_bytes; unsigned tileb, index, num_banks, tile_split_bytes;
/* Calculate the macrotile mode index. */ /* Calculate the macrotile mode index. */
...@@ -1194,13 +1194,14 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -1194,13 +1194,14 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
return -EINVAL; return -EINVAL;
} }
if (rdev->family >= CHIP_BONAIRE)
num_banks = (rdev->config.cik.macrotile_mode_array[index] >> 6) & 0x3; num_banks = (rdev->config.cik.macrotile_mode_array[index] >> 6) & 0x3;
else
num_banks = (rdev->config.si.tile_mode_array[index] >> 20) & 0x3;
fb_format |= EVERGREEN_GRPH_NUM_BANKS(num_banks); fb_format |= EVERGREEN_GRPH_NUM_BANKS(num_banks);
} else { } else {
/* SI and older. */ /* NI and older. */
if (rdev->family >= CHIP_TAHITI) if (rdev->family >= CHIP_CAYMAN)
tmp = rdev->config.si.tile_config;
else if (rdev->family >= CHIP_CAYMAN)
tmp = rdev->config.cayman.tile_config; tmp = rdev->config.cayman.tile_config;
else else
tmp = rdev->config.evergreen.tile_config; tmp = rdev->config.evergreen.tile_config;
......
...@@ -464,11 +464,12 @@ atombios_tv_setup(struct drm_encoder *encoder, int action) ...@@ -464,11 +464,12 @@ atombios_tv_setup(struct drm_encoder *encoder, int action)
static u8 radeon_atom_get_bpc(struct drm_encoder *encoder) static u8 radeon_atom_get_bpc(struct drm_encoder *encoder)
{ {
struct drm_connector *connector = radeon_get_connector_for_encoder(encoder);
int bpc = 8; int bpc = 8;
if (connector) if (encoder->crtc) {
bpc = radeon_get_monitor_bpc(connector); struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);
bpc = radeon_crtc->bpc;
}
switch (bpc) { switch (bpc) {
case 0: case 0:
......
...@@ -2588,7 +2588,7 @@ static int ni_populate_sq_ramping_values(struct radeon_device *rdev, ...@@ -2588,7 +2588,7 @@ static int ni_populate_sq_ramping_values(struct radeon_device *rdev,
if (NISLANDS_DPM2_SQ_RAMP_STI_SIZE > (STI_SIZE_MASK >> STI_SIZE_SHIFT)) if (NISLANDS_DPM2_SQ_RAMP_STI_SIZE > (STI_SIZE_MASK >> STI_SIZE_SHIFT))
enable_sq_ramping = false; enable_sq_ramping = false;
if (NISLANDS_DPM2_SQ_RAMP_LTI_RATIO <= (LTI_RATIO_MASK >> LTI_RATIO_SHIFT)) if (NISLANDS_DPM2_SQ_RAMP_LTI_RATIO > (LTI_RATIO_MASK >> LTI_RATIO_SHIFT))
enable_sq_ramping = false; enable_sq_ramping = false;
for (i = 0; i < state->performance_level_count; i++) { for (i = 0; i < state->performance_level_count; i++) {
......
...@@ -135,6 +135,9 @@ extern int radeon_hard_reset; ...@@ -135,6 +135,9 @@ extern int radeon_hard_reset;
/* R600+ */ /* R600+ */
#define R600_RING_TYPE_UVD_INDEX 5 #define R600_RING_TYPE_UVD_INDEX 5
/* number of hw syncs before falling back on blocking */
#define RADEON_NUM_SYNCS 4
/* hardcode those limit for now */ /* hardcode those limit for now */
#define RADEON_VA_IB_OFFSET (1 << 20) #define RADEON_VA_IB_OFFSET (1 << 20)
#define RADEON_VA_RESERVED_SIZE (8 << 20) #define RADEON_VA_RESERVED_SIZE (8 << 20)
...@@ -554,7 +557,6 @@ int radeon_mode_dumb_mmap(struct drm_file *filp, ...@@ -554,7 +557,6 @@ int radeon_mode_dumb_mmap(struct drm_file *filp,
/* /*
* Semaphores. * Semaphores.
*/ */
/* everything here is constant */
struct radeon_semaphore { struct radeon_semaphore {
struct radeon_sa_bo *sa_bo; struct radeon_sa_bo *sa_bo;
signed waiters; signed waiters;
......
...@@ -571,6 +571,8 @@ static void radeon_crtc_init(struct drm_device *dev, int index) ...@@ -571,6 +571,8 @@ static void radeon_crtc_init(struct drm_device *dev, int index)
radeon_crtc->max_cursor_width = CURSOR_WIDTH; radeon_crtc->max_cursor_width = CURSOR_WIDTH;
radeon_crtc->max_cursor_height = CURSOR_HEIGHT; radeon_crtc->max_cursor_height = CURSOR_HEIGHT;
} }
dev->mode_config.cursor_width = radeon_crtc->max_cursor_width;
dev->mode_config.cursor_height = radeon_crtc->max_cursor_height;
#if 0 #if 0
radeon_crtc->mode_set.crtc = &radeon_crtc->base; radeon_crtc->mode_set.crtc = &radeon_crtc->base;
......
...@@ -139,7 +139,7 @@ int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib, ...@@ -139,7 +139,7 @@ int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib,
} }
/* 64 dwords should be enough for fence too */ /* 64 dwords should be enough for fence too */
r = radeon_ring_lock(rdev, ring, 64 + RADEON_NUM_RINGS * 8); r = radeon_ring_lock(rdev, ring, 64 + RADEON_NUM_SYNCS * 8);
if (r) { if (r) {
dev_err(rdev->dev, "scheduling IB failed (%d).\n", r); dev_err(rdev->dev, "scheduling IB failed (%d).\n", r);
return r; return r;
......
...@@ -34,14 +34,15 @@ ...@@ -34,14 +34,15 @@
int radeon_semaphore_create(struct radeon_device *rdev, int radeon_semaphore_create(struct radeon_device *rdev,
struct radeon_semaphore **semaphore) struct radeon_semaphore **semaphore)
{ {
uint32_t *cpu_addr;
int i, r; int i, r;
*semaphore = kmalloc(sizeof(struct radeon_semaphore), GFP_KERNEL); *semaphore = kmalloc(sizeof(struct radeon_semaphore), GFP_KERNEL);
if (*semaphore == NULL) { if (*semaphore == NULL) {
return -ENOMEM; return -ENOMEM;
} }
r = radeon_sa_bo_new(rdev, &rdev->ring_tmp_bo, r = radeon_sa_bo_new(rdev, &rdev->ring_tmp_bo, &(*semaphore)->sa_bo,
&(*semaphore)->sa_bo, 8, 8, true); 8 * RADEON_NUM_SYNCS, 8, true);
if (r) { if (r) {
kfree(*semaphore); kfree(*semaphore);
*semaphore = NULL; *semaphore = NULL;
...@@ -49,7 +50,10 @@ int radeon_semaphore_create(struct radeon_device *rdev, ...@@ -49,7 +50,10 @@ int radeon_semaphore_create(struct radeon_device *rdev,
} }
(*semaphore)->waiters = 0; (*semaphore)->waiters = 0;
(*semaphore)->gpu_addr = radeon_sa_bo_gpu_addr((*semaphore)->sa_bo); (*semaphore)->gpu_addr = radeon_sa_bo_gpu_addr((*semaphore)->sa_bo);
*((uint64_t*)radeon_sa_bo_cpu_addr((*semaphore)->sa_bo)) = 0;
cpu_addr = radeon_sa_bo_cpu_addr((*semaphore)->sa_bo);
for (i = 0; i < RADEON_NUM_SYNCS; ++i)
cpu_addr[i] = 0;
for (i = 0; i < RADEON_NUM_RINGS; ++i) for (i = 0; i < RADEON_NUM_RINGS; ++i)
(*semaphore)->sync_to[i] = NULL; (*semaphore)->sync_to[i] = NULL;
...@@ -125,6 +129,7 @@ int radeon_semaphore_sync_rings(struct radeon_device *rdev, ...@@ -125,6 +129,7 @@ int radeon_semaphore_sync_rings(struct radeon_device *rdev,
struct radeon_semaphore *semaphore, struct radeon_semaphore *semaphore,
int ring) int ring)
{ {
unsigned count = 0;
int i, r; int i, r;
for (i = 0; i < RADEON_NUM_RINGS; ++i) { for (i = 0; i < RADEON_NUM_RINGS; ++i) {
...@@ -140,6 +145,12 @@ int radeon_semaphore_sync_rings(struct radeon_device *rdev, ...@@ -140,6 +145,12 @@ int radeon_semaphore_sync_rings(struct radeon_device *rdev,
return -EINVAL; return -EINVAL;
} }
if (++count > RADEON_NUM_SYNCS) {
/* not enough room, wait manually */
radeon_fence_wait_locked(fence);
continue;
}
/* allocate enough space for sync command */ /* allocate enough space for sync command */
r = radeon_ring_alloc(rdev, &rdev->ring[i], 16); r = radeon_ring_alloc(rdev, &rdev->ring[i], 16);
if (r) { if (r) {
...@@ -164,6 +175,8 @@ int radeon_semaphore_sync_rings(struct radeon_device *rdev, ...@@ -164,6 +175,8 @@ int radeon_semaphore_sync_rings(struct radeon_device *rdev,
radeon_ring_commit(rdev, &rdev->ring[i]); radeon_ring_commit(rdev, &rdev->ring[i]);
radeon_fence_note_sync(fence, ring); radeon_fence_note_sync(fence, ring);
semaphore->gpu_addr += 8;
} }
return 0; return 0;
......
...@@ -2526,14 +2526,7 @@ u32 rv770_dpm_get_mclk(struct radeon_device *rdev, bool low) ...@@ -2526,14 +2526,7 @@ u32 rv770_dpm_get_mclk(struct radeon_device *rdev, bool low)
bool rv770_dpm_vblank_too_short(struct radeon_device *rdev) bool rv770_dpm_vblank_too_short(struct radeon_device *rdev)
{ {
u32 vblank_time = r600_dpm_get_vblank_time(rdev); u32 vblank_time = r600_dpm_get_vblank_time(rdev);
u32 switch_limit = 300; u32 switch_limit = 200; /* 300 */
/* quirks */
/* ASUS K70AF */
if ((rdev->pdev->device == 0x9553) &&
(rdev->pdev->subsystem_vendor == 0x1043) &&
(rdev->pdev->subsystem_device == 0x1c42))
switch_limit = 200;
/* RV770 */ /* RV770 */
/* mclk switching doesn't seem to work reliably on desktop RV770s */ /* mclk switching doesn't seem to work reliably on desktop RV770s */
......
...@@ -2395,7 +2395,7 @@ static int si_populate_sq_ramping_values(struct radeon_device *rdev, ...@@ -2395,7 +2395,7 @@ static int si_populate_sq_ramping_values(struct radeon_device *rdev,
if (SISLANDS_DPM2_SQ_RAMP_STI_SIZE > (STI_SIZE_MASK >> STI_SIZE_SHIFT)) if (SISLANDS_DPM2_SQ_RAMP_STI_SIZE > (STI_SIZE_MASK >> STI_SIZE_SHIFT))
enable_sq_ramping = false; enable_sq_ramping = false;
if (SISLANDS_DPM2_SQ_RAMP_LTI_RATIO <= (LTI_RATIO_MASK >> LTI_RATIO_SHIFT)) if (SISLANDS_DPM2_SQ_RAMP_LTI_RATIO > (LTI_RATIO_MASK >> LTI_RATIO_SHIFT))
enable_sq_ramping = false; enable_sq_ramping = false;
for (i = 0; i < state->performance_level_count; i++) { for (i = 0; i < state->performance_level_count; i++) {
......
...@@ -907,6 +907,9 @@ struct drm_mode_config { ...@@ -907,6 +907,9 @@ struct drm_mode_config {
/* whether async page flip is supported or not */ /* whether async page flip is supported or not */
bool async_page_flip; bool async_page_flip;
/* cursor size */
uint32_t cursor_width, cursor_height;
}; };
#define obj_to_crtc(x) container_of(x, struct drm_crtc, base) #define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
......
...@@ -619,6 +619,8 @@ struct drm_gem_open { ...@@ -619,6 +619,8 @@ struct drm_gem_open {
#define DRM_PRIME_CAP_EXPORT 0x2 #define DRM_PRIME_CAP_EXPORT 0x2
#define DRM_CAP_TIMESTAMP_MONOTONIC 0x6 #define DRM_CAP_TIMESTAMP_MONOTONIC 0x6
#define DRM_CAP_ASYNC_PAGE_FLIP 0x7 #define DRM_CAP_ASYNC_PAGE_FLIP 0x7
#define DRM_CAP_CURSOR_WIDTH 0x8
#define DRM_CAP_CURSOR_HEIGHT 0x9
/** DRM_IOCTL_GET_CAP ioctl argument type */ /** DRM_IOCTL_GET_CAP ioctl argument type */
struct drm_get_cap { struct drm_get_cap {
......
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