mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Corentin Labbe <clabbe@baylibre.com>
To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be,
	mchehab@kernel.org
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org, Corentin Labbe <clabbe@baylibre.com>
Subject: [PATCH RFT/RFC 20/49] staging: media: zoran: move overlay_settings out of zoran_fh
Date: Mon, 21 Sep 2020 10:19:55 +0000	[thread overview]
Message-ID: <1600683624-5863-21-git-send-email-clabbe@baylibre.com> (raw)
In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com>

We need to get rid of zoran_fh, so move the overlay_settings directly in the
zoran structure.
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
 drivers/staging/media/zoran/zoran.h        |  1 -
 drivers/staging/media/zoran/zoran_device.c |  8 ++---
 drivers/staging/media/zoran/zoran_driver.c | 40 +++++++++-------------
 3 files changed, 21 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/media/zoran/zoran.h b/drivers/staging/media/zoran/zoran.h
index 7e6e03563a2a..e9fef23a720c 100644
--- a/drivers/staging/media/zoran/zoran.h
+++ b/drivers/staging/media/zoran/zoran.h
@@ -211,7 +211,6 @@ struct zoran_fh {
 
 	enum zoran_map_mode map_mode;		/* Flag which bufferset will map by next mmap() */
 
-	struct zoran_overlay_settings overlay_settings;
 	u32 *overlay_mask;			/* overlay mask */
 	enum zoran_lock_activity overlay_active;/* feature currently in use? */
 
diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c
index 4f9b28e63ac0..e81316ac6521 100644
--- a/drivers/staging/media/zoran/zoran_device.c
+++ b/drivers/staging/media/zoran/zoran_device.c
@@ -508,10 +508,10 @@ void write_overlay_mask(struct zoran_fh *fh, struct v4l2_clip *vp, int count)
 			height += y;
 			y = 0;
 		}
-		if (x + width > fh->overlay_settings.width)
-			width = fh->overlay_settings.width - x;
-		if (y + height > fh->overlay_settings.height)
-			height = fh->overlay_settings.height - y;
+		if (x + width > zr->overlay_settings.width)
+			width = zr->overlay_settings.width - x;
+		if (y + height > zr->overlay_settings.height)
+			height = zr->overlay_settings.height - y;
 
 		/* ignore degenerate clips */
 		if (height <= 0)
diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c
index f0ceda9a3d44..77cd2c07c394 100644
--- a/drivers/staging/media/zoran/zoran_driver.c
+++ b/drivers/staging/media/zoran/zoran_driver.c
@@ -744,9 +744,7 @@ static void zoran_open_init_session(struct zoran_fh *fh)
 	map_mode_raw(fh);
 
 	/* take over the card's current settings */
-	fh->overlay_settings = zr->overlay_settings;
-	fh->overlay_settings.is_set = 0;
-	fh->overlay_settings.format = zr->overlay_settings.format;
+	zr->overlay_settings.is_set = 0;
 	fh->overlay_active = ZORAN_FREE;
 
 	/* buffers */
@@ -1005,7 +1003,7 @@ static int setup_window(struct zoran_fh *fh, int x, int y, int width, int height
 		return -EINVAL;
 	}
 
