Message ID | 20210517115922.8033-2-drawat.floss@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v4,1/3] drm/hyperv: Add DRM driver for hyperv synthetic video device | expand |
Am 17.05.21 um 13:59 schrieb Deepak Rawat: > Virtual device inform if screen update is needed or not with > SYNTHVID_FEATURE_CHANGE message. Handle this message to set dirt_needed > flag. > > Suggested-by: Dexuan Cui <decui@microsoft.com> > Signed-off-by: Deepak Rawat <drawat.floss@gmail.com> Acked-by: Thomas Zimmermann <tzimmermann@suse.de> > --- > drivers/gpu/drm/hyperv/hyperv_drm.h | 1 + > drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 2 ++ > drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 7 +++++++ > 3 files changed, 10 insertions(+) > > diff --git a/drivers/gpu/drm/hyperv/hyperv_drm.h b/drivers/gpu/drm/hyperv/hyperv_drm.h > index e1d1fdea96f2..886add4f9cd0 100644 > --- a/drivers/gpu/drm/hyperv/hyperv_drm.h > +++ b/drivers/gpu/drm/hyperv/hyperv_drm.h > @@ -29,6 +29,7 @@ struct hyperv_drm_device { > struct completion wait; > u32 synthvid_version; > u32 mmio_megabytes; > + bool dirt_needed; > > u8 init_buf[VMBUS_MAX_PACKET_SIZE]; > u8 recv_buf[VMBUS_MAX_PACKET_SIZE]; > diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c > index 68a6ba91a486..8e6ff86c471a 100644 > --- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c > +++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c > @@ -201,6 +201,8 @@ static int hyperv_vmbus_probe(struct hv_device *hdev, > if (ret) > drm_warn(dev, "Failed to update vram location.\n"); > > + hv->dirt_needed = true; > + > ret = hyperv_mode_config_init(hv); > if (ret) > goto err_vmbus_close; > diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_proto.c b/drivers/gpu/drm/hyperv/hyperv_drm_proto.c > index 700870b243fe..6fff24b40974 100644 > --- a/drivers/gpu/drm/hyperv/hyperv_drm_proto.c > +++ b/drivers/gpu/drm/hyperv/hyperv_drm_proto.c > @@ -301,8 +301,12 @@ int hyperv_update_situation(struct hv_device *hdev, u8 active, u32 bpp, > > int hyperv_update_dirt(struct hv_device *hdev, struct drm_rect *rect) > { > + struct hyperv_drm_device *hv = hv_get_drvdata(hdev); > struct synthvid_msg msg; > > + if (!hv->dirt_needed) > + return 0; > + > memset(&msg, 0, sizeof(struct synthvid_msg)); > > msg.vid_hdr.type = SYNTHVID_DIRT; > @@ -387,6 +391,9 @@ static void hyperv_receive_sub(struct hv_device *hdev) > complete(&hv->wait); > return; > } > + > + if (msg->vid_hdr.type == SYNTHVID_FEATURE_CHANGE) > + hv->dirt_needed = msg->feature_chg.is_dirt_needed; > } > > static void hyperv_receive(void *ctx) >
diff --git a/drivers/gpu/drm/hyperv/hyperv_drm.h b/drivers/gpu/drm/hyperv/hyperv_drm.h index e1d1fdea96f2..886add4f9cd0 100644 --- a/drivers/gpu/drm/hyperv/hyperv_drm.h +++ b/drivers/gpu/drm/hyperv/hyperv_drm.h @@ -29,6 +29,7 @@ struct hyperv_drm_device { struct completion wait; u32 synthvid_version; u32 mmio_megabytes; + bool dirt_needed; u8 init_buf[VMBUS_MAX_PACKET_SIZE]; u8 recv_buf[VMBUS_MAX_PACKET_SIZE]; diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c index 68a6ba91a486..8e6ff86c471a 100644 --- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c +++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c @@ -201,6 +201,8 @@ static int hyperv_vmbus_probe(struct hv_device *hdev, if (ret) drm_warn(dev, "Failed to update vram location.\n"); + hv->dirt_needed = true; + ret = hyperv_mode_config_init(hv); if (ret) goto err_vmbus_close; diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_proto.c b/drivers/gpu/drm/hyperv/hyperv_drm_proto.c index 700870b243fe..6fff24b40974 100644 --- a/drivers/gpu/drm/hyperv/hyperv_drm_proto.c +++ b/drivers/gpu/drm/hyperv/hyperv_drm_proto.c @@ -301,8 +301,12 @@ int hyperv_update_situation(struct hv_device *hdev, u8 active, u32 bpp, int hyperv_update_dirt(struct hv_device *hdev, struct drm_rect *rect) { + struct hyperv_drm_device *hv = hv_get_drvdata(hdev); struct synthvid_msg msg; + if (!hv->dirt_needed) + return 0; + memset(&msg, 0, sizeof(struct synthvid_msg)); msg.vid_hdr.type = SYNTHVID_DIRT; @@ -387,6 +391,9 @@ static void hyperv_receive_sub(struct hv_device *hdev) complete(&hv->wait); return; } + + if (msg->vid_hdr.type == SYNTHVID_FEATURE_CHANGE) + hv->dirt_needed = msg->feature_chg.is_dirt_needed; } static void hyperv_receive(void *ctx)
Virtual device inform if screen update is needed or not with SYNTHVID_FEATURE_CHANGE message. Handle this message to set dirt_needed flag. Suggested-by: Dexuan Cui <decui@microsoft.com> Signed-off-by: Deepak Rawat <drawat.floss@gmail.com> --- drivers/gpu/drm/hyperv/hyperv_drm.h | 1 + drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 2 ++ drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 7 +++++++ 3 files changed, 10 insertions(+)