|
38 | 38 | #include <linux/pci.h>
|
39 | 39 | #include <linux/pm_runtime.h>
|
40 | 40 | #include <drm/drm_crtc_helper.h>
|
| 41 | +#include <drm/drm_damage_helper.h> |
| 42 | +#include <drm/drm_drv.h> |
41 | 43 | #include <drm/drm_edid.h>
|
42 | 44 | #include <drm/drm_fb_helper.h>
|
43 | 45 | #include <drm/drm_gem_framebuffer_helper.h>
|
@@ -532,11 +534,29 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,
|
532 | 534 | return true;
|
533 | 535 | }
|
534 | 536 |
|
| 537 | +static int amdgpu_dirtyfb(struct drm_framebuffer *fb, struct drm_file *file, |
| 538 | + unsigned int flags, unsigned int color, |
| 539 | + struct drm_clip_rect *clips, unsigned int num_clips) |
| 540 | +{ |
| 541 | + |
| 542 | + if (file) |
| 543 | + return -ENOSYS; |
| 544 | + |
| 545 | + return drm_atomic_helper_dirtyfb(fb, file, flags, color, clips, |
| 546 | + num_clips); |
| 547 | +} |
| 548 | + |
535 | 549 | static const struct drm_framebuffer_funcs amdgpu_fb_funcs = {
|
536 | 550 | .destroy = drm_gem_fb_destroy,
|
537 | 551 | .create_handle = drm_gem_fb_create_handle,
|
538 | 552 | };
|
539 | 553 |
|
| 554 | +static const struct drm_framebuffer_funcs amdgpu_fb_funcs_atomic = { |
| 555 | + .destroy = drm_gem_fb_destroy, |
| 556 | + .create_handle = drm_gem_fb_create_handle, |
| 557 | + .dirty = amdgpu_dirtyfb |
| 558 | +}; |
| 559 | + |
540 | 560 | uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev,
|
541 | 561 | uint64_t bo_flags)
|
542 | 562 | {
|
@@ -1139,7 +1159,11 @@ static int amdgpu_display_gem_fb_verify_and_init(struct drm_device *dev,
|
1139 | 1159 | if (ret)
|
1140 | 1160 | goto err;
|
1141 | 1161 |
|
1142 |
| - ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); |
| 1162 | + if (drm_drv_uses_atomic_modeset(dev)) |
| 1163 | + ret = drm_framebuffer_init(dev, &rfb->base, |
| 1164 | + &amdgpu_fb_funcs_atomic); |
| 1165 | + else |
| 1166 | + ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); |
1143 | 1167 |
|
1144 | 1168 | if (ret)
|
1145 | 1169 | goto err;
|
|
0 commit comments