[PATCH libdrm 07/24] radeon: annotate the private symbols

2015-04-01 Thread Jerome Glisse
On Thu, Apr 02, 2015 at 11:48:25AM +0900, Michel Dänzer wrote:
> On 02.04.2015 01:15, Emil Velikov wrote:
> > They are less and easier to track than the public ones.
> 
> Grammar: s/less/fewer/
> 
> 
> Other than that, this patch and patch 8 are
> 
> Acked-by: Michel Dänzer 
> 
> though I'm not sure about the impact of Jerome's objection to previous
> patches on this one.

Yes same apply, adding drm specific define would break my cping of those
file to my tools. But if Emil feels like adding bofreplay to libdrm i do
not have any objection.

Thought using some macro trickery inside bof.h this can be work around.

Cheers,
Jérôme

> 
> 
> -- 
> Earthling Michel Dänzer   |   http://www.amd.com
> Libre software enthusiast | Mesa and X developer
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH libdrm 02/24] radeon: remove empty function declarations

2015-04-01 Thread Jerome Glisse
On Wed, Apr 01, 2015 at 11:04:45PM +0100, Emil Velikov wrote:
> On 1 April 2015 at 22:26, Jerome Glisse  wrote:
> > On Wed, Apr 01, 2015 at 09:57:40PM +0100, Emil Velikov wrote:
> >> On 1 April 2015 at 21:34, Emil Velikov  wrote:
> >> > On 1 April 2015 at 18:30, Jerome Glisse  wrote:
> >> >> On Wed, Apr 01, 2015 at 05:15:13PM +0100, Emil Velikov wrote:
> >> >>> Missing definition and unused since their introduction.
> >> >>>
> >> >>> Cc: Jerome Glisse 
> >> >>> Signed-off-by: Emil Velikov 
> >> >>
> >> >> NAK
> >> >>
> >> >> I use all this in tools to debug lockup. Best course of action is to
> >> >> exclude bof.h from being distributed. My tools static link and i just
> >> >> point them to libdrm git tree.
> >> >>
> >> > Did not notice any mention of such out-of-tree tools in the commit
> >> > that introduced these functions, so I've naively assumed that they are
> >> > unused.
> >> Scratch that - I'm blind.
> >>
> >> Upon closer look at your radeondb repo, I cannot see any static
> >> linking in there. Also it seems that some of the functionality is
> >> duplicated between the two. With the radeondb version being out of
> >> date :'(
> >
> > Yeah i guess i never pushed anywhere patches that did that, divergence btw
> > my memory and what is out there. All this symbol can just be hidden and
> > never exported. It would cleaner, but i still need the bof.h intact as i
> > tend to just cp it afaict into my local radeondb copy so that i am in
> > sync with libdrm code.
> >
> I can volunteer with the cleanup/integration of radeondb next to
> libdrm_radeon. If you update your repo (or push your work elsewhere),
> I could double-check, integrate and nuke the duplication. It will
> avoid the next person from coming over and trying to nuke things, the
> divergence mentioned, plus the copy/pasting of bof.[ch] every time you
> use the tool.
> 
> How does that sound ?

If you feel like it yes, but as i said i fear bof will stay relevant
only for the duration xf86-video-ati is and i fear with the advance
of the generic modesetting and glamor acceleration this might not last
long. As mesa is using a different scheme to allow capture and replay
of cs.

Anyway, the only tool that matter regarding bof is bofreplay from my
joujou repository

git://people.freedesktop.org/~glisse/joujou

I used to have a tool to allow bisecting bof cs but it might have been
lost in translation somewhere. Thought all is needed is a parameter to
bofreplay to limit the number of dwords replayed.

Happy coding if you decide to go down that road :)

Cheers,
Jérôme


> 
> Cheers,
> Emil


[PATCH v4 3/7] drm/tilcdc: Add support for external tda998x encoder

2015-04-01 Thread Russell King - ARM Linux
On Wed, Apr 01, 2015 at 11:49:27AM +0300, Jyri Sarha wrote:
> Add support for an external compontised DRM encoder. The external
> encoder can be connected to tilcdc trough device tree graph binding.
> The binding document for tilcdc has been updated. The current
> implementation supports only tda998x encoder.
> 
> To be able to filter out the unsupported video modes the tilcdc driver
> needs to hijack the external connectors helper functions. The tilcdc
> installes new helper functions that are otherwise identical to
> orignals, but the mode_valid() call-back check the mode first localy,
> before calling the original call-back. The tilcdc dirver restores the
> original helper functions before it is unbound from the external
> device.

This is where the DRM model is weak - we don't really have a way to
say "this is the set of CRTCs which /can/ be associated with this
connector, can any of the CRTCs accept this mode?" and eliminate
modes which fail that check.

This problem seems to be one which recurrs, so I wonder if it's
something which ought to be solved properly.

It's made slightly more difficult because we don't really know which
connectors could be associated with which CRTCs - that information is
stored at the encoder level (with the encoders possible_crtcs), and
I'm not sure we have a way for generic DRM code to know which encoders
could be associated with which connectors.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.


[PATCH libdrm 02/24] radeon: remove empty function declarations

2015-04-01 Thread Emil Velikov
On 1 April 2015 at 22:26, Jerome Glisse  wrote:
> On Wed, Apr 01, 2015 at 09:57:40PM +0100, Emil Velikov wrote:
>> On 1 April 2015 at 21:34, Emil Velikov  wrote:
>> > On 1 April 2015 at 18:30, Jerome Glisse  wrote:
>> >> On Wed, Apr 01, 2015 at 05:15:13PM +0100, Emil Velikov wrote:
>> >>> Missing definition and unused since their introduction.
>> >>>
>> >>> Cc: Jerome Glisse 
>> >>> Signed-off-by: Emil Velikov 
>> >>
>> >> NAK
>> >>
>> >> I use all this in tools to debug lockup. Best course of action is to
>> >> exclude bof.h from being distributed. My tools static link and i just
>> >> point them to libdrm git tree.
>> >>
>> > Did not notice any mention of such out-of-tree tools in the commit
>> > that introduced these functions, so I've naively assumed that they are
>> > unused.
>> Scratch that - I'm blind.
>>
>> Upon closer look at your radeondb repo, I cannot see any static
>> linking in there. Also it seems that some of the functionality is
>> duplicated between the two. With the radeondb version being out of
>> date :'(
>
> Yeah i guess i never pushed anywhere patches that did that, divergence btw
> my memory and what is out there. All this symbol can just be hidden and
> never exported. It would cleaner, but i still need the bof.h intact as i
> tend to just cp it afaict into my local radeondb copy so that i am in
> sync with libdrm code.
>
I can volunteer with the cleanup/integration of radeondb next to
libdrm_radeon. If you update your repo (or push your work elsewhere),
I could double-check, integrate and nuke the duplication. It will
avoid the next person from coming over and trying to nuke things, the
divergence mentioned, plus the copy/pasting of bof.[ch] every time you
use the tool.

How does that sound ?

Cheers,
Emil


[PATCH v2 1/4] break kconfig dependency loop

2015-04-01 Thread John Hunter
Hi Gerd,
I've read the patches about the virtio-gpu, it's a nice design.
As far as I know, there are two other drivers used by qemu, CIRRUS and
BOCHS.
I have a question about the relationship of these three drivers, is that
the virtio-gpu
designed to replace the other two drivers? I mean are the CIRRUS and BOCHS
going to be deprecated in the future?

Would you please kindly explain this a little bit?

Actually, this is a problem by *Martin Peres* who is the GSoC xorg
administor.
My proposal is "Convert the BOCHS and CIRRUS drivers to atomic
mode-setting".
Martin wonder if the two drivers are going to be deprecated, there is no
need for
me to do the job.

Best regards,
John

On Wed, Apr 1, 2015 at 9:15 PM, Gerd Hoffmann  wrote:

> After adding virtio-gpu I get this funky kconfig dependency loop.
>
> scripts/kconfig/conf --oldconfig Kconfig
> drivers/video/fbdev/Kconfig:5:error: recursive dependency detected!
> drivers/video/fbdev/Kconfig:5:  symbol FB is selected by DRM_KMS_FB_HELPER
> drivers/gpu/drm/Kconfig:34: symbol DRM_KMS_FB_HELPER is selected by
> DRM_VIRTIO_GPU
> drivers/gpu/drm/virtio/Kconfig:1:   symbol DRM_VIRTIO_GPU depends on
> VIRTIO
> drivers/virtio/Kconfig:1:   symbol VIRTIO is selected by REMOTEPROC
> drivers/remoteproc/Kconfig:4:   symbol REMOTEPROC is selected by
> OMAP_REMOTEPROC
> drivers/remoteproc/Kconfig:12:  symbol OMAP_REMOTEPROC depends on
> OMAP_IOMMU
> drivers/iommu/Kconfig:141:  symbol OMAP_IOMMU is selected by
> VIDEO_OMAP3
> drivers/media/platform/Kconfig:96:  symbol VIDEO_OMAP3 depends on
> VIDEO_V4L2
> drivers/media/v4l2-core/Kconfig:6:  symbol VIDEO_V4L2 depends on I2C
> drivers/i2c/Kconfig:7:  symbol I2C is selected by FB_DDC
> drivers/video/fbdev/Kconfig:59: symbol FB_DDC is selected by
> FB_CYBER2000_DDC
> drivers/video/fbdev/Kconfig:374:symbol FB_CYBER2000_DDC depends on
> FB_CYBER2000
> drivers/video/fbdev/Kconfig:362:symbol FB_CYBER2000 depends on FB
>
> Making VIDEO_OMAP3 depend on OMAP_IOMMU instead of selecting it breaks the
> loop, which looks like the best way to handle it to me.  I'm open to better
> suggestions though.
>
> Signed-off-by: Gerd Hoffmann 
> ---
>  drivers/media/platform/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/Kconfig
> b/drivers/media/platform/Kconfig
> index d9b872b..fc21734 100644
> --- a/drivers/media/platform/Kconfig
> +++ b/drivers/media/platform/Kconfig
> @@ -87,8 +87,8 @@ config VIDEO_OMAP3
> tristate "OMAP 3 Camera support"
> depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3
> depends on HAS_DMA
> +   depends on OMAP_IOMMU
> select ARM_DMA_USE_IOMMU
> -   select OMAP_IOMMU
> select VIDEOBUF2_DMA_CONTIG
> ---help---
>   Driver for an OMAP 3 camera controller.
> --
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>



-- 
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science &Technology
Peking University
Beijing, 100871, PRC
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150401/2294ad8f/attachment.html>


[PATCH libdrm 02/24] radeon: remove empty function declarations

2015-04-01 Thread Emil Velikov
On 1 April 2015 at 21:34, Emil Velikov  wrote:
> On 1 April 2015 at 18:30, Jerome Glisse  wrote:
>> On Wed, Apr 01, 2015 at 05:15:13PM +0100, Emil Velikov wrote:
>>> Missing definition and unused since their introduction.
>>>
>>> Cc: Jerome Glisse 
>>> Signed-off-by: Emil Velikov 
>>
>> NAK
>>
>> I use all this in tools to debug lockup. Best course of action is to
>> exclude bof.h from being distributed. My tools static link and i just
>> point them to libdrm git tree.
>>
> Did not notice any mention of such out-of-tree tools in the commit
> that introduced these functions, so I've naively assumed that they are
> unused.
Scratch that - I'm blind.

Upon closer look at your radeondb repo, I cannot see any static
linking in there. Also it seems that some of the functionality is
duplicated between the two. With the radeondb version being out of
date :'(

-Emil


[pull] drm/msm: msm-next for 4.1

2015-04-01 Thread Rob Clark
Hi Dave,

Main pull request for 4.1 for msm.  Highlights:

1) support for "stolen mem" for splash-screen take-over
2) additional hdmi pixel clks
3) various pipe flush related fixes
4) support for snapdragon 410 (8x16)
5) support for DSI and dual-DSI

It includes one small patch to export tile-group functions (which was ack'd
by you), as these are used to explain to userspace dual-dsi configurations
(with left and right tile).

The following changes since commit 564b687b031ccc647943f946b93037cf0780612a:

  drm/bochs: disable video before changing video mode (2015-04-01
08:28:15 +1000)

are available in the git repository at:

  git://people.freedesktop.org/~robclark/linux msm-next

for you to fetch changes up to d5af49c92a8aff8236e7b0bb35e9af364000c017:

  drm/msm/mdp5: Enable DSI connector in msm drm driver (2015-04-01
19:29:38 -0400)


Hai Li (8):
  drm/msm/mdp5: Add pingpong entry to mdp5 config table
  drm/msm/mdp5: Update generated mdp5 header file with DSI support
  drm/msm/mdp5: Fix PIPE source image size settings
  drm/msm/dsi: Update generated DSI header file
  drm/msm/mdp5: Move *_modeset_init out of construct_encoder function
  drm/msm: Add split display interface
  drm/msm: Initial add DSI connector support
  drm/msm/mdp5: Enable DSI connector in msm drm driver

Rob Clark (4):
  drm/msm: split out vram initialization
  drm/msm: add support for "stolen" mem
  drm/msm/hdmi: add 74.176MHz and 154.0MHz pix clks
  drm: export tile-group functions

Stephane Viau (12):
  drm/msm/mdp5: only flush on a CRTC ->atomic_flush()
  drm/msm/mdp5: Update generated header files
  drm/msm/mdp5: Enhance operation mode for pipeline configuration
  drm/msm/mdp5: Add START signal to kick off certain pipelines
  drm/msm/mdp5: Make the intf connection in config module
  drm/msm/mdp5: Update headers (introduce MDP5 domain)
  drm/msm/mdp5: Separate MDP5 domain from MDSS domain
  drm/msm/mdp5: Update headers (remove enum mdp5_client_id)
  drm/msm/mdp5: Get SMP client list from mdp5_cfg
  drm/msm/mdp5: Add hardware configuration for msm8x16
  drm/msm/mdp5: Update headers (add CTL flush bits)
  drm/msm/mdp5: Remove CTL flush dummy bits

 drivers/gpu/drm/drm_crtc.c  |2 +
 drivers/gpu/drm/msm/Kconfig |   11 +
 drivers/gpu/drm/msm/Makefile|5 +
 drivers/gpu/drm/msm/dsi/dsi.c   |  212 +++
 drivers/gpu/drm/msm/dsi/dsi.h   |  117 ++
 drivers/gpu/drm/msm/dsi/dsi.xml.h   |  418 -
 drivers/gpu/drm/msm/dsi/dsi_host.c  | 1993 +++
 drivers/gpu/drm/msm/dsi/dsi_manager.c   |  705 
 drivers/gpu/drm/msm/dsi/dsi_phy.c   |  352 
 drivers/gpu/drm/msm/hdmi/hdmi_phy_8960.c|   34 +
 drivers/gpu/drm/msm/mdp/mdp5/mdp5.xml.h |  399 +++--
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c |  102 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h |   18 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c |  343 
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c|   86 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_ctl.c |  315 +++-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_ctl.h |   75 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c |   83 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_irq.c |   26 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c |  200 ++-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h |   75 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |4 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_smp.c |   64 +-
 drivers/gpu/drm/msm/msm_drv.c   |  100 +-
 drivers/gpu/drm/msm/msm_drv.h   |   29 +
 drivers/gpu/drm/msm/msm_fbdev.c |3 +-
 drivers/gpu/drm/msm/msm_gem.c   |   25 +-
 drivers/gpu/drm/msm/msm_gem.h   |5 +-
 drivers/gpu/drm/msm/msm_kms.h   |4 +
 29 files changed, 5327 insertions(+), 478 deletions(-)
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi.c
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi.h
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi_host.c
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi_manager.c
 create mode 100644 drivers/gpu/drm/msm/dsi/dsi_phy.c
 create mode 100644 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c


[PATCH libdrm 02/24] radeon: remove empty function declarations

2015-04-01 Thread Emil Velikov
On 1 April 2015 at 18:30, Jerome Glisse  wrote:
> On Wed, Apr 01, 2015 at 05:15:13PM +0100, Emil Velikov wrote:
>> Missing definition and unused since their introduction.
>>
>> Cc: Jerome Glisse 
>> Signed-off-by: Emil Velikov 
>
> NAK
>
> I use all this in tools to debug lockup. Best course of action is to
> exclude bof.h from being distributed. My tools static link and i just
> point them to libdrm git tree.
>
Did not notice any mention of such out-of-tree tools in the commit
that introduced these functions, so I've naively assumed that they are
unused. Sorry about that. Do you mind if I add a note about it, or
alternatively will you be ok with pushing your tool to libdrm ? The
Intel team already have a test_decode tool in, which is similar in
nature.

I'm not sure that your suggestion will work - one cannot exclude bof.h
(and bof.c) from the distribution as it's used by radeon_cs_gem.c.
Annotating the symbols as hidden/private should work for everyone. How
does that sound ?

...
>> -extern int bof_file_flush(bof_t *root);
>> -extern bof_t *bof_file_new(const char *filename);
>> -extern int bof_object_dump(bof_t *object, const char *filename);
>> -
Can you please elaborate how you are using these three, do you have
them implemented outside of libdrm as well ?

Cheers,
Emil


[PULL] vmwgfx-next

2015-04-01 Thread Thomas Hellstrom
Dave,

I see you haven't pulled this one yet. Please don't do that as there is
a problem with fbdev and screen targets.
I'll resend a pull request when the code is fixed.

Thanks,
Thomas


On 03/11/2015 08:02 PM, Thomas Hellstrom wrote:
> Dave,
>
> The first pull request for 4.1. Mainly Sinclair's screen target work.
>
> The following changes since commit 03be70050c85768e9ce7c0d0887110d1b629e127:
>
>   Merge tag 'topic/drm-misc-2015-03-10' of 
> git://anongit.freedesktop.org/drm-intel into drm-next (2015-03-11 12:15:06 
> +1000)
>
> are available in the git repository at:
>
>   git://people.freedesktop.org/~thomash 
>
> for you to fetch changes up to 51850be6365084dc3ff6516bb9d89c6d7e3a98f1:
>
>   drm/ttm: Add lockdep annotation to the TTM lock (2015-03-11 11:57:40 -0700)
>
> 
> Sinclair Yeh (4):
>   drm/vmwgfx: SVGA device definition update
>   drm/vmwgfx: Refactor vmw_gb_surface_define_ioctl()
>   drm/vmwgfx: Major KMS refactoring / cleanup in preparation of screen 
> targets
>   drm/vmwgfx: Implement screen targets
>
> Thomas Hellstrom (3):
>   drm/vmwgfx: Add an interface to pin a resource v3
>   drm/vmwgfx: Add "quirk" to handling command verification exceptions
>   drm/ttm: Add lockdep annotation to the TTM lock
>
>  drivers/gpu/drm/ttm/ttm_lock.c  |   73 +-
>  drivers/gpu/drm/vmwgfx/Makefile |2 +-
>  drivers/gpu/drm/vmwgfx/svga3d_reg.h |   56 +-
>  drivers/gpu/drm/vmwgfx/svga3d_surfacedefs.h |   67 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |   21 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_drv.h |   52 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c |   10 +
>  drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c|4 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c   |4 +
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |  608 +++-
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.h |   97 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c |   45 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_mob.c |3 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c |6 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_resource.c|   91 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c|  433 -
>  drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c| 1360 
> +++
>  drivers/gpu/drm/vmwgfx/vmwgfx_surface.c |  199 ++--
>  include/drm/ttm/ttm_lock.h  |   13 +-
>  include/uapi/drm/vmwgfx_drm.h   |1 +
>  20 files changed, 2470 insertions(+), 675 deletions(-)
>  create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel



[PATCH 1/5] drm/i915: Fix for DP CTS test 4.2.2.5 - I2C DEFER handling

2015-04-01 Thread Ville Syrjälä
On Wed, Apr 01, 2015 at 10:52:58AM -0700, Todd Previte wrote:
> For test 4.2.2.5 to pass per the Link CTS Core 1.2 rev1.1 spec, the source
> device must attempt at least 7 times to read the EDID when it receives an
> I2C defer. The normal DRM code makes only 7 retries, regardless of whether
> or not the response is a native defer or an I2C defer. Test 4.2.2.5 fails
> since there are native defers interspersed with the I2C defers which
> results in less than 7 EDID read attempts.
> 
> The solution is to decrement the retry counter when an I2C DEFER is returned
> such that another read attempt will be made. This situation should normally
> only occur in compliance testing, however, as a worse case real-world
> scenario, it would result in 13 attempts ( 6 native defers, 7 I2C defers)
> for a single transaction to complete. The net result is a slightly slower
> response to an EDID read that shouldn't significantly impact overall
> performance.
> 
> Signed-off-by: Todd Previte 
> Cc: dri-devel at lists.freedesktop.org
> ---
>  drivers/gpu/drm/drm_dp_helper.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index 79968e3..0539758 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -469,6 +469,11 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, 
> struct drm_dp_aux_msg *msg)
>   case DP_AUX_I2C_REPLY_DEFER:
>   DRM_DEBUG_KMS("I2C defer\n");
>   aux->i2c_defer_count++;
> + /* DP Compliance Test 4.2.2.5 Requirement:
> +  * Must have at least 7 retries for I2C defers on the
> +  * transaction to pass this test
> +  */
> + retry--;

That could lead to an infinite loop. I think what we need to do is
count the native and i2c defers separately, and abort if either
exceeds the limit.

>   usleep_range(400, 500);
>   continue;
>  
> -- 
> 1.9.1
> 
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC


[PATCH drm] drm/vgem: vgem_gem_dumb_map() can be static