-	if (!fh->overlay_settings.format) {
+	if (!zr->overlay_settings.format) {
 		pci_err(zr->pci_dev, "%s - no overlay format set\n", __func__);
 		return -EINVAL;
 	}
@@ -1043,11 +1041,11 @@ static int setup_window(struct zoran_fh *fh, int x, int y, int width, int height
 		return -EINVAL;
 	}
 
-	fh->overlay_settings.x = x;
-	fh->overlay_settings.y = y;
-	fh->overlay_settings.width = width;
-	fh->overlay_settings.height = height;
-	fh->overlay_settings.clipcount = clipcount;
+	zr->overlay_settings.x = x;
+	zr->overlay_settings.y = y;
+	zr->overlay_settings.width = width;
+	zr->overlay_settings.height = height;
+	zr->overlay_settings.clipcount = clipcount;
 
 	/*
 	 * If an overlay is running, we have to switch it off
@@ -1069,7 +1067,7 @@ static int setup_window(struct zoran_fh *fh, int x, int y, int width, int height
 	 */
 	if (bitmap) {
 		/* fake value - it just means we want clips */
-		fh->overlay_settings.clipcount = 1;
+		zr->overlay_settings.clipcount = 1;
 
 		if (copy_from_user(fh->overlay_mask, bitmap,
 				   (width * height + 7) / 8)) {
@@ -1091,10 +1089,7 @@ static int setup_window(struct zoran_fh *fh, int x, int y, int width, int height
 		vfree(vcp);
 	}
 
-	fh->overlay_settings.is_set = 1;
-	if (fh->overlay_active != ZORAN_FREE &&
-	    zr->overlay_active != ZORAN_FREE)
-		zr->overlay_settings = fh->overlay_settings;
+	zr->overlay_settings.is_set = 1;
 
 	if (on)
 		zr36057_overlay(zr, 1);
@@ -1135,18 +1130,17 @@ static int setup_overlay(struct zoran_fh *fh, int on)
 			zr36057_overlay(zr, 0);
 		zr->overlay_mask = NULL;
 	} else {
-		if (!zr->vbuf_base || !fh->overlay_settings.is_set) {
+		if (!zr->vbuf_base || !zr->overlay_settings.is_set) {
 			pci_err(zr->pci_dev, "%s - buffer or window not set\n", __func__);
 			return -EINVAL;
 		}
-		if (!fh->overlay_settings.format) {
+		if (!zr->overlay_settings.format) {
 			pci_err(zr->pci_dev, "%s - no overlay format set\n", __func__);
 			return -EINVAL;
 		}
 		zr->overlay_active = fh->overlay_active = ZORAN_LOCKED;
 		zr->v4l_overlay_active = 1;
 		zr->overlay_mask = fh->overlay_mask;
-		zr->overlay_settings = fh->overlay_settings;
 		if (!zr->v4l_memgrab_active)
 			zr36057_overlay(zr, 1);
 		/*
@@ -1430,11 +1424,11 @@ static int zoran_g_fmt_vid_overlay(struct file *file, void *__fh,
 	struct zoran_fh *fh = __fh;
 	struct zoran *zr = fh->zr;
 
-	fmt->fmt.win.w.left = fh->overlay_settings.x;
-	fmt->fmt.win.w.top = fh->overlay_settings.y;
-	fmt->fmt.win.w.width = fh->overlay_settings.width;
-	fmt->fmt.win.w.height = fh->overlay_settings.height;
-	if (fh->overlay_settings.width * 2 > BUZ_MAX_HEIGHT)
+	fmt->fmt.win.w.left = zr->overlay_settings.x;
+	fmt->fmt.win.w.top = zr->overlay_settings.y;
+	fmt->fmt.win.w.width = zr->overlay_settings.width;
+	fmt->fmt.win.w.height = zr->overlay_settings.height;
+	if (zr->overlay_settings.width * 2 > BUZ_MAX_HEIGHT)
 		fmt->fmt.win.field = V4L2_FIELD_INTERLACED;
 	else
 		fmt->fmt.win.field = V4L2_FIELD_TOP;
@@ -1703,7 +1697,7 @@ static int zoran_g_fbuf(struct file *file, void *__fh,
 	fb->fmt.width = zr->vbuf_width;
 	fb->fmt.height = zr->vbuf_height;
 	if (zr->overlay_settings.format)
-		fb->fmt.pixelformat = fh->overlay_settings.format->fourcc;
+		fb->fmt.pixelformat = zr->overlay_settings.format->fourcc;
 	fb->fmt.bytesperline = zr->vbuf_bytesperline;
 	fb->fmt.colorspace = V4L2_COLORSPACE_SRGB;
 	fb->fmt.field = V4L2_FIELD_INTERLACED;
-- 
2.26.2


  parent reply	other threads:[~2020-09-21 10:23 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-21 10:19 [PATCH RFT/RFC 00/49] staging: media: bring back zoran driver Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 01/49] staging: media: Revert "media: zoran: remove deprecated driver" Corentin Labbe
2020-09-22  5:16   ` Christoph Hellwig
2020-09-22 19:15     ` LABBE Corentin
2020-09-21 10:19 ` [PATCH RFT/RFC 02/49] MAINTAINERS: change maintainer of the zoran driver Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 03/49] staging: media: zoran: datasheet is no longer available from zoran.com Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 04/49] staging: media: zoran: Documentation: fix typo Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 05/49] staging: media: zoran: fix checkpatch issue Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 06/49] staging: media: zoran: unsplit lines Corentin Labbe
2020-09-22  5:13   ` Christoph Hellwig
2020-09-21 10:19 ` [PATCH RFT/RFC 07/49] staging: media: zoran: do not forward declare zr36057_init_vfe Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 08/49] staging: media: zoran: convert all error dprintk to pci_err/pr_err Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 09/49] staging: media: zoran: convert dprintk warn Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 10/49] staging: media: zoran: convert dprintk info to pci_info Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 11/49] staging: media: zoran: convert dprintk debug Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 12/49] staging: media: zoran: zoran_device.c: convert pr_x to pci_x Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 13/49] staging: media: zoran: remove proc_fs Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 14/49] staging: media: zoran: use VFL_TYPE_VIDEO Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 15/49] staging: media: zoran: use v4l2_buffer_set_timestamp Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 16/49] staging: media: zoran: do not print random guest 0 Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 17/49] staging: media: zoran: move buffer_size out of zoran_fh Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 18/49] staging: media: zoran: move v4l_settings " Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 19/49] staging: media: zoran: move jpg_settings " Corentin Labbe
2020-09-21 10:19 ` Corentin Labbe [this message]
2020-09-21 10:19 ` [PATCH RFT/RFC 21/49] staging: media: zoran: Use video_drvdata to get struct zoran Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 22/49] staging: media: zoran: Change zoran_v4l_set_format parameter from zoran_fh to zoran Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 23/49] staging: media: zoran: remove overlay Corentin Labbe
2020-09-21 10:19 ` [PATCH RFT/RFC 24/49] staging: media: zoran: Use DMA coherent for stat_com Corentin Labbe
2020-09-22  5:14   ` Christoph Hellwig
2020-09-21 10:20 ` [PATCH RFT/RFC 25/49] staging: media: zoran: use ZR_NORM Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 26/49] staging: media: zoran: zoran does not support STD_ALL Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 27/49] staging: media: zoran: convert irq to pci irq Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 28/49] staging: media: zoran: convert zoran alloc to devm Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 29/49] staging: media: zoran: convert mdelay to udelay Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 30/49] staging: media: zoran: use devm for videocodec_master alloc Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 31/49] staging: media: zoran: use pci_request_regions Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 32/49] staging: media: zoran: use devm_ioremap Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 33/49] staging: media: zoran: add stat_com buffer Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 34/49] staging: media: zoran: constify struct tvnorm Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 35/49] staging: media: zoran: constify codec_name Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 36/49] staging: media: zoran: Add more check for compliance Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 37/49] staging: media: zoran: add fallthrough keyword Corentin Labbe
2020-09-21 10:59   ` Dan Carpenter
2020-09-24 18:03     ` LABBE Corentin
2020-09-21 10:20 ` [PATCH RFT/RFC 38/49] staging: media: zoran: Add vb_queue Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 39/49] staging: media: zoran: disable output Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 40/49] staging: media: zoran: device support only 32bit DMA address Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 41/49] staging: media: zoran: enable makefile Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 42/49] staging: media: zoran: remove framebuffer support Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 43/49] staging: media: zoran: add vidioc_g_parm Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 44/49] staging: media: zoran: remove test_interrupts Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 45/49] staging: media: zoran: fix use of buffer_size and sizeimage Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 46/49] staging: media: zoran: fix some compliance test Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 47/49] staging: media: zoran: remove deprecated .vidioc_g_jpegcomp Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 48/49] staging: media: zoran: convert to vb2 Corentin Labbe
2020-09-21 10:20 ` [PATCH RFT/RFC 49/49] staging: media: zoran: update TODO Corentin Labbe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1600683624-5863-21-git-send-email-clabbe@baylibre.com \
    --to=clabbe@baylibre.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=laurent.pinchart@skynet.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®