Merge tag 'topic/drm-misc-2016-06-07' of git://anongit.freedesktop.org/drm-intel into drm-next
As promised, piles of prep work all around: - drm_atomic_state rework, prep for nonblocking commit helpers - fence patches from Gustavo and Christian to prep for atomic fences and some cool work in ttm/amdgpu from Christian - drm event prep for both nonblocking commit and atomic fences - Gustavo seems on a crusade against the non-kms-native version of the vblank functions. - prep work from Boris to nuke all the silly ->best_encoder implementations we have (we really only need that for truly dynamic cases like dvi-i vs dvi-d or dp mst selecting the right transcoder on intel) - prep work from Laurent to rework the format handling functions - and few small things all over * tag 'topic/drm-misc-2016-06-07' of git://anongit.freedesktop.org/drm-intel: (47 commits) drm/dsi: Implement set tear scanline drm/fb_cma_helper: Implement fb_mmap callback drm/qxl: Remove useless drm_fb_get_bpp_depth() call drm/ast: Remove useless drm_fb_get_bpp_depth() call drm/atomic: Fix remaining places where !funcs->best_encoder is valid drm/core: Change declaration for gamma_set. Documentation: add fence-array to kernel DocBook drm/shmobile: use drm_crtc_vblank_{get,put}() drm/radeon: use drm_crtc_vblank_{get,put}() drm/qxl: use drm_crtc_vblank_{get,put}() drm/atmel: use drm_crtc_vblank_{get,put}() drm/armada: use drm_crtc_vblank_{get,put}() drm/amdgpu: use drm_crtc_vblank_{get,put}() drm/virtio: use drm_crtc_send_vblank_event() drm/udl: use drm_crtc_send_vblank_event() drm/qxl: use drm_crtc_send_vblank_event() drm/atmel: use drm_crtc_send_vblank_event() drm/armada: use drm_crtc_send_vblank_event() drm/doc: Switch to sphinx/rst fixed-width quoting drm/doc: Drop kerneldoc for static functions in drm_irq.c ...
This commit is contained in:
@@ -2032,7 +2032,7 @@ struct amdgpu_device {
|
||||
struct amdgpu_irq_src hpd_irq;
|
||||
|
||||
/* rings */
|
||||
unsigned fence_context;
|
||||
u64 fence_context;
|
||||
unsigned num_rings;
|
||||
struct amdgpu_ring *rings[AMDGPU_MAX_RINGS];
|
||||
bool ib_pool_ready;
|
||||
|
@@ -240,7 +240,7 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
|
||||
|
||||
work->base = base;
|
||||
|
||||
r = drm_vblank_get(crtc->dev, amdgpu_crtc->crtc_id);
|
||||
r = drm_crtc_vblank_get(crtc);
|
||||
if (r) {
|
||||
DRM_ERROR("failed to get vblank before flip\n");
|
||||
goto pflip_cleanup;
|
||||
@@ -268,7 +268,7 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
|
||||
return 0;
|
||||
|
||||
vblank_cleanup:
|
||||
drm_vblank_put(crtc->dev, amdgpu_crtc->crtc_id);
|
||||
drm_crtc_vblank_put(&amdgpu_crtc->base);
|
||||
|
||||
pflip_cleanup:
|
||||
if (unlikely(amdgpu_bo_reserve(new_rbo, false) != 0)) {
|
||||
|
@@ -427,7 +427,7 @@ void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager,
|
||||
soffset, eoffset, eoffset - soffset);
|
||||
|
||||
if (i->fence)
|
||||
seq_printf(m, " protected by 0x%08x on context %d",
|
||||
seq_printf(m, " protected by 0x%08x on context %llu",
|
||||
i->fence->seqno, i->fence->context);
|
||||
|
||||
seq_printf(m, "\n");
|
||||
|
@@ -2667,19 +2667,21 @@ static void dce_v10_0_cursor_reset(struct drm_crtc *crtc)
|
||||
}
|
||||
}
|
||||
|
||||
static void dce_v10_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
|
||||
u16 *blue, uint32_t start, uint32_t size)
|
||||
static int dce_v10_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
|
||||
u16 *blue, uint32_t size)
|
||||
{
|
||||
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
|
||||
int end = (start + size > 256) ? 256 : start + size, i;
|
||||
int i;
|
||||
|
||||
/* userspace palettes are always correct as is */
|
||||
for (i = start; i < end; i++) {
|
||||
for (i = 0; i < size; i++) {
|
||||
amdgpu_crtc->lut_r[i] = red[i] >> 6;
|
||||
amdgpu_crtc->lut_g[i] = green[i] >> 6;
|
||||
amdgpu_crtc->lut_b[i] = blue[i] >> 6;
|
||||
}
|
||||
dce_v10_0_crtc_load_lut(crtc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void dce_v10_0_crtc_destroy(struct drm_crtc *crtc)
|
||||
@@ -3372,7 +3374,7 @@ static int dce_v10_0_pageflip_irq(struct amdgpu_device *adev,
|
||||
|
||||
spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
|
||||
|
||||
drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
|
||||
drm_crtc_vblank_put(&amdgpu_crtc->base);
|
||||
schedule_work(&works->unpin_work);
|
||||
|
||||
return 0;
|
||||
|
@@ -2678,19 +2678,21 @@ static void dce_v11_0_cursor_reset(struct drm_crtc *crtc)
|
||||
}
|
||||
}
|
||||
|
||||
static void dce_v11_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
|
||||
u16 *blue, uint32_t start, uint32_t size)
|
||||
static int dce_v11_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
|
||||
u16 *blue, uint32_t size)
|
||||
{
|
||||
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
|
||||
int end = (start + size > 256) ? 256 : start + size, i;
|
||||
int i;
|
||||
|
||||
/* userspace palettes are always correct as is */
|
||||
for (i = start; i < end; i++) {
|
||||
for (i = 0; i < size; i++) {
|
||||
amdgpu_crtc->lut_r[i] = red[i] >> 6;
|
||||
amdgpu_crtc->lut_g[i] = green[i] >> 6;
|
||||
amdgpu_crtc->lut_b[i] = blue[i] >> 6;
|
||||
}
|
||||
dce_v11_0_crtc_load_lut(crtc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void dce_v11_0_crtc_destroy(struct drm_crtc *crtc)
|
||||
@@ -3433,7 +3435,7 @@ static int dce_v11_0_pageflip_irq(struct amdgpu_device *adev,
|
||||
|
||||
spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
|
||||
|
||||
drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
|
||||
drm_crtc_vblank_put(&amdgpu_crtc->base);
|
||||
schedule_work(&works->unpin_work);
|
||||
|
||||
return 0;
|
||||
|
@@ -2574,19 +2574,21 @@ static void dce_v8_0_cursor_reset(struct drm_crtc *crtc)
|
||||
}
|
||||
}
|
||||
|
||||
static void dce_v8_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
|
||||
u16 *blue, uint32_t start, uint32_t size)
|
||||
static int dce_v8_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
|
||||
u16 *blue, uint32_t size)
|
||||
{
|
||||
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
|
||||
int end = (start + size > 256) ? 256 : start + size, i;
|
||||
int i;
|
||||
|
||||
/* userspace palettes are always correct as is */
|
||||
for (i = start; i < end; i++) {
|
||||
for (i = 0; i < size; i++) {
|
||||
amdgpu_crtc->lut_r[i] = red[i] >> 6;
|
||||
amdgpu_crtc->lut_g[i] = green[i] >> 6;
|
||||
amdgpu_crtc->lut_b[i] = blue[i] >> 6;
|
||||
}
|
||||
dce_v8_0_crtc_load_lut(crtc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void dce_v8_0_crtc_destroy(struct drm_crtc *crtc)
|
||||
@@ -3376,7 +3378,7 @@ static int dce_v8_0_pageflip_irq(struct amdgpu_device *adev,
|
||||
|
||||
spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
|
||||
|
||||
drm_vblank_put(adev->ddev, amdgpu_crtc->crtc_id);
|
||||
drm_crtc_vblank_put(&amdgpu_crtc->base);
|
||||
schedule_work(&works->unpin_work);
|
||||
|
||||
return 0;
|
||||
|
@@ -92,7 +92,7 @@ static void arcpgu_preclose(struct drm_device *drm, struct drm_file *file)
|
||||
if (e->base.file_priv != file)
|
||||
continue;
|
||||
list_del(&e->base.link);
|
||||
e->base.destroy(&e->base);
|
||||
kfree(&e->base);
|
||||
}
|
||||
spin_unlock_irqrestore(&drm->event_lock, flags);
|
||||
}
|
||||
|
@@ -196,30 +196,11 @@ static void hdlcd_crtc_atomic_begin(struct drm_crtc *crtc,
|
||||
}
|
||||
}
|
||||
|
||||
static void hdlcd_crtc_atomic_flush(struct drm_crtc *crtc,
|
||||
struct drm_crtc_state *state)
|
||||
{
|
||||
}
|
||||
|
||||
static bool hdlcd_crtc_mode_fixup(struct drm_crtc *crtc,
|
||||
const struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static const struct drm_crtc_helper_funcs hdlcd_crtc_helper_funcs = {
|
||||
.mode_fixup = hdlcd_crtc_mode_fixup,
|
||||
.mode_set = drm_helper_crtc_mode_set,
|
||||
.mode_set_base = drm_helper_crtc_mode_set_base,
|
||||
.mode_set_nofb = hdlcd_crtc_mode_set_nofb,
|
||||
.enable = hdlcd_crtc_enable,
|
||||
.disable = hdlcd_crtc_disable,
|
||||
.prepare = hdlcd_crtc_disable,
|
||||
.commit = hdlcd_crtc_enable,
|
||||
.atomic_check = hdlcd_crtc_atomic_check,
|
||||
.atomic_begin = hdlcd_crtc_atomic_begin,
|
||||
.atomic_flush = hdlcd_crtc_atomic_flush,
|
||||
};
|
||||
|
||||
static int hdlcd_plane_atomic_check(struct drm_plane *plane,
|
||||
|
@@ -199,7 +199,7 @@ static void armada_drm_plane_work_run(struct armada_crtc *dcrtc,
|
||||
/* Handle any pending frame work. */
|
||||
if (work) {
|
||||
work->fn(dcrtc, plane, work);
|
||||
drm_vblank_put(dcrtc->crtc.dev, dcrtc->num);
|
||||
drm_crtc_vblank_put(&dcrtc->crtc);
|
||||
}
|
||||
|
||||
wake_up(&plane->frame_wait);
|
||||
@@ -210,7 +210,7 @@ int armada_drm_plane_work_queue(struct armada_crtc *dcrtc,
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = drm_vblank_get(dcrtc->crtc.dev, dcrtc->num);
|
||||
ret = drm_crtc_vblank_get(&dcrtc->crtc);
|
||||
if (ret) {
|
||||
DRM_ERROR("failed to acquire vblank counter\n");
|
||||
return ret;
|
||||
@@ -218,7 +218,7 @@ int armada_drm_plane_work_queue(struct armada_crtc *dcrtc,
|
||||
|
||||
ret = cmpxchg(&plane->work, NULL, work) ? -EBUSY : 0;
|
||||
if (ret)
|
||||
drm_vblank_put(dcrtc->crtc.dev, dcrtc->num);
|
||||
drm_crtc_vblank_put(&dcrtc->crtc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -234,7 +234,7 @@ struct armada_plane_work *armada_drm_plane_work_cancel(
|
||||
struct armada_plane_work *work = xchg(&plane->work, NULL);
|
||||
|
||||
if (work)
|
||||
drm_vblank_put(dcrtc->crtc.dev, dcrtc->num);
|
||||
drm_crtc_vblank_put(&dcrtc->crtc);
|
||||
|
||||
return work;
|
||||
}
|
||||
@@ -260,7 +260,7 @@ static void armada_drm_crtc_complete_frame_work(struct armada_crtc *dcrtc,
|
||||
|
||||
if (fwork->event) {
|
||||
spin_lock_irqsave(&dev->event_lock, flags);
|
||||
drm_send_vblank_event(dev, dcrtc->num, fwork->event);
|
||||
drm_crtc_send_vblank_event(&dcrtc->crtc, fwork->event);
|
||||
spin_unlock_irqrestore(&dev->event_lock, flags);
|
||||
}
|
||||
|
||||
@@ -592,9 +592,9 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc,
|
||||
|
||||
if (interlaced ^ dcrtc->interlaced) {
|
||||
if (adj->flags & DRM_MODE_FLAG_INTERLACE)
|
||||
drm_vblank_get(dcrtc->crtc.dev, dcrtc->num);
|
||||
drm_crtc_vblank_get(&dcrtc->crtc);
|
||||
else
|
||||
drm_vblank_put(dcrtc->crtc.dev, dcrtc->num);
|
||||
drm_crtc_vblank_put(&dcrtc->crtc);
|
||||
dcrtc->interlaced = interlaced;
|
||||
}
|
||||
|
||||
|
@@ -167,12 +167,9 @@ static int astfb_create_object(struct ast_fbdev *afbdev,
|
||||
struct drm_gem_object **gobj_p)
|
||||
{
|
||||
struct drm_device *dev = afbdev->helper.dev;
|
||||
u32 bpp, depth;
|
||||
u32 size;
|
||||
struct drm_gem_object *gobj;
|
||||
|
||||
int ret = 0;
|
||||
drm_fb_get_bpp_depth(mode_cmd->pixel_format, &depth, &bpp);
|
||||
|
||||
size = mode_cmd->pitches[0] * mode_cmd->height;
|
||||
ret = ast_gem_create(dev, size, true, &gobj);
|
||||
|
@@ -624,19 +624,21 @@ static void ast_crtc_reset(struct drm_crtc *crtc)
|
||||
|
||||
}
|
||||
|
||||
static void ast_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
|
||||
u16 *blue, uint32_t start, uint32_t size)
|
||||
static int ast_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
|
||||
u16 *blue, uint32_t size)
|
||||
{
|
||||
struct ast_crtc *ast_crtc = to_ast_crtc(crtc);
|
||||
int end = (start + size > 256) ? 256 : start + size, i;
|
||||
int i;
|
||||
|
||||
/* userspace palettes are always correct as is */
|
||||
for (i = start; i < end; i++) {
|
||||
for (i = 0; i < size; i++) {
|
||||
ast_crtc->lut_r[i] = red[i] >> 8;
|
||||
ast_crtc->lut_g[i] = green[i] >> 8;
|
||||
ast_crtc->lut_b[i] = blue[i] >> 8;
|
||||
}
|
||||
ast_crtc_load_lut(crtc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -374,8 +374,8 @@ static void atmel_hlcdc_crtc_finish_page_flip(struct atmel_hlcdc_crtc *crtc)
|
||||
|
||||
spin_lock_irqsave(&dev->event_lock, flags);
|
||||
if (crtc->event) {
|
||||
drm_send_vblank_event(dev, crtc->id, crtc->event);
|
||||
drm_vblank_put(dev, crtc->id);
|
||||
drm_crtc_send_vblank_event(&crtc->base, crtc->event);
|
||||
drm_crtc_vblank_put(&crtc->base);
|
||||
crtc->event = NULL;
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->event_lock, flags);
|
||||
|
@@ -325,18 +325,20 @@ static void cirrus_crtc_commit(struct drm_crtc *crtc)
|
||||
* use this for 8-bit mode so can't perform smooth fades on deeper modes,
|
||||
* but it's a requirement that we provide the function
|
||||
*/
|
||||
static void cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
|
||||
u16 *blue, uint32_t start, uint32_t size)
|
||||
static int cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
|
||||
u16 *blue, uint32_t size)
|
||||
{
|
||||
struct cirrus_crtc *cirrus_crtc = to_cirrus_crtc(crtc);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < CIRRUS_LUT_SIZE; i++) {
|
||||
for (i = 0; i < size; i++) {
|
||||
cirrus_crtc->lut_r[i] = red[i];
|
||||
cirrus_crtc->lut_g[i] = green[i];
|
||||
cirrus_crtc->lut_b[i] = blue[i];
|
||||
}
|
||||
cirrus_crtc_load_lut(crtc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Simple cleanup function */
|
||||
|
@@ -44,11 +44,8 @@
|
||||
void drm_atomic_state_default_release(struct drm_atomic_state *state)
|
||||
{
|
||||
kfree(state->connectors);
|
||||
kfree(state->connector_states);
|
||||
kfree(state->crtcs);
|
||||
kfree(state->crtc_states);
|
||||
kfree(state->planes);
|
||||
kfree(state->plane_states);
|
||||
}
|
||||
EXPORT_SYMBOL(drm_atomic_state_default_release);
|
||||
|
||||
@@ -72,18 +69,10 @@ drm_atomic_state_init(struct drm_device *dev, struct drm_atomic_state *state)
|
||||
sizeof(*state->crtcs), GFP_KERNEL);
|
||||
if (!state->crtcs)
|
||||
goto fail;
|
||||
state->crtc_states = kcalloc(dev->mode_config.num_crtc,
|
||||
sizeof(*state->crtc_states), GFP_KERNEL);
|
||||
if (!state->crtc_states)
|
||||
goto fail;
|
||||
state->planes = kcalloc(dev->mode_config.num_total_plane,
|
||||
sizeof(*state->planes), GFP_KERNEL);
|
||||
if (!state->planes)
|
||||
goto fail;
|
||||
state->plane_states = kcalloc(dev->mode_config.num_total_plane,
|
||||
sizeof(*state->plane_states), GFP_KERNEL);
|
||||
if (!state->plane_states)
|
||||
goto fail;
|
||||
|
||||
state->dev = dev;
|
||||
|
||||
@@ -139,40 +128,40 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state)
|
||||
DRM_DEBUG_ATOMIC("Clearing atomic state %p\n", state);
|
||||
|
||||
for (i = 0; i < state->num_connector; i++) {
|
||||
struct drm_connector *connector = state->connectors[i];
|
||||
struct drm_connector *connector = state->connectors[i].ptr;
|
||||
|
||||
if (!connector)
|
||||
continue;
|
||||
|
||||
connector->funcs->atomic_destroy_state(connector,
|
||||
state->connector_states[i]);
|
||||
state->connectors[i] = NULL;
|
||||
state->connector_states[i] = NULL;
|
||||
state->connectors[i].state);
|
||||
state->connectors[i].ptr = NULL;
|
||||
state->connectors[i].state = NULL;
|
||||
drm_connector_unreference(connector);
|
||||
}
|
||||
|
||||
for (i = 0; i < config->num_crtc; i++) {
|
||||
struct drm_crtc *crtc = state->crtcs[i];
|
||||
struct drm_crtc *crtc = state->crtcs[i].ptr;
|
||||
|
||||
if (!crtc)
|
||||
continue;
|
||||
|
||||
crtc->funcs->atomic_destroy_state(crtc,
|
||||
state->crtc_states[i]);
|
||||
state->crtcs[i] = NULL;
|
||||
state->crtc_states[i] = NULL;
|
||||
state->crtcs[i].state);
|
||||
state->crtcs[i].ptr = NULL;
|
||||
state->crtcs[i].state = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < config->num_total_plane; i++) {
|
||||
struct drm_plane *plane = state->planes[i];
|
||||
struct drm_plane *plane = state->planes[i].ptr;
|
||||
|
||||
if (!plane)
|
||||
continue;
|
||||
|
||||
plane->funcs->atomic_destroy_state(plane,
|
||||
state->plane_states[i]);
|
||||
state->planes[i] = NULL;
|
||||
state->plane_states[i] = NULL;
|
||||
state->planes[i].state);
|
||||
state->planes[i].ptr = NULL;
|
||||
state->planes[i].state = NULL;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(drm_atomic_state_default_clear);
|
||||
@@ -270,8 +259,8 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,
|
||||
if (!crtc_state)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
state->crtc_states[index] = crtc_state;
|
||||
state->crtcs[index] = crtc;
|
||||
state->crtcs[index].state = crtc_state;
|
||||
state->crtcs[index].ptr = crtc;
|
||||
crtc_state->state = state;
|
||||
|
||||
DRM_DEBUG_ATOMIC("Added [CRTC:%d:%s] %p state to %p\n",
|
||||
@@ -632,8 +621,8 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state,
|
||||
if (!plane_state)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
state->plane_states[index] = plane_state;
|
||||
state->planes[index] = plane;
|
||||
state->planes[index].state = plane_state;
|
||||
state->planes[index].ptr = plane;
|
||||
plane_state->state = state;
|
||||
|
||||
DRM_DEBUG_ATOMIC("Added [PLANE:%d:%s] %p state to %p\n",
|
||||
@@ -897,8 +886,7 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
|
||||
index = drm_connector_index(connector);
|
||||
|
||||
if (index >= state->num_connector) {
|
||||
struct drm_connector **c;
|
||||
struct drm_connector_state **cs;
|
||||
struct __drm_connnectors_state *c;
|
||||
int alloc = max(index + 1, config->num_connector);
|
||||
|
||||
c = krealloc(state->connectors, alloc * sizeof(*state->connectors), GFP_KERNEL);
|
||||
@@ -909,26 +897,19 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
|
||||
memset(&state->connectors[state->num_connector], 0,
|
||||
sizeof(*state->connectors) * (alloc - state->num_connector));
|
||||
|
||||
cs = krealloc(state->connector_states, alloc * sizeof(*state->connector_states), GFP_KERNEL);
|
||||
if (!cs)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
state->connector_states = cs;
|
||||
memset(&state->connector_states[state->num_connector], 0,
|
||||
sizeof(*state->connector_states) * (alloc - state->num_connector));
|
||||
state->num_connector = alloc;
|
||||
}
|
||||
|
||||
if (state->connector_states[index])
|
||||
return state->connector_states[index];
|
||||
if (state->connectors[index].state)
|
||||
return state->connectors[index].state;
|
||||
|
||||
connector_state = connector->funcs->atomic_duplicate_state(connector);
|
||||
if (!connector_state)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
drm_connector_reference(connector);
|
||||
state->connector_states[index] = connector_state;
|
||||
state->connectors[index] = connector;
|
||||
state->connectors[index].state = connector_state;
|
||||
state->connectors[index].ptr = connector;
|
||||
connector_state->state = state;
|
||||
|
||||
DRM_DEBUG_ATOMIC("Added [CONNECTOR:%d] %p state to %p\n",
|
||||
@@ -1432,7 +1413,8 @@ EXPORT_SYMBOL(drm_atomic_nonblocking_commit);
|
||||
*/
|
||||
|
||||
static struct drm_pending_vblank_event *create_vblank_event(
|
||||
struct drm_device *dev, struct drm_file *file_priv, uint64_t user_data)
|
||||
struct drm_device *dev, struct drm_file *file_priv,
|
||||
struct fence *fence, uint64_t user_data)
|
||||
{
|
||||
struct drm_pending_vblank_event *e = NULL;
|
||||
int ret;
|
||||
@@ -1445,12 +1427,17 @@ static struct drm_pending_vblank_event *create_vblank_event(
|
||||
e->event.base.length = sizeof(e->event);
|
||||
e->event.user_data = user_data;
|
||||
|
||||
ret = drm_event_reserve_init(dev, file_priv, &e->base, &e->event.base);
|
||||
if (ret) {
|
||||
kfree(e);
|
||||
return NULL;
|
||||
if (file_priv) {
|
||||
ret = drm_event_reserve_init(dev, file_priv, &e->base,
|
||||
&e->event.base);
|
||||
if (ret) {
|
||||
kfree(e);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
e->base.fence = fence;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
@@ -1690,7 +1677,8 @@ retry:
|
||||
for_each_crtc_in_state(state, crtc, crtc_state, i) {
|
||||
struct drm_pending_vblank_event *e;
|
||||
|
||||
e = create_vblank_event(dev, file_priv, arg->user_data);
|
||||
e = create_vblank_event(dev, file_priv, NULL,
|
||||
arg->user_data);
|
||||
if (!e) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
|
@@ -110,8 +110,10 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
|
||||
|
||||
if (funcs->atomic_best_encoder)
|
||||
new_encoder = funcs->atomic_best_encoder(connector, conn_state);
|
||||
else
|
||||
else if (funcs->best_encoder)
|
||||
new_encoder = funcs->best_encoder(connector);
|
||||
else
|
||||
new_encoder = drm_atomic_helper_best_encoder(connector);
|
||||
|
||||
if (new_encoder) {
|
||||
if (encoder_mask & (1 << drm_encoder_index(new_encoder))) {
|
||||
@@ -298,8 +300,10 @@ update_connector_routing(struct drm_atomic_state *state,
|
||||
if (funcs->atomic_best_encoder)
|
||||
new_encoder = funcs->atomic_best_encoder(connector,
|
||||
connector_state);
|
||||
else
|
||||
else if (funcs->best_encoder)
|
||||
new_encoder = funcs->best_encoder(connector);
|
||||
else
|
||||
new_encoder = drm_atomic_helper_best_encoder(connector);
|
||||
|
||||
if (!new_encoder) {
|
||||
DRM_DEBUG_ATOMIC("No suitable encoder found for [CONNECTOR:%d:%s]\n",
|
||||
@@ -614,7 +618,7 @@ drm_atomic_helper_check_planes(struct drm_device *dev,
|
||||
if (!funcs || !funcs->atomic_check)
|
||||
continue;
|
||||
|
||||
ret = funcs->atomic_check(crtc, state->crtc_states[i]);
|
||||
ret = funcs->atomic_check(crtc, crtc_state);
|
||||
if (ret) {
|
||||
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] atomic driver check failed\n",
|
||||
crtc->base.id, crtc->name);
|
||||
@@ -1252,16 +1256,12 @@ EXPORT_SYMBOL(drm_atomic_helper_commit);
|
||||
int drm_atomic_helper_prepare_planes(struct drm_device *dev,
|
||||
struct drm_atomic_state *state)
|
||||
{
|
||||
int nplanes = dev->mode_config.num_total_plane;
|
||||
int ret, i;
|
||||
struct drm_plane *plane;
|
||||
struct drm_plane_state *plane_state;
|
||||
int ret, i, j;
|
||||
|
||||
for (i = 0; i < nplanes; i++) {
|
||||
for_each_plane_in_state(state, plane, plane_state, i) {
|
||||
const struct drm_plane_helper_funcs *funcs;
|
||||
struct drm_plane *plane = state->planes[i];
|
||||
struct drm_plane_state *plane_state = state->plane_states[i];
|
||||
|
||||
if (!plane)
|
||||
continue;
|
||||
|
||||
funcs = plane->helper_private;
|
||||
|
||||
@@ -1275,12 +1275,10 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev,
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
for (i--; i >= 0; i--) {
|
||||
for_each_plane_in_state(state, plane, plane_state, j) {
|
||||
const struct drm_plane_helper_funcs *funcs;
|
||||
struct drm_plane *plane = state->planes[i];
|
||||
struct drm_plane_state *plane_state = state->plane_states[i];
|
||||
|
||||
if (!plane)
|
||||
if (j >= i)
|
||||
continue;
|
||||
|
||||
funcs = plane->helper_private;
|
||||
@@ -1567,37 +1565,28 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
|
||||
struct drm_atomic_state *state)
|
||||
{
|
||||
int i;
|
||||
struct drm_connector *connector;
|
||||
struct drm_connector_state *conn_state;
|
||||
struct drm_crtc *crtc;
|
||||
struct drm_crtc_state *crtc_state;
|
||||
struct drm_plane *plane;
|
||||
struct drm_plane_state *plane_state;
|
||||
|
||||
for (i = 0; i < state->num_connector; i++) {
|
||||
struct drm_connector *connector = state->connectors[i];
|
||||
|
||||
if (!connector)
|
||||
continue;
|
||||
|
||||
for_each_connector_in_state(state, connector, conn_state, i) {
|
||||
connector->state->state = state;
|
||||
swap(state->connector_states[i], connector->state);
|
||||
swap(state->connectors[i].state, connector->state);
|
||||
connector->state->state = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < dev->mode_config.num_crtc; i++) {
|
||||
struct drm_crtc *crtc = state->crtcs[i];
|
||||
|
||||
if (!crtc)
|
||||
continue;
|
||||
|
||||
for_each_crtc_in_state(state, crtc, crtc_state, i) {
|
||||
crtc->state->state = state;
|
||||
swap(state->crtc_states[i], crtc->state);
|
||||
swap(state->crtcs[i].state, crtc->state);
|
||||
crtc->state->state = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < dev->mode_config.num_total_plane; i++) {
|
||||
struct drm_plane *plane = state->planes[i];
|
||||
|
||||
if (!plane)
|
||||
continue;
|
||||
|
||||
for_each_plane_in_state(state, plane, plane_state, i) {
|
||||
plane->state->state = state;
|
||||
swap(state->plane_states[i], plane->state);
|
||||
swap(state->planes[i].state, plane->state);
|
||||
plane->state->state = NULL;
|
||||
}
|
||||
}
|
||||
@@ -2412,7 +2401,7 @@ EXPORT_SYMBOL(drm_atomic_helper_page_flip);
|
||||
* This is the main helper function provided by the atomic helper framework for
|
||||
* implementing the legacy DPMS connector interface. It computes the new desired
|
||||
* ->active state for the corresponding CRTC (if the connector is enabled) and
|
||||
* updates it.
|
||||
* updates it.
|
||||
*
|
||||
* Returns:
|
||||
* Returns 0 on success, negative errno numbers on failure.
|
||||
@@ -2933,16 +2922,15 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_destroy_state);
|
||||
* @red: red correction table
|
||||
* @green: green correction table
|
||||
* @blue: green correction table
|
||||
* @start:
|
||||
* @size: size of the tables
|
||||
*
|
||||
* Implements support for legacy gamma correction table for drivers
|
||||
* that support color management through the DEGAMMA_LUT/GAMMA_LUT
|
||||
* properties.
|
||||
*/
|
||||
void drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc,
|
||||
u16 *red, u16 *green, u16 *blue,
|
||||
uint32_t start, uint32_t size)
|
||||
int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc,
|
||||
u16 *red, u16 *green, u16 *blue,
|
||||
uint32_t size)
|
||||
{
|
||||
struct drm_device *dev = crtc->dev;
|
||||
struct drm_mode_config *config = &dev->mode_config;
|
||||
@@ -2954,7 +2942,7 @@ void drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc,
|
||||
|
||||
state = drm_atomic_state_alloc(crtc->dev);
|
||||
if (!state)
|
||||
return;
|
||||
return -ENOMEM;
|
||||
|
||||
blob = drm_property_create_blob(dev,
|
||||
sizeof(struct drm_color_lut) * size,
|
||||
@@ -3005,7 +2993,7 @@ retry:
|
||||
|
||||
drm_property_unreference_blob(blob);
|
||||
|
||||
return;
|
||||
return 0;
|
||||
fail:
|
||||
if (ret == -EDEADLK)
|
||||
goto backoff;
|
||||
@@ -3013,7 +3001,7 @@ fail:
|
||||
drm_atomic_state_free(state);
|
||||
drm_property_unreference_blob(blob);
|
||||
|
||||
return;
|
||||
return ret;
|
||||
backoff:
|
||||
drm_atomic_state_clear(state);
|
||||
drm_atomic_legacy_backoff(state);
|
||||
|
@@ -36,7 +36,7 @@
|
||||
* encoder chain.
|
||||
*
|
||||
* A bridge is always attached to a single &drm_encoder at a time, but can be
|
||||
* either connected to it directly, or through an intermediate bridge:
|
||||
* either connected to it directly, or through an intermediate bridge::
|
||||
*
|
||||
* encoder ---> bridge B ---> bridge A
|
||||
*
|
||||
|
@@ -535,7 +535,7 @@ EXPORT_SYMBOL(drm_framebuffer_unregister_private);
|
||||
*
|
||||
* Cleanup framebuffer. This function is intended to be used from the drivers
|
||||
* ->destroy callback. It can also be used to clean up driver private
|
||||
* framebuffers embedded into a larger structure.
|
||||
* framebuffers embedded into a larger structure.
|
||||
*
|
||||
* Note that this function does not remove the fb from active usuage - if it is
|
||||
* still used anywhere, hilarity can ensue since userspace could call getfb on
|
||||
@@ -692,7 +692,7 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc,
|
||||
crtc->base.properties = &crtc->properties;
|
||||
|
||||
list_add_tail(&crtc->head, &config->crtc_list);
|
||||
config->num_crtc++;
|
||||
crtc->index = config->num_crtc++;
|
||||
|
||||
crtc->primary = primary;
|
||||
crtc->cursor = cursor;
|
||||
@@ -722,6 +722,11 @@ void drm_crtc_cleanup(struct drm_crtc *crtc)
|
||||
{
|
||||
struct drm_device *dev = crtc->dev;
|
||||
|
||||
/* Note that the crtc_list is considered to be static; should we
|
||||
* remove the drm_crtc at runtime we would have to decrement all
|
||||
* the indices on the drm_crtc after us in the crtc_list.
|
||||
*/
|
||||
|
||||
kfree(crtc->gamma_store);
|
||||
crtc->gamma_store = NULL;
|
||||
|
||||
@@ -741,29 +746,6 @@ void drm_crtc_cleanup(struct drm_crtc *crtc)
|
||||
}
|
||||
EXPORT_SYMBOL(drm_crtc_cleanup);
|
||||
|
||||
/**
|
||||
* drm_crtc_index - find the index of a registered CRTC
|
||||
* @crtc: CRTC to find index for
|
||||
*
|
||||
* Given a registered CRTC, return the index of that CRTC within a DRM
|
||||
* device's list of CRTCs.
|
||||
*/
|
||||
unsigned int drm_crtc_index(struct drm_crtc *crtc)
|
||||
{
|
||||
unsigned int index = 0;
|
||||
struct drm_crtc *tmp;
|
||||
|
||||
drm_for_each_crtc(tmp, crtc->dev) {
|
||||
if (tmp == crtc)
|
||||
return index;
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
BUG();
|
||||
}
|
||||
EXPORT_SYMBOL(drm_crtc_index);
|
||||
|
||||
/*
|
||||
* drm_mode_remove - remove and free a mode
|
||||
* @connector: connector list to modify
|
||||
@@ -1166,7 +1148,7 @@ int drm_encoder_init(struct drm_device *dev,
|
||||
}
|
||||
|
||||
list_add_tail(&encoder->head, &dev->mode_config.encoder_list);
|
||||
dev->mode_config.num_encoder++;
|
||||
encoder->index = dev->mode_config.num_encoder++;
|
||||
|
||||
out_put:
|
||||
if (ret)
|
||||
@@ -1179,29 +1161,6 @@ out_unlock:
|
||||
}
|
||||
EXPORT_SYMBOL(drm_encoder_init);
|
||||
|
||||
/**
|
||||
* drm_encoder_index - find the index of a registered encoder
|
||||
* @encoder: encoder to find index for
|
||||
*
|
||||
* Given a registered encoder, return the index of that encoder within a DRM
|
||||
* device's list of encoders.
|
||||
*/
|
||||
unsigned int drm_encoder_index(struct drm_encoder *encoder)
|
||||
{
|
||||
unsigned int index = 0;
|
||||
struct drm_encoder *tmp;
|
||||
|
||||
drm_for_each_encoder(tmp, encoder->dev) {
|
||||
if (tmp == encoder)
|
||||
return index;
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
BUG();
|
||||
}
|
||||
EXPORT_SYMBOL(drm_encoder_index);
|
||||
|
||||
/**
|
||||
* drm_encoder_cleanup - cleans up an initialised encoder
|
||||
* @encoder: encoder to cleanup
|
||||
@@ -1212,6 +1171,11 @@ void drm_encoder_cleanup(struct drm_encoder *encoder)
|
||||
{
|
||||
struct drm_device *dev = encoder->dev;
|
||||
|
||||
/* Note that the encoder_list is considered to be static; should we
|
||||
* remove the drm_encoder at runtime we would have to decrement all
|
||||
* the indices on the drm_encoder after us in the encoder_list.
|
||||
*/
|
||||
|
||||
drm_modeset_lock_all(dev);
|
||||
drm_mode_object_unregister(dev, &encoder->base);
|
||||
kfree(encoder->name);
|
||||
@@ -1300,7 +1264,7 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
|
||||
plane->type = type;
|
||||
|
||||
list_add_tail(&plane->head, &config->plane_list);
|
||||
config->num_total_plane++;
|
||||
plane->index = config->num_total_plane++;
|
||||
if (plane->type == DRM_PLANE_TYPE_OVERLAY)
|
||||
config->num_overlay_plane++;
|
||||
|
||||
@@ -1374,6 +1338,11 @@ void drm_plane_cleanup(struct drm_plane *plane)
|
||||
|
||||
BUG_ON(list_empty(&plane->head));
|
||||
|
||||
/* Note that the plane_list is considered to be static; should we
|
||||
* remove the drm_plane at runtime we would have to decrement all
|
||||
* the indices on the drm_plane after us in the plane_list.
|
||||
*/
|
||||
|
||||
list_del(&plane->head);
|
||||
dev->mode_config.num_total_plane--;
|
||||
if (plane->type == DRM_PLANE_TYPE_OVERLAY)
|
||||
@@ -1390,29 +1359,6 @@ void drm_plane_cleanup(struct drm_plane *plane)
|
||||
}
|
||||
EXPORT_SYMBOL(drm_plane_cleanup);
|
||||
|
||||
/**
|
||||
* drm_plane_index - find the index of a registered plane
|
||||
* @plane: plane to find index for
|
||||
*
|
||||
* Given a registered plane, return the index of that CRTC within a DRM
|
||||
* device's list of planes.
|
||||
*/
|
||||
unsigned int drm_plane_index(struct drm_plane *plane)
|
||||
{
|
||||
unsigned int index = 0;
|
||||
struct drm_plane *tmp;
|
||||
|
||||
drm_for_each_plane(tmp, plane->dev) {
|
||||
if (tmp == plane)
|
||||
return index;
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
BUG();
|
||||
}
|
||||
EXPORT_SYMBOL(drm_plane_index);
|
||||
|
||||
/**
|
||||
* drm_plane_from_index - find the registered plane at an index
|
||||
* @dev: DRM device
|
||||
@@ -1425,13 +1371,11 @@ struct drm_plane *
|
||||
drm_plane_from_index(struct drm_device *dev, int idx)
|
||||
{
|
||||
struct drm_plane *plane;
|
||||
unsigned int i = 0;
|
||||
|
||||
drm_for_each_plane(plane, dev) {
|
||||
if (i == idx)
|
||||
drm_for_each_plane(plane, dev)
|
||||
if (idx == plane->index)
|
||||
return plane;
|
||||
i++;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_plane_from_index);
|
||||
@@ -5227,7 +5171,7 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev,
|
||||
goto out;
|
||||
}
|
||||
|
||||
crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, 0, crtc->gamma_size);
|
||||
ret = crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, crtc->gamma_size);
|
||||
|
||||
out:
|
||||
drm_modeset_unlock_all(dev);
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_gem_cma_helper.h>
|
||||
#include <drm/drm_fb_cma_helper.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#define DEFAULT_FBDEFIO_DELAY_MS 50
|
||||
@@ -52,7 +53,7 @@ struct drm_fbdev_cma {
|
||||
* will be set up automatically. dirty() is called by
|
||||
* drm_fb_helper_deferred_io() in process context (struct delayed_work).
|
||||
*
|
||||
* Example fbdev deferred io code:
|
||||
* Example fbdev deferred io code::
|
||||
*
|
||||
* static int driver_fbdev_fb_dirty(struct drm_framebuffer *fb,
|
||||
* struct drm_file *file_priv,
|
||||
@@ -162,6 +163,10 @@ static struct drm_fb_cma *drm_fb_cma_alloc(struct drm_device *dev,
|
||||
* drm_fb_cma_create_with_funcs() - helper function for the
|
||||
* &drm_mode_config_funcs ->fb_create
|
||||
* callback function
|
||||
* @dev: DRM device
|
||||
* @file_priv: drm file for the ioctl call
|
||||
* @mode_cmd: metadata from the userspace fb creation request
|
||||
* @funcs: vtable to be used for the new framebuffer object
|
||||
*
|
||||
* This can be used to set &drm_framebuffer_funcs for drivers that need the
|
||||
* dirty() callback. Use drm_fb_cma_create() if you don't need to change
|
||||
@@ -223,6 +228,9 @@ EXPORT_SYMBOL_GPL(drm_fb_cma_create_with_funcs);
|
||||
|
||||
/**
|
||||
* drm_fb_cma_create() - &drm_mode_config_funcs ->fb_create callback function
|
||||
* @dev: DRM device
|
||||
* @file_priv: drm file for the ioctl call
|
||||
* @mode_cmd: metadata from the userspace fb creation request
|
||||
*
|
||||
* If your hardware has special alignment or pitch requirements these should be
|
||||
* checked before calling this function. Use drm_fb_cma_create_with_funcs() if
|
||||
@@ -246,7 +254,7 @@ EXPORT_SYMBOL_GPL(drm_fb_cma_create);
|
||||
* This function will usually be called from the CRTC callback functions.
|
||||
*/
|
||||
struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb,
|
||||
unsigned int plane)
|
||||
unsigned int plane)
|
||||
{
|
||||
struct drm_fb_cma *fb_cma = to_fb_cma(fb);
|
||||
|
||||
@@ -258,10 +266,6 @@ struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb,
|
||||
EXPORT_SYMBOL_GPL(drm_fb_cma_get_gem_obj);
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
/*
|
||||
* drm_fb_cma_describe() - Helper to dump information about a single
|
||||
* CMA framebuffer object
|
||||
*/
|
||||
static void drm_fb_cma_describe(struct drm_framebuffer *fb, struct seq_file *m)
|
||||
{
|
||||
struct drm_fb_cma *fb_cma = to_fb_cma(fb);
|
||||
@@ -279,7 +283,9 @@ static void drm_fb_cma_describe(struct drm_framebuffer *fb, struct seq_file *m)
|
||||
|
||||
/**
|
||||
* drm_fb_cma_debugfs_show() - Helper to list CMA framebuffer objects
|
||||
* in debugfs.
|
||||
* in debugfs.
|
||||
* @m: output file
|
||||
* @arg: private data for the callback
|
||||
*/
|
||||
int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg)
|
||||
{
|
||||
@@ -297,6 +303,12 @@ int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg)
|
||||
EXPORT_SYMBOL_GPL(drm_fb_cma_debugfs_show);
|
||||
#endif
|
||||
|
||||
static int drm_fb_cma_mmap(struct fb_info *info, struct vm_area_struct *vma)
|
||||
{
|
||||
return dma_mmap_writecombine(info->device, vma, info->screen_base,
|
||||
info->fix.smem_start, info->fix.smem_len);
|
||||
}
|
||||
|
||||
static struct fb_ops drm_fbdev_cma_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.fb_fillrect = drm_fb_helper_sys_fillrect,
|
||||
@@ -307,6 +319,7 @@ static struct fb_ops drm_fbdev_cma_ops = {
|
||||
.fb_blank = drm_fb_helper_blank,
|
||||
.fb_pan_display = drm_fb_helper_pan_display,
|
||||
.fb_setcmap = drm_fb_helper_setcmap,
|
||||
.fb_mmap = drm_fb_cma_mmap,
|
||||
};
|
||||
|
||||
static int drm_fbdev_cma_deferred_io_mmap(struct fb_info *info,
|
||||
|
@@ -227,7 +227,7 @@ static void drm_fb_helper_restore_lut_atomic(struct drm_crtc *crtc)
|
||||
g_base = r_base + crtc->gamma_size;
|
||||
b_base = g_base + crtc->gamma_size;
|
||||
|
||||
crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, 0, crtc->gamma_size);
|
||||
crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, crtc->gamma_size);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1971,7 +1971,18 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,
|
||||
my_score++;
|
||||
|
||||
connector_funcs = connector->helper_private;
|
||||
encoder = connector_funcs->best_encoder(connector);
|
||||
|
||||
/*
|
||||
* If the DRM device implements atomic hooks and ->best_encoder() is
|
||||
* NULL we fallback to the default drm_atomic_helper_best_encoder()
|
||||
* helper.
|
||||
*/
|
||||
if (fb_helper->dev->mode_config.funcs->atomic_commit &&
|
||||
!connector_funcs->best_encoder)
|
||||
encoder = drm_atomic_helper_best_encoder(connector);
|
||||
else
|
||||
encoder = connector_funcs->best_encoder(connector);
|
||||
|
||||
if (!encoder)
|
||||
goto out;
|
||||
|
||||
|
@@ -67,7 +67,7 @@ DEFINE_MUTEX(drm_global_mutex);
|
||||
* specific implementations. For GEM-based drivers this is drm_gem_mmap().
|
||||
*
|
||||
* No other file operations are supported by the DRM userspace API. Overall the
|
||||
* following is an example #file_operations structure:
|
||||
* following is an example #file_operations structure::
|
||||
*
|
||||
* static const example_drm_fops = {
|
||||
* .owner = THIS_MODULE,
|
||||
@@ -368,7 +368,7 @@ static void drm_events_release(struct drm_file *file_priv)
|
||||
/* Remove unconsumed events */
|
||||
list_for_each_entry_safe(e, et, &file_priv->event_list, link) {
|
||||
list_del(&e->link);
|
||||
e->destroy(e);
|
||||
kfree(e);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&dev->event_lock, flags);
|
||||
@@ -636,7 +636,7 @@ put_back_event:
|
||||
}
|
||||
|
||||
ret += length;
|
||||
e->destroy(e);
|
||||
kfree(e);
|
||||
}
|
||||
}
|
||||
mutex_unlock(&file_priv->event_read_lock);
|
||||
@@ -713,9 +713,6 @@ int drm_event_reserve_init_locked(struct drm_device *dev,
|
||||
list_add(&p->pending_link, &file_priv->pending_event_list);
|
||||
p->file_priv = file_priv;
|
||||
|
||||
/* we *could* pass this in as arg, but everyone uses kfree: */
|
||||
p->destroy = (void (*) (struct drm_pending_event *)) kfree;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_event_reserve_init_locked);
|
||||
@@ -778,7 +775,7 @@ void drm_event_cancel_free(struct drm_device *dev,
|
||||
list_del(&p->pending_link);
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->event_lock, flags);
|
||||
p->destroy(p);
|
||||
kfree(p);
|
||||
}
|
||||
EXPORT_SYMBOL(drm_event_cancel_free);
|
||||
|
||||
@@ -800,8 +797,13 @@ void drm_send_event_locked(struct drm_device *dev, struct drm_pending_event *e)
|
||||
{
|
||||
assert_spin_locked(&dev->event_lock);
|
||||
|
||||
if (e->fence) {
|
||||
fence_signal(e->fence);
|
||||
fence_put(e->fence);
|
||||
}
|
||||
|
||||
if (!e->file_priv) {
|
||||
e->destroy(e);
|
||||
kfree(e);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -787,7 +787,7 @@ EXPORT_SYMBOL(drm_gem_object_release);
|
||||
* @kref: kref of the object to free
|
||||
*
|
||||
* Called after the last reference to the object has been lost.
|
||||
* Must be called holding struct_ mutex
|
||||
* Must be called holding &drm_device->struct_mutex.
|
||||
*
|
||||
* Frees the object
|
||||
*/
|
||||
|
@@ -89,11 +89,7 @@ static void store_vblank(struct drm_device *dev, unsigned int pipe,
|
||||
write_sequnlock(&vblank->seqlock);
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_reset_vblank_timestamp - reset the last timestamp to the last vblank
|
||||
* @dev: DRM device
|
||||
* @pipe: index of CRTC for which to reset the timestamp
|
||||
*
|
||||
/*
|
||||
* Reset the stored timestamp for the current vblank count to correspond
|
||||
* to the last vblank occurred.
|
||||
*
|
||||
@@ -137,11 +133,7 @@ static void drm_reset_vblank_timestamp(struct drm_device *dev, unsigned int pipe
|
||||
spin_unlock(&dev->vblank_time_lock);
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_update_vblank_count - update the master vblank counter
|
||||
* @dev: DRM device
|
||||
* @pipe: counter to update
|
||||
*
|
||||
/*
|
||||
* Call back into the driver to update the appropriate vblank counter
|
||||
* (specified by @pipe). Deal with wraparound, if it occurred, and
|
||||
* update the last read value so we can deal with wraparound on the next
|
||||
|
@@ -982,6 +982,28 @@ int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
|
||||
}
|
||||
EXPORT_SYMBOL(mipi_dsi_dcs_set_tear_on);
|
||||
|
||||
/**
|
||||
* mipi_dsi_set_tear_scanline() - turn on the display module's Tearing Effect
|
||||
* output signal on the TE signal line when display module reaches line N
|
||||
* defined by STS[n:0].
|
||||
* @dsi: DSI peripheral device
|
||||
* @param: STS[10:0]
|
||||
* Return: 0 on success or a negative error code on failure
|
||||
*/
|
||||
int mipi_dsi_set_tear_scanline(struct mipi_dsi_device *dsi, u16 param)
|
||||
{
|
||||
u8 payload[3] = { MIPI_DCS_SET_TEAR_SCANLINE, param >> 8,
|
||||
param & 0xff };
|
||||
ssize_t err;
|
||||
|
||||
err = mipi_dsi_generic_write(dsi, payload, sizeof(payload));
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(mipi_dsi_set_tear_scanline);
|
||||
|
||||
/**
|
||||
* mipi_dsi_dcs_set_pixel_format() - sets the pixel format for the RGB image
|
||||
* data used by the interface
|
||||
|
@@ -544,6 +544,7 @@ EXPORT_SYMBOL(drm_gtf_mode_complex);
|
||||
*
|
||||
* This function is to create the modeline based on the GTF algorithm.
|
||||
* Generalized Timing Formula is derived from:
|
||||
*
|
||||
* GTF Spreadsheet by Andy Morrish (1/5/97)
|
||||
* available at http://www.vesa.org
|
||||
*
|
||||
@@ -552,7 +553,8 @@ EXPORT_SYMBOL(drm_gtf_mode_complex);
|
||||
* I also refer to the function of fb_get_mode in the file of
|
||||
* drivers/video/fbmon.c
|
||||
*
|
||||
* Standard GTF parameters:
|
||||
* Standard GTF parameters::
|
||||
*
|
||||
* M = 600
|
||||
* C = 40
|
||||
* K = 128
|
||||
|
@@ -37,7 +37,7 @@
|
||||
*
|
||||
* For basic principles of &ww_mutex, see: Documentation/locking/ww-mutex-design.txt
|
||||
*
|
||||
* The basic usage pattern is to:
|
||||
* The basic usage pattern is to::
|
||||
*
|
||||
* drm_modeset_acquire_init(&ctx)
|
||||
* retry:
|
||||
|
@@ -219,10 +219,12 @@ EXPORT_SYMBOL(drm_plane_helper_check_update);
|
||||
*
|
||||
* Note that we make some assumptions about hardware limitations that may not be
|
||||
* true for all hardware --
|
||||
* 1) Primary plane cannot be repositioned.
|
||||
* 2) Primary plane cannot be scaled.
|
||||
* 3) Primary plane must cover the entire CRTC.
|
||||
* 4) Subpixel positioning is not supported.
|
||||
*
|
||||
* 1. Primary plane cannot be repositioned.
|
||||
* 2. Primary plane cannot be scaled.
|
||||
* 3. Primary plane must cover the entire CRTC.
|
||||
* 4. Subpixel positioning is not supported.
|
||||
*
|
||||
* Drivers for hardware that don't have these restrictions can provide their
|
||||
* own implementation rather than using this helper.
|
||||
*
|
||||
|
@@ -82,13 +82,30 @@ drm_mode_validate_flag(const struct drm_display_mode *mode,
|
||||
|
||||
static int drm_helper_probe_add_cmdline_mode(struct drm_connector *connector)
|
||||
{
|
||||
struct drm_cmdline_mode *cmdline_mode;
|
||||
struct drm_display_mode *mode;
|
||||
|
||||
if (!connector->cmdline_mode.specified)
|
||||
cmdline_mode = &connector->cmdline_mode;
|
||||
if (!cmdline_mode->specified)
|
||||
return 0;
|
||||
|
||||
/* Only add a GTF mode if we find no matching probed modes */
|
||||
list_for_each_entry(mode, &connector->probed_modes, head) {
|
||||
if (mode->hdisplay != cmdline_mode->xres ||
|
||||
mode->vdisplay != cmdline_mode->yres)
|
||||
continue;
|
||||
|
||||
if (cmdline_mode->refresh_specified) {
|
||||
/* The probed mode's vrefresh is set until later */
|
||||
if (drm_mode_vrefresh(mode) != cmdline_mode->refresh)
|
||||
continue;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
mode = drm_mode_create_from_cmdline_mode(connector->dev,
|
||||
&connector->cmdline_mode);
|
||||
cmdline_mode);
|
||||
if (mode == NULL)
|
||||
return 0;
|
||||
|
||||
|
@@ -127,6 +127,9 @@ EXPORT_SYMBOL(drm_vma_offset_manager_destroy);
|
||||
* used to implement weakly referenced lookups using kref_get_unless_zero().
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ::
|
||||
*
|
||||
* drm_vma_offset_lock_lookup(mgr);
|
||||
* node = drm_vma_offset_lookup_locked(mgr);
|
||||
* if (node)
|
||||
|
@@ -125,7 +125,7 @@ struct etnaviv_gpu {
|
||||
u32 completed_fence;
|
||||
u32 retired_fence;
|
||||
wait_queue_head_t fence_event;
|
||||
unsigned int fence_context;
|
||||
u64 fence_context;
|
||||
spinlock_t fence_spinlock;
|
||||
|
||||
/* worker for handling active-list retiring: */
|
||||
|
@@ -267,6 +267,8 @@ int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state,
|
||||
{
|
||||
struct exynos_drm_private *priv = dev->dev_private;
|
||||
struct exynos_atomic_commit *commit;
|
||||
struct drm_crtc *crtc;
|
||||
struct drm_crtc_state *crtc_state;
|
||||
int i, ret;
|
||||
|
||||
commit = kzalloc(sizeof(*commit), GFP_KERNEL);
|
||||
@@ -288,10 +290,8 @@ int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state,
|
||||
/* Wait until all affected CRTCs have completed previous commits and
|
||||
* mark them as pending.
|
||||
*/
|
||||
for (i = 0; i < dev->mode_config.num_crtc; ++i) {
|
||||
if (state->crtcs[i])
|
||||
commit->crtcs |= 1 << drm_crtc_index(state->crtcs[i]);
|
||||
}
|
||||
for_each_crtc_in_state(state, crtc, crtc_state, i)
|
||||
commit->crtcs |= drm_crtc_mask(crtc);
|
||||
|
||||
wait_event(priv->wait, !commit_is_pending(priv, commit->crtcs));
|
||||
|
||||
|
@@ -175,20 +175,21 @@ void gma_crtc_load_lut(struct drm_crtc *crtc)
|
||||
}
|
||||
}
|
||||
|
||||
void gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue,
|
||||
u32 start, u32 size)
|
||||
int gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue,
|
||||
u32 size)
|
||||
{
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
int i;
|
||||
int end = (start + size > 256) ? 256 : start + size;
|
||||
|
||||
for (i = start; i < end; i++) {
|
||||
for (i = 0; i < size; i++) {
|
||||
gma_crtc->lut_r[i] = red[i] >> 8;
|
||||
gma_crtc->lut_g[i] = green[i] >> 8;
|
||||
gma_crtc->lut_b[i] = blue[i] >> 8;
|
||||
}
|
||||
|
||||
gma_crtc_load_lut(crtc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -72,8 +72,8 @@ extern int gma_crtc_cursor_set(struct drm_crtc *crtc,
|
||||
uint32_t width, uint32_t height);
|
||||
extern int gma_crtc_cursor_move(struct drm_crtc *crtc, int x, int y);
|
||||
extern void gma_crtc_load_lut(struct drm_crtc *crtc);
|
||||
extern void gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
|
||||
u16 *blue, u32 start, u32 size);
|
||||
extern int gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
|
||||
u16 *blue, u32 size);
|
||||
extern void gma_crtc_dpms(struct drm_crtc *crtc, int mode);
|
||||
extern void gma_crtc_prepare(struct drm_crtc *crtc);
|
||||
extern void gma_crtc_commit(struct drm_crtc *crtc);
|
||||
|
@@ -886,7 +886,7 @@ enum skl_disp_power_wells {
|
||||
* PLLs can be routed to any transcoder A/B/C.
|
||||
*
|
||||
* Note: DDI0 is digital port B, DD1 is digital port C, and DDI2 is
|
||||
* digital port D (CHV) or port A (BXT).
|
||||
* digital port D (CHV) or port A (BXT). ::
|
||||
*
|
||||
*
|
||||
* Dual channel PHY (VLV/CHV/BXT)
|
||||
|
@@ -150,28 +150,28 @@ static int vgt_balloon_space(struct drm_mm *mm,
|
||||
* of its graphic space being zero. Yet there are some portions ballooned out(
|
||||
* the shadow part, which are marked as reserved by drm allocator). From the
|
||||
* host point of view, the graphic address space is partitioned by multiple
|
||||
* vGPUs in different VMs.
|
||||
* vGPUs in different VMs. ::
|
||||
*
|
||||
* vGPU1 view Host view
|
||||
* 0 ------> +-----------+ +-----------+
|
||||
* ^ |///////////| | vGPU3 |
|
||||
* | |///////////| +-----------+
|
||||
* | |///////////| | vGPU2 |
|
||||
* ^ |###########| | vGPU3 |
|
||||
* | |###########| +-----------+
|
||||
* | |###########| | vGPU2 |
|
||||
* | +-----------+ +-----------+
|
||||
* mappable GM | available | ==> | vGPU1 |
|
||||
* | +-----------+ +-----------+
|
||||
* | |///////////| | |
|
||||
* v |///////////| | Host |
|
||||
* | |###########| | |
|
||||
* v |###########| | Host |
|
||||
* +=======+===========+ +===========+
|
||||
* ^ |///////////| | vGPU3 |
|
||||
* | |///////////| +-----------+
|
||||
* | |///////////| | vGPU2 |
|
||||
* ^ |###########| | vGPU3 |
|
||||
* | |###########| +-----------+
|
||||
* | |###########| | vGPU2 |
|
||||
* | +-----------+ +-----------+
|
||||
* unmappable GM | available | ==> | vGPU1 |
|
||||
* | +-----------+ +-----------+
|
||||
* | |///////////| | |
|
||||
* | |///////////| | Host |
|
||||
* v |///////////| | |
|
||||
* | |###########| | |
|
||||
* | |###########| | Host |
|
||||
* v |###########| | |
|
||||
* total GM size ------> +-----------+ +-----------+
|
||||
*
|
||||
* Returns:
|
||||
|
@@ -191,7 +191,7 @@ int intel_atomic_setup_scalers(struct drm_device *dev,
|
||||
|
||||
/* plane scaler case: assign as a plane scaler */
|
||||
/* find the plane that set the bit as scaler_user */
|
||||
plane = drm_state->planes[i];
|
||||
plane = drm_state->planes[i].ptr;
|
||||
|
||||
/*
|
||||
* to enable/disable hq mode, add planes that are using scaler
|
||||
@@ -223,7 +223,8 @@ int intel_atomic_setup_scalers(struct drm_device *dev,
|
||||
continue;
|
||||
}
|
||||
|
||||
plane_state = to_intel_plane_state(drm_state->plane_states[i]);
|
||||
plane_state = intel_atomic_get_existing_plane_state(drm_state,
|
||||
intel_plane);
|
||||
scaler_id = &plane_state->scaler_id;
|
||||
}
|
||||
|
||||
|
@@ -5214,14 +5214,14 @@ void intel_edp_drrs_flush(struct drm_device *dev,
|
||||
*
|
||||
* DRRS saves power by switching to low RR based on usage scenarios.
|
||||
*
|
||||
* eDP DRRS:-
|
||||
* The implementation is based on frontbuffer tracking implementation.
|
||||
* When there is a disturbance on the screen triggered by user activity or a
|
||||
* periodic system activity, DRRS is disabled (RR is changed to high RR).
|
||||
* When there is no movement on screen, after a timeout of 1 second, a switch
|
||||
* to low RR is made.
|
||||
* For integration with frontbuffer tracking code,
|
||||
* intel_edp_drrs_invalidate() and intel_edp_drrs_flush() are called.
|
||||
* The implementation is based on frontbuffer tracking implementation. When
|
||||
* there is a disturbance on the screen triggered by user activity or a periodic
|
||||
* system activity, DRRS is disabled (RR is changed to high RR). When there is
|
||||
* no movement on screen, after a timeout of 1 second, a switch to low RR is
|
||||
* made.
|
||||
*
|
||||
* For integration with frontbuffer tracking code, intel_edp_drrs_invalidate()
|
||||
* and intel_edp_drrs_flush() are called.
|
||||
*
|
||||
* DRRS can be further extended to support other internal panels and also
|
||||
* the scenario of video playback wherein RR is set based on the rate
|
||||
|
@@ -374,8 +374,9 @@ static void intel_fbc_hw_deactivate(struct drm_i915_private *dev_priv)
|
||||
* @dev_priv: i915 device instance
|
||||
*
|
||||
* This function is used to verify the current state of FBC.
|
||||
*
|
||||
* FIXME: This should be tracked in the plane config eventually
|
||||
* instead of queried at runtime for most callers.
|
||||
* instead of queried at runtime for most callers.
|
||||
*/
|
||||
bool intel_fbc_is_active(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
|
@@ -1352,19 +1352,20 @@ static void mga_crtc_commit(struct drm_crtc *crtc)
|
||||
* use this for 8-bit mode so can't perform smooth fades on deeper modes,
|
||||
* but it's a requirement that we provide the function
|
||||
*/
|
||||
static void mga_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
|
||||
u16 *blue, uint32_t start, uint32_t size)
|
||||
static int mga_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
|
||||
u16 *blue, uint32_t size)
|
||||
{
|
||||
struct mga_crtc *mga_crtc = to_mga_crtc(crtc);
|
||||
int end = (start + size > MGAG200_LUT_SIZE) ? MGAG200_LUT_SIZE : start + size;
|
||||
int i;
|
||||
|
||||
for (i = start; i < end; i++) {
|
||||
for (i = 0; i < size; i++) {
|
||||
mga_crtc->lut_r[i] = red[i] >> 8;
|
||||
mga_crtc->lut_g[i] = green[i] >> 8;
|
||||
mga_crtc->lut_b[i] = blue[i] >> 8;
|
||||
}
|
||||
mga_crtc_load_lut(crtc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Simple cleanup function */
|
||||
|
@@ -106,31 +106,27 @@ out:
|
||||
static void mdp4_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *state)
|
||||
{
|
||||
struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms));
|
||||
int i, ncrtcs = state->dev->mode_config.num_crtc;
|
||||
int i;
|
||||
struct drm_crtc *crtc;
|
||||
struct drm_crtc_state *crtc_state;
|
||||
|
||||
mdp4_enable(mdp4_kms);
|
||||
|
||||
/* see 119ecb7fd */
|
||||
for (i = 0; i < ncrtcs; i++) {
|
||||
struct drm_crtc *crtc = state->crtcs[i];
|
||||
if (!crtc)
|
||||
continue;
|
||||
for_each_crtc_in_state(state, crtc, crtc_state, i)
|
||||
drm_crtc_vblank_get(crtc);
|
||||
}
|
||||
}
|
||||
|
||||
static void mdp4_complete_commit(struct msm_kms *kms, struct drm_atomic_state *state)
|
||||
{
|
||||
struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms));
|
||||
int i, ncrtcs = state->dev->mode_config.num_crtc;
|
||||
int i;
|
||||
struct drm_crtc *crtc;
|
||||
struct drm_crtc_state *crtc_state;
|
||||
|
||||
/* see 119ecb7fd */
|
||||
for (i = 0; i < ncrtcs; i++) {
|
||||
struct drm_crtc *crtc = state->crtcs[i];
|
||||
if (!crtc)
|
||||
continue;
|
||||
for_each_crtc_in_state(state, crtc, crtc_state, i)
|
||||
drm_crtc_vblank_put(crtc);
|
||||
}
|
||||
|
||||
mdp4_disable(mdp4_kms);
|
||||
}
|
||||
|
@@ -374,6 +374,7 @@ static int mdp5_crtc_atomic_check(struct drm_crtc *crtc,
|
||||
struct drm_device *dev = crtc->dev;
|
||||
struct plane_state pstates[STAGE_MAX + 1];
|
||||
const struct mdp5_cfg_hw *hw_cfg;
|
||||
const struct drm_plane_state *pstate;
|
||||
int cnt = 0, i;
|
||||
|
||||
DBG("%s: check", mdp5_crtc->name);
|
||||
@@ -382,20 +383,13 @@ static int mdp5_crtc_atomic_check(struct drm_crtc *crtc,
|
||||
* and that we don't have conflicting mixer stages:
|
||||
*/
|
||||
hw_cfg = mdp5_cfg_get_hw_config(mdp5_kms->cfg);
|
||||
drm_atomic_crtc_state_for_each_plane(plane, state) {
|
||||
struct drm_plane_state *pstate;
|
||||
drm_atomic_crtc_state_for_each_plane_state(plane, pstate, state) {
|
||||
if (cnt >= (hw_cfg->lm.nb_stages)) {
|
||||
dev_err(dev->dev, "too many planes!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
pstate = state->state->plane_states[drm_plane_index(plane)];
|
||||
|
||||
/* plane might not have changed, in which case take
|
||||
* current state:
|
||||
*/
|
||||
if (!pstate)
|
||||
pstate = plane->state;
|
||||
pstates[cnt].plane = plane;
|
||||
pstates[cnt].state = to_mdp5_plane_state(pstate);
|
||||
|
||||
|
@@ -78,17 +78,11 @@ static void mdp5_complete_commit(struct msm_kms *kms, struct drm_atomic_state *s
|
||||
{
|
||||
int i;
|
||||
struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms));
|
||||
int nplanes = mdp5_kms->dev->mode_config.num_total_plane;
|
||||
|
||||
for (i = 0; i < nplanes; i++) {
|
||||
struct drm_plane *plane = state->planes[i];
|
||||
struct drm_plane_state *plane_state = state->plane_states[i];
|
||||
|
||||
if (!plane)
|
||||
continue;
|
||||
struct drm_plane *plane;
|
||||
struct drm_plane_state *plane_state;
|
||||
|
||||
for_each_plane_in_state(state, plane, plane_state, i)
|
||||
mdp5_plane_complete_commit(plane, plane_state);
|
||||
}
|
||||
|
||||
mdp5_disable(mdp5_kms);
|
||||
}
|
||||
|
@@ -84,17 +84,12 @@ static void msm_atomic_wait_for_commit_done(struct drm_device *dev,
|
||||
struct drm_atomic_state *old_state)
|
||||
{
|
||||
struct drm_crtc *crtc;
|
||||
struct drm_crtc_state *crtc_state;
|
||||
struct msm_drm_private *priv = old_state->dev->dev_private;
|
||||
struct msm_kms *kms = priv->kms;
|
||||
int ncrtcs = old_state->dev->mode_config.num_crtc;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ncrtcs; i++) {
|
||||
crtc = old_state->crtcs[i];
|
||||
|
||||
if (!crtc)
|
||||
continue;
|
||||
|
||||
for_each_crtc_in_state(old_state, crtc, crtc_state, i) {
|
||||
if (!crtc->state->enable)
|
||||
continue;
|
||||
|
||||
@@ -192,9 +187,11 @@ int msm_atomic_commit(struct drm_device *dev,
|
||||
struct drm_atomic_state *state, bool nonblock)
|
||||
{
|
||||
struct msm_drm_private *priv = dev->dev_private;
|
||||
int nplanes = dev->mode_config.num_total_plane;
|
||||
int ncrtcs = dev->mode_config.num_crtc;
|
||||
struct msm_commit *c;
|
||||
struct drm_crtc *crtc;
|
||||
struct drm_crtc_state *crtc_state;
|
||||
struct drm_plane *plane;
|
||||
struct drm_plane_state *plane_state;
|
||||
int i, ret;
|
||||
|
||||
ret = drm_atomic_helper_prepare_planes(dev, state);
|
||||
@@ -210,28 +207,18 @@ int msm_atomic_commit(struct drm_device *dev,
|
||||
/*
|
||||
* Figure out what crtcs we have:
|
||||
*/
|
||||
for (i = 0; i < ncrtcs; i++) {
|
||||
struct drm_crtc *crtc = state->crtcs[i];
|
||||
if (!crtc)
|
||||
continue;
|
||||
c->crtc_mask |= (1 << drm_crtc_index(crtc));
|
||||
}
|
||||
for_each_crtc_in_state(state, crtc, crtc_state, i)
|
||||
c->crtc_mask |= drm_crtc_mask(crtc);
|
||||
|
||||
/*
|
||||
* Figure out what fence to wait for:
|
||||
*/
|
||||
for (i = 0; i < nplanes; i++) {
|
||||
struct drm_plane *plane = state->planes[i];
|
||||
struct drm_plane_state *new_state = state->plane_states[i];
|
||||
|
||||
if (!plane)
|
||||
continue;
|
||||
|
||||
if ((plane->state->fb != new_state->fb) && new_state->fb) {
|
||||
struct drm_gem_object *obj = msm_framebuffer_bo(new_state->fb, 0);
|
||||
for_each_plane_in_state(state, plane, plane_state, i) {
|
||||
if ((plane->state->fb != plane_state->fb) && plane_state->fb) {
|
||||
struct drm_gem_object *obj = msm_framebuffer_bo(plane_state->fb, 0);
|
||||
struct msm_gem_object *msm_obj = to_msm_bo(obj);
|
||||
|
||||
new_state->fence = reservation_object_get_excl_rcu(msm_obj->resv);
|
||||
plane_state->fence = reservation_object_get_excl_rcu(msm_obj->resv);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -785,14 +785,14 @@ nv_crtc_disable(struct drm_crtc *crtc)
|
||||
nouveau_bo_ref(NULL, &disp->image[nv_crtc->index]);
|
||||
}
|
||||
|
||||
static void
|
||||
nv_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t start,
|
||||
static int
|
||||
nv_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
|
||||
uint32_t size)
|
||||
{
|
||||
int end = (start + size > 256) ? 256 : start + size, i;
|
||||
struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
|
||||
int i;
|
||||
|
||||
for (i = start; i < end; i++) {
|
||||
for (i = 0; i < size; i++) {
|
||||
nv_crtc->lut.r[i] = r[i];
|
||||
nv_crtc->lut.g[i] = g[i];
|
||||
nv_crtc->lut.b[i] = b[i];
|
||||
@@ -805,10 +805,12 @@ nv_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t start,
|
||||
*/
|
||||
if (!nv_crtc->base.primary->fb) {
|
||||
nv_crtc->lut.depth = 0;
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
nv_crtc_gamma_load(crtc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@@ -57,7 +57,8 @@ struct nouveau_fence_priv {
|
||||
int (*context_new)(struct nouveau_channel *);
|
||||
void (*context_del)(struct nouveau_channel *);
|
||||
|
||||
u32 contexts, context_base;
|
||||
u32 contexts;
|
||||
u64 context_base;
|
||||
bool uevent;
|
||||
};
|
||||
|
||||
|
@@ -212,7 +212,6 @@ usif_notify_get(struct drm_file *f, void *data, u32 size, void *argv, u32 argc)
|
||||
ntfy->p->base.event = &ntfy->p->e.base;
|
||||
ntfy->p->base.file_priv = f;
|
||||
ntfy->p->base.pid = current->pid;
|
||||
ntfy->p->base.destroy =(void(*)(struct drm_pending_event *))kfree;
|
||||
ntfy->p->e.base.type = DRM_NOUVEAU_EVENT_NVIF;
|
||||
ntfy->p->e.base.length = sizeof(ntfy->p->e.base) + ntfy->reply;
|
||||
|
||||
|
@@ -1346,21 +1346,22 @@ nv50_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
nv50_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
|
||||
uint32_t start, uint32_t size)
|
||||
uint32_t size)
|
||||
{
|
||||
struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
|
||||
u32 end = min_t(u32, start + size, 256);
|
||||
u32 i;
|
||||
|
||||
for (i = start; i < end; i++) {
|
||||
for (i = 0; i < size; i++) {
|
||||
nv_crtc->lut.r[i] = r[i];
|
||||
nv_crtc->lut.g[i] = g[i];
|
||||
nv_crtc->lut.b[i] = b[i];
|
||||
}
|
||||
|
||||
nv50_crtc_lut_load(crtc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -142,8 +142,9 @@ static int omap_atomic_commit(struct drm_device *dev,
|
||||
{
|
||||
struct omap_drm_private *priv = dev->dev_private;
|
||||
struct omap_atomic_state_commit *commit;
|
||||
unsigned int i;
|
||||
int ret;
|
||||
struct drm_crtc *crtc;
|
||||
struct drm_crtc_state *crtc_state;
|
||||
int i, ret;
|
||||
|
||||
ret = drm_atomic_helper_prepare_planes(dev, state);
|
||||
if (ret)
|
||||
@@ -163,10 +164,8 @@ static int omap_atomic_commit(struct drm_device *dev,
|
||||
/* Wait until all affected CRTCs have completed previous commits and
|
||||
* mark them as pending.
|
||||
*/
|
||||
for (i = 0; i < dev->mode_config.num_crtc; ++i) {
|
||||
if (state->crtcs[i])
|
||||
commit->crtcs |= 1 << drm_crtc_index(state->crtcs[i]);
|
||||
}
|
||||
for_each_crtc_in_state(state, crtc, crtc_state, i)
|
||||
commit->crtcs |= drm_crtc_mask(crtc);
|
||||
|
||||
wait_event(priv->commit.wait, !omap_atomic_is_pending(priv, commit));
|
||||
|
||||
|
@@ -221,7 +221,6 @@ static int qxl_crtc_page_flip(struct drm_crtc *crtc,
|
||||
{
|
||||
struct drm_device *dev = crtc->dev;
|
||||
struct qxl_device *qdev = dev->dev_private;
|
||||
struct qxl_crtc *qcrtc = to_qxl_crtc(crtc);
|
||||
struct qxl_framebuffer *qfb_src = to_qxl_framebuffer(fb);
|
||||
struct qxl_framebuffer *qfb_old = to_qxl_framebuffer(crtc->primary->fb);
|
||||
struct qxl_bo *bo_old = gem_to_qxl_bo(qfb_old->obj);
|
||||
@@ -252,14 +251,14 @@ static int qxl_crtc_page_flip(struct drm_crtc *crtc,
|
||||
qxl_draw_dirty_fb(qdev, qfb_src, bo, 0, 0,
|
||||
&norect, one_clip_rect, inc);
|
||||
|
||||
drm_vblank_get(dev, qcrtc->index);
|
||||
drm_crtc_vblank_get(crtc);
|
||||
|
||||
if (event) {
|
||||
spin_lock_irqsave(&dev->event_lock, flags);
|
||||
drm_send_vblank_event(dev, qcrtc->index, event);
|
||||
drm_crtc_send_vblank_event(crtc, event);
|
||||
spin_unlock_irqrestore(&dev->event_lock, flags);
|
||||
}
|
||||
drm_vblank_put(dev, qcrtc->index);
|
||||
drm_crtc_vblank_put(crtc);
|
||||
|
||||
ret = qxl_bo_reserve(bo, false);
|
||||
if (!ret) {
|
||||
|
@@ -131,10 +131,6 @@ static int qxlfb_create_pinned_object(struct qxl_fbdev *qfbdev,
|
||||
int ret;
|
||||
int aligned_size, size;
|
||||
int height = mode_cmd->height;
|
||||
int bpp;
|
||||
int depth;
|
||||
|
||||
drm_fb_get_bpp_depth(mode_cmd->pixel_format, &bpp, &depth);
|
||||
|
||||
size = mode_cmd->pitches[0] * height;
|
||||
aligned_size = ALIGN(size, PAGE_SIZE);
|
||||
|
@@ -96,7 +96,7 @@ retry:
|
||||
return 0;
|
||||
|
||||
if (have_drawable_releases && sc > 300) {
|
||||
FENCE_WARN(fence, "failed to wait on release %d "
|
||||
FENCE_WARN(fence, "failed to wait on release %llu "
|
||||
"after spincount %d\n",
|
||||
fence->context & ~0xf0000000, sc);
|
||||
goto signaled;
|
||||
|
@@ -2386,7 +2386,7 @@ struct radeon_device {
|
||||
struct radeon_mman mman;
|
||||
struct radeon_fence_driver fence_drv[RADEON_NUM_RINGS];
|
||||
wait_queue_head_t fence_queue;
|
||||
unsigned fence_context;
|
||||
u64 fence_context;
|
||||
struct mutex ring_lock;
|
||||
struct radeon_ring ring[RADEON_NUM_RINGS];
|
||||
bool ib_pool_ready;
|
||||
|
@@ -231,19 +231,21 @@ void radeon_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
|
||||
*blue = radeon_crtc->lut_b[regno] << 6;
|
||||
}
|
||||
|
||||
static void radeon_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
|
||||
u16 *blue, uint32_t start, uint32_t size)
|
||||
static int radeon_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
|
||||
u16 *blue, uint32_t size)
|
||||
{
|
||||
struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
|
||||
int end = (start + size > 256) ? 256 : start + size, i;
|
||||
int i;
|
||||
|
||||
/* userspace palettes are always correct as is */
|
||||
for (i = start; i < end; i++) {
|
||||
for (i = 0; i < size; i++) {
|
||||
radeon_crtc->lut_r[i] = red[i] >> 6;
|
||||
radeon_crtc->lut_g[i] = green[i] >> 6;
|
||||
radeon_crtc->lut_b[i] = blue[i] >> 6;
|
||||
}
|
||||
radeon_crtc_load_lut(crtc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void radeon_crtc_destroy(struct drm_crtc *crtc)
|
||||
@@ -381,7 +383,7 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)
|
||||
|
||||
spin_unlock_irqrestore(&rdev->ddev->event_lock, flags);
|
||||
|
||||
drm_vblank_put(rdev->ddev, radeon_crtc->crtc_id);
|
||||
drm_crtc_vblank_put(&radeon_crtc->base);
|
||||
radeon_irq_kms_pflip_irq_put(rdev, work->crtc_id);
|
||||
queue_work(radeon_crtc->flip_queue, &work->unpin_work);
|
||||
}
|
||||
@@ -598,7 +600,7 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc,
|
||||
}
|
||||
work->base = base;
|
||||
|
||||
r = drm_vblank_get(crtc->dev, radeon_crtc->crtc_id);
|
||||
r = drm_crtc_vblank_get(crtc);
|
||||
if (r) {
|
||||
DRM_ERROR("failed to get vblank before flip\n");
|
||||
goto pflip_cleanup;
|
||||
@@ -625,7 +627,7 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc,
|
||||
return 0;
|
||||
|
||||
vblank_cleanup:
|
||||
drm_vblank_put(crtc->dev, radeon_crtc->crtc_id);
|
||||
drm_crtc_vblank_put(&radeon_crtc->base);
|
||||
|
||||
pflip_cleanup:
|
||||
if (unlikely(radeon_bo_reserve(new_rbo, false) != 0)) {
|
||||
@@ -688,6 +690,7 @@ radeon_crtc_set_config(struct drm_mode_set *set)
|
||||
pm_runtime_put_autosuspend(dev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct drm_crtc_funcs radeon_crtc_funcs = {
|
||||
.cursor_set2 = radeon_crtc_cursor_set2,
|
||||
.cursor_move = radeon_crtc_cursor_move,
|
||||
|
@@ -246,6 +246,7 @@ static void radeon_set_power_state(struct radeon_device *rdev)
|
||||
|
||||
static void radeon_pm_set_clocks(struct radeon_device *rdev)
|
||||
{
|
||||
struct drm_crtc *crtc;
|
||||
int i, r;
|
||||
|
||||
/* no need to take locks, etc. if nothing's going to change */
|
||||
@@ -274,26 +275,30 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)
|
||||
radeon_unmap_vram_bos(rdev);
|
||||
|
||||
if (rdev->irq.installed) {
|
||||
for (i = 0; i < rdev->num_crtc; i++) {
|
||||
i = 0;
|
||||
drm_for_each_crtc(crtc, rdev->ddev) {
|
||||
if (rdev->pm.active_crtcs & (1 << i)) {
|
||||
/* This can fail if a modeset is in progress */
|
||||
if (drm_vblank_get(rdev->ddev, i) == 0)
|
||||
if (drm_crtc_vblank_get(crtc) == 0)
|
||||
rdev->pm.req_vblank |= (1 << i);
|
||||
else
|
||||
DRM_DEBUG_DRIVER("crtc %d no vblank, can glitch\n",
|
||||
i);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
radeon_set_power_state(rdev);
|
||||
|
||||
if (rdev->irq.installed) {
|
||||
for (i = 0; i < rdev->num_crtc; i++) {
|
||||
i = 0;
|
||||
drm_for_each_crtc(crtc, rdev->ddev) {
|
||||
if (rdev->pm.req_vblank & (1 << i)) {
|
||||
rdev->pm.req_vblank &= ~(1 << i);
|
||||
drm_vblank_put(rdev->ddev, i);
|
||||
drm_crtc_vblank_put(crtc);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -288,6 +288,8 @@ static int rcar_du_atomic_commit(struct drm_device *dev,
|
||||
{
|
||||
struct rcar_du_device *rcdu = dev->dev_private;
|
||||
struct rcar_du_commit *commit;
|
||||
struct drm_crtc *crtc;
|
||||
struct drm_crtc_state *crtc_state;
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
@@ -309,10 +311,8 @@ static int rcar_du_atomic_commit(struct drm_device *dev,
|
||||
/* Wait until all affected CRTCs have completed previous commits and
|
||||
* mark them as pending.
|
||||
*/
|
||||
for (i = 0; i < dev->mode_config.num_crtc; ++i) {
|
||||
if (state->crtcs[i])
|
||||
commit->crtcs |= 1 << drm_crtc_index(state->crtcs[i]);
|
||||
}
|
||||
for_each_crtc_in_state(state, crtc, crtc_state, i)
|
||||
commit->crtcs |= drm_crtc_mask(crtc);
|
||||
|
||||
spin_lock(&rcdu->commit.wait.lock);
|
||||
ret = wait_event_interruptible_locked(rcdu->commit.wait,
|
||||
|
@@ -140,18 +140,17 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
|
||||
bool needs_realloc = false;
|
||||
unsigned int groups = 0;
|
||||
unsigned int i;
|
||||
struct drm_plane *drm_plane;
|
||||
struct drm_plane_state *drm_plane_state;
|
||||
|
||||
/* Check if hardware planes need to be reallocated. */
|
||||
for (i = 0; i < dev->mode_config.num_total_plane; ++i) {
|
||||
for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
|
||||
struct rcar_du_plane_state *plane_state;
|
||||
struct rcar_du_plane *plane;
|
||||
unsigned int index;
|
||||
|
||||
if (!state->planes[i])
|
||||
continue;
|
||||
|
||||
plane = to_rcar_plane(state->planes[i]);
|
||||
plane_state = to_rcar_plane_state(state->plane_states[i]);
|
||||
plane = to_rcar_plane(drm_plane);
|
||||
plane_state = to_rcar_plane_state(drm_plane_state);
|
||||
|
||||
dev_dbg(rcdu->dev, "%s: checking plane (%u,%tu)\n", __func__,
|
||||
plane->group->index, plane - plane->group->planes);
|
||||
@@ -247,18 +246,15 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
|
||||
}
|
||||
|
||||
/* Reallocate hardware planes for each plane that needs it. */
|
||||
for (i = 0; i < dev->mode_config.num_total_plane; ++i) {
|
||||
for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
|
||||
struct rcar_du_plane_state *plane_state;
|
||||
struct rcar_du_plane *plane;
|
||||
unsigned int crtc_planes;
|
||||
unsigned int free;
|
||||
int idx;
|
||||
|
||||
if (!state->planes[i])
|
||||
continue;
|
||||
|
||||
plane = to_rcar_plane(state->planes[i]);
|
||||
plane_state = to_rcar_plane_state(state->plane_states[i]);
|
||||
plane = to_rcar_plane(drm_plane);
|
||||
plane_state = to_rcar_plane_state(drm_plane_state);
|
||||
|
||||
dev_dbg(rcdu->dev, "%s: allocating plane (%u,%tu)\n", __func__,
|
||||
plane->group->index, plane - plane->group->planes);
|
||||
|
@@ -889,7 +889,7 @@ static void vop_crtc_cancel_pending_vblank(struct drm_crtc *crtc,
|
||||
if (e && e->base.file_priv == file_priv) {
|
||||
vop->event = NULL;
|
||||
|
||||
e->base.destroy(&e->base);
|
||||
kfree(&e->base);
|
||||
file_priv->event_space += sizeof(e->event);
|
||||
}
|
||||
spin_unlock_irqrestore(&drm->event_lock, flags);
|
||||
|
@@ -441,7 +441,7 @@ void shmob_drm_crtc_finish_page_flip(struct shmob_drm_crtc *scrtc)
|
||||
scrtc->event = NULL;
|
||||
if (event) {
|
||||
drm_crtc_send_vblank_event(&scrtc->crtc, event);
|
||||
drm_vblank_put(dev, 0);
|
||||
drm_crtc_vblank_put(&scrtc->crtc);
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->event_lock, flags);
|
||||
}
|
||||
@@ -467,7 +467,7 @@ static int shmob_drm_crtc_page_flip(struct drm_crtc *crtc,
|
||||
|
||||
if (event) {
|
||||
event->pipe = 0;
|
||||
drm_vblank_get(dev, 0);
|
||||
drm_crtc_vblank_get(&scrtc->crtc);
|
||||
spin_lock_irqsave(&dev->event_lock, flags);
|
||||
scrtc->event = event;
|
||||
spin_unlock_irqrestore(&dev->event_lock, flags);
|
||||
|
@@ -376,7 +376,7 @@ static int udl_crtc_page_flip(struct drm_crtc *crtc,
|
||||
|
||||
spin_lock_irqsave(&dev->event_lock, flags);
|
||||
if (event)
|
||||
drm_send_vblank_event(dev, 0, event);
|
||||
drm_crtc_send_vblank_event(crtc, event);
|
||||
spin_unlock_irqrestore(&dev->event_lock, flags);
|
||||
crtc->primary->fb = fb;
|
||||
|
||||
|
@@ -175,20 +175,22 @@ vc4_crtc_lut_load(struct drm_crtc *crtc)
|
||||
HVS_WRITE(SCALER_GAMDATA, vc4_crtc->lut_b[i]);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
vc4_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
|
||||
uint32_t start, uint32_t size)
|
||||
uint32_t size)
|
||||
{
|
||||
struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
|
||||
u32 i;
|
||||
|
||||
for (i = start; i < start + size; i++) {
|
||||
for (i = 0; i < size; i++) {
|
||||
vc4_crtc->lut_r[i] = r[i] >> 8;
|
||||
vc4_crtc->lut_g[i] = g[i] >> 8;
|
||||
vc4_crtc->lut_b[i] = b[i] >> 8;
|
||||
}
|
||||
|
||||
vc4_crtc_lut_load(crtc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 vc4_get_fifo_full_level(u32 format)
|
||||
@@ -395,6 +397,7 @@ static int vc4_crtc_atomic_check(struct drm_crtc *crtc,
|
||||
struct vc4_dev *vc4 = to_vc4_dev(dev);
|
||||
struct drm_plane *plane;
|
||||
unsigned long flags;
|
||||
const struct drm_plane_state *plane_state;
|
||||
u32 dlist_count = 0;
|
||||
int ret;
|
||||
|
||||
@@ -404,18 +407,8 @@ static int vc4_crtc_atomic_check(struct drm_crtc *crtc,
|
||||
if (hweight32(state->connector_mask) > 1)
|
||||
return -EINVAL;
|
||||
|
||||
drm_atomic_crtc_state_for_each_plane(plane, state) {
|
||||
struct drm_plane_state *plane_state =
|
||||
state->state->plane_states[drm_plane_index(plane)];
|
||||
|
||||
/* plane might not have changed, in which case take
|
||||
* current state:
|
||||
*/
|
||||
if (!plane_state)
|
||||
plane_state = plane->state;
|
||||
|
||||
drm_atomic_crtc_state_for_each_plane_state(plane, plane_state, state)
|
||||
dlist_count += vc4_plane_dlist_size(plane_state);
|
||||
}
|
||||
|
||||
dlist_count++; /* Account for SCALER_CTL0_END. */
|
||||
|
||||
|
@@ -469,7 +469,7 @@ int vc4_kms_load(struct drm_device *dev);
|
||||
struct drm_plane *vc4_plane_init(struct drm_device *dev,
|
||||
enum drm_plane_type type);
|
||||
u32 vc4_plane_write_dlist(struct drm_plane *plane, u32 __iomem *dlist);
|
||||
u32 vc4_plane_dlist_size(struct drm_plane_state *state);
|
||||
u32 vc4_plane_dlist_size(const struct drm_plane_state *state);
|
||||
void vc4_plane_async_set_fb(struct drm_plane *plane,
|
||||
struct drm_framebuffer *fb);
|
||||
|
||||
|
@@ -111,6 +111,8 @@ static int vc4_atomic_commit(struct drm_device *dev,
|
||||
int i;
|
||||
uint64_t wait_seqno = 0;
|
||||
struct vc4_commit *c;
|
||||
struct drm_plane *plane;
|
||||
struct drm_plane_state *new_state;
|
||||
|
||||
c = commit_init(state);
|
||||
if (!c)
|
||||
@@ -130,13 +132,7 @@ static int vc4_atomic_commit(struct drm_device *dev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < dev->mode_config.num_total_plane; i++) {
|
||||
struct drm_plane *plane = state->planes[i];
|
||||
struct drm_plane_state *new_state = state->plane_states[i];
|
||||
|
||||
if (!plane)
|
||||
continue;
|
||||
|
||||
for_each_plane_in_state(state, plane, new_state, i) {
|
||||
if ((plane->state->fb != new_state->fb) && new_state->fb) {
|
||||
struct drm_gem_cma_object *cma_bo =
|
||||
drm_fb_cma_get_gem_obj(new_state->fb, 0);
|
||||
|
@@ -690,9 +690,10 @@ u32 vc4_plane_write_dlist(struct drm_plane *plane, u32 __iomem *dlist)
|
||||
return vc4_state->dlist_count;
|
||||
}
|
||||
|
||||
u32 vc4_plane_dlist_size(struct drm_plane_state *state)
|
||||
u32 vc4_plane_dlist_size(const struct drm_plane_state *state)
|
||||
{
|
||||
struct vc4_plane_state *vc4_state = to_vc4_plane_state(state);
|
||||
const struct vc4_plane_state *vc4_state =
|
||||
container_of(state, typeof(*vc4_state), base);
|
||||
|
||||
return vc4_state->dlist_count;
|
||||
}
|
||||
|
@@ -156,7 +156,7 @@ static int virtio_gpu_page_flip(struct drm_crtc *crtc,
|
||||
|
||||
if (event) {
|
||||
spin_lock_irqsave(&crtc->dev->event_lock, irqflags);
|
||||
drm_send_vblank_event(crtc->dev, -1, event);
|
||||
drm_crtc_send_vblank_event(crtc, event);
|
||||
spin_unlock_irqrestore(&crtc->dev->event_lock, irqflags);
|
||||
}
|
||||
|
||||
|
@@ -46,7 +46,7 @@ struct vmw_fence_manager {
|
||||
bool goal_irq_on; /* Protected by @goal_irq_mutex */
|
||||
bool seqno_valid; /* Protected by @lock, and may not be set to true
|
||||
without the @goal_irq_mutex held. */
|
||||
unsigned ctx;
|
||||
u64 ctx;
|
||||
};
|
||||
|
||||
struct vmw_user_fence {
|
||||
|
@@ -1404,9 +1404,9 @@ static int vmw_du_update_layout(struct vmw_private *dev_priv, unsigned num,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void vmw_du_crtc_gamma_set(struct drm_crtc *crtc,
|
||||
u16 *r, u16 *g, u16 *b,
|
||||
uint32_t start, uint32_t size)
|
||||
int vmw_du_crtc_gamma_set(struct drm_crtc *crtc,
|
||||
u16 *r, u16 *g, u16 *b,
|
||||
uint32_t size)
|
||||
{
|
||||
struct vmw_private *dev_priv = vmw_priv(crtc->dev);
|
||||
int i;
|
||||
@@ -1418,6 +1418,8 @@ void vmw_du_crtc_gamma_set(struct drm_crtc *crtc,
|
||||
vmw_write(dev_priv, SVGA_PALETTE_BASE + i * 3 + 1, g[i] >> 8);
|
||||
vmw_write(dev_priv, SVGA_PALETTE_BASE + i * 3 + 2, b[i] >> 8);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vmw_du_connector_dpms(struct drm_connector *connector, int mode)
|
||||
|
@@ -195,9 +195,9 @@ struct vmw_display_unit {
|
||||
void vmw_du_cleanup(struct vmw_display_unit *du);
|
||||
void vmw_du_crtc_save(struct drm_crtc *crtc);
|
||||
void vmw_du_crtc_restore(struct drm_crtc *crtc);
|
||||
void vmw_du_crtc_gamma_set(struct drm_crtc *crtc,
|
||||
int vmw_du_crtc_gamma_set(struct drm_crtc *crtc,
|
||||
u16 *r, u16 *g, u16 *b,
|
||||
uint32_t start, uint32_t size);
|
||||
uint32_t size);
|
||||
int vmw_du_crtc_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv,
|
||||
uint32_t handle, uint32_t width, uint32_t height,
|
||||
int32_t hot_x, int32_t hot_y);
|
||||
|
Reference in New Issue
Block a user