[MPlayer-dev-eng] [PATCH] - No Reset of D3D device on resize

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Tue Jan 27 11:12:02 CET 2009


On Tue, Jan 27, 2009 at 01:59:26AM +0200, Georgi Petrov wrote:
> Great! Please apply it. I can always rework it to make it better, but
> the patch makes it better for sure.

I think the issue is that currently we have loads of possible states
with half-, quarter-, whatever initialized Direct3D.
IMO we should find out which states we need, and make sure that at least
at the start and end of each function we are in one of those states.
I propose having the following states:
1) Completely uninitialized. Should only happen in preinit
2) We have a d3d_handle, but nothing else
3) We have a d3d_device and all the stuff to display a video, like
backbuffer, StretchBlt source etc.
4) We have a d3d_device, all the stuff to display a video, and
everything we need for the OSD.

To init / uninit I would then propose functions that ensure a
minimum/maximum state, using one of the exisiting variables
to detect the state e.g.

int ensure_osd_created(void) {
  if (!ensure_device_created())
    return 0;
  if (priv->d3d_texture_osd)
    return 1;
  if (FAILED(IDirect3DDevice9_CreateTexture ... )
    goto fail;
  if (FAILED(IDirect3DDevice9_CreateTexture ... )
    goto fail;
  return 1;

fail:
  ensure_osd_freed();
  return 0;
}

or the opposite:

void ensure_device_freed(void) {
  ensure_osd_freed();
  if (priv->d3d_surface) IDirect3DSurface9_Release(priv->d3d_surface);
  priv->d3d_surface = NULL;
  ... freeing other stuff and NULLing it
}

Greetings,
Reimar Döffinger



More information about the MPlayer-dev-eng mailing list