aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/exynos
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-02-26 21:55:51 -0500
committerDavid S. Miller <davem@davemloft.net>2012-02-26 21:55:51 -0500
commitff4783ce78c08d2990126ce1874250ae8e72bbd2 (patch)
tree5c95885a4ab768101dd72942b57c238d452a7565 /drivers/gpu/drm/exynos
parent622121719934f60378279eb440d3cec2fc3176d2 (diff)
parent203738e548cefc3fc3c2f73a9063176c9f3583d5 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/net/ethernet/sfc/rx.c Overlapping changes in drivers/net/ethernet/sfc/rx.c, one to change the rx_buf->is_page boolean into a set of u16 flags, and another to adjust how ->ip_summed is initialized. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/gpu/drm/exynos')
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_core.c3
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_crtc.c6
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.c26
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_encoder.c34
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_encoder.h1
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fbdev.c70
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fimd.c7
-rw-r--r--drivers/gpu/drm/exynos/exynos_mixer.c19
8 files changed, 81 insertions, 85 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c
index 661a03571d0c..d08a55896d50 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_core.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_core.c
@@ -193,6 +193,9 @@ int exynos_drm_subdrv_register(struct exynos_drm_subdrv *subdrv)
193 return err; 193 return err;
194 } 194 }
195 195
196 /* setup possible_clones. */
197 exynos_drm_encoder_setup(drm_dev);
198
196 /* 199 /*
197 * if any specific driver such as fimd or hdmi driver called 200 * if any specific driver such as fimd or hdmi driver called
198 * exynos_drm_subdrv_register() later than drm_load(), 201 * exynos_drm_subdrv_register() later than drm_load(),
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index e3861ac49295..de818831a511 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -307,9 +307,6 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
307 */ 307 */
308 event->pipe = exynos_crtc->pipe; 308 event->pipe = exynos_crtc->pipe;
309 309
310 list_add_tail(&event->base.link,
311 &dev_priv->pageflip_event_list);
312
313 ret = drm_vblank_get(dev, exynos_crtc->pipe); 310 ret = drm_vblank_get(dev, exynos_crtc->pipe);
314 if (ret) { 311 if (ret) {
315 DRM_DEBUG("failed to acquire vblank counter\n"); 312 DRM_DEBUG("failed to acquire vblank counter\n");
@@ -318,6 +315,9 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
318 goto out; 315 goto out;
319 } 316 }
320 317
318 list_add_tail(&event->base.link,
319 &dev_priv->pageflip_event_list);
320
321 crtc->fb = fb; 321 crtc->fb = fb;
322 ret = exynos_drm_crtc_update(crtc); 322 ret = exynos_drm_crtc_update(crtc);
323 if (ret) { 323 if (ret) {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 35889ca255e9..58820ebd3558 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -33,6 +33,7 @@
33 33
34#include "exynos_drm_drv.h" 34#include "exynos_drm_drv.h"
35#include "exynos_drm_crtc.h" 35#include "exynos_drm_crtc.h"
36#include "exynos_drm_encoder.h"
36#include "exynos_drm_fbdev.h" 37#include "exynos_drm_fbdev.h"
37#include "exynos_drm_fb.h" 38#include "exynos_drm_fb.h"
38#include "exynos_drm_gem.h" 39#include "exynos_drm_gem.h"
@@ -99,6 +100,9 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
99 if (ret) 100 if (ret)
100 goto err_vblank; 101 goto err_vblank;
101 102
103 /* setup possible_clones. */
104 exynos_drm_encoder_setup(dev);
105
102 /* 106 /*
103 * create and configure fb helper and also exynos specific 107 * create and configure fb helper and also exynos specific
104 * fbdev object. 108 * fbdev object.
@@ -141,16 +145,21 @@ static int exynos_drm_unload(struct drm_device *dev)
141} 145}
142 146
143static void exynos_drm_preclose(struct drm_device *dev, 147static void exynos_drm_preclose(struct drm_device *dev,
144 struct drm_file *file_priv) 148 struct drm_file *file)
145{ 149{
146 struct exynos_drm_private *dev_priv = dev->dev_private; 150 DRM_DEBUG_DRIVER("%s\n", __FILE__);
147 151
148 /* 152}
149 * drm framework frees all events at release time, 153
150 * so private event list should be cleared. 154static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file)
151 */ 155{
152 if (!list_empty(&dev_priv->pageflip_event_list)) 156 DRM_DEBUG_DRIVER("%s\n", __FILE__);
153 INIT_LIST_HEAD(&dev_priv->pageflip_event_list); 157
158 if (!file->driver_priv)
159 return;
160
161 kfree(file->driver_priv);
162 file->driver_priv = NULL;
154} 163}
155 164
156static void exynos_drm_lastclose(struct drm_device *dev) 165static void exynos_drm_lastclose(struct drm_device *dev)
@@ -195,6 +204,7 @@ static struct drm_driver exynos_drm_driver = {
195 .unload = exynos_drm_unload, 204 .unload = exynos_drm_unload,
196 .preclose = exynos_drm_preclose, 205 .preclose = exynos_drm_preclose,
197 .lastclose = exynos_drm_lastclose, 206 .lastclose = exynos_drm_lastclose,
207 .postclose = exynos_drm_postclose,
198 .get_vblank_counter = drm_vblank_count, 208 .get_vblank_counter = drm_vblank_count,
199 .enable_vblank = exynos_drm_crtc_enable_vblank, 209 .enable_vblank = exynos_drm_crtc_enable_vblank,
200 .disable_vblank = exynos_drm_crtc_disable_vblank, 210 .disable_vblank = exynos_drm_crtc_disable_vblank,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 86b93dde219a..ef4754f1519b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -195,6 +195,40 @@ static struct drm_encoder_funcs exynos_encoder_funcs = {
195 .destroy = exynos_drm_encoder_destroy, 195 .destroy = exynos_drm_encoder_destroy,
196}; 196};
197 197
198static unsigned int exynos_drm_encoder_clones(struct drm_encoder *encoder)
199{
200 struct drm_encoder *clone;
201 struct drm_device *dev = encoder->dev;
202 struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
203 struct exynos_drm_display_ops *display_ops =
204 exynos_encoder->manager->display_ops;
205 unsigned int clone_mask = 0;
206 int cnt = 0;
207
208 list_for_each_entry(clone, &dev->mode_config.encoder_list, head) {
209 switch (display_ops->type) {
210 case EXYNOS_DISPLAY_TYPE_LCD:
211 case EXYNOS_DISPLAY_TYPE_HDMI:
212 clone_mask |= (1 << (cnt++));
213 break;
214 default:
215 continue;
216 }
217 }
218
219 return clone_mask;
220}
221
222void exynos_drm_encoder_setup(struct drm_device *dev)
223{
224 struct drm_encoder *encoder;
225
226 DRM_DEBUG_KMS("%s\n", __FILE__);
227
228 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
229 encoder->possible_clones = exynos_drm_encoder_clones(encoder);
230}
231
198struct drm_encoder * 232struct drm_encoder *
199exynos_drm_encoder_create(struct drm_device *dev, 233exynos_drm_encoder_create(struct drm_device *dev,
200 struct exynos_drm_manager *manager, 234 struct exynos_drm_manager *manager,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.h b/drivers/gpu/drm/exynos/exynos_drm_encoder.h
index 97b087a51cb6..eb7d2316847e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.h
@@ -30,6 +30,7 @@
30 30
31struct exynos_drm_manager; 31struct exynos_drm_manager;
32 32
33void exynos_drm_encoder_setup(struct drm_device *dev);
33struct drm_encoder *exynos_drm_encoder_create(struct drm_device *dev, 34struct drm_encoder *exynos_drm_encoder_create(struct drm_device *dev,
34 struct exynos_drm_manager *mgr, 35 struct exynos_drm_manager *mgr,
35 unsigned int possible_crtcs); 36 unsigned int possible_crtcs);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index d7ae29d2f3d6..3508700e529b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -195,66 +195,6 @@ out:
195 return ret; 195 return ret;
196} 196}
197 197
198static bool
199exynos_drm_fbdev_is_samefb(struct drm_framebuffer *fb,
200 struct drm_fb_helper_surface_size *sizes)
201{
202 if (fb->width != sizes->surface_width)
203 return false;
204 if (fb->height != sizes->surface_height)
205 return false;
206 if (fb->bits_per_pixel != sizes->surface_bpp)
207 return false;
208 if (fb->depth != sizes->surface_depth)
209 return false;
210
211 return true;
212}
213
214static int exynos_drm_fbdev_recreate(struct drm_fb_helper *helper,
215 struct drm_fb_helper_surface_size *sizes)
216{
217 struct drm_device *dev = helper->dev;
218 struct exynos_drm_fbdev *exynos_fbdev = to_exynos_fbdev(helper);
219 struct exynos_drm_gem_obj *exynos_gem_obj;
220 struct drm_framebuffer *fb = helper->fb;
221 struct drm_mode_fb_cmd2 mode_cmd = { 0 };
222 unsigned long size;
223
224 DRM_DEBUG_KMS("%s\n", __FILE__);
225
226 if (exynos_drm_fbdev_is_samefb(fb, sizes))
227 return 0;
228
229 mode_cmd.width = sizes->surface_width;
230 mode_cmd.height = sizes->surface_height;
231 mode_cmd.pitches[0] = sizes->surface_width * (sizes->surface_bpp >> 3);
232 mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
233 sizes->surface_depth);
234
235 if (exynos_fbdev->exynos_gem_obj)
236 exynos_drm_gem_destroy(exynos_fbdev->exynos_gem_obj);
237
238 if (fb->funcs->destroy)
239 fb->funcs->destroy(fb);
240
241 size = mode_cmd.pitches[0] * mode_cmd.height;
242 exynos_gem_obj = exynos_drm_gem_create(dev, size);
243 if (IS_ERR(exynos_gem_obj))
244 return PTR_ERR(exynos_gem_obj);
245
246 exynos_fbdev->exynos_gem_obj = exynos_gem_obj;
247
248 helper->fb = exynos_drm_framebuffer_init(dev, &mode_cmd,
249 &exynos_gem_obj->base);
250 if (IS_ERR_OR_NULL(helper->fb)) {
251 DRM_ERROR("failed to create drm framebuffer.\n");
252 return PTR_ERR(helper->fb);
253 }
254
255 return exynos_drm_fbdev_update(helper, helper->fb);
256}
257
258static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper, 198static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper,
259 struct drm_fb_helper_surface_size *sizes) 199 struct drm_fb_helper_surface_size *sizes)
260{ 200{
@@ -262,6 +202,10 @@ static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper,
262 202
263 DRM_DEBUG_KMS("%s\n", __FILE__); 203 DRM_DEBUG_KMS("%s\n", __FILE__);
264 204
205 /*
206 * with !helper->fb, it means that this funcion is called first time
207 * and after that, the helper->fb would be used as clone mode.
208 */
265 if (!helper->fb) { 209 if (!helper->fb) {
266 ret = exynos_drm_fbdev_create(helper, sizes); 210 ret = exynos_drm_fbdev_create(helper, sizes);
267 if (ret < 0) { 211 if (ret < 0) {
@@ -274,12 +218,6 @@ static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper,
274 * because register_framebuffer() should be called. 218 * because register_framebuffer() should be called.
275 */ 219 */
276 ret = 1; 220 ret = 1;
277 } else {
278 ret = exynos_drm_fbdev_recreate(helper, sizes);
279 if (ret < 0) {
280 DRM_ERROR("failed to reconfigure fbdev\n");
281 return ret;
282 }
283 } 221 }
284 222
285 return ret; 223 return ret;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index b6a737d196ae..0dbb32bb18a3 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -604,7 +604,12 @@ static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc)
604 } 604 }
605 605
606 if (is_checked) { 606 if (is_checked) {
607 drm_vblank_put(drm_dev, crtc); 607 /*
608 * call drm_vblank_put only in case that drm_vblank_get was
609 * called.
610 */
611 if (atomic_read(&drm_dev->vblank_refcount[crtc]) > 0)
612 drm_vblank_put(drm_dev, crtc);
608 613
609 /* 614 /*
610 * don't off vblank if vblank_disable_allowed is 1, 615 * don't off vblank if vblank_disable_allowed is 1,
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index ac24cff39775..93846e810e38 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -712,7 +712,12 @@ static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc)
712 } 712 }
713 713
714 if (is_checked) 714 if (is_checked)
715 drm_vblank_put(drm_dev, crtc); 715 /*
716 * call drm_vblank_put only in case that drm_vblank_get was
717 * called.
718 */
719 if (atomic_read(&drm_dev->vblank_refcount[crtc]) > 0)
720 drm_vblank_put(drm_dev, crtc);
716 721
717 spin_unlock_irqrestore(&drm_dev->event_lock, flags); 722 spin_unlock_irqrestore(&drm_dev->event_lock, flags);
718} 723}
@@ -779,15 +784,15 @@ static void mixer_win_reset(struct mixer_context *ctx)
779 mixer_reg_writemask(res, MXR_STATUS, MXR_STATUS_16_BURST, 784 mixer_reg_writemask(res, MXR_STATUS, MXR_STATUS_16_BURST,
780 MXR_STATUS_BURST_MASK); 785 MXR_STATUS_BURST_MASK);
781 786
782 /* setting default layer priority: layer1 > video > layer0 787 /* setting default layer priority: layer1 > layer0 > video
783 * because typical usage scenario would be 788 * because typical usage scenario would be
789 * layer1 - OSD
784 * layer0 - framebuffer 790 * layer0 - framebuffer
785 * video - video overlay 791 * video - video overlay
786 * layer1 - OSD
787 */ 792 */
788 val = MXR_LAYER_CFG_GRP0_VAL(1); 793 val = MXR_LAYER_CFG_GRP1_VAL(3);
789 val |= MXR_LAYER_CFG_VP_VAL(2); 794 val |= MXR_LAYER_CFG_GRP0_VAL(2);
790 val |= MXR_LAYER_CFG_GRP1_VAL(3); 795 val |= MXR_LAYER_CFG_VP_VAL(1);
791 mixer_reg_write(res, MXR_LAYER_CFG, val); 796 mixer_reg_write(res, MXR_LAYER_CFG, val);
792 797
793 /* setting background color */ 798 /* setting background color */
@@ -1044,7 +1049,7 @@ static int mixer_remove(struct platform_device *pdev)
1044 platform_get_drvdata(pdev); 1049 platform_get_drvdata(pdev);
1045 struct mixer_context *ctx = (struct mixer_context *)drm_hdmi_ctx->ctx; 1050 struct mixer_context *ctx = (struct mixer_context *)drm_hdmi_ctx->ctx;
1046 1051
1047 dev_info(dev, "remove sucessful\n"); 1052 dev_info(dev, "remove successful\n");
1048 1053
1049 mixer_resource_poweroff(ctx); 1054 mixer_resource_poweroff(ctx);
1050 mixer_resources_cleanup(ctx); 1055 mixer_resources_cleanup(ctx);