diff options
| -rw-r--r-- | drivers/gpu/drm/omapdrm/omap_drv.h | 11 | ||||
| -rw-r--r-- | drivers/gpu/drm/omapdrm/omap_fb.c | 37 | ||||
| -rw-r--r-- | drivers/gpu/drm/omapdrm/omap_plane.c | 25 |
3 files changed, 21 insertions, 52 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index ca087a993909..4bd1e9070b31 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h | |||
| @@ -38,15 +38,6 @@ | |||
| 38 | 38 | ||
| 39 | struct omap_drm_usergart; | 39 | struct omap_drm_usergart; |
| 40 | 40 | ||
| 41 | /* parameters which describe (unrotated) coordinates of scanout within a fb: */ | ||
| 42 | struct omap_drm_window { | ||
| 43 | uint32_t rotation; | ||
| 44 | int32_t crtc_x, crtc_y; /* signed because can be offscreen */ | ||
| 45 | uint32_t crtc_w, crtc_h; | ||
| 46 | uint32_t src_x, src_y; | ||
| 47 | uint32_t src_w, src_h; | ||
| 48 | }; | ||
| 49 | |||
| 50 | /* For KMS code that needs to wait for a certain # of IRQs: | 41 | /* For KMS code that needs to wait for a certain # of IRQs: |
| 51 | */ | 42 | */ |
| 52 | struct omap_irq_wait; | 43 | struct omap_irq_wait; |
| @@ -157,7 +148,7 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev, | |||
| 157 | int omap_framebuffer_pin(struct drm_framebuffer *fb); | 148 | int omap_framebuffer_pin(struct drm_framebuffer *fb); |
| 158 | void omap_framebuffer_unpin(struct drm_framebuffer *fb); | 149 | void omap_framebuffer_unpin(struct drm_framebuffer *fb); |
| 159 | void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, | 150 | void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, |
| 160 | struct omap_drm_window *win, struct omap_overlay_info *info); | 151 | struct drm_plane_state *state, struct omap_overlay_info *info); |
| 161 | struct drm_connector *omap_framebuffer_get_next_connector( | 152 | struct drm_connector *omap_framebuffer_get_next_connector( |
| 162 | struct drm_framebuffer *fb, struct drm_connector *from); | 153 | struct drm_framebuffer *fb, struct drm_connector *from); |
| 163 | bool omap_framebuffer_supports_rotation(struct drm_framebuffer *fb); | 154 | bool omap_framebuffer_supports_rotation(struct drm_framebuffer *fb); |
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c index 2f461d427924..4093e0e38a90 100644 --- a/drivers/gpu/drm/omapdrm/omap_fb.c +++ b/drivers/gpu/drm/omapdrm/omap_fb.c | |||
| @@ -155,7 +155,7 @@ static uint32_t drm_rotation_to_tiler(unsigned int drm_rot) | |||
| 155 | /* update ovl info for scanout, handles cases of multi-planar fb's, etc. | 155 | /* update ovl info for scanout, handles cases of multi-planar fb's, etc. |
| 156 | */ | 156 | */ |
| 157 | void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, | 157 | void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, |
| 158 | struct omap_drm_window *win, struct omap_overlay_info *info) | 158 | struct drm_plane_state *state, struct omap_overlay_info *info) |
| 159 | { | 159 | { |
| 160 | struct omap_framebuffer *omap_fb = to_omap_framebuffer(fb); | 160 | struct omap_framebuffer *omap_fb = to_omap_framebuffer(fb); |
| 161 | const struct drm_format_info *format = omap_fb->format; | 161 | const struct drm_format_info *format = omap_fb->format; |
| @@ -164,25 +164,27 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, | |||
| 164 | 164 | ||
| 165 | info->fourcc = fb->format->format; | 165 | info->fourcc = fb->format->format; |
| 166 | 166 | ||
| 167 | info->pos_x = win->crtc_x; | 167 | info->pos_x = state->crtc_x; |
| 168 | info->pos_y = win->crtc_y; | 168 | info->pos_y = state->crtc_y; |
| 169 | info->out_width = win->crtc_w; | 169 | info->out_width = state->crtc_w; |
| 170 | info->out_height = win->crtc_h; | 170 | info->out_height = state->crtc_h; |
| 171 | info->width = win->src_w; | 171 | info->width = state->src_w >> 16; |
| 172 | info->height = win->src_h; | 172 | info->height = state->src_h >> 16; |
| 173 | 173 | ||
| 174 | x = win->src_x; | 174 | /* DSS driver wants the w & h in rotated orientation */ |
| 175 | y = win->src_y; | 175 | if (drm_rotation_90_or_270(state->rotation)) |
| 176 | swap(info->width, info->height); | ||
| 177 | |||
| 178 | x = state->src_x >> 16; | ||
| 179 | y = state->src_y >> 16; | ||
| 176 | 180 | ||
| 177 | if (omap_gem_flags(plane->bo) & OMAP_BO_TILED) { | 181 | if (omap_gem_flags(plane->bo) & OMAP_BO_TILED) { |
| 178 | uint32_t w = win->src_w; | 182 | uint32_t w = state->src_w >> 16; |
| 179 | uint32_t h = win->src_h; | 183 | uint32_t h = state->src_h >> 16; |
| 180 | 184 | ||
| 181 | orient = drm_rotation_to_tiler(win->rotation); | 185 | orient = drm_rotation_to_tiler(state->rotation); |
| 182 | 186 | ||
| 183 | /* adjust x,y offset for flip/invert: */ | 187 | /* adjust x,y offset for invert: */ |
| 184 | if (orient & MASK_XY_FLIP) | ||
| 185 | swap(w, h); | ||
| 186 | if (orient & MASK_Y_INVERT) | 188 | if (orient & MASK_Y_INVERT) |
| 187 | y += h - 1; | 189 | y += h - 1; |
| 188 | if (orient & MASK_X_INVERT) | 190 | if (orient & MASK_X_INVERT) |
| @@ -193,7 +195,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, | |||
| 193 | info->rotation_type = OMAP_DSS_ROT_TILER; | 195 | info->rotation_type = OMAP_DSS_ROT_TILER; |
| 194 | info->screen_width = omap_gem_tiled_stride(plane->bo, orient); | 196 | info->screen_width = omap_gem_tiled_stride(plane->bo, orient); |
| 195 | } else { | 197 | } else { |
| 196 | switch (win->rotation & DRM_MODE_ROTATE_MASK) { | 198 | switch (state->rotation & DRM_MODE_ROTATE_MASK) { |
| 197 | case 0: | 199 | case 0: |
| 198 | case DRM_MODE_ROTATE_0: | 200 | case DRM_MODE_ROTATE_0: |
| 199 | /* OK */ | 201 | /* OK */ |
| @@ -202,8 +204,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, | |||
| 202 | default: | 204 | default: |
| 203 | dev_warn(fb->dev->dev, | 205 | dev_warn(fb->dev->dev, |
| 204 | "rotation '%d' ignored for non-tiled fb\n", | 206 | "rotation '%d' ignored for non-tiled fb\n", |
| 205 | win->rotation); | 207 | state->rotation); |
| 206 | win->rotation = 0; | ||
| 207 | break; | 208 | break; |
| 208 | } | 209 | } |
| 209 | 210 | ||
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index 96c15e6d7397..08a446463afa 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c | |||
| @@ -59,7 +59,6 @@ static void omap_plane_atomic_update(struct drm_plane *plane, | |||
| 59 | struct omap_plane *omap_plane = to_omap_plane(plane); | 59 | struct omap_plane *omap_plane = to_omap_plane(plane); |
| 60 | struct drm_plane_state *state = plane->state; | 60 | struct drm_plane_state *state = plane->state; |
| 61 | struct omap_overlay_info info; | 61 | struct omap_overlay_info info; |
| 62 | struct omap_drm_window win; | ||
| 63 | int ret; | 62 | int ret; |
| 64 | 63 | ||
| 65 | DBG("%s, crtc=%p fb=%p", omap_plane->name, state->crtc, state->fb); | 64 | DBG("%s, crtc=%p fb=%p", omap_plane->name, state->crtc, state->fb); |
| @@ -71,30 +70,8 @@ static void omap_plane_atomic_update(struct drm_plane *plane, | |||
| 71 | info.mirror = 0; | 70 | info.mirror = 0; |
| 72 | info.zorder = state->zpos; | 71 | info.zorder = state->zpos; |
| 73 | 72 | ||
| 74 | memset(&win, 0, sizeof(win)); | ||
| 75 | win.rotation = state->rotation; | ||
| 76 | win.crtc_x = state->crtc_x; | ||
| 77 | win.crtc_y = state->crtc_y; | ||
| 78 | win.crtc_w = state->crtc_w; | ||
| 79 | win.crtc_h = state->crtc_h; | ||
| 80 | |||
| 81 | /* | ||
| 82 | * src values are in Q16 fixed point, convert to integer. | ||
| 83 | * omap_framebuffer_update_scanout() takes adjusted src. | ||
| 84 | */ | ||
| 85 | win.src_x = state->src_x >> 16; | ||
| 86 | win.src_y = state->src_y >> 16; | ||
| 87 | |||
| 88 | if (drm_rotation_90_or_270(state->rotation)) { | ||
| 89 | win.src_w = state->src_h >> 16; | ||
| 90 | win.src_h = state->src_w >> 16; | ||
| 91 | } else { | ||
| 92 | win.src_w = state->src_w >> 16; | ||
| 93 | win.src_h = state->src_h >> 16; | ||
| 94 | } | ||
| 95 | |||
| 96 | /* update scanout: */ | 73 | /* update scanout: */ |
| 97 | omap_framebuffer_update_scanout(state->fb, &win, &info); | 74 | omap_framebuffer_update_scanout(state->fb, state, &info); |
| 98 | 75 | ||
| 99 | DBG("%dx%d -> %dx%d (%d)", info.width, info.height, | 76 | DBG("%dx%d -> %dx%d (%d)", info.width, info.height, |
| 100 | info.out_width, info.out_height, | 77 | info.out_width, info.out_height, |