2015-04-01 Thread Joe Perches
On Thu, 2015-04-02 at 10:59 +0800, kbuild test robot wrote:
> Signed-off-by: Fengguang Wu 
[]
> diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
[]
> @@ -195,7 +195,7 @@ static int vgem_gem_dumb_create(struct drm_file *file, 
> struct drm_device *dev,
>   return 0;
>  }
>  
> -int vgem_gem_dumb_map(struct drm_file *file, struct drm_device *dev,
> +static int vgem_gem_dumb_map(struct drm_file *file, struct drm_device *dev,
> uint32_t handle, uint64_t *offset)

Hello Fengguang.

When you or your robot does these, can you please
make sure the entire statement is indented properly?

thanks,




[Bug 89785] GPU Fault 147 and Ring Stalls and Tests Fail in Pillars of Eternity

2015-04-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=89785

--- Comment #11 from Alex B  ---
I can confirm, patch from the last comment fixes this issue on my Radeon HD
7750.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150401/2fbef53d/attachment.html>


[Bug 89829] [bisected] radeonsi, commit 2cf48c creates artefacts in some applications (worst being Flash animations that are garbage)

2015-04-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=89829

--- Comment #6 from Laura Ekstrand  ---
Hi.

I installed google chrome on my Fedora 21 and ran it under my build of libGL.
The carousel at http://www.environnementestrie.ca/ worked just fine for me.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150401/2757cfed/attachment.html>


[Bug 89734] GL_AMD_pinned_memory extension causing a kernel hardlock

2015-04-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=89734

--- Comment #12 from poub365-bugzilla at yahoo.com ---
Created attachment 114821
  --> https://bugs.freedesktop.org/attachment.cgi?id=114821&action=edit
dmesg with patch

No idea if that helps, but just in case.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150401/9a3865ca/attachment.html>


[Bug 89734] GL_AMD_pinned_memory extension causing a kernel hardlock

2015-04-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=89734

--- Comment #11 from poub365-bugzilla at yahoo.com ---
Created attachment 114820
  --> https://bugs.freedesktop.org/attachment.cgi?id=114820&action=edit
screen flickers with patch

I tried the new patch.
I can exit now without freezing but I have a lot of artifacts (see video) in
the game but also on desktop (kde with opengl): the screen flickers a lot.
The dmesg will follow.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150401/9a749615/attachment.html>


[PATCH v2 1/4] break kconfig dependency loop

2015-04-01 Thread Gerd Hoffmann
On Mi, 2015-04-01 at 22:55 +0800, John Hunter wrote:
> Hi Gerd,
> I've read the patches about the virtio-gpu, it's a nice design.
> As far as I know, there are two other drivers used by qemu, CIRRUS and
> BOCHS.
> I have a question about the relationship of these three drivers, is
> that the virtio-gpu
> designed to replace the other two drivers? I mean are the CIRRUS and
> BOCHS
> going to be deprecated in the future?

qemu has a bunch of different virtual graphics cards, and these are the
drivers for them.  cirrus used to be the default gfx card until recently
(qemu older then version 2.2).  stdvga (bochs driver) is the current
default.  So expect them to be around for a while.

virtio-gpu will not replace them.

> Actually, this is a problem by Martin Peres who is the GSoC xorg
> administor. 
> My proposal is "Convert the BOCHS and CIRRUS drivers to atomic
> mode-setting".

Surely makes sense for bochs and you shouldn't find major blockers.
Not sure this is a reasonable task size for gsoc given it took me only a
few days to convert virtio-gpu to atomic modesetting.  But maybe fine if
you are new to drm kernel hacking and therefore the task includes
learning alot new stuff.

I have my doubts it'll work out for cirrus though, due to the small
amount of video memory it has (and other limitations, because we mimic
hardware from the 90ies here).  Current code is already swapping
framebuffers in and out of video ram because of that.  So atomic
modesetting, page flip, running wayland on that beast all is going to be
problematic I expect.

See also:
https://www.kraxel.org/blog/2014/10/qemu-using-cirrus-considered-harmful/

HTH,
  Gerd





[PATCH libdrm 02/24] radeon: remove empty function declarations

2015-04-01 Thread Jerome Glisse
On Wed, Apr 01, 2015 at 09:57:40PM +0100, Emil Velikov wrote:
> On 1 April 2015 at 21:34, Emil Velikov  wrote:
> > On 1 April 2015 at 18:30, Jerome Glisse  wrote:
> >> On Wed, Apr 01, 2015 at 05:15:13PM +0100, Emil Velikov wrote:
> >>> Missing definition and unused since their introduction.
> >>>
> >>> Cc: Jerome Glisse 
> >>> Signed-off-by: Emil Velikov 
> >>
> >> NAK
> >>
> >> I use all this in tools to debug lockup. Best course of action is to
> >> exclude bof.h from being distributed. My tools static link and i just
> >> point them to libdrm git tree.
> >>
> > Did not notice any mention of such out-of-tree tools in the commit
> > that introduced these functions, so I've naively assumed that they are
> > unused.
> Scratch that - I'm blind.
> 
> Upon closer look at your radeondb repo, I cannot see any static
> linking in there. Also it seems that some of the functionality is
> duplicated between the two. With the radeondb version being out of
> date :'(

Yeah i guess i never pushed anywhere patches that did that, divergence btw
my memory and what is out there. All this symbol can just be hidden and
never exported. It would cleaner, but i still need the bof.h intact as i
tend to just cp it afaict into my local radeondb copy so that i am in
sync with libdrm code.

Cheers,
Jérôme

> 
> -Emil


[PATCH libdrm 02/24] radeon: remove empty function declarations

2015-04-01 Thread Jerome Glisse
On Wed, Apr 01, 2015 at 09:34:05PM +0100, Emil Velikov wrote:
> On 1 April 2015 at 18:30, Jerome Glisse  wrote:
> > On Wed, Apr 01, 2015 at 05:15:13PM +0100, Emil Velikov wrote:
> >> Missing definition and unused since their introduction.
> >>
> >> Cc: Jerome Glisse 
> >> Signed-off-by: Emil Velikov 
> >
> > NAK
> >
> > I use all this in tools to debug lockup. Best course of action is to
> > exclude bof.h from being distributed. My tools static link and i just
> > point them to libdrm git tree.
> >
> Did not notice any mention of such out-of-tree tools in the commit
> that introduced these functions, so I've naively assumed that they are
> unused. Sorry about that. Do you mind if I add a note about it, or
> alternatively will you be ok with pushing your tool to libdrm ? The
> Intel team already have a test_decode tool in, which is similar in
> nature.

It would need cleanup before this can happen, saddly my schedule is kind
of full for foreseeable future. So i do not want to commit to do such thing.
But i definitly use the bof feature, last time was a month or so ago to
debug something. It have been very usefull to me in the past and i expect
for as long as the radeon ddx stays releavant it will be in the future.

But with the advance of the modesetting ddx and glamor, the tracing that
does exist in mesa will be as easy as the bof tracing. If not easier. So
i am not sure of the value there is into putting effort into this.

This kind of feature is really usefull when debugging lockup, at least
this allow me to bisect offend command stream to pin point the last
dword before lockup and thus get a clue about what kind of cmd is the
root cause. Dunno how others dev do such thing.

> I'm not sure that your suggestion will work - one cannot exclude bof.h
> (and bof.c) from the distribution as it's used by radeon_cs_gem.c.
> Annotating the symbols as hidden/private should work for everyone. How
> does that sound ?

I do not see how this is an issue, symbol needed by radeon_cs_gem can
be hidden from other and thus there is no point into shipping bof.h
Really no symbol need to be exported, iirc i tend to ln -s the bof
files in my tools or simply cp the lastest version from libdrm into
a local copy but i still need bof.h to have all symbol listed.

Cheers,
Jérôme

> 
> ...
> >> -extern int bof_file_flush(bof_t *root);
> >> -extern bof_t *bof_file_new(const char *filename);
> >> -extern int bof_object_dump(bof_t *object, const char *filename);
> >> -
> Can you please elaborate how you are using these three, do you have
> them implemented outside of libdrm as well ?
> 
> Cheers,
> Emil


[PATCH libdrm 24/24] drm: remove drm_public macro

2015-04-01 Thread Emil Velikov
Some compilers (like the Oracle Studio), require that the function
declaration must be annotated with the same visibility attribute as the
definition. As annotating functions with drm_public is no longer
required just remove the macro.

Cc: Ben Skeggs 
Cc: Damien Lespiau 
Cc: Maarten Lankhorst 
Cc: Michel Dänzer 
Cc: Rob Clark 
Cc: Thierry Reding 
Signed-off-by: Emil Velikov 
---
 configure.ac |  5 ++--
 exynos/exynos_drm.c  | 24 
 exynos/exynos_fimg2d.c   | 16 +--
 freedreno/freedreno_bo.c | 26 -
 freedreno/freedreno_device.c |  8 +++---
 freedreno/freedreno_pipe.c   |  8 +++---
 freedreno/freedreno_ringbuffer.c | 26 -
 freedreno/kgsl/kgsl_bo.c |  2 +-
 intel/intel_bufmgr.c | 60 
 intel/intel_bufmgr_fake.c| 16 +--
 intel/intel_bufmgr_gem.c | 52 +-
 intel/intel_decode.c | 14 +-
 libdrm_macros.h  |  2 --
 nouveau/bufctx.c | 10 +++
 nouveau/nouveau.c| 40 +--
 nouveau/pushbuf.c| 20 +++---
 omap/omap_drm.c  | 36 
 radeon/radeon_bo.c   | 28 +--
 radeon/radeon_bo_gem.c   | 16 +--
 radeon/radeon_cs.c   | 24 
 radeon/radeon_cs_gem.c   |  4 +--
 radeon/radeon_cs_space.c |  8 +++---
 radeon/radeon_surface.c  |  8 +++---
 tegra/tegra.c| 13 -
 24 files changed, 225 insertions(+), 241 deletions(-)

diff --git a/configure.ac b/configure.ac
index c25a813..e715262 100644
--- a/configure.ac
+++ b/configure.ac
@@ -403,14 +403,13 @@ AC_ARG_WITH([kernel-source],
[kernel_source="$with_kernel_source"])
 AC_SUBST(kernel_source)

-AC_MSG_CHECKING([whether $CC supports __attribute__((visibility))])
+AC_MSG_CHECKING([whether $CC supports __attribute__(("hidden"))])
 AC_LINK_IFELSE([AC_LANG_PROGRAM([
-int foo_default( void ) __attribute__((visibility("default")));
 int foo_hidden( void ) __attribute__((visibility("hidden")));
 ])], HAVE_ATTRIBUTE_VISIBILITY="yes"; AC_MSG_RESULT([yes]), 
AC_MSG_RESULT([no]));

 if test "x$HAVE_ATTRIBUTE_VISIBILITY" = xyes; then
-AC_DEFINE(HAVE_VISIBILITY, 1, [Compiler supports 
__attribute__((visibility))])
+AC_DEFINE(HAVE_VISIBILITY, 1, [Compiler supports 
__attribute__(("hidden"))])
 fi

 AC_SUBST(WARN_CFLAGS)
diff --git a/exynos/exynos_drm.c b/exynos/exynos_drm.c
index 5d07ea7..df9b8ed 100644
--- a/exynos/exynos_drm.c
+++ b/exynos/exynos_drm.c
@@ -49,7 +49,7 @@
  *
  * if true, return the device object else NULL.
  */
-drm_public struct exynos_device * exynos_device_create(int fd)
+struct exynos_device * exynos_device_create(int fd)
 {
struct exynos_device *dev;

@@ -70,7 +70,7 @@ drm_public struct exynos_device * exynos_device_create(int fd)
  *
  * @dev: exynos drm device object.
  */
-drm_public void exynos_device_destroy(struct exynos_device *dev)
+void exynos_device_destroy(struct exynos_device *dev)
 {
free(dev);
 }
@@ -88,7 +88,7 @@ drm_public void exynos_device_destroy(struct exynos_device 
*dev)
  *
  * if true, return a exynos buffer object else NULL.
  */
-drm_public struct exynos_bo * exynos_bo_create(struct exynos_device *dev,
+struct exynos_bo * exynos_bo_create(struct exynos_device *dev,
   size_t size, uint32_t flags)
 {
struct exynos_bo *bo;
@@ -142,7 +142,7 @@ fail:
  *
  * if true, return 0 else negative.
  */
-drm_public int exynos_bo_get_info(struct exynos_device *dev, uint32_t handle,
+int exynos_bo_get_info(struct exynos_device *dev, uint32_t handle,
  size_t *size, uint32_t *flags)
 {
int ret;
@@ -168,7 +168,7 @@ drm_public int exynos_bo_get_info(struct exynos_device 
*dev, uint32_t handle,
  *
  * @bo: a exynos buffer object to be destroyed.
  */
-drm_public void exynos_bo_destroy(struct exynos_bo *bo)
+void exynos_bo_destroy(struct exynos_bo *bo)
 {
if (!bo)
return;
@@ -200,7 +200,7 @@ drm_public void exynos_bo_destroy(struct exynos_bo *bo)
  * if true, return a exynos buffer object else NULL.
  *
  */
-drm_public struct exynos_bo *
+struct exynos_bo *
 exynos_bo_from_name(struct exynos_device *dev, uint32_t name)
 {
struct exynos_bo *bo;
@@ -243,7 +243,7 @@ err_free_bo:
  *
  * if true, return 0 else negative.
  */
-drm_public int exynos_bo_get_name(struct exynos_bo *bo, uint32_t *name)
+int exynos_bo_get_name(struct exynos_bo *bo, uint32_t *name)
 {
if (!bo->name) {
struct drm_gem_flink req = {
@@ -266,7 +266,7 @@ drm_public int exynos_bo_get_name(struct exynos_bo *bo, 
uint32_t *name)
return 0;
 }

-drm_public uint32_t exynos_bo_handle(struct exynos_bo *bo)
+uint32_t ex

[PATCH libdrm 23/24] drm: remove no longer needed VISIBILITY_CFLAGS

2015-04-01 Thread Emil Velikov
With earlier commits we've annotated the private symbols, thus
we no longer require the -fvisibility=hidden CFLAGS.

Cc: Ben Skeggs 
Cc: Damien Lespiau 
Cc: Maarten Lankhorst 
Cc: Michel Dänzer 
Cc: Rob Clark 
Cc: Thierry Reding 
Signed-off-by: Emil Velikov 
---
 configure.ac  | 15 ---
 exynos/Makefile.am|  1 -
 freedreno/Makefile.am |  1 -
 intel/Makefile.am |  1 -
 nouveau/Makefile.am   |  1 -
 omap/Makefile.am  |  1 -
 radeon/Makefile.am|  1 -
 tegra/Makefile.am |  1 -
 8 files changed, 22 deletions(-)

diff --git a/configure.ac b/configure.ac
index 76cf91e..c25a813 100644
--- a/configure.ac
+++ b/configure.ac
@@ -403,21 +403,6 @@ AC_ARG_WITH([kernel-source],
[kernel_source="$with_kernel_source"])
 AC_SUBST(kernel_source)

-dnl Add flags for gcc and g++
-if test "x$GCC" = xyes; then
-# Enable -fvisibility=hidden if using a gcc that supports it
-save_CFLAGS="$CFLAGS"
-AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
-VISIBILITY_CFLAGS="-fvisibility=hidden"
-CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
-AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
-   [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);
-
-# Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
-CFLAGS=$save_CFLAGS
-AC_SUBST([VISIBILITY_CFLAGS])
-fi
-
 AC_MSG_CHECKING([whether $CC supports __attribute__((visibility))])
 AC_LINK_IFELSE([AC_LANG_PROGRAM([
 int foo_default( void ) __attribute__((visibility("default")));
diff --git a/exynos/Makefile.am b/exynos/Makefile.am
index 0136a61..f99f898 100644
--- a/exynos/Makefile.am
+++ b/exynos/Makefile.am
@@ -1,6 +1,5 @@
 AM_CFLAGS = \
$(WARN_CFLAGS) \
-   $(VISIBILITY_CFLAGS) \
-I$(top_srcdir) \
$(PTHREADSTUBS_CFLAGS) \
-I$(top_srcdir)/include/drm
diff --git a/freedreno/Makefile.am b/freedreno/Makefile.am
index 27e6aa6..0720867 100644
--- a/freedreno/Makefile.am
+++ b/freedreno/Makefile.am
@@ -3,7 +3,6 @@ include Makefile.sources

 AM_CFLAGS = \
$(WARN_CFLAGS) \
-   $(VISIBILITY_CFLAGS) \
-I$(top_srcdir) \
$(PTHREADSTUBS_CFLAGS) \
-I$(top_srcdir)/include/drm
diff --git a/intel/Makefile.am b/intel/Makefile.am
index 09bfbae..de3baab 100644
--- a/intel/Makefile.am
+++ b/intel/Makefile.am
@@ -26,7 +26,6 @@ include Makefile.sources

 AM_CFLAGS = \
$(WARN_CFLAGS) \
-   $(VISIBILITY_CFLAGS) \
-I$(top_srcdir) \
$(PTHREADSTUBS_CFLAGS) \
$(PCIACCESS_CFLAGS) \
diff --git a/nouveau/Makefile.am b/nouveau/Makefile.am
index 2f61351..25ea6dc 100644
--- a/nouveau/Makefile.am
+++ b/nouveau/Makefile.am
@@ -2,7 +2,6 @@ include Makefile.sources

 AM_CFLAGS = \
$(WARN_CFLAGS) \
-   $(VISIBILITY_CFLAGS) \
-I$(top_srcdir) \
$(PTHREADSTUBS_CFLAGS) \
-I$(top_srcdir)/include/drm \
diff --git a/omap/Makefile.am b/omap/Makefile.am
index b34fba6..599bb9d 100644
--- a/omap/Makefile.am
+++ b/omap/Makefile.am
@@ -1,6 +1,5 @@
 AM_CFLAGS = \
$(WARN_CFLAGS) \
-   $(VISIBILITY_CFLAGS) \
-I$(top_srcdir) \
$(PTHREADSTUBS_CFLAGS) \
-I$(top_srcdir)/include/drm
diff --git a/radeon/Makefile.am b/radeon/Makefile.am
index 54abd9e..ab3cd08 100644
--- a/radeon/Makefile.am
+++ b/radeon/Makefile.am
@@ -26,7 +26,6 @@ include Makefile.sources

 AM_CFLAGS = \
$(WARN_CFLAGS) \
-   $(VISIBILITY_CFLAGS) \
-I$(top_srcdir) \
$(PTHREADSTUBS_CFLAGS) \
-I$(top_srcdir)/include/drm
diff --git a/tegra/Makefile.am b/tegra/Makefile.am
index efa14f9..fb40be5 100644
--- a/tegra/Makefile.am
+++ b/tegra/Makefile.am
@@ -4,7 +4,6 @@ AM_CPPFLAGS = \

 AM_CFLAGS = \
@PTHREADSTUBS_CFLAGS@ \
-   $(VISIBILITY_CFLAGS) \
$(WARN_CFLAGS)

 libdrm_tegra_ladir = $(libdir)
-- 
2.3.1



[PATCH libdrm 22/24] drm: rename libdrm{,_macros}.h

2015-04-01 Thread Emil Velikov
Provide a more meaningful name, considering what it does.

Signed-off-by: Emil Velikov 
---
 Makefile.sources   |  2 +-
 exynos/exynos_drm.c|  2 +-
 exynos/exynos_fimg2d.c |  2 +-
 freedreno/freedreno_priv.h |  2 +-
 intel/intel_bufmgr.c   |  2 +-
 intel/intel_bufmgr_fake.c  |  2 +-
 intel/intel_bufmgr_gem.c   |  2 +-
 intel/intel_decode.c   |  2 +-
 intel/mm.c |  2 +-
 intel/mm.h |  2 +-
 intel/test_decode.c|  2 +-
 libdrm.h   | 89 --
 libdrm_macros.h| 89 ++
 libkms/api.c   |  2 +-
 libkms/dumb.c  |  2 +-
 libkms/exynos.c|  2 +-
 libkms/intel.c |  2 +-
 libkms/internal.h  |  2 +-
 libkms/linux.c |  2 +-
 libkms/nouveau.c   |  2 +-
 libkms/radeon.c|  2 +-
 libkms/vmwgfx.c|  2 +-
 nouveau/nouveau.c  |  2 +-
 nouveau/private.h  |  2 +-
 omap/omap_drm.c|  2 +-
 radeon/bof.h   |  2 +-
 radeon/radeon_bo.c |  2 +-
 radeon/radeon_bo_gem.c |  2 +-
 radeon/radeon_cs.c |  2 +-
 radeon/radeon_cs_gem.c |  2 +-
 radeon/radeon_cs_space.c   |  2 +-
 radeon/radeon_surface.c|  6 ++--
 tegra/private.h|  2 +-
 tests/modetest/buffers.c   |  2 +-
 xf86drm.c  |  2 +-
 35 files changed, 124 insertions(+), 124 deletions(-)
 delete mode 100644 libdrm.h
 create mode 100644 libdrm_macros.h

diff --git a/Makefile.sources b/Makefile.sources
index 566f7b5..8747ccd 100644
--- a/Makefile.sources
+++ b/Makefile.sources
@@ -5,7 +5,7 @@ LIBDRM_FILES := \
xf86drmSL.c \
xf86drmMode.c \
xf86atomic.h \
-   libdrm.h \
+   libdrm_macros.h \
libdrm_lists.h

 LIBDRM_H_FILES := \
diff --git a/exynos/exynos_drm.c b/exynos/exynos_drm.c
index c5dd948..5d07ea7 100644
--- a/exynos/exynos_drm.c
+++ b/exynos/exynos_drm.c
@@ -38,7 +38,7 @@

 #include 

-#include "libdrm.h"
+#include "libdrm_macros.h"
 #include "exynos_drm.h"
 #include "exynos_drmif.h"

diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
index fc605ed..cb422e8 100644
--- a/exynos/exynos_fimg2d.c
+++ b/exynos/exynos_fimg2d.c
@@ -24,7 +24,7 @@

 #include 

-#include "libdrm.h"
+#include "libdrm_macros.h"
 #include "exynos_drm.h"
 #include "fimg2d_reg.h"
 #include "exynos_fimg2d.h"
diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h
index 2d0fa6d..3c194fb 100644
--- a/freedreno/freedreno_priv.h
+++ b/freedreno/freedreno_priv.h
@@ -44,7 +44,7 @@
 #include 
 #include 

-#include "libdrm.h"
+#include "libdrm_macros.h"
 #include "xf86drm.h"
 #include "xf86atomic.h"

diff --git a/intel/intel_bufmgr.c b/intel/intel_bufmgr.c
index 234cd13..a95771d 100644
--- a/intel/intel_bufmgr.c
+++ b/intel/intel_bufmgr.c
@@ -37,7 +37,7 @@
 #include 
 #include 
 #include 
-#include "libdrm.h"
+#include "libdrm_macros.h"
 #include "intel_bufmgr.h"
 #include "intel_bufmgr_priv.h"
 #include "xf86drm.h"
diff --git a/intel/intel_bufmgr_fake.c b/intel/intel_bufmgr_fake.c
index c4828fa..d0c2d74 100644
--- a/intel/intel_bufmgr_fake.c
+++ b/intel/intel_bufmgr_fake.c
@@ -49,7 +49,7 @@
 #include "drm.h"
 #include "i915_drm.h"
 #include "mm.h"
-#include "libdrm.h"
+#include "libdrm_macros.h"
 #include "libdrm_lists.h"

 /* Support gcc's __FUNCTION__ for people using other compilers */
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 5a67f53..201da08 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -56,7 +56,7 @@
 #ifndef ETIME
 #define ETIME ETIMEDOUT
 #endif
-#include "libdrm.h"
+#include "libdrm_macros.h"
 #include "libdrm_lists.h"
 #include "intel_bufmgr.h"
 #include "intel_bufmgr_priv.h"
diff --git a/intel/intel_decode.c b/intel/intel_decode.c
index 7d5cbe5..8759760 100644
--- a/intel/intel_decode.c
+++ b/intel/intel_decode.c
@@ -33,7 +33,7 @@
 #include 
 #include 

-#include "libdrm.h"
+#include "libdrm_macros.h"
 #include "xf86drm.h"
 #include "intel_chipset.h"
 #include "intel_bufmgr.h"
diff --git a/intel/mm.c b/intel/mm.c
index 9c67660..954e9dc 100644
--- a/intel/mm.c
+++ b/intel/mm.c
@@ -30,7 +30,7 @@
 #include 

 #include "xf86drm.h"
-#include "libdrm.h"
+#include "libdrm_macros.h"
 #include "mm.h"

 drm_private void mmDumpMemInfo(const struct mem_block *heap)
diff --git a/intel/mm.h b/intel/mm.h
index 01813a5..8d83743 100644
--- a/intel/mm.h
+++ b/intel/mm.h
@@ -33,7 +33,7 @@
 #include "config.h"
 #endif

-#include "libdrm.h"
+#include "libdrm_macros.h"

 struct mem_block {
struct mem_block *next, *prev;
diff --git a/intel/test_decode.c b/intel/test_decode.c
index 93f47ef..bef86bb 100644
--- a/intel/test_decode.c
+++ b/intel/test_decode.c
@@ -34,7 +34,7 @@
 #include 
 #include 

-#include "libdrm.h"
+#include "libdrm_macros.h"
 #include "intel_bufmgr.h"
 #include "intel_chipset.h"

diff --git a/libdrm.h b/libdrm.h
deleted file 

[PATCH libdrm 21/24] tegra: add symbols test

2015-04-01 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 tegra/Makefile.am|  3 +++
 tegra/tegra-symbol-check | 30 ++
 2 files changed, 33 insertions(+)
 create mode 100755 tegra/tegra-symbol-check

diff --git a/tegra/Makefile.am b/tegra/Makefile.am
index a647487..efa14f9 100644
--- a/tegra/Makefile.am
+++ b/tegra/Makefile.am
@@ -21,3 +21,6 @@ libdrm_tegrainclude_HEADERS = tegra.h

 pkgconfigdir = @pkgconfigdir@
 pkgconfig_DATA = libdrm_tegra.pc
+
+TESTS = tegra-symbol-check
+EXTRA_DIST = $(TESTS)
diff --git a/tegra/tegra-symbol-check b/tegra/tegra-symbol-check
new file mode 100755
index 000..4020831
--- /dev/null
+++ b/tegra/tegra-symbol-check
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# The following symbols (past the first five) are taken from the public 
headers.
+# A list of the latter should be available 
Makefile.sources/LIBDRM_FREEDRENO_H_FILES
+
+FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_tegra.so} | awk 
'{print $3}'| while read func; do
+( grep -q "^$func$" || echo $func )  <

[PATCH libdrm 20/24] omap: add symbols test

2015-04-01 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 omap/Makefile.am   |  3 +++
 omap/omap-symbol-check | 35 +++
 2 files changed, 38 insertions(+)
 create mode 100755 omap/omap-symbol-check

diff --git a/omap/Makefile.am b/omap/Makefile.am
index d6f5298..b34fba6 100644
--- a/omap/Makefile.am
+++ b/omap/Makefile.am
@@ -20,3 +20,6 @@ libdrm_omapinclude_HEADERS = omap_drmif.h

 pkgconfigdir = @pkgconfigdir@
 pkgconfig_DATA = libdrm_omap.pc
+
+TESTS = omap-symbol-check
+EXTRA_DIST = $(TESTS)
diff --git a/omap/omap-symbol-check b/omap/omap-symbol-check
new file mode 100755
index 000..759c84b
--- /dev/null
+++ b/omap/omap-symbol-check
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# The following symbols (past the first five) are taken from the public 
headers.
+# A list of the latter should be available Makefile.am/libdrm_omap*HEADERS
+
+FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_omap.so} | awk 
'{print $3}'| while read func; do
+( grep -q "^$func$" || echo $func )  <

[PATCH libdrm 19/24] exynos: add symbols test

2015-04-01 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 exynos/Makefile.am |  3 +++
 exynos/exynos-symbol-check | 37 +
 2 files changed, 40 insertions(+)
 create mode 100755 exynos/exynos-symbol-check

diff --git a/exynos/Makefile.am b/exynos/Makefile.am
index a9da0ff..0136a61 100644
--- a/exynos/Makefile.am
+++ b/exynos/Makefile.am
@@ -23,3 +23,6 @@ libdrm_exynosinclude_HEADERS = exynos_drmif.h

 pkgconfigdir = @pkgconfigdir@
 pkgconfig_DATA = libdrm_exynos.pc
+
+TESTS = exynos-symbol-check
+EXTRA_DIST = $(TESTS)
diff --git a/exynos/exynos-symbol-check b/exynos/exynos-symbol-check
new file mode 100755
index 000..1a1be89
--- /dev/null
+++ b/exynos/exynos-symbol-check
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+# The following symbols (past the first five) are taken from the public 
headers.
+# A list of the latter should be available Makefile.am/libdrm_exynos*_HEADERS
+
+FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_exynos.so} | awk 
'{print $3}'| while read func; do
+( grep -q "^$func$" || echo $func )  <

[PATCH libdrm 18/24] libkms: add symbols test

2015-04-01 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 libkms/Makefile.am  |  3 ++-
 libkms/kms-symbol-check | 25 +
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100755 libkms/kms-symbol-check

diff --git a/libkms/Makefile.am b/libkms/Makefile.am
index 4baf4fc..6c0ab7a 100644
--- a/libkms/Makefile.am
+++ b/libkms/Makefile.am
@@ -43,4 +43,5 @@ libkmsinclude_HEADERS = $(LIBKMS_H_FILES)
 pkgconfigdir = @pkgconfigdir@
 pkgconfig_DATA = libkms.pc

-EXTRA_DIST = Android.mk
+TESTS = kms-symbol-check
+EXTRA_DIST = Android.mk $(TESTS)
diff --git a/libkms/kms-symbol-check b/libkms/kms-symbol-check
new file mode 100755
index 000..658b269
--- /dev/null
+++ b/libkms/kms-symbol-check
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# The following symbols (past the first five) are taken from the public 
headers.
+# A list of the latter should be available Makefile.sources/LIBKMS_H_FILES
+
+FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libkms.so} | awk '{print 
$3}'| while read func; do
+( grep -q "^$func$" || echo $func )  <

[PATCH libdrm 17/24] libkms: annotate private symbols

2015-04-01 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 libkms/api.c  |  3 +++
 libkms/dumb.c |  2 +-
 libkms/exynos.c   |  2 +-
 libkms/intel.c|  2 +-
 libkms/internal.h | 19 ---
 libkms/linux.c|  4 ++--
 libkms/nouveau.c  |  2 +-
 libkms/radeon.c   |  2 +-
 libkms/vmwgfx.c   |  2 +-
 9 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/libkms/api.c b/libkms/api.c
index b512c42..a07a242 100644
--- a/libkms/api.c
+++ b/libkms/api.c
@@ -29,9 +29,12 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+
 #include 
 #include 
 #include 
+
+#include "libdrm.h"
 #include "internal.h"

 int kms_create(int fd, struct kms_driver **out)
diff --git a/libkms/dumb.c b/libkms/dumb.c
index f9c16e1..e252d8c 100644
--- a/libkms/dumb.c
+++ b/libkms/dumb.c
@@ -190,7 +190,7 @@ dumb_bo_destroy(struct kms_bo *_bo)
return 0;
 }

-int
+drm_private int
 dumb_create(int fd, struct kms_driver **out)
 {
struct kms_driver *kms;
diff --git a/libkms/exynos.c b/libkms/exynos.c
index 1123482..db65f81 100644
--- a/libkms/exynos.c
+++ b/libkms/exynos.c
@@ -185,7 +185,7 @@ exynos_bo_destroy(struct kms_bo *_bo)
return 0;
 }

-int
+drm_private int
 exynos_create(int fd, struct kms_driver **out)
 {
struct kms_driver *kms;
diff --git a/libkms/intel.c b/libkms/intel.c
index 51a7fd2..a539df2 100644
--- a/libkms/intel.c
+++ b/libkms/intel.c
@@ -216,7 +216,7 @@ intel_bo_destroy(struct kms_bo *_bo)
return 0;
 }

-int
+drm_private int
 intel_create(int fd, struct kms_driver **out)
 {
struct kms_driver *kms;
diff --git a/libkms/internal.h b/libkms/internal.h
index f831b57..e7d5c46 100644
--- a/libkms/internal.h
+++ b/libkms/internal.h
@@ -29,6 +29,11 @@
 #ifndef INTERNAL_H_
 #define INTERNAL_H_

+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "libdrm.h"
 #include "libkms.h"

 struct kms_driver
@@ -62,18 +67,18 @@ struct kms_bo
unsigned handle;
 };

-int linux_create(int fd, struct kms_driver **out);
+drm_private int linux_create(int fd, struct kms_driver **out);

-int vmwgfx_create(int fd, struct kms_driver **out);
+drm_private int vmwgfx_create(int fd, struct kms_driver **out);

-int intel_create(int fd, struct kms_driver **out);
+drm_private int intel_create(int fd, struct kms_driver **out);

-int dumb_create(int fd, struct kms_driver **out);
+drm_private int dumb_create(int fd, struct kms_driver **out);

-int nouveau_create(int fd, struct kms_driver **out);
+drm_private int nouveau_create(int fd, struct kms_driver **out);

-int radeon_create(int fd, struct kms_driver **out);
+drm_private int radeon_create(int fd, struct kms_driver **out);

-int exynos_create(int fd, struct kms_driver **out);
+drm_private int exynos_create(int fd, struct kms_driver **out);

 #endif
diff --git a/libkms/linux.c b/libkms/linux.c
index 77a0bbe..06dbc42 100644
--- a/libkms/linux.c
+++ b/libkms/linux.c
@@ -39,9 +39,9 @@
 #include 
 #include 
 #include 
-
 #include 

+#include "libdrm.h"
 #include "internal.h"

 #define PATH_SIZE 512
@@ -225,7 +225,7 @@ linux_from_udev(int fd, struct kms_driver **out)
 }
 #endif

-int
+drm_private int
 linux_create(int fd, struct kms_driver **out)
 {
if (!dumb_create(fd, out))
diff --git a/libkms/nouveau.c b/libkms/nouveau.c
index 228903f..7f57f21 100644
--- a/libkms/nouveau.c
+++ b/libkms/nouveau.c
@@ -198,7 +198,7 @@ nouveau_bo_destroy(struct kms_bo *_bo)
return 0;
 }

-int
+drm_private int
 nouveau_create(int fd, struct kms_driver **out)
 {
struct kms_driver *kms;
diff --git a/libkms/radeon.c b/libkms/radeon.c
index 9383a0a..f0d5db6 100644
--- a/libkms/radeon.c
+++ b/libkms/radeon.c
@@ -219,7 +219,7 @@ radeon_bo_destroy(struct kms_bo *_bo)
return 0;
 }

-int
+drm_private int
 radeon_create(int fd, struct kms_driver **out)
 {
struct kms_driver *kms;
diff --git a/libkms/vmwgfx.c b/libkms/vmwgfx.c
index bc04133..3c99ea3 100644
--- a/libkms/vmwgfx.c
+++ b/libkms/vmwgfx.c
@@ -185,7 +185,7 @@ vmwgfx_bo_destroy(struct kms_bo *_bo)
return 0;
 }

-int
+drm_private int
 vmwgfx_create(int fd, struct kms_driver **out)
 {
struct kms_driver *kms;
-- 
2.3.1



[PATCH libdrm 16/24] nouveau: add symbols test

2015-04-01 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 nouveau/Makefile.am  |  3 ++-
 nouveau/nouveau-symbol-check | 52 
 2 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100755 nouveau/nouveau-symbol-check

diff --git a/nouveau/Makefile.am b/nouveau/Makefile.am
index 1ca235d..2f61351 100644
--- a/nouveau/Makefile.am
+++ b/nouveau/Makefile.am
@@ -21,4 +21,5 @@ libdrm_nouveauinclude_HEADERS = $(LIBDRM_NOUVEAU_H_FILES)
 pkgconfigdir = @pkgconfigdir@
 pkgconfig_DATA = libdrm_nouveau.pc

-EXTRA_DIST = Android.mk
+TESTS = nouveau-symbol-check
+EXTRA_DIST = Android.mk $(TESTS)
diff --git a/nouveau/nouveau-symbol-check b/nouveau/nouveau-symbol-check
new file mode 100755
index 000..0fef563
--- /dev/null
+++ b/nouveau/nouveau-symbol-check
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+# The following symbols (past the first five) are taken from the public 
headers.
+# A list of the latter should be available 
Makefile.sources/LIBDRM_NOUVEAU_H_FILES
+
+FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_nouveau.so} | awk 
'{print $3}'| while read func; do
+( grep -q "^$func$" || echo $func )  <

[PATCH libdrm 15/24] nouveau: annotate the private symbols

2015-04-01 Thread Emil Velikov
They are less and easier to track than the public ones. The macro
drm_public will be going away by the end of the series.

Cc: Maarten Lankhorst 
Cc: Ben Skeggs 
Signed-off-by: Emil Velikov 
---
 nouveau/abi16.c   | 14 +++---
 nouveau/nouveau.c |  2 +-
 nouveau/private.h | 18 +-
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/nouveau/abi16.c b/nouveau/abi16.c
index ae13821..538f3a7 100644
--- a/nouveau/abi16.c
+++ b/nouveau/abi16.c
@@ -33,7 +33,7 @@
 #include "private.h"


-int
+drm_private int
 abi16_chan_nv04(struct nouveau_object *obj)
 {
struct nouveau_device *dev = (struct nouveau_device *)obj->parent;
@@ -54,7 +54,7 @@ abi16_chan_nv04(struct nouveau_object *obj)
return 0;
 }

-int
+drm_private int
 abi16_chan_nvc0(struct nouveau_object *obj)
 {
struct nouveau_device *dev = (struct nouveau_device *)obj->parent;
@@ -75,7 +75,7 @@ abi16_chan_nvc0(struct nouveau_object *obj)
return 0;
 }

-int
+drm_private int
 abi16_chan_nve0(struct nouveau_object *obj)
 {
struct nouveau_device *dev = (struct nouveau_device *)obj->parent;
@@ -101,7 +101,7 @@ abi16_chan_nve0(struct nouveau_object *obj)
return 0;
 }

-int
+drm_private int
 abi16_engobj(struct nouveau_object *obj)
 {
struct drm_nouveau_grobj_alloc req = {
@@ -120,7 +120,7 @@ abi16_engobj(struct nouveau_object *obj)
return 0;
 }

-int
+drm_private int
 abi16_ntfy(struct nouveau_object *obj)
 {
struct nv04_notify *ntfy = obj->data;
@@ -141,7 +141,7 @@ abi16_ntfy(struct nouveau_object *obj)
return 0;
 }

-void
+drm_private void
 abi16_bo_info(struct nouveau_bo *bo, struct drm_nouveau_gem_info *info)
 {
struct nouveau_bo_priv *nvbo = nouveau_bo(bo);
@@ -175,7 +175,7 @@ abi16_bo_info(struct nouveau_bo *bo, struct 
drm_nouveau_gem_info *info)
}
 }

-int
+drm_private int
 abi16_bo_init(struct nouveau_bo *bo, uint32_t alignment,
  union nouveau_bo_config *config)
 {
diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index 2d95b74..5c8a0ec 100644
--- a/nouveau/nouveau.c
+++ b/nouveau/nouveau.c
@@ -45,7 +45,7 @@
 #include "private.h"

 #ifdef DEBUG
-uint32_t nouveau_debug = 0;
+drm_private uint32_t nouveau_debug = 0;

 static void
 debug_init(char *args)
diff --git a/nouveau/private.h b/nouveau/private.h
index bf9db04..74d604e 100644
--- a/nouveau/private.h
+++ b/nouveau/private.h
@@ -10,7 +10,7 @@
 #include "nouveau.h"

 #ifdef DEBUG
-uint32_t nouveau_debug;
+drm_private uint32_t nouveau_debug;
 #define dbg_on(lvl) (nouveau_debug & (1 << lvl))
 #define dbg(lvl, fmt, args...) do {
\
if (dbg_on((lvl))) \
@@ -114,13 +114,13 @@ int
 nouveau_device_open_existing(struct nouveau_device **, int, int, 
drm_context_t);

 /* abi16.c */
-int  abi16_chan_nv04(struct nouveau_object *);
-int  abi16_chan_nvc0(struct nouveau_object *);
-int  abi16_chan_nve0(struct nouveau_object *);
-int  abi16_engobj(struct nouveau_object *);
-int  abi16_ntfy(struct nouveau_object *);
-void abi16_bo_info(struct nouveau_bo *, struct drm_nouveau_gem_info *);
-int  abi16_bo_init(struct nouveau_bo *, uint32_t alignment,
-  union nouveau_bo_config *);
+drm_private int  abi16_chan_nv04(struct nouveau_object *);
+drm_private int  abi16_chan_nvc0(struct nouveau_object *);
+drm_private int  abi16_chan_nve0(struct nouveau_object *);
+drm_private int  abi16_engobj(struct nouveau_object *);
+drm_private int  abi16_ntfy(struct nouveau_object *);
+drm_private void abi16_bo_info(struct nouveau_bo *, struct 
drm_nouveau_gem_info *);
+drm_private int  abi16_bo_init(struct nouveau_bo *, uint32_t alignment,
+  union nouveau_bo_config *);

 #endif
-- 
2.3.1



[PATCH libdrm 14/24] intel: add symbols test

2015-04-01 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 intel/Makefile.am|  6 ++--
 intel/intel-symbol-check | 88 
 2 files changed, 92 insertions(+), 2 deletions(-)
 create mode 100755 intel/intel-symbol-check

diff --git a/intel/Makefile.am b/intel/Makefile.am
index 22a45f0..09bfbae 100644
--- a/intel/Makefile.am
+++ b/intel/Makefile.am
@@ -60,7 +60,8 @@ BATCHES = \
tests/gen7-3d.batch

 TESTS = \
-   $(BATCHES:.batch=.batch.sh)
+   $(BATCHES:.batch=.batch.sh) \
+   intel-symbol-check

 EXTRA_DIST = \
$(BATCHES) \
@@ -68,7 +69,8 @@ EXTRA_DIST = \
$(BATCHES:.batch=.batch-ref.txt) \
$(BATCHES:.batch=.batch-ref.txt) \
tests/test-batch.sh \
-   Android.mk
+   Android.mk \
+   $(TESTS)

 test_decode_LDADD = libdrm_intel.la ../libdrm.la

diff --git a/intel/intel-symbol-check b/intel/intel-symbol-check
new file mode 100755
index 000..c555e6d
--- /dev/null
+++ b/intel/intel-symbol-check
@@ -0,0 +1,88 @@
+#!/bin/bash
+
+# The following symbols (past the first five) are taken from the public 
headers.
+# A list of the latter should be available 
Makefile.sources/LIBDRM_INTEL_H_FILES
+
+FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_intel.so} | awk 
'{print $3}' | while read func; do
+( grep -q "^$func$" || echo $func )  <

[PATCH libdrm 13/24] intel: annotate the private symbols

2015-04-01 Thread Emil Velikov
They are less and easier to track than the public ones. The macro
drm_public will be going away by the end of the series.

Cc: Damien Lespiau 
Cc: Daniel Vetter 
Signed-off-by: Emil Velikov 
---
 intel/mm.c | 17 +++--
 intel/mm.h | 19 +--
 2 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/intel/mm.c b/intel/mm.c
index 10b74bf..9c67660 100644
--- a/intel/mm.c
+++ b/intel/mm.c
@@ -22,13 +22,18 @@
  *
  */

+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include 
 #include 

 #include "xf86drm.h"
+#include "libdrm.h"
 #include "mm.h"

-void mmDumpMemInfo(const struct mem_block *heap)
+drm_private void mmDumpMemInfo(const struct mem_block *heap)
 {
drmMsg("Memory heap %p:\n", (void *)heap);
if (heap == 0) {
@@ -54,7 +59,7 @@ void mmDumpMemInfo(const struct mem_block *heap)
drmMsg("End of memory blocks\n");
 }

-struct mem_block *mmInit(int ofs, int size)
+drm_private struct mem_block *mmInit(int ofs, int size)
 {
struct mem_block *heap, *block;

@@ -159,8 +164,8 @@ static struct mem_block *SliceBlock(struct mem_block *p,
return p;
 }

-struct mem_block *mmAllocMem(struct mem_block *heap, int size, int align2,
-int startSearch)
+drm_private struct mem_block *mmAllocMem(struct mem_block *heap, int size,
+int align2, int startSearch)
 {
struct mem_block *p;
const int mask = (1 << align2) - 1;
@@ -215,7 +220,7 @@ static int Join2Blocks(struct mem_block *p)
return 0;
 }

-int mmFreeMem(struct mem_block *b)
+drm_private int mmFreeMem(struct mem_block *b)
 {
if (!b)
return 0;
@@ -242,7 +247,7 @@ int mmFreeMem(struct mem_block *b)
return 0;
 }

-void mmDestroy(struct mem_block *heap)
+drm_private void mmDestroy(struct mem_block *heap)
 {
struct mem_block *p;

diff --git a/intel/mm.h b/intel/mm.h
index c7dd8b0..01813a5 100644
--- a/intel/mm.h
+++ b/intel/mm.h
@@ -29,6 +29,12 @@
 #ifndef MM_H
 #define MM_H

+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "libdrm.h"
+
 struct mem_block {
struct mem_block *next, *prev;
struct mem_block *next_free, *prev_free;
@@ -42,7 +48,7 @@ struct mem_block {
  * input: total size in bytes
  * return: a heap pointer if OK, NULL if error
  */
-extern struct mem_block *mmInit(int ofs, int size);
+drm_private extern struct mem_block *mmInit(int ofs, int size);

 /**
  * Allocate 'size' bytes with 2^align2 bytes alignment,
@@ -54,24 +60,25 @@ extern struct mem_block *mmInit(int ofs, int size);
  * startSearch = linear offset from start of heap to begin search
  * return: pointer to the allocated block, 0 if error
  */
-extern struct mem_block *mmAllocMem(struct mem_block *heap, int size,
-   int align2, int startSearch);
+drm_private extern struct mem_block *mmAllocMem(struct mem_block *heap,
+   int size, int align2,
+   int startSearch);

 /**
  * Free block starts at offset
  * input: pointer to a block
  * return: 0 if OK, -1 if error
  */
-extern int mmFreeMem(struct mem_block *b);
+drm_private extern int mmFreeMem(struct mem_block *b);

 /**
  * destroy MM
  */
-extern void mmDestroy(struct mem_block *mmInit);
+drm_private extern void mmDestroy(struct mem_block *mmInit);

 /**
  * For debuging purpose.
  */
-extern void mmDumpMemInfo(const struct mem_block *mmInit);
+drm_private extern void mmDumpMemInfo(const struct mem_block *mmInit);

 #endif
-- 
2.3.1



[PATCH libdrm 12/24] intel: remove unused mmFindBlock

2015-04-01 Thread Emil Velikov
The function was never part of the public API and a release or so back
was hidden from the global name-space (list of exported symbols).

According to git log this function was never used internally.

Signed-off-by: Emil Velikov 
---
 intel/mm.c | 12 
 intel/mm.h |  7 ---
 2 files changed, 19 deletions(-)

diff --git a/intel/mm.c b/intel/mm.c
index 1069745..10b74bf 100644
--- a/intel/mm.c
+++ b/intel/mm.c
@@ -191,18 +191,6 @@ struct mem_block *mmAllocMem(struct mem_block *heap, int 
size, int align2,
return p;
 }

-struct mem_block *mmFindBlock(struct mem_block *heap, int start)
-{
-   struct mem_block *p;
-
-   for (p = heap->next; p != heap; p = p->next) {
-   if (p->ofs == start)
-   return p;
-   }
-
-   return NULL;
-}
-
 static int Join2Blocks(struct mem_block *p)
 {
/* XXX there should be some assertions here */
diff --git a/intel/mm.h b/intel/mm.h
index a6ee102..c7dd8b0 100644
--- a/intel/mm.h
+++ b/intel/mm.h
@@ -65,13 +65,6 @@ extern struct mem_block *mmAllocMem(struct mem_block *heap, 
int size,
 extern int mmFreeMem(struct mem_block *b);

 /**
- * Free block starts at offset
- * input: pointer to a heap, start offset
- * return: pointer to a block
- */
-extern struct mem_block *mmFindBlock(struct mem_block *heap, int start);
-
-/**
  * destroy MM
  */
 extern void mmDestroy(struct mem_block *mmInit);
-- 
2.3.1



[PATCH libdrm 11/24] intel: remove the drm_mm* symbol workarounds

2015-04-01 Thread Emil Velikov
Added with commit 57b4c4c32d3(Move the renaming of mm.c symbols to
symbol duplication/collision with ones that are available elsewhere.

As the public/private symbols of libdrm are properly annotated neither
one of the symbols will end up in the global name-space, thus should no
longer be required.

Eric,
Does this sound correct, or there is something more subtle in there ?

Cc: Eric Anholt 
Signed-off-by: Emil Velikov 
---
 intel/mm.h | 10 --
 1 file changed, 10 deletions(-)

diff --git a/intel/mm.h b/intel/mm.h
index 8a5235b..a6ee102 100644
--- a/intel/mm.h
+++ b/intel/mm.h
@@ -38,16 +38,6 @@ struct mem_block {
unsigned int reserved:1;
 };

-/* Rename the variables in the drm copy of this code so that it doesn't
- * conflict with mesa or whoever else has copied it around.
- */
-#define mmInit drm_mmInit
-#define mmAllocMem drm_mmAllocMem
-#define mmFreeMem drm_mmFreeMem
-#define mmFindBlock drm_mmFindBlock
-#define mmDestroy drm_mmDestroy
-#define mmDumpMemInfo drm_mmDumpMemInfo
-
 /** 
  * input: total size in bytes
  * return: a heap pointer if OK, NULL if error
-- 
2.3.1



[PATCH libdrm 10/24] freedreno: add symbols test

2015-04-01 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 freedreno/Makefile.am|  3 ++-
 freedreno/freedreno-symbol-check | 52 
 2 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100755 freedreno/freedreno-symbol-check

diff --git a/freedreno/Makefile.am b/freedreno/Makefile.am
index 407ab70..27e6aa6 100644
--- a/freedreno/Makefile.am
+++ b/freedreno/Makefile.am
@@ -24,4 +24,5 @@ libdrm_freedrenocommoninclude_HEADERS = 
$(LIBDRM_FREEDRENO_H_FILES)
 pkgconfigdir = @pkgconfigdir@
 pkgconfig_DATA = libdrm_freedreno.pc

-EXTRA_DIST = Android.mk
+TESTS = freedreno-symbol-check
+EXTRA_DIST = Android.mk $(TESTS)
diff --git a/freedreno/freedreno-symbol-check b/freedreno/freedreno-symbol-check
new file mode 100755
index 000..7115448
--- /dev/null
+++ b/freedreno/freedreno-symbol-check
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+# The following symbols (past the first five) are taken from the public 
headers.
+# A list of the latter should be available 
Makefile.sources/LIBDRM_FREEDRENO_H_FILES
+
+FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_freedreno.so} | awk 
'{print $3}'| while read func; do
+( grep -q "^$func$" || echo $func )  <

[PATCH libdrm 09/24] freedreno: annotate the private symbols

2015-04-01 Thread Emil Velikov
They are less and easier to track than the public ones. The macro
drm_public will be going away by the end of the series.

Cc: Rob Clark 
Signed-off-by: Emil Velikov 
---
 freedreno/freedreno_bo.c |  2 +-
 freedreno/freedreno_device.c |  2 +-
 freedreno/freedreno_priv.h   |  4 ++--
 freedreno/kgsl/kgsl_bo.c | 11 ++-
 freedreno/kgsl/kgsl_device.c |  2 +-
 freedreno/kgsl/kgsl_pipe.c   | 18 +++---
 freedreno/kgsl/kgsl_priv.h   | 33 +++--
 freedreno/kgsl/kgsl_ringbuffer.c |  2 +-
 freedreno/msm/msm_bo.c   |  4 ++--
 freedreno/msm/msm_device.c   |  2 +-
 freedreno/msm/msm_pipe.c |  3 ++-
 freedreno/msm/msm_priv.h | 11 ++-
 freedreno/msm/msm_ringbuffer.c   |  2 +-
 13 files changed, 54 insertions(+), 42 deletions(-)

diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c
index 9089c93..c56fdbd 100644
--- a/freedreno/freedreno_bo.c
+++ b/freedreno/freedreno_bo.c
@@ -81,7 +81,7 @@ static struct fd_bo * bo_from_handle(struct fd_device *dev,
 }

 /* Frees older cached buffers.  Called under table_lock */
-void fd_cleanup_bo_cache(struct fd_device *dev, time_t time)
+drm_private void fd_cleanup_bo_cache(struct fd_device *dev, time_t time)
 {
int i;

diff --git a/freedreno/freedreno_device.c b/freedreno/freedreno_device.c
index e8b5f60..09b2302 100644
--- a/freedreno/freedreno_device.c
+++ b/freedreno/freedreno_device.c
@@ -145,7 +145,7 @@ static void fd_device_del_impl(struct fd_device *dev)
dev->funcs->destroy(dev);
 }

-void fd_device_del_locked(struct fd_device *dev)
+drm_private void fd_device_del_locked(struct fd_device *dev)
 {
if (!atomic_dec_and_test(&dev->refcnt))
return;
diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h
index 8e072d9..2d0fa6d 100644
--- a/freedreno/freedreno_priv.h
+++ b/freedreno/freedreno_priv.h
@@ -92,10 +92,10 @@ struct fd_device {
int closefd;/* call close(fd) upon destruction */
 };

-void fd_cleanup_bo_cache(struct fd_device *dev, time_t time);
+drm_private void fd_cleanup_bo_cache(struct fd_device *dev, time_t time);

 /* for where @table_lock is already held: */
-void fd_device_del_locked(struct fd_device *dev);
+drm_private void fd_device_del_locked(struct fd_device *dev);

 struct fd_pipe_funcs {
struct fd_ringbuffer * (*ringbuffer_new)(struct fd_pipe *pipe, uint32_t 
size);
diff --git a/freedreno/kgsl/kgsl_bo.c b/freedreno/kgsl/kgsl_bo.c
index fab3350..f151186 100644
--- a/freedreno/kgsl/kgsl_bo.c
+++ b/freedreno/kgsl/kgsl_bo.c
@@ -131,7 +131,7 @@ static struct fd_bo_funcs funcs = {
 };

 /* allocate a buffer handle: */
-int kgsl_bo_new_handle(struct fd_device *dev,
+drm_private int kgsl_bo_new_handle(struct fd_device *dev,
uint32_t size, uint32_t flags, uint32_t *handle)
 {
struct drm_kgsl_gem_create req = {
@@ -155,7 +155,7 @@ int kgsl_bo_new_handle(struct fd_device *dev,
 }

 /* allocate a new buffer object */
-struct fd_bo * kgsl_bo_from_handle(struct fd_device *dev,
+drm_private struct fd_bo * kgsl_bo_from_handle(struct fd_device *dev,
uint32_t size, uint32_t handle)
 {
struct kgsl_bo *kgsl_bo;
@@ -218,7 +218,7 @@ fail:
return NULL;
 }

-uint32_t kgsl_bo_gpuaddr(struct kgsl_bo *kgsl_bo, uint32_t offset)
+drm_private uint32_t kgsl_bo_gpuaddr(struct kgsl_bo *kgsl_bo, uint32_t offset)
 {
struct fd_bo *bo = &kgsl_bo->base;
if (!kgsl_bo->gpuaddr) {
@@ -267,7 +267,8 @@ uint32_t kgsl_bo_gpuaddr(struct kgsl_bo *kgsl_bo, uint32_t 
offset)
  * _emit_reloc()..
  */

-void kgsl_bo_set_timestamp(struct kgsl_bo *kgsl_bo, uint32_t timestamp)
+drm_private void kgsl_bo_set_timestamp(struct kgsl_bo *kgsl_bo,
+   uint32_t timestamp)
 {
struct fd_bo *bo = &kgsl_bo->base;
if (bo->name) {
@@ -285,7 +286,7 @@ void kgsl_bo_set_timestamp(struct kgsl_bo *kgsl_bo, 
uint32_t timestamp)
}
 }

-uint32_t kgsl_bo_get_timestamp(struct kgsl_bo *kgsl_bo)
+drm_private uint32_t kgsl_bo_get_timestamp(struct kgsl_bo *kgsl_bo)
 {
struct fd_bo *bo = &kgsl_bo->base;
uint32_t timestamp = 0;
diff --git a/freedreno/kgsl/kgsl_device.c b/freedreno/kgsl/kgsl_device.c
index 5f2dfea..8352d60 100644
--- a/freedreno/kgsl/kgsl_device.c
+++ b/freedreno/kgsl/kgsl_device.c
@@ -49,7 +49,7 @@ static struct fd_device_funcs funcs = {
.destroy = kgsl_device_destroy,
 };

-struct fd_device * kgsl_device_new(int fd)
+drm_private struct fd_device * kgsl_device_new(int fd)
 {
struct kgsl_device *kgsl_dev;
struct fd_device *dev;
diff --git a/freedreno/kgsl/kgsl_pipe.c b/freedreno/kgsl/kgsl_pipe.c
index 1a795ba..fc76b2b 100644
--- a/freedreno/kgsl/kgsl_pipe.c
+++ b/freedreno/kgsl/kgsl_pipe.c
@@ -75,7 +75,8 @@ static int kgsl_pipe_wait(struct fd_pipe *pipe, uint32_t 
timestamp)
return ret;
 }

-int kgsl_pipe_timestamp(struct kgsl_pipe *kgsl_pipe, uint32_t *timestamp)
+dr

[PATCH libdrm 08/24] radeon: add symbols test

2015-04-01 Thread Emil Velikov
Will allow us to catch when the library exports more symbols than
the ones in the public headers.

Signed-off-by: Emil Velikov 
---
 radeon/Makefile.am |  3 ++-
 radeon/radeon-symbol-check | 61 ++
 2 files changed, 63 insertions(+), 1 deletion(-)
 create mode 100755 radeon/radeon-symbol-check

diff --git a/radeon/Makefile.am b/radeon/Makefile.am
index 5cca394..54abd9e 100644
--- a/radeon/Makefile.am
+++ b/radeon/Makefile.am
@@ -44,4 +44,5 @@ libdrm_radeoninclude_HEADERS = $(LIBDRM_RADEON_H_FILES)
 pkgconfigdir = @pkgconfigdir@
 pkgconfig_DATA = libdrm_radeon.pc

-EXTRA_DIST = Android.mk
+TESTS = radeon-symbol-check
+EXTRA_DIST = Android.mk $(TESTS)
diff --git a/radeon/radeon-symbol-check b/radeon/radeon-symbol-check
new file mode 100755
index 000..0bf2ffc
--- /dev/null
+++ b/radeon/radeon-symbol-check
@@ -0,0 +1,61 @@
+#!/bin/bash
+
+# The following symbols (past the first five) are taken from the public 
headers.
+# A list of the latter should be available 
Makefile.sources/LIBDRM_RADEON_H_FILES
+
+FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_radeon.so} | awk 
'{print $3}'| while read func; do
+( grep -q "^$func$" || echo $func )  <

[PATCH libdrm 07/24] radeon: annotate the private symbols

2015-04-01 Thread Emil Velikov
They are less and easier to track than the public ones. The macro
drm_public will be going away by the end of the series.

Cc: Maarten Lankhorst 
Cc: Michel Dänzer 
Signed-off-by: Emil Velikov 
---
 radeon/bof.c | 22 +-
 radeon/bof.h | 23 ++-
 2 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/radeon/bof.c b/radeon/bof.c
index 92f4b91..2b29b89 100644
--- a/radeon/bof.c
+++ b/radeon/bof.c
@@ -23,6 +23,10 @@
  * Authors:
  *  Jerome Glisse
  */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include 
 #include 
 #include 
@@ -50,7 +54,7 @@ static void bof_incref(bof_t *bof)
bof->refcount++;
 }

-void bof_decref(bof_t *bof)
+drm_private void bof_decref(bof_t *bof)
 {
unsigned i;

@@ -96,7 +100,7 @@ static bof_t *bof_string(const char *value)
 /*
  * object 
  */
-bof_t *bof_object(void)
+drm_private bof_t *bof_object(void)
 {
bof_t *object;

@@ -109,7 +113,7 @@ bof_t *bof_object(void)
return object;
 }

-int bof_object_set(bof_t *object, const char *keyname, bof_t *value)
+drm_private int bof_object_set(bof_t *object, const char *keyname, bof_t 
*value)
 {
bof_t *key;
int r;
@@ -133,7 +137,7 @@ int bof_object_set(bof_t *object, const char *keyname, 
bof_t *value)
 /*
  * array
  */
-bof_t *bof_array(void)
+drm_private bof_t *bof_array(void)
 {
bof_t *array = bof_object();

@@ -144,7 +148,7 @@ bof_t *bof_array(void)
return array;
 }

-int bof_array_append(bof_t *array, bof_t *value)
+drm_private int bof_array_append(bof_t *array, bof_t *value)
 {
int r;
if (array->type != BOF_TYPE_ARRAY)
@@ -161,7 +165,7 @@ int bof_array_append(bof_t *array, bof_t *value)
 /*
  * blob
  */
-bof_t *bof_blob(unsigned size, void *value)
+drm_private bof_t *bof_blob(unsigned size, void *value)
 {
bof_t *blob = bof_object();

@@ -182,7 +186,7 @@ bof_t *bof_blob(unsigned size, void *value)
 /*
  *  int32
  */
-bof_t *bof_int32(int32_t value)
+drm_private bof_t *bof_int32(int32_t value)
 {
bof_t *int32 = bof_object();

@@ -200,7 +204,7 @@ bof_t *bof_int32(int32_t value)
return int32;
 }

-int32_t bof_int32_value(bof_t *bof)
+drm_private int32_t bof_int32_value(bof_t *bof)
 {
return *((uint32_t*)bof->value);
 }
@@ -245,7 +249,7 @@ static int bof_file_write(bof_t *bof, FILE *file)
return 0;
 }

-int bof_dump_file(bof_t *bof, const char *filename)
+drm_private int bof_dump_file(bof_t *bof, const char *filename)
 {
unsigned i;
int r = 0;
diff --git a/radeon/bof.h b/radeon/bof.h
index 8108dd5..b7632b4 100644
--- a/radeon/bof.h
+++ b/radeon/bof.h
@@ -26,8 +26,13 @@
 #ifndef BOF_H
 #define BOF_H

+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include 
 #include 
+#include "libdrm.h"

 #define BOF_TYPE_STRING0
 #define BOF_TYPE_NULL  1
@@ -52,19 +57,19 @@ typedef struct bof {
 } bof_t;

 /* object */
-extern bof_t *bof_object(void);
-extern int bof_object_set(bof_t *object, const char *keyname, bof_t *value);
+drm_private extern bof_t *bof_object(void);
+drm_private extern int bof_object_set(bof_t *object, const char *keyname, 
bof_t *value);
 /* array */
-extern bof_t *bof_array(void);
-extern int bof_array_append(bof_t *array, bof_t *value);
+drm_private extern bof_t *bof_array(void);
+drm_private extern int bof_array_append(bof_t *array, bof_t *value);
 /* blob */
-extern bof_t *bof_blob(unsigned size, void *value);
+drm_private extern bof_t *bof_blob(unsigned size, void *value);
 /* int32 */
-extern bof_t *bof_int32(int32_t value);
-extern int32_t bof_int32_value(bof_t *bof);
+drm_private extern bof_t *bof_int32(int32_t value);
+drm_private extern int32_t bof_int32_value(bof_t *bof);
 /* common functions */
-extern void bof_decref(bof_t *bof);
-extern int bof_dump_file(bof_t *bof, const char *filename);
+drm_private extern void bof_decref(bof_t *bof);
+drm_private extern int bof_dump_file(bof_t *bof, const char *filename);

 static inline int bof_is_object(bof_t *bof){return (bof->type == 
BOF_TYPE_OBJECT);}
 static inline int bof_is_blob(bof_t *bof){return (bof->type == BOF_TYPE_BLOB);}
-- 
2.3.1



[PATCH libdrm 06/24] radeon: remove no-longer used static functions

2015-04-01 Thread Emil Velikov
The users of bof_print_rec and bof_read(bof_print and bof_load_file
respectively) were removed with earlier commit. With the former two
gone, two more functions become unused - bof_print_bof and bof_indent.
Remove those as well.

Signed-off-by: Emil Velikov 
---
 radeon/bof.c | 110 ---
 1 file changed, 110 deletions(-)

diff --git a/radeon/bof.c b/radeon/bof.c
index 9c7997f..92f4b91 100644
--- a/radeon/bof.c
+++ b/radeon/bof.c
@@ -205,116 +205,6 @@ int32_t bof_int32_value(bof_t *bof)
return *((uint32_t*)bof->value);
 }

-/*
- *  common
- */
-static void bof_indent(int level)
-{
-   int i;
-
-   for (i = 0; i < level; i++)
-   fprintf(stderr, " ");
-}
-
-static void bof_print_bof(bof_t *bof, int level, int entry)
-{
-   bof_indent(level);
-   if (bof == NULL) {
-   fprintf(stderr, "--NULL-- for entry %d\n", entry);
-   return;
-   }
-   switch (bof->type) {
-   case BOF_TYPE_STRING:
-   fprintf(stderr, "%p string [%s %d]\n", bof, (char*)bof->value, 
bof->size);
-   break;
-   case BOF_TYPE_INT32:
-   fprintf(stderr, "%p int32 [%d %d]\n", bof, *(int*)bof->value, 
bof->size);
-   break;
-   case BOF_TYPE_BLOB:
-   fprintf(stderr, "%p blob [%d]\n", bof, bof->size);
-   break;
-   case BOF_TYPE_NULL:
-   fprintf(stderr, "%p null [%d]\n", bof, bof->size);
-   break;
-   case BOF_TYPE_OBJECT:
-   fprintf(stderr, "%p object [%d %d]\n", bof, bof->array_size / 
2, bof->size);
-   break;
-   case BOF_TYPE_ARRAY:
-   fprintf(stderr, "%p array [%d %d]\n", bof, bof->array_size, 
bof->size);
-   break;
-   default:
-   fprintf(stderr, "%p unknown [%d]\n", bof, bof->type);
-   return;
-   }
-}
-
-static void bof_print_rec(bof_t *bof, int level, int entry)
-{
-   unsigned i;
-
-   bof_print_bof(bof, level, entry);
-   for (i = 0; i < bof->array_size; i++) {
-   bof_print_rec(bof->array[i], level + 2, i);
-   }
-}
-
-static int bof_read(bof_t *root, FILE *file, long end, int level)
-{
-   bof_t *bof = NULL;
-   int r;
-
-   if (ftell(file) >= end) {
-   return 0;
-   }
-   r = bof_entry_grow(root);
-   if (r)
-   return r;
-   bof = bof_object();
-   if (bof == NULL)
-   return -ENOMEM;
-   bof->offset = ftell(file);
-   r = fread(&bof->type, 4, 1, file);
-   if (r != 1)
-   goto out_err;
-   r = fread(&bof->size, 4, 1, file);
-   if (r != 1)
-   goto out_err;
-   r = fread(&bof->array_size, 4, 1, file);
-   if (r != 1)
-   goto out_err;
-   switch (bof->type) {
-   case BOF_TYPE_STRING:
-   case BOF_TYPE_INT32:
-   case BOF_TYPE_BLOB:
-   bof->value = calloc(1, bof->size - 12);
-   if (bof->value == NULL) {
-   goto out_err;
-   }
-   r = fread(bof->value, bof->size - 12, 1, file);
-   if (r != 1) {
-   fprintf(stderr, "error reading %d\n", bof->size - 12);
-   goto out_err;
-   }
-   break;
-   case BOF_TYPE_NULL:
-   return 0;
-   case BOF_TYPE_OBJECT:
-   case BOF_TYPE_ARRAY:
-   r = bof_read(bof, file, bof->offset + bof->size, level + 2);
-   if (r)
-   goto out_err;
-   break;
-   default:
-   fprintf(stderr, "invalid type %d\n", bof->type);
-   goto out_err;
-   }
-   root->array[root->centry++] = bof;
-   return bof_read(root, file, end, level);
-out_err:
-   bof_decref(bof);
-   return -EINVAL;
-}
-
 static int bof_file_write(bof_t *bof, FILE *file)
 {
unsigned i;
-- 
2.3.1



[PATCH libdrm 05/24] radeon: remove more unused functions

2015-04-01 Thread Emil Velikov
bof_array_{get,size} and bof_blob_{size,value}. All of which unused
since their introduction with commit 78de69713d7(drm/radeon: add new cs
command stream dumping facilities)

Cc: Jerome Glisse 
Signed-off-by: Emil Velikov 
---
 radeon/bof.c | 28 
 radeon/bof.h |  4 
 2 files changed, 32 deletions(-)

diff --git a/radeon/bof.c b/radeon/bof.c
index 20901a0..9c7997f 100644
--- a/radeon/bof.c
+++ b/radeon/bof.c
@@ -158,20 +158,6 @@ int bof_array_append(bof_t *array, bof_t *value)
return 0;
 }

-bof_t *bof_array_get(bof_t *bof, unsigned i)
-{
-   if (!bof_is_array(bof) || i >= bof->array_size)
-   return NULL;
-   return bof->array[i];
-}
-
-unsigned bof_array_size(bof_t *bof)
-{
-   if (!bof_is_array(bof))
-   return 0;
-   return bof->array_size;
-}
-
 /*
  * blob
  */
@@ -193,20 +179,6 @@ bof_t *bof_blob(unsigned size, void *value)
return blob;
 }

-unsigned bof_blob_size(bof_t *bof)
-{
-   if (!bof_is_blob(bof))
-   return 0;
-   return bof->size - 12;
-}
-
-void *bof_blob_value(bof_t *bof)
-{
-   if (!bof_is_blob(bof))
-   return NULL;
-   return bof->value;
-}
-
 /*
  *  int32
  */
diff --git a/radeon/bof.h b/radeon/bof.h
index 4dae923..8108dd5 100644
--- a/radeon/bof.h
+++ b/radeon/bof.h
@@ -57,12 +57,8 @@ extern int bof_object_set(bof_t *object, const char 
*keyname, bof_t *value);
 /* array */
 extern bof_t *bof_array(void);
 extern int bof_array_append(bof_t *array, bof_t *value);
-extern bof_t *bof_array_get(bof_t *bof, unsigned i);
-extern unsigned bof_array_size(bof_t *bof);
 /* blob */
 extern bof_t *bof_blob(unsigned size, void *value);
-extern unsigned bof_blob_size(bof_t *bof);
-extern void *bof_blob_value(bof_t *bof);
 /* int32 */
 extern bof_t *bof_int32(int32_t value);
 extern int32_t bof_int32_value(bof_t *bof);
-- 
2.3.1



[PATCH libdrm 04/24] radeon: annotate bof_incref, bof_string functions as static

2015-04-01 Thread Emil Velikov
Used locally in bof.c.

Cc: Jerome Glisse 
Signed-off-by: Emil Velikov 
---
 radeon/bof.c | 96 ++--
 radeon/bof.h |  3 --
 2 files changed, 48 insertions(+), 51 deletions(-)

diff --git a/radeon/bof.c b/radeon/bof.c
index 6f3760a..20901a0 100644
--- a/radeon/bof.c
+++ b/radeon/bof.c
@@ -45,6 +45,54 @@ static int bof_entry_grow(bof_t *bof)
return 0;
 }

+static void bof_incref(bof_t *bof)
+{
+   bof->refcount++;
+}
+
+void bof_decref(bof_t *bof)
+{
+   unsigned i;
+
+   if (bof == NULL)
+   return;
+   if (--bof->refcount > 0)
+   return;
+   for (i = 0; i < bof->array_size; i++) {
+   bof_decref(bof->array[i]);
+   bof->array[i] = NULL;
+   }
+   bof->array_size = 0;
+   if (bof->file) {
+   fclose(bof->file);
+   bof->file = NULL;
+   }
+   free(bof->array);
+   free(bof->value);
+   free(bof);
+}
+
+/*
+ * string
+ */
+static bof_t *bof_string(const char *value)
+{
+   bof_t *string = bof_object();
+
+   if (string == NULL)
+   return NULL;
+   string->type = BOF_TYPE_STRING;
+   string->size = strlen(value) + 1;
+   string->value = calloc(1, string->size);
+   if (string->value == NULL) {
+   bof_decref(string);
+   return NULL;
+   }
+   strcpy(string->value, value);
+   string->size += 12;
+   return string;
+}
+
 /*
  * object 
  */
@@ -160,27 +208,6 @@ void *bof_blob_value(bof_t *bof)
 }

 /*
- * string
- */
-bof_t *bof_string(const char *value)
-{
-   bof_t *string = bof_object();
-
-   if (string == NULL)
-   return NULL;
-   string->type = BOF_TYPE_STRING;
-   string->size = strlen(value) + 1;
-   string->value = calloc(1, string->size);
-   if (string->value == NULL) {
-   bof_decref(string);
-   return NULL;
-   }
-   strcpy(string->value, value);
-   string->size += 12;
-   return string;
-}
-
-/*
  *  int32
  */
 bof_t *bof_int32(int32_t value)
@@ -316,33 +343,6 @@ out_err:
return -EINVAL;
 }

-void bof_incref(bof_t *bof)
-{
-   bof->refcount++;
-}
-
-void bof_decref(bof_t *bof)
-{
-   unsigned i;
-
-   if (bof == NULL)
-   return;
-   if (--bof->refcount > 0)
-   return;
-   for (i = 0; i < bof->array_size; i++) {
-   bof_decref(bof->array[i]);
-   bof->array[i] = NULL;
-   }
-   bof->array_size = 0;
-   if (bof->file) {
-   fclose(bof->file);
-   bof->file = NULL;
-   }
-   free(bof->array);
-   free(bof->value);
-   free(bof);
-}
-
 static int bof_file_write(bof_t *bof, FILE *file)
 {
unsigned i;
diff --git a/radeon/bof.h b/radeon/bof.h
index 8e952c1..4dae923 100644
--- a/radeon/bof.h
+++ b/radeon/bof.h
@@ -63,14 +63,11 @@ extern unsigned bof_array_size(bof_t *bof);
 extern bof_t *bof_blob(unsigned size, void *value);
 extern unsigned bof_blob_size(bof_t *bof);
 extern void *bof_blob_value(bof_t *bof);
-/* string */
-extern bof_t *bof_string(const char *value);
 /* int32 */
 extern bof_t *bof_int32(int32_t value);
 extern int32_t bof_int32_value(bof_t *bof);
 /* common functions */
 extern void bof_decref(bof_t *bof);
-extern void bof_incref(bof_t *bof);
 extern int bof_dump_file(bof_t *bof, const char *filename);

 static inline int bof_is_object(bof_t *bof){return (bof->type == 
BOF_TYPE_OBJECT);}
-- 
2.3.1



[PATCH libdrm 03/24] radeon: remove unused functions

2015-04-01 Thread Emil Velikov
Namely bof_load_file, bof_print, bof_object_get. Unused since their
introduction according to git log.

Cc: Jerome Glisse 
Signed-off-by: Emil Velikov 
---
 radeon/bof.c | 53 -
 radeon/bof.h |  3 ---
 2 files changed, 56 deletions(-)

diff --git a/radeon/bof.c b/radeon/bof.c
index 0598cc6..6f3760a 100644
--- a/radeon/bof.c
+++ b/radeon/bof.c
@@ -61,18 +61,6 @@ bof_t *bof_object(void)
return object;
 }

-bof_t *bof_object_get(bof_t *object, const char *keyname)
-{
-   unsigned i;
-
-   for (i = 0; i < object->array_size; i += 2) {
-   if (!strcmp(object->array[i]->value, keyname)) {
-   return object->array[i + 1];
-   }
-   }
-   return NULL;
-}
-
 int bof_object_set(bof_t *object, const char *keyname, bof_t *value)
 {
bof_t *key;
@@ -271,11 +259,6 @@ static void bof_print_rec(bof_t *bof, int level, int entry)
}
 }

-void bof_print(bof_t *bof)
-{
-   bof_print_rec(bof, 0, 0);
-}
-
 static int bof_read(bof_t *root, FILE *file, long end, int level)
 {
bof_t *bof = NULL;
@@ -333,42 +316,6 @@ out_err:
return -EINVAL;
 }

-bof_t *bof_load_file(const char *filename)
-{
-   bof_t *root = bof_object();
-   int r;
-
-   if (root == NULL) {
-   fprintf(stderr, "%s failed to create root object\n", __func__);
-   return NULL;
-   }
-   root->file = fopen(filename, "r");
-   if (root->file == NULL)
-   goto out_err;
-   r = fseek(root->file, 0L, SEEK_SET);
-   if (r) {
-   fprintf(stderr, "%s failed to seek into file %s\n", __func__, 
filename);
-   goto out_err;
-   }
-   root->offset = ftell(root->file);
-   r = fread(&root->type, 4, 1, root->file);
-   if (r != 1)
-   goto out_err;
-   r = fread(&root->size, 4, 1, root->file);
-   if (r != 1)
-   goto out_err;
-   r = fread(&root->array_size, 4, 1, root->file);
-   if (r != 1)
-   goto out_err;
-   r = bof_read(root, root->file, root->offset + root->size, 2);
-   if (r)
-   goto out_err;
-   return root;
-out_err:
-   bof_decref(root);
-   return NULL;
-}
-
 void bof_incref(bof_t *bof)
 {
bof->refcount++;
diff --git a/radeon/bof.h b/radeon/bof.h
index cb829a1..8e952c1 100644
--- a/radeon/bof.h
+++ b/radeon/bof.h
@@ -53,7 +53,6 @@ typedef struct bof {

 /* object */
 extern bof_t *bof_object(void);
-extern bof_t *bof_object_get(bof_t *object, const char *keyname);
 extern int bof_object_set(bof_t *object, const char *keyname, bof_t *value);
 /* array */
 extern bof_t *bof_array(void);
@@ -72,9 +71,7 @@ extern int32_t bof_int32_value(bof_t *bof);
 /* common functions */
 extern void bof_decref(bof_t *bof);
 extern void bof_incref(bof_t *bof);
-extern bof_t *bof_load_file(const char *filename);
 extern int bof_dump_file(bof_t *bof, const char *filename);
-extern void bof_print(bof_t *bof);

 static inline int bof_is_object(bof_t *bof){return (bof->type == 
BOF_TYPE_OBJECT);}
 static inline int bof_is_blob(bof_t *bof){return (bof->type == BOF_TYPE_BLOB);}
-- 
2.3.1



[PATCH libdrm 02/24] radeon: remove empty function declarations

2015-04-01 Thread Emil Velikov
Missing definition and unused since their introduction.

Cc: Jerome Glisse 
Signed-off-by: Emil Velikov 
---
 radeon/bof.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/radeon/bof.h b/radeon/bof.h
index 014affb..cb829a1 100644
--- a/radeon/bof.h
+++ b/radeon/bof.h
@@ -51,10 +51,6 @@ typedef struct bof {
longoffset;
 } bof_t;

-extern int bof_file_flush(bof_t *root);
-extern bof_t *bof_file_new(const char *filename);
-extern int bof_object_dump(bof_t *object, const char *filename);
-
 /* object */
 extern bof_t *bof_object(void);
 extern bof_t *bof_object_get(bof_t *object, const char *keyname);
-- 
2.3.1



[PATCH libdrm 01/24] configure.ac: split -fvisibility and __attribute__((visibility)) checks

2015-04-01 Thread Emil Velikov
The former does not imply the latter and vice-versa. One such example is
the Sun compiler.

v2: Add missing closing brakets. (Alan)

Cc: Alan Coopersmith 
Cc: Thierry Reding 
Signed-off-by: Emil Velikov 
---
 configure.ac | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 155d577..76cf91e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -415,12 +415,17 @@ if test "x$GCC" = xyes; then

 # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
 CFLAGS=$save_CFLAGS
+AC_SUBST([VISIBILITY_CFLAGS])
+fi

-if test "x$VISIBILITY_CFLAGS" != x; then
-AC_DEFINE(HAVE_VISIBILITY, 1, [Compiler has -fvisibility support])
-fi
+AC_MSG_CHECKING([whether $CC supports __attribute__((visibility))])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([
+int foo_default( void ) __attribute__((visibility("default")));
+int foo_hidden( void ) __attribute__((visibility("hidden")));
+])], HAVE_ATTRIBUTE_VISIBILITY="yes"; AC_MSG_RESULT([yes]), 
AC_MSG_RESULT([no]));

-AC_SUBST([VISIBILITY_CFLAGS])
+if test "x$HAVE_ATTRIBUTE_VISIBILITY" = xyes; then
+AC_DEFINE(HAVE_VISIBILITY, 1, [Compiler supports 
__attribute__((visibility))])
 fi

 AC_SUBST(WARN_CFLAGS)
-- 
2.3.1



[PATCH libdrm 00/24] Annotate private symbols, drop drm_public macro

2015-04-01 Thread Emil Velikov
Hi all,

As mentioned by Alan, some compilers do not like it when the symbol 
declaration and definition differ wrt their visibility attribute.

Afaict there are three ways to handle this;
 - Add the drm_public macro into the public headers, and annotate the 
declarations.
 - Use version script to limit the exported symbols.
 - Remove the drm_public macro/VISIBILITY_CFLAGS and annotate the 
private symbols.

>From the above three I believe that 3) is the better one as:
 - it does not add drm_public to the library API,
 - does not rely on features that some platform may be missing (or 
require singling out every platform in the configure.ac script).

So I've went ahead with 3), added a few tests and wired them to
`make check' so that one can easily catch problems.

I have checked that the libraries do not export any new symbols and the 
scripts work as intended nearly a dozen times :-)

The whole series can be found in branch reannotate-symbols at
https://github.com/evelikov/libdrm

Cheers,
Emil




[PATCH 2/3] drm:msm: Initial Add Writeback Support

2015-04-01 Thread Jilai Wang
Add writeback support in msm kms framework.

Signed-off-by: Jilai Wang 
---
 drivers/gpu/drm/msm/Kconfig   |  10 +
 drivers/gpu/drm/msm/Makefile  |   9 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c   |  10 +
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h   |   1 +
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c   |  19 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h   |   7 +
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_wb_encoder.c| 460 +++
 drivers/gpu/drm/msm/mdp/mdp_kms.h |   2 +-
 drivers/gpu/drm/msm/mdp/mdp_wb/mdp_wb.c   | 319 +
 drivers/gpu/drm/msm/mdp/mdp_wb/mdp_wb.h   |  98 
 drivers/gpu/drm/msm/mdp/mdp_wb/mdp_wb_connector.c | 157 +++
 drivers/gpu/drm/msm/mdp/mdp_wb/mdp_wb_v4l2.c  | 522 ++
 drivers/gpu/drm/msm/msm_drv.c |   2 +
 drivers/gpu/drm/msm/msm_drv.h |  19 +-
 drivers/gpu/drm/msm/msm_fbdev.c   |  34 +-
 drivers/gpu/drm/msm/msm_gem.c |   1 +
 16 files changed, 1664 insertions(+), 6 deletions(-)
 create mode 100644 drivers/gpu/drm/msm/mdp/mdp5/mdp5_wb_encoder.c
 create mode 100644 drivers/gpu/drm/msm/mdp/mdp_wb/mdp_wb.c
 create mode 100644 drivers/gpu/drm/msm/mdp/mdp_wb/mdp_wb.h
 create mode 100644 drivers/gpu/drm/msm/mdp/mdp_wb/mdp_wb_connector.c
 create mode 100644 drivers/gpu/drm/msm/mdp/mdp_wb/mdp_wb_v4l2.c

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index 1e6a907..f6c7914 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -27,6 +27,16 @@ config DRM_MSM_FBDEV
  support. Note that this support also provide the linux console
  support on top of the MSM modesetting driver.

+config DRM_MSM_WB
+   bool "Enable writeback support for MSM modesetting driver"
+   depends on DRM_MSM
+   depends on VIDEO_V4L2
+   select VIDEOBUF2_CORE
+   default y
+   help
+ Choose this option if you have a need to support writeback
+ connector.
+
 config DRM_MSM_REGISTER_LOGGING
bool "MSM DRM register logging"
depends on DRM_MSM
diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile
index 674a132..e5bf334 100644
--- a/drivers/gpu/drm/msm/Makefile
+++ b/drivers/gpu/drm/msm/Makefile
@@ -1,4 +1,5 @@
-ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/msm
+ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/msm -Idrivers/gpu/drm/msm/mdp_wb
+ccflags-$(CONFIG_DRM_MSM_WB) += -Idrivers/gpu/drm/msm/mdp/mdp_wb

 msm-y := \
adreno/adreno_device.o \
@@ -51,4 +52,10 @@ msm-y := \
 msm-$(CONFIG_DRM_MSM_FBDEV) += msm_fbdev.o
 msm-$(CONFIG_COMMON_CLK) += mdp/mdp4/mdp4_lvds_pll.o

+msm-$(CONFIG_DRM_MSM_WB) += \
+   mdp/mdp5/mdp5_wb_encoder.o \
+   mdp/mdp_wb/mdp_wb.o \
+   mdp/mdp_wb/mdp_wb_connector.o \
+   mdp/mdp_wb/mdp_wb_v4l2.o
+
 obj-$(CONFIG_DRM_MSM)  += msm.o
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
index 1fe7315..e87cf74 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
@@ -71,9 +71,14 @@ const struct mdp5_cfg_hw msm8x74_config = {
.count = 4,
.base = { 0x12500, 0x12700, 0x12900, 0x12b00 },
},
+   .wb = {
+   .count = 5,
+   .base = { 0x11100, 0x13100, 0x15100, 0x17100, 0x19100 },
+   },
.intfs = {
[0] = INTF_eDP,
[3] = INTF_HDMI,
+   [4] = INTF_WB,
},
.max_clk = 2,
 };
@@ -135,9 +140,14 @@ const struct mdp5_cfg_hw apq8084_config = {
.count = 5,
.base = { 0x12500, 0x12700, 0x12900, 0x12b00, 0x12d00 },
},
+   .wb = {
+   .count = 5,
+   .base = { 0x11100, 0x11500, 0x11900, 0x11d00, 0x12100 },
+   },
.intfs = {
[0] = INTF_eDP,
[3] = INTF_HDMI,
+   [4] = INTF_WB,
},
.max_clk = 32000,
 };
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h
index f47328d..ccb6048c 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h
@@ -74,6 +74,7 @@ struct mdp5_cfg_hw {
struct mdp5_sub_block dspp;
struct mdp5_sub_block ad;
struct mdp5_sub_block intf;
+   struct mdp5_sub_block wb;

u32 intfs[MDP5_INTF_NUM_MAX]; /* array of enum mdp5_intf_type */

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
index ff9201b..1b1569d 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
@@ -179,7 +179,11 @@ static struct drm_encoder *construct_encoder(struct 
mdp5_kms *mdp5_kms,
.mode   = intf_mode,
};

-   encoder = mdp5_encoder_init(dev, &intf);
+   i

[PATCH 1/3] drm/msm/mdp5: Update generated header files with writeback support

2015-04-01 Thread Jilai Wang
Add register field for MDP5 writeback block

Signed-off-by: Jilai Wang 
---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5.xml.h  | 373 ++-
 drivers/gpu/drm/msm/mdp/mdp_common.xml.h |  18 +-
 2 files changed, 373 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5.xml.h 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5.xml.h
index 09bfaff..ea470a2 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5.xml.h
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5.xml.h
@@ -8,9 +8,9 @@ http://github.com/freedreno/envytools/
 git clone https://github.com/freedreno/envytools.git

 The rules-ng-ng source files this header was generated from are:
-- /local/mnt2/workspace2/sviau/envytools/rnndb/mdp/mdp5.xml(  
26608 bytes, from 2015-02-05 23:01:09)
-- /local/mnt2/workspace2/sviau/envytools/rnndb/freedreno_copyright.xml (   
1453 bytes, from 2014-06-02 18:31:15)
-- /local/mnt2/workspace2/sviau/envytools/rnndb/mdp/mdp_common.xml  (   
2357 bytes, from 2015-01-23 16:20:19)
+- 
/local/mnt2/workspace2/jilaiw/chromeos/envytools/envytools/rnndb/mdp/mdp5.xml   
 (  31502 bytes, from 2015-01-16 22:36:33)
+- 
/local/mnt2/workspace2/jilaiw/chromeos/envytools/envytools/rnndb/freedreno_copyright.xml
 (   1453 bytes, from 2014-11-24 22:27:21)
+- 
/local/mnt2/workspace2/jilaiw/chromeos/envytools/envytools/rnndb/mdp/mdp_common.xml
  (   2352 bytes, from 2015-01-16 22:37:14)

 Copyright (C) 2013-2015 by the following authors:
 - Rob Clark  (robclark)
@@ -120,6 +120,21 @@ enum mdp5_data_format {
DATA_FORMAT_YUV = 1,
 };

+enum mdp5_block_size {
+   BLOCK_SIZE_64 = 0,
+   BLOCK_SIZE_128 = 1,
+};
+
+enum mdp5_rotate_mode {
+   ROTATE_0 = 0,
+   ROTATE_90 = 1,
+};
+
+enum mdp5_chroma_downsample_method {
+   DS_MTHD_NO_PIXEL_DROP = 0,
+   DS_MTHD_PIXEL_DROP = 1,
+};
+
 #define MDP5_IRQ_WB_0_DONE 0x0001
 #define MDP5_IRQ_WB_1_DONE 0x0002
 #define MDP5_IRQ_WB_2_DONE 0x0010
@@ -757,7 +772,7 @@ static inline uint32_t 
MDP5_PIPE_SRC_FORMAT_UNPACK_COUNT(uint32_t val)
 #define MDP5_PIPE_SRC_FORMAT_UNPACK_ALIGN_MSB  0x0004
 #define MDP5_PIPE_SRC_FORMAT_NUM_PLANES__MASK  0x0018
 #define MDP5_PIPE_SRC_FORMAT_NUM_PLANES__SHIFT 19
-static inline uint32_t MDP5_PIPE_SRC_FORMAT_NUM_PLANES(enum 
mdp_sspp_fetch_type val)
+static inline uint32_t MDP5_PIPE_SRC_FORMAT_NUM_PLANES(enum mdp_fetch_type val)
 {
return ((val) << MDP5_PIPE_SRC_FORMAT_NUM_PLANES__SHIFT) & 
MDP5_PIPE_SRC_FORMAT_NUM_PLANES__MASK;
 }
@@ -1121,6 +1136,356 @@ static inline uint32_t 
REG_MDP5_DSPP_GAMUT_BASE(uint32_t i0) { return 0x02dc

 static inline uint32_t REG_MDP5_DSPP_GC_BASE(uint32_t i0) { return 0x02b0 
+ __offset_DSPP(i0); }

+static inline uint32_t __offset_WB(uint32_t idx)
+{
+   switch (idx) {
+   case 0: return (mdp5_cfg->wb.base[0]);
+   case 1: return (mdp5_cfg->wb.base[1]);
+   case 2: return (mdp5_cfg->wb.base[2]);
+   case 3: return (mdp5_cfg->wb.base[3]);
+   case 4: return (mdp5_cfg->wb.base[4]);
+   default: return INVALID_IDX(idx);
+   }
+}
+static inline uint32_t REG_MDP5_WB(uint32_t i0) { return 0x + 
__offset_WB(i0); }
+
+static inline uint32_t REG_MDP5_WB_DST_FORMAT(uint32_t i0) { return 0x 
+ __offset_WB(i0); }
+#define MDP5_WB_DST_FORMAT_DSTC0_OUT__MASK 0x0003
+#define MDP5_WB_DST_FORMAT_DSTC0_OUT__SHIFT0
+static inline uint32_t MDP5_WB_DST_FORMAT_DSTC0_OUT(uint32_t val)
+{
+   return ((val) << MDP5_WB_DST_FORMAT_DSTC0_OUT__SHIFT) & 
MDP5_WB_DST_FORMAT_DSTC0_OUT__MASK;
+}
+#define MDP5_WB_DST_FORMAT_DSTC1_OUT__MASK 0x000c
+#define MDP5_WB_DST_FORMAT_DSTC1_OUT__SHIFT2
+static inline uint32_t MDP5_WB_DST_FORMAT_DSTC1_OUT(uint32_t val)
+{
+   return ((val) << MDP5_WB_DST_FORMAT_DSTC1_OUT__SHIFT) & 
MDP5_WB_DST_FORMAT_DSTC1_OUT__MASK;
+}
+#define MDP5_WB_DST_FORMAT_DSTC2_OUT__MASK 0x0030
+#define MDP5_WB_DST_FORMAT_DSTC2_OUT__SHIFT4
+static inline uint32_t MDP5_WB_DST_FORMAT_DSTC2_OUT(uint32_t val)
+{
+   return ((val) << MDP5_WB_DST_FORMAT_DSTC2_OUT__SHIFT) & 
MDP5_WB_DST_FORMAT_DSTC2_OUT__MASK;
+}
+#define MDP5_WB_DST_FORMAT_DSTC3_OUT__MASK 0x00c0
+#define MDP5_WB_DST_FORMAT_DSTC3_OUT__SHIFT6
+static inline uint32_t MDP5_WB_DST_FORMAT_DSTC3_OUT(uint32_t val)
+{
+   return ((val) << MDP5_WB_DST_FORMAT_DSTC3_OUT__SHIFT) & 
MDP5_WB_DST_FORMAT_DSTC3_OUT__MASK;
+}
+#define MDP5_WB_DST_FORMAT_DSTC3_EN0x0100
+#define MDP5_WB_DST_FORMAT_DST_BPP__MASK   0x0600
+#define MDP5_WB_DST_FORMAT_DST_BPP__SHIFT  9
+static inline uint32_t MDP5_WB_DST_FORMAT_DST_BPP(u

[PATCH] rnndb: Add register description in mdp5 writeback block

2015-04-01 Thread Jilai Wang
This patch adds the register description in mdp5 writeback block.

Signed-off-by: Jilai Wang 
---
 rnndb/mdp/mdp5.xml   | 126 ++-
 rnndb/mdp/mdp_common.xml |   2 +-
 2 files changed, 126 insertions(+), 2 deletions(-)

diff --git a/rnndb/mdp/mdp5.xml b/rnndb/mdp/mdp5.xml
index 29c5992..f1a6397 100644
--- a/rnndb/mdp/mdp5.xml
+++ b/rnndb/mdp/mdp5.xml
@@ -332,7 +332,7 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ 
rules-ng.xsd">



-   
+   



@@ -454,6 +454,130 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ 
rules-ng.xsd">



+   
+   
+   
+   
+
+   
+   
+   
+   
+
+   
+   
+   
+   
+
+
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+
 


diff --git a/rnndb/mdp/mdp_common.xml b/rnndb/mdp/mdp_common.xml
index 6f805f7..b4d1949 100644
--- a/rnndb/mdp/mdp_common.xml
+++ b/rnndb/mdp/mdp_common.xml
@@ -13,7 +13,7 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ 
rules-ng.xsd">
 
 

-
+
 
 
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v2 1/4] break kconfig dependency loop

2015-04-01 Thread Michael S. Tsirkin
On Wed, Apr 01, 2015 at 10:55:01PM +0800, John Hunter wrote:
> Hi Gerd,
> I've read the patches about the virtio-gpu, it's a nice design.
> As far as I know, there are two other drivers used by qemu, CIRRUS and BOCHS.
> I have a question about the relationship of these three drivers, is that the
> virtio-gpu
> designed to replace the other two drivers? I mean are the CIRRUS and BOCHS
> going to be deprecated in the future?
> 
> Would you please kindly explain this a little bit?
> 
> Actually, this is a problem by Martin Peres who is the GSoC xorg 
> administor. 
> My proposal is "Convert the BOCHS and CIRRUS drivers to atomic mode-setting".
> Martin wonder if the two drivers are going to be deprecated, there is no need
> for
> me to do the job.
> 
> Best regards,
> John 

Hypervisors are going to support BOCHS and CIRRUS for years to come.

-- 
MST


[PATCH libdrm] android: set the HAVE_VISIBILITY define

2015-04-01 Thread Emil Velikov
... in order to limit the exported symbols only to the required ones.
Both compilers used with Android (GCC and LLVM) support this, so set it
unconditionally.

Cc: Chih-Wei Huang 
Signed-off-by: Emil Velikov 
---
 Android.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Android.mk b/Android.mk
index 7038c3c..90cdcb3 100644
--- a/Android.mk
+++ b/Android.mk
@@ -39,6 +39,7 @@ LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include/drm

 LOCAL_CFLAGS := \
+   -DHAVE_VISIBILITY=1 \
-DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1

 include $(BUILD_SHARED_LIBRARY)
-- 
2.3.1



[PATCH libdrm] freedreno: link against CLOCK_LIB

2015-04-01 Thread Emil Velikov
Required by clock_gettime()

Cc: Rob Clark 
Signed-off-by: Emil Velikov 
---
 freedreno/Makefile.am | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/freedreno/Makefile.am b/freedreno/Makefile.am
index 0720867..9b7ec7d 100644
--- a/freedreno/Makefile.am
+++ b/freedreno/Makefile.am
@@ -10,7 +10,10 @@ AM_CFLAGS = \
 libdrm_freedreno_la_LTLIBRARIES = libdrm_freedreno.la
 libdrm_freedreno_ladir = $(libdir)
 libdrm_freedreno_la_LDFLAGS = -version-number 1:0:0 -no-undefined
-libdrm_freedreno_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
+libdrm_freedreno_la_LIBADD = \
+   ../libdrm.la \
+   @PTHREADSTUBS_LIBS@ \
+   @CLOCK_LIB@

 libdrm_freedreno_la_SOURCES = $(LIBDRM_FREEDRENO_FILES)
 if HAVE_FREEDRENO_KGSL
-- 
2.3.1



[PATCH v2 1/4] break kconfig dependency loop

2015-04-01 Thread Jani Nikula
On Wed, 01 Apr 2015, Gerd Hoffmann  wrote:
> After adding virtio-gpu I get this funky kconfig dependency loop.
>
> scripts/kconfig/conf --oldconfig Kconfig
> drivers/video/fbdev/Kconfig:5:error: recursive dependency detected!
> drivers/video/fbdev/Kconfig:5:  symbol FB is selected by DRM_KMS_FB_HELPER
> drivers/gpu/drm/Kconfig:34: symbol DRM_KMS_FB_HELPER is selected by 
> DRM_VIRTIO_GPU
> drivers/gpu/drm/virtio/Kconfig:1:   symbol DRM_VIRTIO_GPU depends on 
> VIRTIO
> drivers/virtio/Kconfig:1:   symbol VIRTIO is selected by REMOTEPROC
> drivers/remoteproc/Kconfig:4:   symbol REMOTEPROC is selected by 
> OMAP_REMOTEPROC
> drivers/remoteproc/Kconfig:12:  symbol OMAP_REMOTEPROC depends on OMAP_IOMMU
> drivers/iommu/Kconfig:141:  symbol OMAP_IOMMU is selected by VIDEO_OMAP3
> drivers/media/platform/Kconfig:96:  symbol VIDEO_OMAP3 depends on 
> VIDEO_V4L2
> drivers/media/v4l2-core/Kconfig:6:  symbol VIDEO_V4L2 depends on I2C
> drivers/i2c/Kconfig:7:  symbol I2C is selected by FB_DDC
> drivers/video/fbdev/Kconfig:59: symbol FB_DDC is selected by FB_CYBER2000_DDC
> drivers/video/fbdev/Kconfig:374:symbol FB_CYBER2000_DDC depends on 
> FB_CYBER2000
> drivers/video/fbdev/Kconfig:362:symbol FB_CYBER2000 depends on FB
>
> Making VIDEO_OMAP3 depend on OMAP_IOMMU instead of selecting it breaks the
> loop, which looks like the best way to handle it to me.  I'm open to better
> suggestions though.

I think part of the problem is that "select" is often used not as
documented [1] but rather as "show my config in menuconfig for
convenience even if my dependency is not met, and select the dependency
even though I know it can screw up the dependency chain".

In light of the documentation, your patch seems to DTRT. (Disclaimer: I
don't work with the drivers in question, hence no Reviewed-by.)

In the big picture, it feels like menuconfig needs a way to display
items whose dependencies are not met, and a way to recursively enable
said items and all their dependencies when told. This would reduce the
resistance to sticking with "select" when clearly "depends" is what's
meant.

BR,
Jani.


[1] Documentation/kbuild/kconfig-language.txt: "In general use select
only for non-visible symbols (no prompts anywhere) and for symbols with
no dependencies. That will limit the usefulness but on the other hand
avoid the illegal configurations all over."


>
> Signed-off-by: Gerd Hoffmann 
> ---
>  drivers/media/platform/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
> index d9b872b..fc21734 100644
> --- a/drivers/media/platform/Kconfig
> +++ b/drivers/media/platform/Kconfig
> @@ -87,8 +87,8 @@ config VIDEO_OMAP3
>   tristate "OMAP 3 Camera support"
>   depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3
>   depends on HAS_DMA
> + depends on OMAP_IOMMU
>   select ARM_DMA_USE_IOMMU
> - select OMAP_IOMMU
>   select VIDEOBUF2_DMA_CONTIG
>   ---help---
> Driver for an OMAP 3 camera controller.
> -- 
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Jani Nikula, Intel Open Source Technology Center


[PATCH v2 4/4] Add virtio-vga bits.

2015-04-01 Thread Gerd Hoffmann
On Mi, 2015-04-01 at 15:26 +0200, Michael S. Tsirkin wrote:
> On Wed, Apr 01, 2015 at 03:15:30PM +0200, Gerd Hoffmann wrote:
> > +static void virtio_pci_kick_out_firmware_fb(struct pci_dev *pci_dev)
> > +{
> > +   struct apertures_struct *ap;
> > +   bool primary;
> > +
> > +   ap = alloc_apertures(1);
> > +   if (!ap)
> > +   return;
> > +
> > +   ap->ranges[0].base = pci_resource_start(pci_dev, 2);
> > +   ap->ranges[0].size = pci_resource_len(pci_dev, 2);
> 
> I thought you mentioned it's better to switch to a different BAR
> to be compatible with stdvga?

Indeed, thats why the cover letter lists this as todo item, because it
isn't sorted yet.

Need to figure a sane way to handle this on the host side.  Current plan
is trying to make virtio_pci_device_plugged() configurable without
making things too messy.

cheers,
  Gerd




[PATCH 1/3] drm/exynos: mixer: add 2x scaling to mixer_graph_buffer

2015-04-01 Thread Tobias Jakobi
Hello Gustavo,

On 2015-03-27 14:11, Gustavo Padovan wrote:
> If you can rebase this in on top of my series this would be really 
> good.
like I said in my other mail, the series doesn't apply cleanly anymore, 
so I had to rebase your series.


>> Then it would just be:
>> static int mixer_setup_scale(const struct exynos_drm_plane *plane,
>>  unsigned int *x_ratio, unsigned int *y_ratio)
>> 
>> Also that would automatically fix your other comment below [*].
>> 
>> 
>> > Use EPERM or ENOTSUPP. Or even true/false.
>> Will do!
>> 
>> 
>> > You need to fix style here
>> >
>> > if (mixer_setup_scale(win_data->src_width, win_data->src_height,
>> >   win_data->crtc_width, win_data->crtc_height,
>> >   &x_ratio, &y_ratio))
>> > return;
>> With [*] this would just be:
>> if (mixer_setup_scale(plane, &x_ratio, &y_ratio)) return;
>> 
>> What do you think?
> 
> Changes sounds good to me. Please go ahead and send a new patch. :)
I've integrated the changes and just sent it out together with two other 
small fixes.

Here's the important part:
https://patchwork.kernel.org/patch/6140451/


With best wishes,
Tobias



[PATCH v2 3/4] Add virtio gpu driver.

2015-04-01 Thread Michael S. Tsirkin
On Wed, Apr 01, 2015 at 03:15:29PM +0200, Gerd Hoffmann wrote:
> +int virtio_gpu_driver_unload(struct drm_device *dev)
> +{
> + struct virtio_gpu_device *vgdev = dev->dev_private;
> +
> + vgdev->vqs_ready = false;

Probably ok since flush below will sync all cpus,
but this needs a comment I think.

> + flush_work(&vgdev->ctrlq.dequeue_work);
> + flush_work(&vgdev->cursorq.dequeue_work);

I see there are a bunch of other work entries -
don't all of them need to be flushed?

> + vgdev->vdev->config->del_vqs(vgdev->vdev);
> +
> + virtio_gpu_modeset_fini(vgdev);
> + virtio_gpu_ttm_fini(vgdev);
> + virtio_gpu_free_vbufs(vgdev);
> + kfree(vgdev);
> + return 0;
> +}


[PATCH 3/3] drm/exynos: mixer: add 2x scaling to mixer_graph_buffer

2015-04-01 Thread Tobias Jakobi
While the VP (video processor) supports arbitrary scaling
of its input, the mixer just supports a simple 2x (line
doubling) scaling. Expose this functionality and exit
early when an unsupported scaling configuration is
encountered.

This was tested with modetest's DRM plane test (from
the libdrm test suite) on an Odroid-X2 (Exynos4412).

Signed-off-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_mixer.c | 35 +--
 1 file changed, 29 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
b/drivers/gpu/drm/exynos/exynos_mixer.c
index 5ab0e32..6822b36 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -499,12 +499,36 @@ static void mixer_layer_update(struct mixer_context *ctx)
mixer_reg_writemask(res, MXR_CFG, ~0, MXR_CFG_LAYER_UPDATE);
 }

+static int mixer_setup_scale(const struct exynos_drm_plane *plane,
+   unsigned int *x_ratio, unsigned int *y_ratio)
+{
+   if (plane->crtc_width != plane->src_width) {
+   if (plane->crtc_width == 2 * plane->src_width)
+   *x_ratio = 1;
+   else
+   goto fail;
+   }
+
+   if (plane->crtc_height != plane->src_height) {
+   if (plane->crtc_height == 2 * plane->src_height)
+   *y_ratio = 1;
+   else
+   goto fail;
+   }
+
+   return 0;
+
+fail:
+   DRM_DEBUG_KMS("only 2x width/height scaling of plane supported\n");
+   return -ENOTSUPP;
+}
+
 static void mixer_graph_buffer(struct mixer_context *ctx, int win)
 {
struct mixer_resources *res = &ctx->mixer_res;
unsigned long flags;
struct exynos_drm_plane *plane;
-   unsigned int x_ratio, y_ratio;
+   unsigned int x_ratio = 0, y_ratio = 0;
unsigned int src_x_offset, src_y_offset, dst_x_offset, dst_y_offset;
dma_addr_t dma_addr;
unsigned int fmt;
@@ -528,9 +552,8 @@ static void mixer_graph_buffer(struct mixer_context *ctx, 
int win)
fmt = ARGB;
}

-   /* 2x scaling feature */
-   x_ratio = 0;
-   y_ratio = 0;
+   /* check if mixer supports requested scaling setup */
+   if (mixer_setup_scale(plane, &x_ratio, &y_ratio)) return;

dst_x_offset = plane->crtc_x;
dst_y_offset = plane->crtc_y;
@@ -566,8 +589,8 @@ static void mixer_graph_buffer(struct mixer_context *ctx, 
int win)
mixer_reg_write(res, MXR_RESOLUTION, val);
}

-   val  = MXR_GRP_WH_WIDTH(plane->crtc_width);
-   val |= MXR_GRP_WH_HEIGHT(plane->crtc_height);
+   val  = MXR_GRP_WH_WIDTH(plane->src_width);
+   val |= MXR_GRP_WH_HEIGHT(plane->src_height);
val |= MXR_GRP_WH_H_SCALE(x_ratio);
val |= MXR_GRP_WH_V_SCALE(y_ratio);
mixer_reg_write(res, MXR_GRAPHIC_WH(win), val);
-- 
2.0.5



[PATCH 2/3] drm/exynos: remove superfluous error messages

2015-04-01 Thread Tobias Jakobi
The messages are redundant since 'check_fb_gem_memory_type'
already prints out exactly the same string when it fails.

Signed-off-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_drm_fb.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c 
b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index d346d1e..929cb03 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -151,10 +151,8 @@ exynos_drm_framebuffer_init(struct drm_device *dev,
exynos_gem_obj = to_exynos_gem_obj(obj);

ret = check_fb_gem_memory_type(dev, exynos_gem_obj);
-   if (ret < 0) {
-   DRM_ERROR("cannot use this gem memory type for fb.\n");
-   return ERR_PTR(-EINVAL);
-   }
+   if (ret < 0)
+   return ERR_PTR(ret);

exynos_fb = kzalloc(sizeof(*exynos_fb), GFP_KERNEL);
if (!exynos_fb)
@@ -250,10 +248,8 @@ exynos_user_fb_create(struct drm_device *dev, struct 
drm_file *file_priv,
exynos_fb->exynos_gem_obj[i] = exynos_gem_obj;

ret = check_fb_gem_memory_type(dev, exynos_gem_obj);
-   if (ret < 0) {
-   DRM_ERROR("cannot use this gem memory type for fb.\n");
+   if (ret < 0)
goto err_unreference;
-   }
}

ret = drm_framebuffer_init(dev, &exynos_fb->fb, &exynos_drm_fb_funcs);
-- 
2.0.5



[PATCH 1/3] drm/exynos: fix typos in hdmi and mixer

2015-04-01 Thread Tobias Jakobi
Use the correct spelling for 'progressive'.

Signed-off-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_hdmi.c  | 2 +-
 drivers/gpu/drm/exynos/exynos_mixer.c | 2 +-
 drivers/gpu/drm/exynos/regs-mixer.h   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 3511fcc..20e2ce7 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -2022,7 +2022,7 @@ static void hdmi_mode_set(struct exynos_drm_display 
*display,
DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%s\n",
m->hdisplay, m->vdisplay,
m->vrefresh, (m->flags & DRM_MODE_FLAG_INTERLACE) ?
-   "INTERLACED" : "PROGERESSIVE");
+   "INTERLACED" : "PROGRESSIVE");

/* preserve mode information for later use. */
drm_mode_copy(&hdata->current_mode, mode);
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
b/drivers/gpu/drm/exynos/exynos_mixer.c
index aa5b6e1..5ab0e32 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -267,7 +267,7 @@ static void mixer_cfg_scan(struct mixer_context *ctx, 
unsigned int height)

/* choosing between interlace and progressive mode */
val = (ctx->interlace ? MXR_CFG_SCAN_INTERLACE :
-   MXR_CFG_SCAN_PROGRASSIVE);
+   MXR_CFG_SCAN_PROGRESSIVE);

if (ctx->mxr_ver != MXR_VER_128_0_0_184) {
/* choosing between proper HD and SD mode */
diff --git a/drivers/gpu/drm/exynos/regs-mixer.h 
b/drivers/gpu/drm/exynos/regs-mixer.h
index 5f32e1a..ac60260 100644
--- a/drivers/gpu/drm/exynos/regs-mixer.h
+++ b/drivers/gpu/drm/exynos/regs-mixer.h
@@ -101,7 +101,7 @@
 #define MXR_CFG_GRP0_ENABLE(1 << 4)
 #define MXR_CFG_VP_ENABLE  (1 << 3)
 #define MXR_CFG_SCAN_INTERLACE (0 << 2)
-#define MXR_CFG_SCAN_PROGRASSIVE   (1 << 2)
+#define MXR_CFG_SCAN_PROGRESSIVE   (1 << 2)
 #define MXR_CFG_SCAN_NTSC  (0 << 1)
 #define MXR_CFG_SCAN_PAL   (1 << 1)
 #define MXR_CFG_SCAN_SD(0 << 0)
-- 
2.0.5



[PATCH v2 4/4] Add virtio-vga bits.

2015-04-01 Thread Michael S. Tsirkin
On Wed, Apr 01, 2015 at 03:15:30PM +0200, Gerd Hoffmann wrote:
> +static void virtio_pci_kick_out_firmware_fb(struct pci_dev *pci_dev)
> +{
> + struct apertures_struct *ap;
> + bool primary;
> +
> + ap = alloc_apertures(1);
> + if (!ap)
> + return;
> +
> + ap->ranges[0].base = pci_resource_start(pci_dev, 2);
> + ap->ranges[0].size = pci_resource_len(pci_dev, 2);

I thought you mentioned it's better to switch to a different BAR
to be compatible with stdvga?

-- 
MST


[PATCH v2 4/4] Add virtio-vga bits.

2015-04-01 Thread Gerd Hoffmann
---
 drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 32 ++--
 drivers/virtio/virtio_pci_common.c   |  7 ++-
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c 
b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c
index 56bd4ed..33d12d5 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c
+++ b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c
@@ -37,6 +37,26 @@ int drm_virtio_set_busid(struct drm_device *dev, struct 
drm_master *master)
return 0;
 }

+static void virtio_pci_kick_out_firmware_fb(struct pci_dev *pci_dev)
+{
+   struct apertures_struct *ap;
+   bool primary;
+
+   ap = alloc_apertures(1);
+   if (!ap)
+   return;
+
+   ap->ranges[0].base = pci_resource_start(pci_dev, 2);
+   ap->ranges[0].size = pci_resource_len(pci_dev, 2);
+
+   primary = pci_dev->resource[PCI_ROM_RESOURCE].flags
+   & IORESOURCE_ROM_SHADOW;
+
+   remove_conflicting_framebuffers(ap, "virtiodrmfb", primary);
+
+   kfree(ap);
+}
+
 int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev)
 {
struct drm_device *dev;
@@ -48,8 +68,16 @@ int drm_virtio_init(struct drm_driver *driver, struct 
virtio_device *vdev)
dev->virtdev = vdev;
vdev->priv = dev;

-   if (strcmp(vdev->dev.parent->bus->name, "pci") == 0)
-   dev->pdev = to_pci_dev(vdev->dev.parent);
+   if (strcmp(vdev->dev.parent->bus->name, "pci") == 0) {
+   struct pci_dev *pdev = to_pci_dev(vdev->dev.parent);
+   bool vga = (pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA;
+
+   DRM_INFO("pci: %s detected\n",
+vga ? "virtio-vga" : "virtio-gpu-pci");
+   dev->pdev = pdev;
+   if (vga)
+   virtio_pci_kick_out_firmware_fb(pdev);
+   }

ret = drm_dev_register(dev, 0);
if (ret)
diff --git a/drivers/virtio/virtio_pci_common.c 
b/drivers/virtio/virtio_pci_common.c
index e894eb2..36d82e8 100644
--- a/drivers/virtio/virtio_pci_common.c
+++ b/drivers/virtio/virtio_pci_common.c
@@ -510,7 +510,12 @@ static int virtio_pci_probe(struct pci_dev *pci_dev,
goto err_enable_device;

rc = pci_request_regions(pci_dev, "virtio-pci");
-   if (rc)
+   /*
+* virtio-vga: vesafb/efifb might hold vga framebuffer
+* resource, but don't fail on that, we'll kick out vesafb
+* later on.
+*/
+   if (rc && ((pci_dev->class >> 8) != PCI_CLASS_DISPLAY_VGA))
goto err_request_regions;

if (force_legacy) {
-- 
1.8.3.1



[PATCH v2 3/4] Add virtio gpu driver.

2015-04-01 Thread Gerd Hoffmann
From: Dave Airlie 

This patch adds a kms driver for the virtio gpu.  The xorg modesetting
driver can handle the device just fine, the framebuffer for fbcon is
there too.

Qemu patches for the host side are under review currently.

The pci version of the device comes in two variants: with and without
vga compatibility.  The former has a extra memory bar for the vga
framebuffer, the later is a pure virtio device.  The only concern for
this driver is that in the virtio-vga case we have to kick out the
firmware framebuffer.

Initial revision has only 2d support, 3d (virgl) support requires
some more work on the qemu side and will be added later.

Signed-off-by: Dave Airlie 
Signed-off-by: Gerd Hoffmann 
---
 drivers/gpu/drm/Kconfig  |   2 +
 drivers/gpu/drm/Makefile |   1 +
 drivers/gpu/drm/virtio/Kconfig   |  14 +
 drivers/gpu/drm/virtio/Makefile  |  11 +
 drivers/gpu/drm/virtio/virtgpu_debugfs.c |  64 
 drivers/gpu/drm/virtio/virtgpu_display.c | 485 
 drivers/gpu/drm/virtio/virtgpu_drm_bus.c |  67 
 drivers/gpu/drm/virtio/virtgpu_drv.c | 136 +++
 drivers/gpu/drm/virtio/virtgpu_drv.h | 350 ++
 drivers/gpu/drm/virtio/virtgpu_fb.c  | 431 ++
 drivers/gpu/drm/virtio/virtgpu_fence.c   | 119 ++
 drivers/gpu/drm/virtio/virtgpu_gem.c | 140 +++
 drivers/gpu/drm/virtio/virtgpu_kms.c | 163 
 drivers/gpu/drm/virtio/virtgpu_object.c  | 170 +
 drivers/gpu/drm/virtio/virtgpu_plane.c   | 120 ++
 drivers/gpu/drm/virtio/virtgpu_ttm.c | 469 +++
 drivers/gpu/drm/virtio/virtgpu_vq.c  | 614 +++
 include/drm/drmP.h   |   1 +
 include/uapi/linux/Kbuild|   1 +
 include/uapi/linux/virtio_gpu.h  | 204 ++
 include/uapi/linux/virtio_ids.h  |   1 +
 21 files changed, 3563 insertions(+)
 create mode 100644 drivers/gpu/drm/virtio/Kconfig
 create mode 100644 drivers/gpu/drm/virtio/Makefile
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_debugfs.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_display.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_drm_bus.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_drv.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_drv.h
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_fb.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_fence.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_gem.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_kms.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_object.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_plane.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_ttm.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_vq.c
 create mode 100644 include/uapi/linux/virtio_gpu.h

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 151a050..f2388ea 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -197,6 +197,8 @@ source "drivers/gpu/drm/qxl/Kconfig"

 source "drivers/gpu/drm/bochs/Kconfig"

+source "drivers/gpu/drm/virtio/Kconfig"
+
 source "drivers/gpu/drm/msm/Kconfig"

 source "drivers/gpu/drm/tegra/Kconfig"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 2c239b9..083d443 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -62,6 +62,7 @@ obj-$(CONFIG_DRM_OMAP)+= omapdrm/
 obj-$(CONFIG_DRM_TILCDC)   += tilcdc/
 obj-$(CONFIG_DRM_QXL) += qxl/
 obj-$(CONFIG_DRM_BOCHS) += bochs/
+obj-$(CONFIG_DRM_VIRTIO_GPU) += virtio/
 obj-$(CONFIG_DRM_MSM) += msm/
 obj-$(CONFIG_DRM_TEGRA) += tegra/
 obj-$(CONFIG_DRM_STI) += sti/
diff --git a/drivers/gpu/drm/virtio/Kconfig b/drivers/gpu/drm/virtio/Kconfig
new file mode 100644
index 000..9983ead
--- /dev/null
+++ b/drivers/gpu/drm/virtio/Kconfig
@@ -0,0 +1,14 @@
+config DRM_VIRTIO_GPU
+   tristate "Virtio GPU driver"
+   depends on DRM && VIRTIO
+   select FB_SYS_FILLRECT
+   select FB_SYS_COPYAREA
+   select FB_SYS_IMAGEBLIT
+select DRM_KMS_HELPER
+select DRM_KMS_FB_HELPER
+select DRM_TTM
+   help
+  This is the virtual GPU driver for virtio.  It can be used with
+   QEMU based VMMs (like KVM or Xen).
+
+  If unsure say M.
diff --git a/drivers/gpu/drm/virtio/Makefile b/drivers/gpu/drm/virtio/Makefile
new file mode 100644
index 000..2ee1602
--- /dev/null
+++ b/drivers/gpu/drm/virtio/Makefile
@@ -0,0 +1,11 @@
+#
+# Makefile for the drm device driver.  This driver provides support for the
+# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
+
+ccflags-y := -Iinclude/drm
+
+virtio-gpu-y := virtgpu_drv.o virtgpu_kms.o virtgpu_drm_bus.o virtgpu_gem.o \
+   virtgpu_fb.o virtgpu_display.o virtgpu_vq.o virtgpu_ttm.o \
+   virtgpu_fence.o virtgpu_object.o virtgpu_debugfs.o virtgpu_plane.o
+
+obj-$(CONFIG_DRM_VIRTIO_GPU) += virtio-gpu.o
diff -

[PATCH v2 2/4] drm_vblank_get: don't WARN_ON in case vblanks are not initialized

2015-04-01 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann 
---
 drivers/gpu/drm/drm_irq.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 10574a0..c631c1a 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -1026,6 +1026,9 @@ int drm_vblank_get(struct drm_device *dev, int crtc)
unsigned long irqflags;
int ret = 0;

+   if (!dev->num_crtcs)
+   return -EINVAL;
+
if (WARN_ON(crtc >= dev->num_crtcs))
return -EINVAL;

-- 
1.8.3.1



[PATCH v2 1/4] break kconfig dependency loop

2015-04-01 Thread Gerd Hoffmann
After adding virtio-gpu I get this funky kconfig dependency loop.

scripts/kconfig/conf --oldconfig Kconfig
drivers/video/fbdev/Kconfig:5:error: recursive dependency detected!
drivers/video/fbdev/Kconfig:5:  symbol FB is selected by DRM_KMS_FB_HELPER
drivers/gpu/drm/Kconfig:34: symbol DRM_KMS_FB_HELPER is selected by 
DRM_VIRTIO_GPU
drivers/gpu/drm/virtio/Kconfig:1:   symbol DRM_VIRTIO_GPU depends on VIRTIO
drivers/virtio/Kconfig:1:   symbol VIRTIO is selected by REMOTEPROC
drivers/remoteproc/Kconfig:4:   symbol REMOTEPROC is selected by OMAP_REMOTEPROC
drivers/remoteproc/Kconfig:12:  symbol OMAP_REMOTEPROC depends on OMAP_IOMMU
drivers/iommu/Kconfig:141:  symbol OMAP_IOMMU is selected by VIDEO_OMAP3
drivers/media/platform/Kconfig:96:  symbol VIDEO_OMAP3 depends on VIDEO_V4L2
drivers/media/v4l2-core/Kconfig:6:  symbol VIDEO_V4L2 depends on I2C
drivers/i2c/Kconfig:7:  symbol I2C is selected by FB_DDC
drivers/video/fbdev/Kconfig:59: symbol FB_DDC is selected by FB_CYBER2000_DDC
drivers/video/fbdev/Kconfig:374:symbol FB_CYBER2000_DDC depends on 
FB_CYBER2000
drivers/video/fbdev/Kconfig:362:symbol FB_CYBER2000 depends on FB

Making VIDEO_OMAP3 depend on OMAP_IOMMU instead of selecting it breaks the
loop, which looks like the best way to handle it to me.  I'm open to better
suggestions though.

Signed-off-by: Gerd Hoffmann 
---
 drivers/media/platform/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index d9b872b..fc21734 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -87,8 +87,8 @@ config VIDEO_OMAP3
tristate "OMAP 3 Camera support"
depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3
depends on HAS_DMA
+   depends on OMAP_IOMMU
select ARM_DMA_USE_IOMMU
-   select OMAP_IOMMU
select VIDEOBUF2_DMA_CONTIG
---help---
  Driver for an OMAP 3 camera controller.
-- 
1.8.3.1



[PATCH v2 0/4] Add virtio gpu driver.

2015-04-01 Thread Gerd Hoffmann
  Hi,

Next version of the virtio-gpu driver.  Turned into a little patch
series now.  Most review comments should be addressed.

Changes in v2:
 * add support for universal plane
 * add support for atomic modesetting
 * make non-failing funcs return void, kill pointless error checking
 * allocate vbuffers at init time, to avoid allocations in critical paths
 * license clarification (dual mit/gpl)
 * splitted vga handling into separate patch
 * improve error handling
 * codestyle fixes
 * misc minor tweaks here and there

Still on the todo list:
 * sort how to handle vga compatibility best, for now the bits just have
   been splitted into a separate patch so they are easier to spot and
   don't confuse when reviewing the main parts of the driver.
 * properly handle page flip.

cheers,
  Gerd

Dave Airlie (1):
  Add virtio gpu driver.

Gerd Hoffmann (3):
  break kconfig dependency loop
  drm_vblank_get: don't WARN_ON in case vblanks are not initialized
  Add virtio-vga bits.

 drivers/gpu/drm/Kconfig  |   2 +
 drivers/gpu/drm/Makefile |   1 +
 drivers/gpu/drm/drm_irq.c|   3 +
 drivers/gpu/drm/virtio/Kconfig   |  14 +
 drivers/gpu/drm/virtio/Makefile  |  11 +
 drivers/gpu/drm/virtio/virtgpu_debugfs.c |  64 
 drivers/gpu/drm/virtio/virtgpu_display.c | 485 
 drivers/gpu/drm/virtio/virtgpu_drm_bus.c |  95 +
 drivers/gpu/drm/virtio/virtgpu_drv.c | 136 +++
 drivers/gpu/drm/virtio/virtgpu_drv.h | 350 ++
 drivers/gpu/drm/virtio/virtgpu_fb.c  | 431 ++
 drivers/gpu/drm/virtio/virtgpu_fence.c   | 119 ++
 drivers/gpu/drm/virtio/virtgpu_gem.c | 140 +++
 drivers/gpu/drm/virtio/virtgpu_kms.c | 163 
 drivers/gpu/drm/virtio/virtgpu_object.c  | 170 +
 drivers/gpu/drm/virtio/virtgpu_plane.c   | 120 ++
 drivers/gpu/drm/virtio/virtgpu_ttm.c | 469 +++
 drivers/gpu/drm/virtio/virtgpu_vq.c  | 614 +++
 drivers/media/platform/Kconfig   |   2 +-
 drivers/virtio/virtio_pci_common.c   |   7 +-
 include/drm/drmP.h   |   1 +
 include/uapi/linux/Kbuild|   1 +
 include/uapi/linux/virtio_gpu.h  | 204 ++
 include/uapi/linux/virtio_ids.h  |   1 +
 24 files changed, 3601 insertions(+), 2 deletions(-)
 create mode 100644 drivers/gpu/drm/virtio/Kconfig
 create mode 100644 drivers/gpu/drm/virtio/Makefile
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_debugfs.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_display.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_drm_bus.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_drv.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_drv.h
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_fb.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_fence.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_gem.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_kms.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_object.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_plane.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_ttm.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_vq.c
 create mode 100644 include/uapi/linux/virtio_gpu.h

-- 
1.8.3.1



[PATCH RFC 07/11] drm/edid: add function to help find SADs

2015-04-01 Thread Jani Nikula
On Mon, 30 Mar 2015, Russell King  wrote:
> Add a function to find the start of the SADs in the ELD.  This
> complements the helper to retrieve the SAD count.
>
> Signed-off-by: Russell King 

I guess version 31 is specific enough to warrant a #define of its own,
but meh.

Reviewed-by: Jani Nikula 

> ---
>  include/drm/drm_edid.h | 19 +++
>  1 file changed, 19 insertions(+)
>
> diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
> index 87d85e81d3a7..c44ad513e0f7 100644
> --- a/include/drm/drm_edid.h
> +++ b/include/drm/drm_edid.h
> @@ -346,6 +346,25 @@ static inline int drm_eld_mnl(const uint8_t *eld)
>  }
>  
>  /**
> + * drm_eld_sad - Get ELD SAD structures.
> + * @eld: pointer to an eld memory structure with sad_count set
> + */
> +static inline const uint8_t *drm_eld_sad(const uint8_t *eld)
> +{
> + unsigned int ver, mnl;
> +
> + ver = (eld[DRM_ELD_VER] & DRM_ELD_VER_MASK) >> DRM_ELD_VER_SHIFT;
> + if (ver != 2 && ver != 31)
> + return NULL;
> +
> + mnl = drm_eld_mnl(eld);
> + if (mnl > 16)
> + return NULL;
> +
> + return eld + DRM_ELD_CEA_SAD(mnl, 0);
> +}
> +
> +/**
>   * drm_eld_sad_count - Get ELD SAD count.
>   * @eld: pointer to an eld memory structure with sad_count set
>   */
> -- 
> 1.8.3.1
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Jani Nikula, Intel Open Source Technology Center


[PATCH] drm/rockchip: vop: add vop power domain support

2015-04-01 Thread Mark Yao
From: Mark Yao 

Reference the power domain incase vop power down when
in use.

Signed-off-by: Mark Yao 
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index d041921..7a61c8e 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -421,6 +421,12 @@ static void vop_enable(struct drm_crtc *crtc)
if (vop->is_enabled)
return;

+   ret = pm_runtime_get_sync(vop->dev);
+   if (ret < 0) {
+   dev_err(vop->dev, "failed to get pm runtime: %d\n", ret);
+   return;
+   }
+
ret = clk_enable(vop->hclk);
if (ret < 0) {
dev_err(vop->dev, "failed to enable hclk - %d\n", ret);
@@ -517,6 +523,7 @@ static void vop_disable(struct drm_crtc *crtc)
clk_disable(vop->dclk);
clk_disable(vop->aclk);
clk_disable(vop->hclk);
+   pm_runtime_put(vop->dev);
 }

 /*
-- 
1.7.9.5




[PATCH libdrm 05/24] radeon: remove more unused functions

2015-04-01 Thread Jerome Glisse
On Wed, Apr 01, 2015 at 05:15:16PM +0100, Emil Velikov wrote:
> bof_array_{get,size} and bof_blob_{size,value}. All of which unused
> since their introduction with commit 78de69713d7(drm/radeon: add new cs
> command stream dumping facilities)
> 
> Cc: Jerome Glisse 
> Signed-off-by: Emil Velikov 

NAK

I use all this in tools to debug lockup. Best course of action is to
exclude bof.h from being distributed. My tools static link and i just
point them to libdrm git tree.

Cheers,
Jérôme


[PATCH libdrm 04/24] radeon: annotate bof_incref, bof_string functions as static

2015-04-01 Thread Jerome Glisse
On Wed, Apr 01, 2015 at 05:15:15PM +0100, Emil Velikov wrote:
> Used locally in bof.c.
> 
> Cc: Jerome Glisse 
> Signed-off-by: Emil Velikov 


NAK

I use all this in tools to debug lockup. Best course of action is to
exclude bof.h from being distributed. My tools static link and i just
point them to libdrm git tree.

Cheers,
Jérôme

> ---
>  radeon/bof.c | 96 
> ++--
>  radeon/bof.h |  3 --
>  2 files changed, 48 insertions(+), 51 deletions(-)
> 
> diff --git a/radeon/bof.c b/radeon/bof.c
> index 6f3760a..20901a0 100644
> --- a/radeon/bof.c
> +++ b/radeon/bof.c
> @@ -45,6 +45,54 @@ static int bof_entry_grow(bof_t *bof)
>   return 0;
>  }
>  
> +static void bof_incref(bof_t *bof)
> +{
> + bof->refcount++;
> +}
> +
> +void bof_decref(bof_t *bof)
> +{
> + unsigned i;
> +
> + if (bof == NULL)
> + return;
> + if (--bof->refcount > 0)
> + return;
> + for (i = 0; i < bof->array_size; i++) {
> + bof_decref(bof->array[i]);
> + bof->array[i] = NULL;
> + }
> + bof->array_size = 0;
> + if (bof->file) {
> + fclose(bof->file);
> + bof->file = NULL;
> + }
> + free(bof->array);
> + free(bof->value);
> + free(bof);
> +}
> +
> +/*
> + * string
> + */
> +static bof_t *bof_string(const char *value)
> +{
> + bof_t *string = bof_object();
> +
> + if (string == NULL)
> + return NULL;
> + string->type = BOF_TYPE_STRING;
> + string->size = strlen(value) + 1;
> + string->value = calloc(1, string->size);
> + if (string->value == NULL) {
> + bof_decref(string);
> + return NULL;
> + }
> + strcpy(string->value, value);
> + string->size += 12;
> + return string;
> +}
> +
>  /*
>   * object 
>   */
> @@ -160,27 +208,6 @@ void *bof_blob_value(bof_t *bof)
>  }
>  
>  /*
> - * string
> - */
> -bof_t *bof_string(const char *value)
> -{
> - bof_t *string = bof_object();
> -
> - if (string == NULL)
> - return NULL;
> - string->type = BOF_TYPE_STRING;
> - string->size = strlen(value) + 1;
> - string->value = calloc(1, string->size);
> - if (string->value == NULL) {
> - bof_decref(string);
> - return NULL;
> - }
> - strcpy(string->value, value);
> - string->size += 12;
> - return string;
> -}
> -
> -/*
>   *  int32
>   */
>  bof_t *bof_int32(int32_t value)
> @@ -316,33 +343,6 @@ out_err:
>   return -EINVAL;
>  }
>  
> -void bof_incref(bof_t *bof)
> -{
> - bof->refcount++;
> -}
> -
> -void bof_decref(bof_t *bof)
> -{
> - unsigned i;
> -
> - if (bof == NULL)
> - return;
> - if (--bof->refcount > 0)
> - return;
> - for (i = 0; i < bof->array_size; i++) {
> - bof_decref(bof->array[i]);
> - bof->array[i] = NULL;
> - }
> - bof->array_size = 0;
> - if (bof->file) {
> - fclose(bof->file);
> - bof->file = NULL;
> - }
> - free(bof->array);
> - free(bof->value);
> - free(bof);
> -}
> -
>  static int bof_file_write(bof_t *bof, FILE *file)
>  {
>   unsigned i;
> diff --git a/radeon/bof.h b/radeon/bof.h
> index 8e952c1..4dae923 100644
> --- a/radeon/bof.h
> +++ b/radeon/bof.h
> @@ -63,14 +63,11 @@ extern unsigned bof_array_size(bof_t *bof);
>  extern bof_t *bof_blob(unsigned size, void *value);
>  extern unsigned bof_blob_size(bof_t *bof);
>  extern void *bof_blob_value(bof_t *bof);
> -/* string */
> -extern bof_t *bof_string(const char *value);
>  /* int32 */
>  extern bof_t *bof_int32(int32_t value);
>  extern int32_t bof_int32_value(bof_t *bof);
>  /* common functions */
>  extern void bof_decref(bof_t *bof);
> -extern void bof_incref(bof_t *bof);
>  extern int bof_dump_file(bof_t *bof, const char *filename);
>  
>  static inline int bof_is_object(bof_t *bof){return (bof->type == 
> BOF_TYPE_OBJECT);}
> -- 
> 2.3.1
> 
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH libdrm 04/24] radeon: annotate bof_incref, bof_string functions as static

2015-04-01 Thread Jerome Glisse
On Wed, Apr 01, 2015 at 05:15:15PM +0100, Emil Velikov wrote:
> Used locally in bof.c.
> 
> Cc: Jerome Glisse 
> Signed-off-by: Emil Velikov 

NAK

I use all this in tools to debug lockup. Best course of action is to
exclude bof.h from being distributed. My tools static link and i just
point them to libdrm git tree.

Cheers,
Jérôme

> ---
>  radeon/bof.c | 96 
> ++--
>  radeon/bof.h |  3 --
>  2 files changed, 48 insertions(+), 51 deletions(-)
> 
> diff --git a/radeon/bof.c b/radeon/bof.c
> index 6f3760a..20901a0 100644
> --- a/radeon/bof.c
> +++ b/radeon/bof.c
> @@ -45,6 +45,54 @@ static int bof_entry_grow(bof_t *bof)
>   return 0;
>  }
>  
> +static void bof_incref(bof_t *bof)
> +{
> + bof->refcount++;
> +}
> +
> +void bof_decref(bof_t *bof)
> +{
> + unsigned i;
> +
> + if (bof == NULL)
> + return;
> + if (--bof->refcount > 0)
> + return;
> + for (i = 0; i < bof->array_size; i++) {
> + bof_decref(bof->array[i]);
> + bof->array[i] = NULL;
> + }
> + bof->array_size = 0;
> + if (bof->file) {
> + fclose(bof->file);
> + bof->file = NULL;
> + }
> + free(bof->array);
> + free(bof->value);
> + free(bof);
> +}
> +
> +/*
> + * string
> + */
> +static bof_t *bof_string(const char *value)
> +{
> + bof_t *string = bof_object();
> +
> + if (string == NULL)
> + return NULL;
> + string->type = BOF_TYPE_STRING;
> + string->size = strlen(value) + 1;
> + string->value = calloc(1, string->size);
> + if (string->value == NULL) {
> + bof_decref(string);
> + return NULL;
> + }
> + strcpy(string->value, value);
> + string->size += 12;
> + return string;
> +}
> +
>  /*
>   * object 
>   */
> @@ -160,27 +208,6 @@ void *bof_blob_value(bof_t *bof)
>  }
>  
>  /*
> - * string
> - */
> -bof_t *bof_string(const char *value)
> -{
> - bof_t *string = bof_object();
> -
> - if (string == NULL)
> - return NULL;
> - string->type = BOF_TYPE_STRING;
> - string->size = strlen(value) + 1;
> - string->value = calloc(1, string->size);
> - if (string->value == NULL) {
> - bof_decref(string);
> - return NULL;
> - }
> - strcpy(string->value, value);
> - string->size += 12;
> - return string;
> -}
> -
> -/*
>   *  int32
>   */
>  bof_t *bof_int32(int32_t value)
> @@ -316,33 +343,6 @@ out_err:
>   return -EINVAL;
>  }
>  
> -void bof_incref(bof_t *bof)
> -{
> - bof->refcount++;
> -}
> -
> -void bof_decref(bof_t *bof)
> -{
> - unsigned i;
> -
> - if (bof == NULL)
> - return;
> - if (--bof->refcount > 0)
> - return;
> - for (i = 0; i < bof->array_size; i++) {
> - bof_decref(bof->array[i]);
> - bof->array[i] = NULL;
> - }
> - bof->array_size = 0;
> - if (bof->file) {
> - fclose(bof->file);
> - bof->file = NULL;
> - }
> - free(bof->array);
> - free(bof->value);
> - free(bof);
> -}
> -
>  static int bof_file_write(bof_t *bof, FILE *file)
>  {
>   unsigned i;
> diff --git a/radeon/bof.h b/radeon/bof.h
> index 8e952c1..4dae923 100644
> --- a/radeon/bof.h
> +++ b/radeon/bof.h
> @@ -63,14 +63,11 @@ extern unsigned bof_array_size(bof_t *bof);
>  extern bof_t *bof_blob(unsigned size, void *value);
>  extern unsigned bof_blob_size(bof_t *bof);
>  extern void *bof_blob_value(bof_t *bof);
> -/* string */
> -extern bof_t *bof_string(const char *value);
>  /* int32 */
>  extern bof_t *bof_int32(int32_t value);
>  extern int32_t bof_int32_value(bof_t *bof);
>  /* common functions */
>  extern void bof_decref(bof_t *bof);
> -extern void bof_incref(bof_t *bof);
>  extern int bof_dump_file(bof_t *bof, const char *filename);
>  
>  static inline int bof_is_object(bof_t *bof){return (bof->type == 
> BOF_TYPE_OBJECT);}
> -- 
> 2.3.1
> 
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH libdrm 03/24] radeon: remove unused functions

2015-04-01 Thread Jerome Glisse
On Wed, Apr 01, 2015 at 05:15:14PM +0100, Emil Velikov wrote:
> Namely bof_load_file, bof_print, bof_object_get. Unused since their
> introduction according to git log.
> 
> Cc: Jerome Glisse 
> Signed-off-by: Emil Velikov 


NAK

I use all this in tools to debug lockup. Best course of action is to
exclude bof.h from being distributed. My tools static link and i just
point them to libdrm git tree.

Cheers,
Jérôme

> ---
>  radeon/bof.c | 53 -
>  radeon/bof.h |  3 ---
>  2 files changed, 56 deletions(-)
> 
> diff --git a/radeon/bof.c b/radeon/bof.c
> index 0598cc6..6f3760a 100644
> --- a/radeon/bof.c
> +++ b/radeon/bof.c
> @@ -61,18 +61,6 @@ bof_t *bof_object(void)
>   return object;
>  }
>  
> -bof_t *bof_object_get(bof_t *object, const char *keyname)
> -{
> - unsigned i;
> -
> - for (i = 0; i < object->array_size; i += 2) {
> - if (!strcmp(object->array[i]->value, keyname)) {
> - return object->array[i + 1];
> - }
> - }
> - return NULL;
> -}
> -
>  int bof_object_set(bof_t *object, const char *keyname, bof_t *value)
>  {
>   bof_t *key;
> @@ -271,11 +259,6 @@ static void bof_print_rec(bof_t *bof, int level, int 
> entry)
>   }
>  }
>  
> -void bof_print(bof_t *bof)
> -{
> - bof_print_rec(bof, 0, 0);
> -}
> -
>  static int bof_read(bof_t *root, FILE *file, long end, int level)
>  {
>   bof_t *bof = NULL;
> @@ -333,42 +316,6 @@ out_err:
>   return -EINVAL;
>  }
>  
> -bof_t *bof_load_file(const char *filename)
> -{
> - bof_t *root = bof_object();
> - int r;
> -
> - if (root == NULL) {
> - fprintf(stderr, "%s failed to create root object\n", __func__);
> - return NULL;
> - }
> - root->file = fopen(filename, "r");
> - if (root->file == NULL)
> - goto out_err;
> - r = fseek(root->file, 0L, SEEK_SET);
> - if (r) {
> - fprintf(stderr, "%s failed to seek into file %s\n", __func__, 
> filename);
> - goto out_err;
> - }
> - root->offset = ftell(root->file);
> - r = fread(&root->type, 4, 1, root->file);
> - if (r != 1)
> - goto out_err;
> - r = fread(&root->size, 4, 1, root->file);
> - if (r != 1)
> - goto out_err;
> - r = fread(&root->array_size, 4, 1, root->file);
> - if (r != 1)
> - goto out_err;
> - r = bof_read(root, root->file, root->offset + root->size, 2);
> - if (r)
> - goto out_err;
> - return root;
> -out_err:
> - bof_decref(root);
> - return NULL;
> -}
> -
>  void bof_incref(bof_t *bof)
>  {
>   bof->refcount++;
> diff --git a/radeon/bof.h b/radeon/bof.h
> index cb829a1..8e952c1 100644
> --- a/radeon/bof.h
> +++ b/radeon/bof.h
> @@ -53,7 +53,6 @@ typedef struct bof {
>  
>  /* object */
>  extern bof_t *bof_object(void);
> -extern bof_t *bof_object_get(bof_t *object, const char *keyname);
>  extern int bof_object_set(bof_t *object, const char *keyname, bof_t *value);
>  /* array */
>  extern bof_t *bof_array(void);
> @@ -72,9 +71,7 @@ extern int32_t bof_int32_value(bof_t *bof);
>  /* common functions */
>  extern void bof_decref(bof_t *bof);
>  extern void bof_incref(bof_t *bof);
> -extern bof_t *bof_load_file(const char *filename);
>  extern int bof_dump_file(bof_t *bof, const char *filename);
> -extern void bof_print(bof_t *bof);
>  
>  static inline int bof_is_object(bof_t *bof){return (bof->type == 
> BOF_TYPE_OBJECT);}
>  static inline int bof_is_blob(bof_t *bof){return (bof->type == 
> BOF_TYPE_BLOB);}
> -- 
> 2.3.1
> 
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH libdrm 02/24] radeon: remove empty function declarations

2015-04-01 Thread Jerome Glisse
On Wed, Apr 01, 2015 at 05:15:13PM +0100, Emil Velikov wrote:
> Missing definition and unused since their introduction.
> 
> Cc: Jerome Glisse 
> Signed-off-by: Emil Velikov 

NAK

I use all this in tools to debug lockup. Best course of action is to
exclude bof.h from being distributed. My tools static link and i just
point them to libdrm git tree.

Cheers,
Jérôme

> ---
>  radeon/bof.h | 4 
>  1 file changed, 4 deletions(-)
> 
> diff --git a/radeon/bof.h b/radeon/bof.h
> index 014affb..cb829a1 100644
> --- a/radeon/bof.h
> +++ b/radeon/bof.h
> @@ -51,10 +51,6 @@ typedef struct bof {
>   longoffset;
>  } bof_t;
>  
> -extern int bof_file_flush(bof_t *root);
> -extern bof_t *bof_file_new(const char *filename);
> -extern int bof_object_dump(bof_t *object, const char *filename);
> -
>  /* object */
>  extern bof_t *bof_object(void);
>  extern bof_t *bof_object_get(bof_t *object, const char *keyname);
> -- 
> 2.3.1
> 
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/exynos: fimd: check whether exynos_drm_crtc_create succeed or not

2015-04-01 Thread Hyungwon Hwang
>From the commit "drm/exynos: fix the execution order in FIMD
initialization" (598285bfdce46d7c47632a2ba4b980f60be4a677), the error
checking code is removed improperly. This patch fix the regression.

Signed-off-by: Hyungwon Hwang 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 31dfa80..15cee94 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -1060,6 +1060,8 @@ static int fimd_bind(struct device *dev, struct device 
*master, void *data)
ctx->crtc = exynos_drm_crtc_create(drm_dev, ctx->pipe,
   EXYNOS_DISPLAY_TYPE_LCD,
   &fimd_crtc_ops, ctx);
+   if (IS_ERR(ctx->crtc))
+   return PTR_ERR(ctx->crtc);

if (ctx->display)
exynos_drm_create_enc_conn(drm_dev, ctx->display);
-- 
1.9.1



[PATCH 3/8] drm/exynos: remove struct *_win_data abstraction on planes

2015-04-01 Thread Gustavo Padovan
Hi Tobias,

2015-03-31 Tobias Jakobi :

> Hello,
> 
> I just wanted to point out that this doesn't apply to exynos-drm-fixes, which 
> was probably caused by Daniel's pitch patch here:
> https://git.kernel.org/cgit/linux/kernel/git/daeinki/drm-exynos.git/commit/?h=exynos-drm-fixes&id=57aaaf373ede95ebaaf90695071f7b1f4a97795f

Right. I've just sent a new version of this patches rebased on top of Daniel's
patch.

Gustavo


[PATCH -v4 8/8] drm/exynos: track vblank events on a per crtc basis

2015-04-01 Thread Gustavo Padovan
From: Mandeep Singh Baines 

The goal of the change is to make sure we send the vblank event on the
current vblank. My hope is to fix any races that might be causing flicker.
After this change I only see a flicker in the transition plymouth and
X11.

Simplified the code by tracking vblank events on a per-crtc basis. This
allowed me to remove all error paths from the callback. It also allowed
me to remove the vblank wait from the callback.

Signed-off-by: Mandeep Singh Baines 
Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 92 +++-
 drivers/gpu/drm/exynos/exynos_drm_drv.c  | 13 -
 drivers/gpu/drm/exynos/exynos_drm_drv.h  |  6 +--
 3 files changed, 44 insertions(+), 67 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 47dd2b0..eb49195 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -34,9 +34,8 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int 
mode)
if (mode > DRM_MODE_DPMS_ON) {
/* wait for the completion of page flip. */
if (!wait_event_timeout(exynos_crtc->pending_flip_queue,
-   !atomic_read(&exynos_crtc->pending_flip),
-   HZ/20))
-   atomic_set(&exynos_crtc->pending_flip, 0);
+   (exynos_crtc->event == NULL), HZ/20))
+   exynos_crtc->event = NULL;
drm_crtc_vblank_off(crtc);
}

@@ -164,11 +163,10 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc 
*crtc,
 uint32_t page_flip_flags)
 {
struct drm_device *dev = crtc->dev;
-   struct exynos_drm_private *dev_priv = dev->dev_private;
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
struct drm_framebuffer *old_fb = crtc->primary->fb;
unsigned int crtc_w, crtc_h;
-   int ret = -EINVAL;
+   int ret;

/* when the page flip is requested, crtc's dpms should be on */
if (exynos_crtc->dpms > DRM_MODE_DPMS_ON) {
@@ -176,48 +174,49 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc 
*crtc,
return -EINVAL;
}

-   mutex_lock(&dev->struct_mutex);
+   if (!event)
+   return -EINVAL;

-   if (event) {
-   /*
-* the pipe from user always is 0 so we can set pipe number
-* of current owner to event.
-*/
-   event->pipe = exynos_crtc->pipe;
+   spin_lock_irq(&dev->event_lock);
+   if (exynos_crtc->event) {
+   ret = -EBUSY;
+   goto out;
+   }

-   ret = drm_vblank_get(dev, exynos_crtc->pipe);
-   if (ret) {
-   DRM_DEBUG("failed to acquire vblank counter\n");
+   ret = drm_vblank_get(dev, exynos_crtc->pipe);
+   if (ret) {
+   DRM_DEBUG("failed to acquire vblank counter\n");
+   goto out;
+   }

-   goto out;
-   }
+   exynos_crtc->event = event;
+   spin_unlock_irq(&dev->event_lock);

+   /*
+* the pipe from user always is 0 so we can set pipe number
+* of current owner to event.
+*/
+   event->pipe = exynos_crtc->pipe;
+
+   crtc->primary->fb = fb;
+   crtc_w = fb->width - crtc->x;
+   crtc_h = fb->height - crtc->y;
+   ret = exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
+ crtc_w, crtc_h, crtc->x, crtc->y,
+ crtc_w, crtc_h);
+   if (ret) {
+   crtc->primary->fb = old_fb;
spin_lock_irq(&dev->event_lock);
-   list_add_tail(&event->base.link,
-   &dev_priv->pageflip_event_list);
-   atomic_set(&exynos_crtc->pending_flip, 1);
+   exynos_crtc->event = NULL;
+   drm_vblank_put(dev, exynos_crtc->pipe);
spin_unlock_irq(&dev->event_lock);
-
-   crtc->primary->fb = fb;
-   crtc_w = fb->width - crtc->x;
-   crtc_h = fb->height - crtc->y;
-   ret = exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
- crtc_w, crtc_h, crtc->x, crtc->y,
- crtc_w, crtc_h);
-   if (ret) {
-   crtc->primary->fb = old_fb;
-
-   spin_lock_irq(&dev->event_lock);
-   drm_vblank_put(dev, exynos_crtc->pipe);
-   list_del(&event->base.link);
-   atomic_set(&exynos_crtc->pending_flip, 0);
-   spin_unlock_irq(&dev->event_lock);
-
-   goto out;
-   }
+   return ret;
}
+
+   return 0;
+
 out:
-   mutex_

[PATCH -v4 7/8] drm/exynos: remove leftover functions declarations

2015-04-01 Thread Gustavo Padovan
From: Gustavo Padovan 

These functions were already removed by previous cleanup work, but these
ones were left behind.

Signed-off-by: Gustavo Padovan 
Acked-by: Joonyoung Shim 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.h | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
index e1fd2ef..0ecd8fc 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
@@ -28,12 +28,6 @@ void exynos_drm_crtc_disable_vblank(struct drm_device *dev, 
int pipe);
 void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe);
 void exynos_drm_crtc_complete_scanout(struct drm_framebuffer *fb);

-void exynos_drm_crtc_plane_mode_set(struct drm_crtc *crtc,
-   struct exynos_drm_plane *plane);
-void exynos_drm_crtc_plane_commit(struct drm_crtc *crtc, int zpos);
-void exynos_drm_crtc_plane_enable(struct drm_crtc *crtc, int zpos);
-void exynos_drm_crtc_plane_disable(struct drm_crtc *crtc, int zpos);
-
 /* This function gets pipe value to crtc device matched with out_type. */
 int exynos_drm_crtc_get_pipe_from_type(struct drm_device *drm_dev,
unsigned int out_type);
-- 
2.1.0



[PATCH -v4 6/8] drm/exynos: remove exynos_plane_destroy()

2015-04-01 Thread Gustavo Padovan
From: Gustavo Padovan 

The .destroy() callback for exynos can be replaced by drm_plane_cleanup().
The only extra operation on exynos_plane_destroy() was a call to
exynos_plane_disable() but the plane is already disabled by a earlier call
to drm_framebuffer_remove().

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 2fbac9b..2b0479e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -178,16 +178,10 @@ static int exynos_disable_plane(struct drm_plane *plane)
return 0;
 }

-static void exynos_plane_destroy(struct drm_plane *plane)
-{
-   exynos_disable_plane(plane);
-   drm_plane_cleanup(plane);
-}
-
 static struct drm_plane_funcs exynos_plane_funcs = {
.update_plane   = exynos_update_plane,
.disable_plane  = exynos_disable_plane,
-   .destroy= exynos_plane_destroy,
+   .destroy= drm_plane_cleanup,
 };

 static void exynos_plane_attach_zpos_property(struct drm_plane *plane,
-- 
2.1.0



[PATCH -v4 5/8] drm/exynos: make zpos property immutable

2015-04-01 Thread Gustavo Padovan
From: Gustavo Padovan 

We already set each plane zpos at init, after that changes to zpos are
not expected. This patch turns zpos into a read-only property so now it is
impossible to set zpos.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 21 ++---
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 504bd6e..2fbac9b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -184,27 +184,10 @@ static void exynos_plane_destroy(struct drm_plane *plane)
drm_plane_cleanup(plane);
 }

-static int exynos_plane_set_property(struct drm_plane *plane,
-struct drm_property *property,
-uint64_t val)
-{
-   struct drm_device *dev = plane->dev;
-   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-   struct exynos_drm_private *dev_priv = dev->dev_private;
-
-   if (property == dev_priv->plane_zpos_property) {
-   exynos_plane->zpos = val;
-   return 0;
-   }
-
-   return -EINVAL;
-}
-
 static struct drm_plane_funcs exynos_plane_funcs = {
.update_plane   = exynos_update_plane,
.disable_plane  = exynos_disable_plane,
.destroy= exynos_plane_destroy,
-   .set_property   = exynos_plane_set_property,
 };

 static void exynos_plane_attach_zpos_property(struct drm_plane *plane,
@@ -216,8 +199,8 @@ static void exynos_plane_attach_zpos_property(struct 
drm_plane *plane,

prop = dev_priv->plane_zpos_property;
if (!prop) {
-   prop = drm_property_create_range(dev, 0, "zpos", 0,
-MAX_PLANE - 1);
+   prop = drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE,
+"zpos", 0, MAX_PLANE - 1);
if (!prop)
return;

-- 
2.1.0



[PATCH -v4 4/8] drm/exynos: preset zpos value for overlay planes

2015-04-01 Thread Gustavo Padovan
From: Gustavo Padovan 

Usually userspace don't want to have two overlay planes on the same zpos
so this change assign a different zpos for each plane. Before this change
a zpos of value zero was created for all planes so the userspace had to
set up the zpos of every plane it wanted to use.

Also all places that were storing zpos positions are now unsigned int.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c | 20 +++-
 drivers/gpu/drm/exynos/exynos_drm_drv.h|  7 +++
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 19 ++-
 drivers/gpu/drm/exynos/exynos_drm_plane.c  | 16 +---
 drivers/gpu/drm/exynos/exynos_drm_plane.h  |  3 ++-
 drivers/gpu/drm/exynos/exynos_drm_vidi.c   | 17 +
 drivers/gpu/drm/exynos/exynos_mixer.c  | 11 +--
 7 files changed, 37 insertions(+), 56 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index cd67037..e37f3e5 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -378,7 +378,7 @@ static void decon_win_set_colkey(struct decon_context *ctx, 
unsigned int win)
  * @protect: 1 to protect (disable updates)
  */
 static void decon_shadow_protect_win(struct decon_context *ctx,
-   int win, bool protect)
+unsigned int win, bool protect)
 {
u32 bits, val;

@@ -392,12 +392,12 @@ static void decon_shadow_protect_win(struct decon_context 
*ctx,
writel(val, ctx->regs + SHADOWCON);
 }

-static void decon_win_commit(struct exynos_drm_crtc *crtc, int zpos)
+static void decon_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
 {
struct decon_context *ctx = crtc->ctx;
struct drm_display_mode *mode = &crtc->base.mode;
struct exynos_drm_plane *plane;
-   int padding, win = zpos;
+   int padding;
unsigned long val, alpha;
unsigned int last_x;
unsigned int last_y;
@@ -405,9 +405,6 @@ static void decon_win_commit(struct exynos_drm_crtc *crtc, 
int zpos)
if (ctx->suspended)
return;

-   if (win == DEFAULT_ZPOS)
-   win = ctx->default_win;
-
if (win < 0 || win >= WINDOWS_NR)
return;

@@ -513,16 +510,12 @@ static void decon_win_commit(struct exynos_drm_crtc 
*crtc, int zpos)
plane->enabled = true;
 }

-static void decon_win_disable(struct exynos_drm_crtc *crtc, int zpos)
+static void decon_win_disable(struct exynos_drm_crtc *crtc, unsigned int win)
 {
struct decon_context *ctx = crtc->ctx;
struct exynos_drm_plane *plane;
-   int win = zpos;
u32 val;

-   if (win == DEFAULT_ZPOS)
-   win = ctx->default_win;
-
if (win < 0 || win >= WINDOWS_NR)
return;

@@ -764,7 +757,8 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
struct drm_device *drm_dev = data;
struct exynos_drm_plane *exynos_plane;
enum drm_plane_type type;
-   int zpos, ret;
+   unsigned int zpos;
+   int ret;

ret = decon_ctx_initialize(ctx, drm_dev);
if (ret) {
@@ -776,7 +770,7 @@ static int decon_bind(struct device *dev, struct device 
*master, void *data)
type = (zpos == ctx->default_win) ? DRM_PLANE_TYPE_PRIMARY :
DRM_PLANE_TYPE_OVERLAY;
ret = exynos_plane_init(drm_dev, &ctx->planes[zpos],
-   1 << ctx->pipe, type);
+   1 << ctx->pipe, type, zpos);
if (ret)
return ret;
}
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 8a2f943..26d6de1 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -21,7 +21,6 @@
 #define MAX_CRTC   3
 #define MAX_PLANE  5
 #define MAX_FB_BUFFER  4
-#define DEFAULT_ZPOS   -1

 #define to_exynos_crtc(x)  container_of(x, struct exynos_drm_crtc, base)
 #define to_exynos_plane(x) container_of(x, struct exynos_drm_plane, base)
@@ -104,7 +103,7 @@ struct exynos_drm_plane {
unsigned int pitch;
uint32_t pixel_format;
dma_addr_t dma_addr[MAX_FB_BUFFER];
-   int zpos;
+   unsigned int zpos;
unsigned int index_color;

bool default_win:1;
@@ -189,8 +188,8 @@ struct exynos_drm_crtc_ops {
int (*enable_vblank)(struct exynos_drm_crtc *crtc);
void (*disable_vblank)(struct exynos_drm_crtc *crtc);
void (*wait_for_vblank)(struct exynos_drm_crtc *crtc);
-   void (*win_commit)(struct exynos_drm_crtc *crtc, int zpos);
-   void (*win_disable)(struct exynos_drm_crtc *crtc, int zpos);
+   void (*win_commit)(struct exynos_drm_crtc *crtc, unsigned

[PATCH -v4 3/8] drm/exynos: remove struct *_win_data abstraction on planes

2015-04-01 Thread Gustavo Padovan
From: Gustavo Padovan 

struct {fimd,mixer,vidi}_win_data was just keeping the same data
as struct exynos_drm_plane thus get ride of it and use exynos_drm_plane
directly.

It changes how planes are created and remove .win_mode_set() callback
that was only filling all *_win_data structs.

v2: check for return of exynos_plane_init()

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c | 166 --
 drivers/gpu/drm/exynos/exynos_drm_crtc.c   |   9 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.h   |   1 +
 drivers/gpu/drm/exynos/exynos_drm_drv.c|  14 --
 drivers/gpu/drm/exynos/exynos_drm_drv.h|   5 +-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 186 +
 drivers/gpu/drm/exynos/exynos_drm_plane.c  |  23 +--
 drivers/gpu/drm/exynos/exynos_drm_plane.h  |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_vidi.c   | 125 +
 drivers/gpu/drm/exynos/exynos_mixer.c  | 216 ++---
 10 files changed, 250 insertions(+), 501 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 63f02e2..cd67037 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -28,6 +28,7 @@
 #include 

 #include "exynos_drm_crtc.h"
+#include "exynos_drm_plane.h"
 #include "exynos_drm_drv.h"
 #include "exynos_drm_fbdev.h"
 #include "exynos_drm_iommu.h"
@@ -41,32 +42,16 @@

 #define WINDOWS_NR 2

-struct decon_win_data {
-   unsigned intovl_x;
-   unsigned intovl_y;
-   unsigned intoffset_x;
-   unsigned intoffset_y;
-   unsigned intovl_width;
-   unsigned intovl_height;
-   unsigned intfb_width;
-   unsigned intfb_height;
-   unsigned intbpp;
-   unsigned intpixel_format;
-   dma_addr_t  dma_addr;
-   boolenabled;
-   boolresume;
-};
-
 struct decon_context {
struct device   *dev;
struct drm_device   *drm_dev;
struct exynos_drm_crtc  *crtc;
+   struct exynos_drm_plane planes[WINDOWS_NR];
struct clk  *pclk;
struct clk  *aclk;
struct clk  *eclk;
struct clk  *vclk;
void __iomem*regs;
-   struct decon_win_data   win_data[WINDOWS_NR];
unsigned intdefault_win;
unsigned long   irq_flags;
booli80_if;
@@ -296,59 +281,16 @@ static void decon_disable_vblank(struct exynos_drm_crtc 
*crtc)
}
 }

-static void decon_win_mode_set(struct exynos_drm_crtc *crtc,
-   struct exynos_drm_plane *plane)
-{
-   struct decon_context *ctx = crtc->ctx;
-   struct decon_win_data *win_data;
-   int win, padding;
-
-   if (!plane) {
-   DRM_ERROR("plane is NULL\n");
-   return;
-   }
-
-   win = plane->zpos;
-   if (win == DEFAULT_ZPOS)
-   win = ctx->default_win;
-
-   if (win < 0 || win >= WINDOWS_NR)
-   return;
-
-
-   win_data = &ctx->win_data[win];
-
-   padding = (plane->pitch / (plane->bpp >> 3)) - plane->fb_width;
-   win_data->offset_x = plane->fb_x;
-   win_data->offset_y = plane->fb_y;
-   win_data->fb_width = plane->fb_width + padding;
-   win_data->fb_height = plane->fb_height;
-   win_data->ovl_x = plane->crtc_x;
-   win_data->ovl_y = plane->crtc_y;
-   win_data->ovl_width = plane->crtc_width;
-   win_data->ovl_height = plane->crtc_height;
-   win_data->dma_addr = plane->dma_addr[0];
-   win_data->bpp = plane->bpp;
-   win_data->pixel_format = plane->pixel_format;
-
-   DRM_DEBUG_KMS("offset_x = %d, offset_y = %d\n",
-   win_data->offset_x, win_data->offset_y);
-   DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n",
-   win_data->ovl_width, win_data->ovl_height);
-   DRM_DEBUG_KMS("paddr = 0x%lx\n", (unsigned long)win_data->dma_addr);
-   DRM_DEBUG_KMS("fb_width = %d, crtc_width = %d\n",
-   plane->fb_width, plane->crtc_width);
-}
-
 static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win)
 {
-   struct decon_win_data *win_data = &ctx->win_data[win];
+   struct exynos_drm_plane *plane = &ctx->planes[win];
unsigned long val;
+   int padding;

val = readl(ctx->regs + WINCON(win));
val &= ~WINCONx_BPPMODE_MASK;

-   switch (win_data->pixel_format) {
+   switch (plane->pixel_format) {
case DRM_FORMAT_RGB565:
val |= WINCONx_BPPMODE_16BPP_565;
val |= WINCONx_BURSTLEN_16WORD;
@@ -397,7 +339

[PATCH -v4 2/8] drm/exynos: remove unused exynos_crtc->win_enable() callback

2015-04-01 Thread Gustavo Padovan
From: Gustavo Padovan 

None of the exynos crtc drivers implements win_enable() so remove it for
better clarity of the code.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_drv.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 9afd390..4e8f0b0 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -174,7 +174,6 @@ struct exynos_drm_display {
  * hardware overlay is updated.
  * @win_mode_set: copy drm overlay info to hw specific overlay info.
  * @win_commit: apply hardware specific overlay data to registers.
- * @win_enable: enable hardware specific overlay.
  * @win_disable: disable hardware specific overlay.
  * @te_handler: trigger to transfer video image at the tearing effect
  * synchronization signal if there is a page flip request.
@@ -192,7 +191,6 @@ struct exynos_drm_crtc_ops {
void (*win_mode_set)(struct exynos_drm_crtc *crtc,
struct exynos_drm_plane *plane);
void (*win_commit)(struct exynos_drm_crtc *crtc, int zpos);
-   void (*win_enable)(struct exynos_drm_crtc *crtc, int zpos);
void (*win_disable)(struct exynos_drm_crtc *crtc, int zpos);
void (*te_handler)(struct exynos_drm_crtc *crtc);
 };
-- 
2.1.0



[PATCH -v4 1/8] drm/exynos: fimd: fix alpha setting for XR24 pixel format

2015-04-01 Thread Gustavo Padovan
From: Gustavo Padovan 

XR24 planes were not shown properly, so now set the right registers
to correctly enable displaying these planes.

It also moves the alpha register settings to fimd_win_set_pixfmt()
to keep all pixel format stuff together.

v2: remove leftover var alpha

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 33 +---
 include/video/samsung_fimd.h |  5 +
 2 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 0d5681f..e16ba75 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -54,6 +54,9 @@
 /* size control register for hardware windows 1 ~ 2. */
 #define VIDOSD_D(win)  (VIDOSD_BASE + 0x0C + (win) * 16)

+#define VIDWnALPHA0(win)   (VIDW_ALPHA + 0x00 + (win) * 8)
+#define VIDWnALPHA1(win)   (VIDW_ALPHA + 0x04 + (win) * 8)
+
 #define VIDWx_BUF_START(win, buf)  (VIDW_BUF_START(buf) + (win) * 8)
 #define VIDWx_BUF_END(win, buf)(VIDW_BUF_END(buf) + (win) * 8)
 #define VIDWx_BUF_SIZE(win, buf)   (VIDW_BUF_SIZE(buf) + (win) * 4)
@@ -625,6 +628,24 @@ static void fimd_win_set_pixfmt(struct fimd_context *ctx, 
unsigned int win)
}

writel(val, ctx->regs + WINCON(win));
+
+   /* hardware window 0 doesn't support alpha channel. */
+   if (win != 0) {
+   /* OSD alpha */
+   val = VIDISD14C_ALPHA0_R(0xf) |
+   VIDISD14C_ALPHA0_G(0xf) |
+   VIDISD14C_ALPHA0_B(0xf) |
+   VIDISD14C_ALPHA1_R(0xf) |
+   VIDISD14C_ALPHA1_G(0xf) |
+   VIDISD14C_ALPHA1_B(0xf);
+
+   writel(val, ctx->regs + VIDOSD_C(win));
+
+   val = VIDW_ALPHA_R(0xf) | VIDW_ALPHA_G(0xf) |
+   VIDW_ALPHA_G(0xf);
+   writel(val, ctx->regs + VIDWnALPHA0(win));
+   writel(val, ctx->regs + VIDWnALPHA1(win));
+   }
 }

 static void fimd_win_set_colkey(struct fimd_context *ctx, unsigned int win)
@@ -672,7 +693,7 @@ static void fimd_win_commit(struct exynos_drm_crtc *crtc, 
int zpos)
struct fimd_context *ctx = crtc->ctx;
struct fimd_win_data *win_data;
int win = zpos;
-   unsigned long val, alpha, size;
+   unsigned long val, size;
unsigned int last_x;
unsigned int last_y;

@@ -749,16 +770,6 @@ static void fimd_win_commit(struct exynos_drm_crtc *crtc, 
int zpos)
DRM_DEBUG_KMS("osd pos: tx = %d, ty = %d, bx = %d, by = %d\n",
win_data->offset_x, win_data->offset_y, last_x, last_y);

-   /* hardware window 0 doesn't support alpha channel. */
-   if (win != 0) {
-   /* OSD alpha */
-   alpha = VIDISD14C_ALPHA1_R(0xf) |
-   VIDISD14C_ALPHA1_G(0xf) |
-   VIDISD14C_ALPHA1_B(0xf);
-
-   writel(alpha, ctx->regs + VIDOSD_C(win));
-   }
-
/* OSD size */
if (win != 3 && win != 4) {
u32 offset = VIDOSD_D(win);
diff --git a/include/video/samsung_fimd.h b/include/video/samsung_fimd.h
index a20e4a3..5132428 100644
--- a/include/video/samsung_fimd.h
+++ b/include/video/samsung_fimd.h
@@ -289,6 +289,11 @@
 #define VIDISD14C_ALPHA1_B_LIMIT   0xf
 #define VIDISD14C_ALPHA1_B(_x) ((_x) << 0)

+#define VIDW_ALPHA 0x021c
+#define VIDW_ALPHA_R(_x)   ((_x) << 16)
+#define VIDW_ALPHA_G(_x)   ((_x) << 8)
+#define VIDW_ALPHA_B(_x)   ((_x) << 0)
+
 /* Video buffer addresses */
 #define VIDW_BUF_START(_buff)  (0xA0 + ((_buff) * 8))
 #define VIDW_BUF_START1(_buff) (0xA4 + ((_buff) * 8))
-- 
2.1.0



[PATCH -v4 0/8] drm/exynos: clean up patches (preparing for atomic)

2015-04-01 Thread Gustavo Padovan
From: Gustavo Padovan 

Hi,

Here goes some clean ups to the exynos drivers. The main clean ups is
the presetting and zpos making the property immutable and the removal
of *_win_data structures.

v2 contains a extra patch to fix alpha setting for planes in fimd, so
now fimd works fine even after the removal of struct fimd_win_data.

v3 removes a leftover var in the first commit and address the comment from
Joonyoung about checking the return value of exynos_plane_init()

v4 rebases on top of Daniel Stone patch, currently only applied to
exynos-drm-fixes

Gustavo Padovan (7):
  drm/exynos: fimd: fix alpha setting for XR24 pixel format
  drm/exynos: remove unused exynos_crtc->win_enable() callback
  drm/exynos: remove struct *_win_data abstraction on planes
  drm/exynos: preset zpos value for overlay planes
  drm/exynos: make zpos property immutable
  drm/exynos: remove exynos_plane_destroy()
  drm/exynos: remove leftover functions declarations

Mandeep Singh Baines (1):
  drm/exynos: track vblank events on a per crtc basis

 drivers/gpu/drm/exynos/exynos7_drm_decon.c | 178 --
 drivers/gpu/drm/exynos/exynos_drm_crtc.c   | 101 ++---
 drivers/gpu/drm/exynos/exynos_drm_crtc.h   |   7 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.c|  27 
 drivers/gpu/drm/exynos/exynos_drm_drv.h|  20 +--
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 230 -
 drivers/gpu/drm/exynos/exynos_drm_plane.c  |  66 ++---
 drivers/gpu/drm/exynos/exynos_drm_plane.h  |   7 +-
 drivers/gpu/drm/exynos/exynos_drm_vidi.c   | 136 +
 drivers/gpu/drm/exynos/exynos_mixer.c  | 221 ++-
 include/video/samsung_fimd.h   |   5 +
 11 files changed, 345 insertions(+), 653 deletions(-)

-- 
2.1.0



[PATCH RFC 07/11] drm/edid: add function to help find SADs

2015-04-01 Thread Russell King - ARM Linux
On Wed, Apr 01, 2015 at 02:47:32PM +0300, Jani Nikula wrote:
> On Mon, 30 Mar 2015, Russell King  wrote:
> > Add a function to find the start of the SADs in the ELD.  This
> > complements the helper to retrieve the SAD count.
> >
> > Signed-off-by: Russell King 
> 
> I guess version 31 is specific enough to warrant a #define of its own,
> but meh.

What about version 2?  We don't have any version definitions in
drm_edid.h at all.  It would be nice to see some...

It would also be nice to see some of this stuff not being DRM specific,
because EDID parsing isn't something limited to DRM - and let's face it,
one of the biggest consumers of graphics on Linux is Android, which I'm
told is pretty much wedded to the fbdev API.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.


[PATCH RFC v2 04/12] drm/components: add generic vga encoder driver

2015-04-01 Thread Heiko Stübner
Hi Russell,

Am Mittwoch, 1. April 2015, 11:27:51 schrieb Russell King - ARM Linux:
> On Wed, Apr 01, 2015 at 12:09:38PM +0200, Heiko Stuebner wrote:
> > This adds a driver for generic vga encoders like the Analog Devices
> > adv7123
> > and similar ics. These chips do not have any special configuration options
> > except a powersafe gpio.
> > 
> > An exception is added for the rcar-du driver which also implements support
> > for the adv7123 internally but is not yet converted to the component
> > framework.
> Why is this implemented as a master?  It's not the top level card device,
> it shouldn't be a master.  It should be a component.
> 
> I wonder if this is why you need your previous patches.  Componentised
> DRM works fine without needing to build lists of connectors and encoders.

It is a component to the upper drm driver (rockchip or whatever) but a master 
to the vga connector below, simply because the drm driver above (the lvds 
controller in this case) does not know and also probably shouldn't care what 
the structure below is.

So in this case the lvds knows there is either a panel or an encoder 
connected, but does not need to handle if this downstream component is some 
one-piece i2c component like a tv encoder or contains another component down 
below, like the vga-connector in this case.


Of course I may very well have overlooked some simpler method to achieve this, 
but got inspired to this by the similar way done in sti/sti_tvout.c


Heiko



[PATCH 2/2] drm/exynos: fix the initialization order in FIMD

2015-04-01 Thread Hyungwon Hwang
Dear Joonyoung Shim,

On Tue, 31 Mar 2015 17:05:47 +0900
Joonyoung Shim  wrote:

> Hi,
> 
> Sorry for late comments.
> 
> On 03/13/2015 07:32 PM, Inki Dae wrote:
> > On 2015년 03월 12일 13:36, Hyungwon Hwang wrote:
> >> Since commit 0f04cf8df0b20a97369cb634663fef0578cbf273 ("drm/exynos:
> >> fix wrong pipe calculation for crtc"), fimd_clear_channel() can be
> >> called when is_drm_iommu_supported() returns true. In this case,
> >> the kernel is going to be panicked because crtc is not set yet.
> > 
> > Nice catch!!!
> > 
> >>
> >> [1.211156] [drm] Initialized drm 1.1.0 20060810
> >> [1.216785] Unable to handle kernel NULL pointer dereference at
> >> virtual address 0350 [1.223415] pgd = c0004000
> >> [1.226086] [0350] *pgd=
> >> [1.229649] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
> >> [1.234940] Modules linked in:
> >> [1.237982] CPU: 2 PID: 1 Comm: swapper/0 Not tainted
> >> 4.0.0-rc1-00062-g7a7cc79-dirty #123 [1.246136] Hardware name:
> >> SAMSUNG EXYNOS (Flattened Device Tree) [1.252214] task:
> >> ee8c8000 ti: ee8d task.ti: ee8d [1.257606] PC is at
> >> fimd_wait_for_vblank+0x8/0xc8 [1.262370] LR is at
> >> fimd_bind+0x138/0x1a8 [1.266450] pc : []lr :
> >> []psr: 2113 [1.266450] sp : ee8d1d28  ip :
> >>   fp :  [1.277906] r10: 0001  r9 :
> >> c09d693c  r8 : c0a2d6a8 [1.283114] r7 : 0034  r6 :
> >> 0001  r5 : ee0bb400  r4 : ee244c10 [1.289624] r3 :
> >>   r2 :   r1 : 0001  r0 : 
> >> [1.296135] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA
> >> ARM  Segment kernel [1.303426] Control: 10c5387d  Table:
> >> 4000404a  DAC: 0015 [1.309154] Process swapper/0 (pid: 1,
> >> stack limit = 0xee8d0210) [1.315143] Stack: (0xee8d1d28 to
> >> 0xee8d2000) [1.319486] 1d20:   
> >> c0113d18 ee0bb400 ee0bb400 ee245c30 eebbe210 [1.327645] 1d40:
> >> ee008a40 ee244c10 ee0bb400 0001 0034 c02fb834 
> >> c030a858 [1.335804] 1d60: ee244a10 eeb60780 ee008a40 eeb60740
> >> ee0bb400 c03030d0   [1.343963] 1d80: ee244a10
> >> ee0bb400  eeb60740 eeb60810   c02f6ba4
> >> [1.352123] 1da0: ee0bb400   c02e0500 ee244a00
> >> c0a04a14 ee0bb400 c02e1de4 [1.360282] 1dc0:  c030a858
> >> 0002 eeb60820 eeb60820 0002 eeb60780 c03033d4
> >> [1.368441] 1de0: c06e9cec  ee244a10 eeb60780 c0a056f8
> >> c03035fc c0a04b24 c0a04b24 [1.376600] 1e00: ee244a10 0001
> >> c0a049d0 c02f6d34 c0ad462c eeba0790  ee244a10
> >> [1.384759] 1e20: ffed c0a049d0  c03090b0 ee244a10
> >> c0ad462c c0a2d840 c03077a0 [1.392919] 1e40: eeb5e880 c024b738
> >> 08db ee244a10 c0a049d0 ee244a44  c09e71d8
> >> [1.401078] 1e60: 00c6 c0307a6c c0a049d0  c03079e0
> >> c0305ea8 ee826e5c ee1dc7b4 [1.409237] 1e80: c0a049d0 eeb5e880
> >> c0a058a8 c0306e2c c0896204 c0a049d0 c06e9d10 c0a049d0
> >> [1.417396] 1ea0: c06e9d10 c0ad4600  c0308360 
> >> 0003 c06e9d10 c02f6e14 [1.42] 1ec0:  c0896204
> >>      
> >> [1.433714] 1ee0:   c02f6d5c c02f6d5c 
> >> eeb5d740 c09e71d8 c0008a30 [1.441874] 1f00: ef7fca5e 
> >>  0066  ee8d1f28 c003ff1c c02514e8
> >> [1.450033] 1f20: 6113  c093906c ef7fca5e 00c6
> >> c004018c  c093906c [1.458192] 1f40: c08a9690 c093840c
> >> 0006 0006 c09eb2ac c09c0d74 0006 c09c0d54
> >> [1.466351] 1f60: c0a3d680 c09745a0 c09d693c 00c6 
> >> c0974db4 0006 0006 [1.474510] 1f80: c09745a0 
> >>  c0692e00    
> >> [1.482669] 1fa0:  c0692e08  c000f040 
> >>    [1.490828] 1fc0:  
> >>      
> >> [1.498988] 1fe0:     0013
> >>    [1.507159] []
> >> (fimd_wait_for_vblank) from [] (fimd_bind+0x138/0x1a8)
> >> [1.515313] [] (fimd_bind) from []
> >> (component_bind_all+0xc4/0x20c) [1.523209] []
> >> (component_bind_all) from []
> >> (exynos_drm_load+0xa0/0x140) [1.531632] []
> >> (exynos_drm_load) from [] (drm_dev_register+0xa0/0xf4)
> >> [1.539788] [] (drm_dev_register) from []
> >> (drm_platform_init+0x44/0xcc) [1.548121] []
> >> (drm_platform_init) from []
> >> (try_to_bring_up_master.part.1+0xc8/0x104) [1.557668]
> >> [] (try_to_bring_up_master.part.1) from []
> >> (component_master_add_with_match+0xd0/0x118) [1.568431]
> >> [] (component_master_add_with_match) from []
> >> (exynos_drm_platform_probe+0xf0/0x118) [1.578847] []
> >> (exynos_drm_platform_probe) from []
> >> (platform_drv_probe+0x48/0x98) [1.58

[PATCH 3/3] drm/exynos: mixer: add 2x scaling to mixer_graph_buffer

2015-04-01 Thread Gustavo Padovan
Hi Tobias,

2015-04-01 Tobias Jakobi :

> While the VP (video processor) supports arbitrary scaling
> of its input, the mixer just supports a simple 2x (line
> doubling) scaling. Expose this functionality and exit
> early when an unsupported scaling configuration is
> encountered.
> 
> This was tested with modetest's DRM plane test (from
> the libdrm test suite) on an Odroid-X2 (Exynos4412).
> 
> Signed-off-by: Tobias Jakobi 
> ---
>  drivers/gpu/drm/exynos/exynos_mixer.c | 35 
> +--
>  1 file changed, 29 insertions(+), 6 deletions(-)

Reviewed-by: Gustavo Padovan 

Gustavo


[PATCH 2/3] drm/exynos: remove superfluous error messages

2015-04-01 Thread Gustavo Padovan
Hi Tobias,

2015-04-01 Tobias Jakobi :

> The messages are redundant since 'check_fb_gem_memory_type'
> already prints out exactly the same string when it fails.
> 
> Signed-off-by: Tobias Jakobi 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fb.c | 10 +++---
>  1 file changed, 3 insertions(+), 7 deletions(-)

Reviewed-by: Gustavo Padovan 

Gustavo


[PATCH 1/3] drm/exynos: fix typos in hdmi and mixer

2015-04-01 Thread Gustavo Padovan
Hi Tobias,

2015-04-01 Tobias Jakobi :

> Use the correct spelling for 'progressive'.
> 
> Signed-off-by: Tobias Jakobi 
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c  | 2 +-
>  drivers/gpu/drm/exynos/exynos_mixer.c | 2 +-
>  drivers/gpu/drm/exynos/regs-mixer.h   | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Gustavo Padovan 

Gustavo


[PATCH] drm/exynos: fimd: check whether exynos_drm_crtc_create succeed or not

2015-04-01 Thread Gustavo Padovan
Hi Hyungwon,

2015-04-01 Hyungwon Hwang :

> From the commit "drm/exynos: fix the execution order in FIMD
> initialization" (598285bfdce46d7c47632a2ba4b980f60be4a677), the error
> checking code is removed improperly. This patch fix the regression.
> 
> Signed-off-by: Hyungwon Hwang 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index 31dfa80..15cee94 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -1060,6 +1060,8 @@ static int fimd_bind(struct device *dev, struct device 
> *master, void *data)
>   ctx->crtc = exynos_drm_crtc_create(drm_dev, ctx->pipe,
>  EXYNOS_DISPLAY_TYPE_LCD,
>  &fimd_crtc_ops, ctx);
> + if (IS_ERR(ctx->crtc))
> + return PTR_ERR(ctx->crtc);

My current clean up patch set fixes this and I hope it will be merged soon.
It is part of "drm/exynos: remove struct *_win_data abstraction on planes"
patch.

Gustavo


[PATCH RFC v2 12/12] ARM: dts: rockchip: add vga encoder and enable lvds on rk3288-firefly

2015-04-01 Thread Heiko Stuebner
Add the sda7123 simple vga encoder, connect it to the vop outputs
and enable the lvds controller with the correct settings.

Signed-off-by: Heiko Stuebner 
---
 arch/arm/boot/dts/rk3288-firefly.dtsi | 68 +++
 1 file changed, 68 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288-firefly.dtsi 
b/arch/arm/boot/dts/rk3288-firefly.dtsi
index b54dd78..2cce2a9 100644
--- a/arch/arm/boot/dts/rk3288-firefly.dtsi
+++ b/arch/arm/boot/dts/rk3288-firefly.dtsi
@@ -159,6 +159,51 @@
regulator-always-on;
vin-supply = <&vcc_5v>;
};
+
+   sda7123: vga-encoder {
+   compatible = "adi,adv7123";
+   psave-gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port at 0 {
+   reg = <0>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   sda7123_in: endpoint at 0 {
+   remote-endpoint = <&lvds_out>;
+   };
+   };
+
+   port at 1 {
+   reg = <1>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   sda7123_out: endpoint at 0 {
+   remote-endpoint = <&vga_connector_in>;
+   };
+   };
+   };
+   };
+
+   vga: vga-connector {
+   compatible = "vga-connector";
+   label = "vga";
+
+   ddc-i2c-bus = <&i2c4>;
+
+   port {
+   vga_connector_in: endpoint {
+   remote-endpoint = <&sda7123_out>;
+   };
+   };
+   };
 };

 &cpu0 {
@@ -347,6 +392,29 @@
status = "okay";
 };

+&lvds {
+   avdd1v0-supply = <&vdd10_lcd>;
+   avdd1v8-supply = <&vcc18_lcd>;
+   avdd3v3-supply = <&vcca_33>;
+   rockchip,data-mapping = "jeida";
+   rockchip,data-width = <24>;
+   rockchip,output = "rgb";
+   status = "okay";
+
+   ports {
+   port at 1 {
+   reg = <1>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   lvds_out: endpoint at 0 {
+   remote-endpoint = <&sda7123_in>;
+   };
+   };
+   };
+};
+
 &pinctrl {
pcfg_output_high: pcfg-output-high {
output-high;
-- 
2.1.4



[PATCH RFC v2 11/12] ARM: dts: rockchip: add rk3288 lvds node

2015-04-01 Thread Heiko Stuebner
Add the basic node for the lvds controller of rk3288 and hook it into the
display-subsystem hirarchy.

Signed-off-by: Heiko Stuebner 
---
 arch/arm/boot/dts/rk3288.dtsi | 42 ++
 1 file changed, 42 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index e7e94f8..97291bb 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -621,6 +621,11 @@
reg = <0>;
remote-endpoint = <&hdmi_in_vopb>;
};
+
+   vopb_out_lvds: endpoint at 1 {
+   reg = <1>;
+   remote-endpoint = <&lvds_in_vopb>;
+   };
};
};

@@ -652,6 +657,11 @@
reg = <0>;
remote-endpoint = <&hdmi_in_vopl>;
};
+
+   vopl_out_lvds: endpoint at 1 {
+   reg = <1>;
+   remote-endpoint = <&lvds_in_vopl>;
+   };
};
};

@@ -664,6 +674,38 @@
status = "disabled";
};

+   lvds: lvds at ff96c000 {
+   compatible = "rockchip,rk3288-lvds";
+   reg = <0xff96c000 0x4000>;
+   clocks = <&cru PCLK_LVDS_PHY>;
+   clock-names = "pclk_lvds";
+   pinctrl-names = "default";
+   pinctrl-0 = <&lcdc0_ctl>;
+   rockchip,grf = <&grf>;
+   status = "disabled";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   lvds_in: port at 0 {
+   reg = <0>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   lvds_in_vopb: endpoint at 0 {
+   reg = <0>;
+   remote-endpoint = <&vopb_out_lvds>;
+   };
+   lvds_in_vopl: endpoint at 1 {
+   reg = <1>;
+   remote-endpoint = <&vopl_out_lvds>;
+   };
+   };
+   };
+   };
+
hdmi: hdmi at ff98 {
compatible = "rockchip,rk3288-dw-hdmi";
reg = <0xff98 0x2>;
-- 
2.1.4



[PATCH RFC v2 10/12] ARM: dts: rockchip: add rk3288 lcdc0 pinmux settings

2015-04-01 Thread Heiko Stuebner
Add pinctrl settings for the configurable lcdc0 signals dclk, den, hsync
and vsync. The lcdc0 data pin configuration is not software controlable.

Signed-off-by: Heiko Stuebner 
---
 arch/arm/boot/dts/rk3288.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index 2c29a3e..e7e94f8 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -945,6 +945,15 @@
};
};

+   lcdc0 {
+   lcdc0_ctl: lcdc0-ctl {
+   rockchip,pins = <1 24 RK_FUNC_1 
&pcfg_pull_none>,
+   <1 25 RK_FUNC_1 
&pcfg_pull_none>,
+   <1 26 RK_FUNC_1 
&pcfg_pull_none>,
+   <1 27 RK_FUNC_1 
&pcfg_pull_none>;
+   };
+   };
+
sdmmc {
sdmmc_clk: sdmmc-clk {
rockchip,pins = <6 20 RK_FUNC_1 
&pcfg_pull_none>;
-- 
2.1.4



[PATCH RFC v2 09/12] drm/rockchip: enable rgb output of vops for all other connectors

2015-04-01 Thread Heiko Stuebner
The socs itself contains encoders for a lot of different outputs. But every
unsupported connector will be routed through the lvds, as it controls the
pins in question.
Therefore enable the lvds output for all of those.

Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index c0387f7..3844b12 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -862,20 +862,16 @@ static int vop_crtc_mode_set(struct drm_crtc *crtc,
clk_disable(vop->dclk);

switch (vop->connector_type) {
-   case DRM_MODE_CONNECTOR_LVDS:
-   VOP_CTRL_SET(vop, rgb_en, 1);
-   break;
case DRM_MODE_CONNECTOR_eDP:
VOP_CTRL_SET(vop, edp_en, 1);
break;
case DRM_MODE_CONNECTOR_HDMIA:
VOP_CTRL_SET(vop, hdmi_en, 1);
break;
+   case DRM_MODE_CONNECTOR_LVDS:
default:
-   DRM_ERROR("unsupport connector_type[%d]\n",
- vop->connector_type);
-   ret = -EINVAL;
-   goto out;
+   VOP_CTRL_SET(vop, rgb_en, 1);
+   break;
};
VOP_CTRL_SET(vop, out_mode, vop->connector_out_mode);

-- 
2.1.4



[PATCH RFC v2 08/12] drm/rockchip: lvds: register a bridge when no panel is set

2015-04-01 Thread Heiko Stuebner
On socs using the lvds components it also controls the use of the
general rgb outputs and must thus be configured for things like
external encoders.

Therefore register a drm_bridge in this case and try to find
the encoder in the output port.

Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/rockchip/rockchip_lvds.c | 255 ---
 1 file changed, 233 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c 
b/drivers/gpu/drm/rockchip/rockchip_lvds.c
index 657609e..5ffd70a 100644
--- a/drivers/gpu/drm/rockchip/rockchip_lvds.c
+++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c
@@ -43,6 +43,9 @@
 #define encoder_to_lvds(c) \
container_of(c, struct rockchip_lvds, encoder)

+#define bridge_to_lvds(c) \
+   container_of(c, struct rockchip_lvds, bridge)
+
 /*
  * @grf_offset: offset inside the grf regmap for setting the rockchip lvds
  */
@@ -68,6 +71,8 @@ struct rockchip_lvds {
struct drm_panel *panel;
struct drm_connector connector;
struct drm_encoder encoder;
+   struct drm_bridge bridge;
+   struct drm_encoder *ext_encoder;

struct mutex suspend_lock;
int suspend;
@@ -248,11 +253,10 @@ rockchip_lvds_encoder_mode_fixup(struct drm_encoder 
*encoder,
return true;
 }

-static void rockchip_lvds_encoder_mode_set(struct drm_encoder *encoder,
- struct drm_display_mode *mode,
- struct drm_display_mode *adjusted)
+static void rockchip_lvds_mode_set(struct rockchip_lvds *lvds,
+  struct drm_display_mode *mode,
+  struct drm_display_mode *adjusted)
 {
-   struct rockchip_lvds *lvds = encoder_to_lvds(encoder);
u32 h_bp = mode->htotal - mode->hsync_start;
u8 pin_hsync = (mode->flags & DRM_MODE_FLAG_PHSYNC) ? 1 : 0;
u8 pin_dclk = (mode->flags & DRM_MODE_FLAG_PCSYNC) ? 1 : 0;
@@ -347,32 +351,52 @@ static void rockchip_lvds_encoder_mode_set(struct 
drm_encoder *encoder,
dsb();
 }

-static void rockchip_lvds_encoder_prepare(struct drm_encoder *encoder)
+static void rockchip_lvds_encoder_mode_set(struct drm_encoder *encoder,
+  struct drm_display_mode *mode,
+  struct drm_display_mode *adjusted)
+{
+   rockchip_lvds_mode_set(encoder_to_lvds(encoder), mode, adjusted);
+}
+
+static int rockchip_lvds_set_vop_source(struct rockchip_lvds *lvds,
+   struct drm_encoder *encoder)
 {
-   struct rockchip_lvds *lvds = encoder_to_lvds(encoder);
u32 val;
int ret;

-   ret = rockchip_drm_crtc_mode_config(encoder->crtc,
-   lvds->connector.connector_type,
-   ROCKCHIP_OUT_MODE_P888);
-   if (ret < 0) {
-   dev_err(lvds->dev, "Could not set crtc mode config: %d\n", ret);
-   return;
-   }
-
ret = rockchip_drm_encoder_get_mux_id(lvds->dev->of_node, encoder);
if (ret < 0)
-   return;
+   return ret;

if (ret)
val = RK3288_LVDS_SOC_CON6_SEL_VOP_LIT |
  (RK3288_LVDS_SOC_CON6_SEL_VOP_LIT << 16);
else
val = RK3288_LVDS_SOC_CON6_SEL_VOP_LIT << 16;
+
ret = regmap_write(lvds->grf, lvds->soc_data->grf_soc_con6, val);
-   if (ret != 0) {
-   dev_err(lvds->dev, "Could not write to GRF: %d\n", ret);
+   if (ret < 0)
+   return ret;
+
+   return 0;
+}
+
+static void rockchip_lvds_encoder_prepare(struct drm_encoder *encoder)
+{
+   struct rockchip_lvds *lvds = encoder_to_lvds(encoder);
+   int ret;
+
+   ret = rockchip_drm_crtc_mode_config(encoder->crtc,
+   lvds->connector.connector_type,
+   ROCKCHIP_OUT_MODE_P888);
+   if (ret < 0) {
+   dev_err(lvds->dev, "Could not set crtc mode config: %d\n", ret);
+   return;
+   }
+
+   ret = rockchip_lvds_set_vop_source(lvds, encoder);
+   if (ret < 0) {
+   dev_err(lvds->dev, "Could not set vop source: %d\n", ret);
return;
}
 }
@@ -405,6 +429,97 @@ static struct drm_encoder_funcs 
rockchip_lvds_encoder_funcs = {
.destroy = rockchip_lvds_encoder_destroy,
 };

+static void rockchip_lvds_bridge_mode_set(struct drm_bridge *bridge,
+ struct drm_display_mode *mode,
+ struct drm_display_mode *adjusted)
+{
+   rockchip_lvds_mode_set(bridge_to_lvds(bridge), mode, adjusted);
+}
+
+static void rockchip_lvds_bridge_pre_enable(struct drm_bridge *bridge)
+{
+}
+
+/*
+ * post_disable is called right after encoder prepare, so do lvds and crtc
+ * mo

[PATCH RFC v2 07/12] drm/rockchip: Add support for Rockchip Soc LVDS

2015-04-01 Thread Heiko Stuebner
From: Mark Yao 

This adds support for Rockchip soc lvds found on rk3288

Signed-off-by: Mark Yao 
Signed-off-by: Heiko Stuebner 
---
This still needs to address Laurent's comment about trying to get the
lvds settings from the panel/connected device instead of encoding them
as separate properties in the devicetree.

 drivers/gpu/drm/rockchip/Kconfig |   9 +
 drivers/gpu/drm/rockchip/Makefile|   1 +
 drivers/gpu/drm/rockchip/rockchip_lvds.c | 640 +++
 drivers/gpu/drm/rockchip/rockchip_lvds.h | 107 ++
 4 files changed, 757 insertions(+)
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.c
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.h

diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
index 35215f6..845f953 100644
--- a/drivers/gpu/drm/rockchip/Kconfig
+++ b/drivers/gpu/drm/rockchip/Kconfig
@@ -25,3 +25,12 @@ config ROCKCHIP_DW_HDMI
  for the Synopsys DesignWare HDMI driver. If you want to
  enable HDMI on RK3288 based SoC, you should selet this
  option.
+
+config ROCKCHIP_LVDS
+   tristate "Rockchip lvds support"
+   depends on DRM_ROCKCHIP
+   help
+ Choose this option to enable support for Rockchip LVDS controllers.
+ Rockchip rk3288 SoC has LVDS TX Controller can be used, and it
+ support lvds, rgb, dual lvds output mode. say Y to enable its
+ driver.
diff --git a/drivers/gpu/drm/rockchip/Makefile 
b/drivers/gpu/drm/rockchip/Makefile
index f3d8a19..8541304 100644
--- a/drivers/gpu/drm/rockchip/Makefile
+++ b/drivers/gpu/drm/rockchip/Makefile
@@ -6,5 +6,6 @@ rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o 
rockchip_drm_fbdev.o \
rockchip_drm_gem.o

 obj-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
+obj-$(CONFIG_ROCKCHIP_LVDS) += rockchip_lvds.o

 obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o rockchip_drm_vop.o
diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c 
b/drivers/gpu/drm/rockchip/rockchip_lvds.c
new file mode 100644
index 000..657609e
--- /dev/null
+++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c
@@ -0,0 +1,640 @@
+/*
+ * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
+ * Author:
+ *  Mark Yao 
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "rockchip_drm_drv.h"
+#include "rockchip_drm_vop.h"
+#include "rockchip_lvds.h"
+
+#define DISPLAY_OUTPUT_RGB 0
+#define DISPLAY_OUTPUT_LVDS1
+#define DISPLAY_OUTPUT_DUAL_LVDS   2
+
+#define connector_to_lvds(c) \
+   container_of(c, struct rockchip_lvds, connector)
+
+#define encoder_to_lvds(c) \
+   container_of(c, struct rockchip_lvds, encoder)
+
+/*
+ * @grf_offset: offset inside the grf regmap for setting the rockchip lvds
+ */
+struct rockchip_lvds_soc_data {
+   int grf_soc_con6;
+   int grf_soc_con7;
+};
+
+struct rockchip_lvds {
+   void *base;
+   struct device *dev;
+   void __iomem *regs;
+   struct regmap *grf;
+   struct clk *pclk;
+   const struct rockchip_lvds_soc_data *soc_data;
+
+   struct regulator_bulk_data supplies[3];
+
+   int output;
+   int format;
+
+   struct drm_device *drm_dev;
+   struct drm_panel *panel;
+   struct drm_connector connector;
+   struct drm_encoder encoder;
+
+   struct mutex suspend_lock;
+   int suspend;
+};
+
+static inline void lvds_writel(struct rockchip_lvds *lvds, u32 offset, u32 val)
+{
+   writel_relaxed(val, lvds->regs + offset);
+   writel_relaxed(val, lvds->regs + offset + 0x100);
+}
+
+static inline int lvds_name_to_format(const char *s)
+{
+   if (!s)
+   return -EINVAL;
+
+   if (strncmp(s, "jeida", 6) == 0)
+   return LVDS_FORMAT_JEIDA;
+   else if (strncmp(s, "vesa", 6) == 0)
+   return LVDS_FORMAT_VESA;
+
+   return -EINVAL;
+}
+
+static inline int lvds_name_to_output(const char *s)
+{
+   if (!s)
+   return -EINVAL;
+
+   if (strncmp(s, "rgb", 3) == 0)
+   return DISPLAY_OUTPUT_RGB;
+   else if (strncmp(s, "lvds", 4) == 0)
+   return DISPLAY_OUTPUT_LVDS;
+   else if (strncmp(s, "duallvds", 8) == 0)
+   return DISPLAY_OUTPUT_DUAL_LVDS;
+
+   return -EINVAL;
+}
+
+static int rockchip_lvds_poweron(struct rockchip_lvds *lvds)
+{
+   int ret;
+
+   ret = regulator_bulk_enable

[PATCH RFC v2 06/12] dt-bindings: Add documentation for rockchip lvds

2015-04-01 Thread Heiko Stuebner
From: Mark Yao 

Add binding documentation for Rockchip SoC LVDS driver.

Signed-off-by: Mark Yao 
Signed-off-by: Heiko Stuebner 
---
 .../devicetree/bindings/video/rockchip-lvds.txt| 74 ++
 1 file changed, 74 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/rockchip-lvds.txt

diff --git a/Documentation/devicetree/bindings/video/rockchip-lvds.txt 
b/Documentation/devicetree/bindings/video/rockchip-lvds.txt
new file mode 100644
index 000..80529f4
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/rockchip-lvds.txt
@@ -0,0 +1,74 @@
+Rockchip RK3288 LVDS interface
+
+
+Required properties:
+- compatible: "rockchip,rk3288-lvds";
+
+- reg: physical base address of the controller and length
+   of memory mapped region.
+- clocks: must include clock specifiers corresponding to entries in the
+   clock-names property.
+- clock-names: must contain "pclk_lvds"
+
+- avdd1v0-supply: regulator phandle for 1.0V analog power
+- avdd1v8-supply: regulator phandle for 1.8V analog power
+- avdd3v3-supply: regulator phandle for 3.3V analog power
+
+- rockchip,grf: phandle to the general register files syscon
+
+- rockchip,data-mapping: should be "vesa" or "jeida",
+   This describes how the color bits are laid out in the
+   serialized LVDS signal.
+- rockchip,data-width : should be <18> or <24>;
+- rockchip,output: should be "rgb", "lvds" or "duallvds",
+   This describes the output face.
+
+Required nodes:
+
+The lvds has two video ports as described by
+   Documentation/devicetree/bindings/media/video-interfaces.txt.
+Their connections are modeled using the OF graph bindings specified in
+   Documentation/devicetree/bindings/graph.txt.
+
+- video port 0 for the VOP inputs
+- video port 1 for either a panel or subsequent encoder
+
+Example:
+   lvds: lvds at ff96c000 {
+   compatible = "rockchip,rk3288-lvds";
+   rockchip,grf = <&grf>;
+   reg = <0xff96c000 0x4000>;
+   clocks = <&cru PCLK_LVDS_PHY>;
+   clock-names = "pclk_lvds";
+   avdd1v0-supply = <&vdd10_lcd>;
+   avdd1v8-supply = <&vcc18_lcd>;
+   avdd3v3-supply = <&vcca_33>;
+   rockchip,data-mapping = "jeida";
+   rockchip,data-width = <24>;
+   rockchip,output = "rgb";
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   lvds_in: port at 0 {
+   reg = <0>;
+
+   lvds_in_vopb: endpoint at 0 {
+   reg = <0>;
+   remote-endpoint = <&vopb_out_lvds>;
+   };
+   lvds_in_vopl: endpoint at 1 {
+   reg = <1>;
+   remote-endpoint = <&vopl_out_lvds>;
+   };
+   };
+
+   lvds_out: port at 1 {
+   reg = <1>;
+
+   lvds_out_panel: endpoint {
+   remote-endpoint = <&panel_in>;
+   };
+   };
+   };
+   };
-- 
2.1.4



[PATCH RFC v2 05/12] drm/components: add generic vga connector driver

2015-04-01 Thread Heiko Stuebner
This adds a driver for generic vga connectors using a system i2c-bus for ddc.

An exception is included for rcar-du which implements the vga-connector
binding interally already and is not yet converted to the component framework.

Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/components/Kconfig |   6 +
 drivers/gpu/drm/components/Makefile|   1 +
 drivers/gpu/drm/components/vga-connector.c | 254 +
 3 files changed, 261 insertions(+)
 create mode 100644 drivers/gpu/drm/components/vga-connector.c

diff --git a/drivers/gpu/drm/components/Kconfig 
b/drivers/gpu/drm/components/Kconfig
index 647cea6..8424143 100644
--- a/drivers/gpu/drm/components/Kconfig
+++ b/drivers/gpu/drm/components/Kconfig
@@ -6,4 +6,10 @@ config DRM_COMPONENTS_VGA_ENCODER
help
  Support for generic vga encoder chips without any special controls.

+config DRM_COMPONENTS_VGA_CONNECTOR:
+   tristate "Generic vga connector"
+   help
+ Support for simple vga connectors using a system i2c bus
+ for ddc.
+
 endmenu
diff --git a/drivers/gpu/drm/components/Makefile 
b/drivers/gpu/drm/components/Makefile
index 719b1c9..2ff64da 100644
--- a/drivers/gpu/drm/components/Makefile
+++ b/drivers/gpu/drm/components/Makefile
@@ -1,3 +1,4 @@
 ccflags-y := -Iinclude/drm

 obj-$(CONFIG_DRM_COMPONENTS_VGA_ENCODER) += vga-encoder.o
+obj-$(CONFIG_DRM_COMPONENTS_VGA_CONNECTOR) += vga-connector.o
diff --git a/drivers/gpu/drm/components/vga-connector.c 
b/drivers/gpu/drm/components/vga-connector.c
new file mode 100644
index 000..400ceb7
--- /dev/null
+++ b/drivers/gpu/drm/components/vga-connector.c
@@ -0,0 +1,254 @@
+/*
+ * Simple vga encoder driver
+ *
+ * Copyright (C) 2014 Heiko Stuebner 
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define connector_to_vga_connector(x) container_of(x, struct vga_connector, 
connector)
+
+struct vga_connector {
+   struct drm_connector connector;
+   struct device *dev;
+   struct i2c_adapter *ddc;
+   struct drm_encoder *encoder;
+};
+
+enum drm_connector_status vga_connector_detect(struct drm_connector *connector,
+   bool force)
+{
+   struct vga_connector *vga = connector_to_vga_connector(connector);
+
+   if (!vga->ddc)
+   return connector_status_unknown;
+
+   if (drm_probe_ddc(vga->ddc))
+   return connector_status_connected;
+
+   return connector_status_disconnected;
+}
+
+void vga_connector_connector_destroy(struct drm_connector *connector)
+{
+   drm_connector_unregister(connector);
+   drm_connector_cleanup(connector);
+}
+
+struct drm_connector_funcs vga_connector_connector_funcs = {
+   .dpms = drm_helper_connector_dpms,
+   .fill_modes = drm_helper_probe_single_connector_modes,
+   .detect = vga_connector_detect,
+   .destroy = vga_connector_connector_destroy,
+};
+
+/*
+ * Connector helper functions
+ */
+
+static int vga_connector_connector_get_modes(struct drm_connector *connector)
+{
+   struct vga_connector *vga = connector_to_vga_connector(connector);
+   struct edid *edid;
+   int ret = 0;
+
+   if (!vga->ddc)
+   return 0;
+
+   edid = drm_get_edid(connector, vga->ddc);
+   if (edid) {
+   drm_mode_connector_update_edid_property(connector, edid);
+   ret = drm_add_edid_modes(connector, edid);
+   kfree(edid);
+   }
+
+   return ret;
+}
+
+static int vga_connector_connector_mode_valid(struct drm_connector *connector,
+   struct drm_display_mode *mode)
+{
+   return MODE_OK;
+}
+
+static struct drm_encoder
+*vga_connector_connector_best_encoder(struct drm_connector *connector)
+{
+   struct vga_connector *vga = connector_to_vga_connector(connector);
+
+   return vga->encoder;
+}
+
+static struct drm_connector_helper_funcs vga_connector_connector_helper_funcs 
= {
+   .get_modes = vga_connector_connector_get_modes,
+   .best_encoder = vga_connector_connector_best_encoder,
+   .mode_valid = vga_connector_connector_mode_valid,
+};
+
+
+static int vga_connector_bind(struct device *dev, struct device *master,
+void *data)
+{
+   struct vga_connector *vga = dev_get_drvdata(dev);
+   struct drm_device *drm = data;
+   struct device_node *endpoint, *encp = NULL;
+
+   v

[PATCH RFC v2 04/12] drm/components: add generic vga encoder driver

2015-04-01 Thread Heiko Stuebner
This adds a driver for generic vga encoders like the Analog Devices adv7123
and similar ics. These chips do not have any special configuration options
except a powersafe gpio.

An exception is added for the rcar-du driver which also implements support
for the adv7123 internally but is not yet converted to the component framework.

Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/components/Kconfig   |   5 +
 drivers/gpu/drm/components/Makefile  |   2 +
 drivers/gpu/drm/components/vga-encoder.c | 315 +++
 3 files changed, 322 insertions(+)
 create mode 100644 drivers/gpu/drm/components/vga-encoder.c

diff --git a/drivers/gpu/drm/components/Kconfig 
b/drivers/gpu/drm/components/Kconfig
index 9d5d462..647cea6 100644
--- a/drivers/gpu/drm/components/Kconfig
+++ b/drivers/gpu/drm/components/Kconfig
@@ -1,4 +1,9 @@
 menu "Standalone components for use with the component framework"
  depends on DRM && DRM_KMS_HELPER

+config DRM_COMPONENTS_VGA_ENCODER
+   tristate "Generic vga encoder"
+   help
+ Support for generic vga encoder chips without any special controls.
+
 endmenu
diff --git a/drivers/gpu/drm/components/Makefile 
b/drivers/gpu/drm/components/Makefile
index be16eca..719b1c9 100644
--- a/drivers/gpu/drm/components/Makefile
+++ b/drivers/gpu/drm/components/Makefile
@@ -1 +1,3 @@
 ccflags-y := -Iinclude/drm
+
+obj-$(CONFIG_DRM_COMPONENTS_VGA_ENCODER) += vga-encoder.o
diff --git a/drivers/gpu/drm/components/vga-encoder.c 
b/drivers/gpu/drm/components/vga-encoder.c
new file mode 100644
index 000..f559b5e
--- /dev/null
+++ b/drivers/gpu/drm/components/vga-encoder.c
@@ -0,0 +1,315 @@
+/*
+ * Simple vga encoder driver
+ *
+ * Copyright (C) 2014 Heiko Stuebner 
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define encoder_to_vga_encoder(x) container_of(x, struct vga_encoder, encoder)
+
+struct vga_encoder {
+   struct drm_encoder encoder;
+   struct device *dev;
+   struct regulator *vaa_reg;
+   struct gpio_desc *psave_gpio;
+
+   struct mutex enable_lock;
+   bool enabled;
+};
+
+static void vga_encoder_destroy(struct drm_encoder *encoder)
+{
+   drm_encoder_cleanup(encoder);
+}
+
+static const struct drm_encoder_funcs vga_encoder_funcs = {
+   .destroy = vga_encoder_destroy,
+};
+
+static void vga_encoder_dpms(struct drm_encoder *encoder, int mode)
+{
+   struct vga_encoder *vga = encoder_to_vga_encoder(encoder);
+
+   mutex_lock(&vga->enable_lock);
+
+   switch (mode) {
+   case DRM_MODE_DPMS_ON:
+   if (vga->enabled)
+   goto out;
+
+   if (!IS_ERR(vga->vaa_reg))
+   regulator_enable(vga->vaa_reg);
+
+   if (vga->psave_gpio)
+   gpiod_set_value(vga->psave_gpio, 1);
+
+   vga->enabled = true;
+   break;
+   case DRM_MODE_DPMS_STANDBY:
+   case DRM_MODE_DPMS_SUSPEND:
+   case DRM_MODE_DPMS_OFF:
+   if (!vga->enabled)
+   goto out;
+
+   if (vga->psave_gpio)
+   gpiod_set_value(vga->psave_gpio, 0);
+
+   if (!IS_ERR(vga->vaa_reg))
+   regulator_enable(vga->vaa_reg);
+
+   vga->enabled = false;
+   break;
+   default:
+   break;
+   }
+
+out:
+   mutex_unlock(&vga->enable_lock);
+}
+
+static bool vga_encoder_mode_fixup(struct drm_encoder *encoder,
+ const struct drm_display_mode *mode,
+ struct drm_display_mode *adjusted_mode)
+{
+   return true;
+}
+
+static void vga_encoder_prepare(struct drm_encoder *encoder)
+{
+}
+
+static void vga_encoder_mode_set(struct drm_encoder *encoder,
+   struct drm_display_mode *mode,
+   struct drm_display_mode *adjusted_mode)
+{
+}
+
+static void vga_encoder_commit(struct drm_encoder *encoder)
+{
+   vga_encoder_dpms(encoder, DRM_MODE_DPMS_ON);
+}
+
+static void vga_encoder_disable(struct drm_encoder *encoder)
+{
+   vga_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);
+}
+
+static const struct drm_encoder_helper_funcs vga_encoder_helper_funcs = {
+   .dpms = vga_encoder_dpms,
+   .mode_fixup = vga_encoder_mode_fixup,
+   .prepare = vga_encoder_prepare,
+   .mode_set = vga_encoder_mode_set,
+ 

[PATCH RFC v2 03/12] drm: add components subdirectory and infrastructure

2015-04-01 Thread Heiko Stuebner
Until there are only the specialized bridge and i2c directories available
to hold generic support code like external components. But as there are
also things like external encoders that do not use i2c, those do not match
all cases.
Therefore introduce a new subdirectories to hold generic components like the
mentioned external encoders that can be used by component-based drm drivers.

Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/Kconfig | 2 ++
 drivers/gpu/drm/Makefile| 1 +
 drivers/gpu/drm/components/Kconfig  | 4 
 drivers/gpu/drm/components/Makefile | 1 +
 4 files changed, 8 insertions(+)
 create mode 100644 drivers/gpu/drm/components/Kconfig
 create mode 100644 drivers/gpu/drm/components/Makefile

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 151a050..2f454f4 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -81,6 +81,8 @@ source "drivers/gpu/drm/i2c/Kconfig"

 source "drivers/gpu/drm/bridge/Kconfig"

+source "drivers/gpu/drm/components/Kconfig"
+
 config DRM_TDFX
tristate "3dfx Banshee/Voodoo3+"
depends on DRM && PCI
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 2c239b9..aa9ccaa 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -69,3 +69,4 @@ obj-$(CONFIG_DRM_IMX) += imx/
 obj-y  += i2c/
 obj-y  += panel/
 obj-y  += bridge/
+obj-y  += components/
diff --git a/drivers/gpu/drm/components/Kconfig 
b/drivers/gpu/drm/components/Kconfig
new file mode 100644
index 000..9d5d462
--- /dev/null
+++ b/drivers/gpu/drm/components/Kconfig
@@ -0,0 +1,4 @@
+menu "Standalone components for use with the component framework"
+ depends on DRM && DRM_KMS_HELPER
+
+endmenu
diff --git a/drivers/gpu/drm/components/Makefile 
b/drivers/gpu/drm/components/Makefile
new file mode 100644
index 000..be16eca
--- /dev/null
+++ b/drivers/gpu/drm/components/Makefile
@@ -0,0 +1 @@
+ccflags-y := -Iinclude/drm
-- 
2.1.4



[PATCH RFC v2 02/12] drm/connector: add functionality to register connectors to a global list

2015-04-01 Thread Heiko Stuebner
This allows standalone connectors to be registered and found again
through their devicetree node when going through their connection graph.

Setting the of_node property is of course still optional, as it is not
necessary in most cases to lookup connectors that are part of a bigger
component.

Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/drm_crtc.c | 41 +
 include/drm/drm_crtc.h |  7 +++
 2 files changed, 48 insertions(+)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index b63e69d..8b49ea7 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -852,6 +852,47 @@ static void drm_connector_get_cmdline_mode(struct 
drm_connector *connector)
  mode->interlace ?  " interlaced" : "");
 }

+static DEFINE_MUTEX(connector_lock);
+static LIST_HEAD(connector_list);
+
+int drm_connector_add(struct drm_connector *connector)
+{
+   mutex_lock(&connector_lock);
+   list_add_tail(&connector->list, &connector_list);
+   mutex_unlock(&connector_lock);
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_connector_add);
+
+void drm_connector_remove(struct drm_connector *connector)
+{
+   mutex_lock(&connector_lock);
+   list_del_init(&connector->list);
+   mutex_unlock(&connector_lock);
+}
+EXPORT_SYMBOL(drm_connector_remove);
+
+#ifdef CONFIG_OF
+struct drm_connector *of_drm_find_connector(struct device_node *np)
+{
+   struct drm_connector *connector;
+
+   mutex_lock(&connector_lock);
+
+   list_for_each_entry(connector, &connector_list, list) {
+   if (connector->of_node == np) {
+   mutex_unlock(&connector_lock);
+   return connector;
+   }
+   }
+
+   mutex_unlock(&connector_lock);
+   return NULL;
+}
+EXPORT_SYMBOL(of_drm_find_connector);
+#endif
+
 /**
  * drm_connector_init - Init a preallocated connector
  * @dev: DRM device
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 76994ba..37b230b 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -671,6 +671,10 @@ struct drm_encoder {
  */
 struct drm_connector {
struct drm_device *dev;
+#ifdef CONFIG_OF
+   struct device_node *of_node;
+#endif
+   struct list_head list;
struct device *kdev;
struct device_attribute *attr;
struct list_head head;
@@ -1213,6 +1217,9 @@ static inline uint32_t drm_crtc_mask(struct drm_crtc 
*crtc)

 extern void drm_connector_ida_init(void);
 extern void drm_connector_ida_destroy(void);
+extern int drm_connector_add(struct drm_connector *connector);
+extern void drm_connector_remove(struct drm_connector *connector);
+extern struct drm_connector *of_drm_find_connector(struct device_node *np);
 extern int drm_connector_init(struct drm_device *dev,
  struct drm_connector *connector,
  const struct drm_connector_funcs *funcs,
-- 
2.1.4



[PATCH RFC v2 01/12] drm/encoder: add functionality to register encoders to a global list

2015-04-01 Thread Heiko Stuebner
This allows standalone encoders to be registered and found again
through their devicetree node when going through their connection graph.

Setting the of_node property is of course still optional, as it is not
necessary in most cases to lookup encoders that are part of a bigger
component.

Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/drm_crtc.c | 41 +
 include/drm/drm_crtc.h |  8 
 2 files changed, 49 insertions(+)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index f6d04c7..b63e69d 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1066,6 +1066,47 @@ void drm_connector_unplug_all(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_connector_unplug_all);

+static DEFINE_MUTEX(encoder_lock);
+static LIST_HEAD(encoder_list);
+
+int drm_encoder_add(struct drm_encoder *encoder)
+{
+   mutex_lock(&encoder_lock);
+   list_add_tail(&encoder->list, &encoder_list);
+   mutex_unlock(&encoder_lock);
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_encoder_add);
+
+void drm_encoder_remove(struct drm_encoder *encoder)
+{
+   mutex_lock(&encoder_lock);
+   list_del_init(&encoder->list);
+   mutex_unlock(&encoder_lock);
+}
+EXPORT_SYMBOL(drm_encoder_remove);
+
+#ifdef CONFIG_OF
+struct drm_encoder *of_drm_find_encoder(struct device_node *np)
+{
+   struct drm_encoder *encoder;
+
+   mutex_lock(&encoder_lock);
+
+   list_for_each_entry(encoder, &encoder_list, list) {
+   if (encoder->of_node == np) {
+   mutex_unlock(&encoder_lock);
+   return encoder;
+   }
+   }
+
+   mutex_unlock(&encoder_lock);
+   return NULL;
+}
+EXPORT_SYMBOL(of_drm_find_encoder);
+#endif
+
 /**
  * drm_encoder_init - Init a preallocated encoder
  * @dev: drm device
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 920e21a..76994ba 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -569,6 +569,7 @@ struct drm_encoder_funcs {
 /**
  * struct drm_encoder - central DRM encoder structure
  * @dev: parent DRM device
+ * @of_node: device node pointer to the bridge
  * @head: list management
  * @base: base KMS object
  * @name: encoder name
@@ -585,6 +586,10 @@ struct drm_encoder_funcs {
  */
 struct drm_encoder {
struct drm_device *dev;
+#ifdef CONFIG_OF
+   struct device_node *of_node;
+#endif
+   struct list_head list;
struct list_head head;

struct drm_mode_object base;
@@ -1225,6 +1230,9 @@ extern void drm_bridge_remove(struct drm_bridge *bridge);
 extern struct drm_bridge *of_drm_find_bridge(struct device_node *np);
 extern int drm_bridge_attach(struct drm_device *dev, struct drm_bridge 
*bridge);

+extern int drm_encoder_add(struct drm_encoder *encoder);
+extern void drm_encoder_remove(struct drm_encoder *encoder);
+extern struct drm_encoder *of_drm_find_encoder(struct device_node *np);
 extern int drm_encoder_init(struct drm_device *dev,
struct drm_encoder *encoder,
const struct drm_encoder_funcs *funcs,
-- 
2.1.4



[PATCH RFC v2 00/12] drm/rockchip: add support for lvds controller and external encoders

2015-04-01 Thread Heiko Stuebner
changes since v1:
- add separate components subdirectory
- implement the already existing bindings for adv7123 and vga-connector
  instead of defining a new one
- use component graph for subsequent lvds-panel or connected external
  encoders instead of defining special properties.


This series still adds support for the soc-level lvds encoder that also
controls the generic rgb output pins. Also generic components for "dumb"
vga encoders and connectors are added to a new subdirectory which implement
the already existing bindings for adv7123 and vga-connector.

While the major comment from Laurent Pinchart gets addressed with these
separate components, it still needs to address others like the lvds setting
in dt and how to handle the atomic mode setting conversion correctly.

But I'd still like to solicit opinions if the general concept looks sane
especially wrt. introducing the new components element and of_graph structure.

Tested on a firefly board using the vga connector.


Thanks
Heiko


Heiko Stuebner (10):
  drm/encoder: add functionality to register encoders to a global list
  drm/connector: add functionality to register connectors to a global
list
  drm: add components subdirectory and infrastructure
  drm/components: add generic vga encoder driver
  drm/components: add generic vga connector driver
  drm/rockchip: lvds: register a bridge when no panel is set
  drm/rockchip: enable rgb output of vops for all other connectors
  ARM: dts: rockchip: add rk3288 lcdc0 pinmux settings
  ARM: dts: rockchip: add rk3288 lvds node
  ARM: dts: rockchip: add vga encoder and enable lvds on rk3288-firefly

Mark Yao (2):
  dt-bindings: Add documentation for rockchip lvds
  drm/rockchip: Add support for Rockchip Soc LVDS

 .../devicetree/bindings/video/rockchip-lvds.txt|  74 ++
 arch/arm/boot/dts/rk3288-firefly.dtsi  |  68 ++
 arch/arm/boot/dts/rk3288.dtsi  |  51 ++
 drivers/gpu/drm/Kconfig|   2 +
 drivers/gpu/drm/Makefile   |   1 +
 drivers/gpu/drm/components/Kconfig |  15 +
 drivers/gpu/drm/components/Makefile|   4 +
 drivers/gpu/drm/components/vga-connector.c | 254 ++
 drivers/gpu/drm/components/vga-encoder.c   | 315 
 drivers/gpu/drm/drm_crtc.c |  82 ++
 drivers/gpu/drm/rockchip/Kconfig   |   9 +
 drivers/gpu/drm/rockchip/Makefile  |   1 +
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c|  10 +-
 drivers/gpu/drm/rockchip/rockchip_lvds.c   | 851 +
 drivers/gpu/drm/rockchip/rockchip_lvds.h   | 107 +++
 include/drm/drm_crtc.h |  15 +
 16 files changed, 1852 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/video/rockchip-lvds.txt
 create mode 100644 drivers/gpu/drm/components/Kconfig
 create mode 100644 drivers/gpu/drm/components/Makefile
 create mode 100644 drivers/gpu/drm/components/vga-connector.c
 create mode 100644 drivers/gpu/drm/components/vga-encoder.c
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.c
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.h

-- 
2.1.4



  1   2   >